aboutsummaryrefslogtreecommitdiffstats
path: root/util-src
Commit message (Collapse)AuthorAgeFilesLines
* util-src: Remove Lua 5.1 compat macrosKim Alvefur2022-07-0112-56/+2
| | | | Part of #1600
* util.hashes: Revert to HMAC() convenience functionKim Alvefur2022-06-241-22/+2
| | | | | | | | | Reverts some of 1e41dd0f8353 Seems HMAC() isn't deprecated after all? Must have been at some point according to #1589 Twice as fast for some reason.
* util.hashes: Remove unused constantsKim Alvefur2022-06-241-3/+0
|
* util.hashes: Remove unused structKim Alvefur2022-06-241-8/+0
| | | | Unused since 9f1c5ae8d70b
* util.hashes: Return OpenSSL error messages on failureKim Alvefur2022-06-241-3/+4
| | | | With luck, might contain more details than just "failed"
* util.hashes: Add SHA3 bindingsKim Alvefur2020-09-101-0/+19
|
* util.hashes: Bind BLAKE2 algoritms supported by OpenSSLKim Alvefur2020-09-101-0/+21
|
* util.hashes: Refactor PBKDF2 to deduplicate codeKim Alvefur2020-09-101-17/+8
|
* util.hashes: Expose sha224 and sha384 HMAC functionsKim Alvefur2020-11-291-0/+10
| | | | For completeness and consistency with set of plain hash functions
* util.hashes: Refactor HMAC bindings (fixes #1589)Kim Alvefur2020-11-291-22/+61
| | | | | | | HMAC() is deprecated As with the regular hash functions, macros like this make it awkward to apply static analysis and code formatting.
* util.hashes: Refactor hash functions to use OpenSSL EVP methods (fix #1698)Kim Alvefur2020-09-101-20/+63
| | | | | | | MD5() is deprecated, but EVP_md5() is not. Functions in macros like this make it awkward to apply static analysis and code formatting.
* util.crand: Reduce scope here tooKim Alvefur2022-04-231-2/+2
| | | | Same as previous commit
* util.strbitop: Reduce scope of functionsKim Alvefur2022-04-231-3/+3
| | | | | | | | | Equivalent to 'local' in Lua, these functions are exported via the luaopen_ function, which is the only one needing to be visible outside of the file. Pointed out by Link Mauve at some point, but there wasn't really any rush here.
* util.table: Compatibility with Lua 5.1 lua_equalsMatthew Wild2022-03-181-1/+5
|
* util.table: Backport table.move() from Lua 5.4Matthew Wild2022-03-181-0/+42
| | | | | One difference is that 5.4 accepts "table-like" values (for this and other table.*() functions), but that would require additional backporting work.
* Spelling: Fix various spelling mistakes (thanks timeless)Kim Alvefur2022-03-071-1/+1
| | | | | | Words, sometimes I wonder how they even work Maybe I missed something.
* make: Fix build of util.struct on *BSDKim Alvefur2022-03-041-1/+2
|
* Merge config-updates+check-turn from timberMatthew Wild2022-03-042-1/+424
|\
| * util.struct: Import Roberto 'struct' library v0.3Matthew Wild2022-03-042-1/+424
| | | | | | | | | | | | | | Downloaded from http://www.inf.puc-rio.br/~roberto/struct/ This is for compatibility with Lua 5.2 (and 5.1). Eventually we can replace this with string.pack/string.unpack which are available in 5.3+.
* | util.poll: Add support for the poll() APIKim Alvefur2022-02-231-1/+129
| | | | | | | | Might be better than select(), more portable than epoll.
* | util.poll: Expose API (epoll or select) usedKim Alvefur2022-02-271-6/+6
| | | | | | | | Could he handy to know for debugging or decisions
* | util.poll: Restructure to make adding additional system APIs easierKim Alvefur2022-02-231-11/+23
|/
* util.pposix: Use mallinfo2() on glibc 2.33, fix #1649Kim Alvefur2022-01-061-5/+12
|
* util.pposix: Bind isatty(3)Kim Alvefur2021-07-041-0/+9
| | | | | Useful for disabling certain behavior, ANSI colors etc when not connected to a terminal.
* util.hashes: Expose OpenSSL versionKim Alvefur2021-05-121-0/+4
|
* Merge 0.11->trunkMatthew Wild2021-05-131-0/+14
|\
| * util.hashes: Add constant-time string comparison (binding to CRYPTO_memcmp)Matthew Wild2021-05-101-0/+14
| |
* | Merge 0.11->trunkKim Alvefur2020-10-151-0/+4
|\|
| * Back out changeset 2c1583bb0e0fKim Alvefur2020-10-151-0/+4
| | | | | | | | Same reason as 712b2e6a09d9
* | Merge 0.11->trunkKim Alvefur2020-10-151-17/+6
|\|
| * Back out 6dde2c9fa272: Doesn't work on Lua 5.1Kim Alvefur2020-10-151-13/+6
| |
| * util.strbitop: Remove redundant init functionKim Alvefur2020-10-151-4/+0
| | | | | | | | | | When you have 3 almost identical functions, you tend to edit one and then copypaste. Forgot to remove this line from the other two.
* | Merge 0.11->trunkKim Alvefur2020-10-151-15/+22
|\|
| * util.strbitop: Create buffer in the correct size (optimization)Kim Alvefur2020-10-151-6/+13
| | | | | | | | | | This avoids dynamically growing the buffer as Lua does when luaL_addchar is used, thus saving on realloc calls.
| * util.strbitop: Reformat codeKim Alvefur2020-10-151-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | astyle \ --indent=tab \ --attach-classes \ --indent-switches \ --break-blocks \ --pad-oper \ --unpad-paren \ --add-braces \ --align-pointer=name \ --lineend=linux \ *.c
* | Merge 0.11->trunkMatthew Wild2020-10-153-2/+93
|\|
| * util.strbitop: Library for bitwise operations on stringsKim Alvefur2019-09-073-2/+93
| |
* | configure: Pass compiler flag to enable ICU only when building util.encodingsKim Alvefur2020-07-122-0/+3
| | | | | | | | Passing it in CFLAGS applied to all modules, which was not needed.
* | util.ringbuffer: Ensure unsigned chars are always returned from :byte()Matthew Wild2020-06-241-3/+3
| |
* | util-src: Use the luaL_pushfail API added in Lua 5.4 to highlight all ↵Kim Alvefur2020-06-076-49/+70
| | | | | | | | | | | | | | failure conditions Actually just an alias of pushnil, but it does make it more obvious where the failure conditions are, which is good for readability.
* | util.ringbuffer: Add :sub() and :byte() methods equivalent to the string methodsMatthew Wild2020-06-041-1/+102
| |
* | util.ringbuffer: Prevent creation of buffer with negative sizeKim Alvefur2020-06-041-1/+1
| | | | | | | | | | Previously this would have been (unsigned)-1 which is a large positive integer.
* | util.ringbuffer: Prevent creation of zero-size bufferKim Alvefur2020-05-291-0/+1
| |
* | util.pposix,signal: Pass around various OS numbers as integers [Lua 5.3]Kim Alvefur2020-05-042-28/+34
| | | | | | | | | | | | | | Passing around PIDs, UIDs etc as integers makes it more sane in Lua 5.3. Getting 1234.0 as PID is silly. Shouldn't change any behavior as these are all integers on the C side and the integral floats are accepted as integers when passed back from Lua into C.
* | util.hashes: Fix output length of PBKDF2-HMAC-SHA256Kim Alvefur2020-04-221-1/+1
| | | | | | | | Somehow it got SHA1's 20 byte output instead of the proper 32 = 256/8
* | util.net: Fix signedness warning on ARMEmmanuel Gil Peyrot2020-01-301-2/+2
| | | | | | | | net.c:87:56: warning: comparison of integer expressions of different signedness: ‘long unsigned int’ and ‘long int’ [-Wsign-compare]
* | util.*.c: Add static qualifiers everywhereEmmanuel Gil Peyrot2019-12-016-52/+47
| |
* | util.encodings: Remove redundant castEmmanuel Gil Peyrot2019-12-011-1/+1
| |
* | util.encodings: Don’t export unneeded symbolsEmmanuel Gil Peyrot2019-12-011-8/+8
| | | | | | | | This reduces the binary size from 22704 B to 18592 B.
* | Merge 0.11->trunkKim Alvefur2019-11-165-108/+146
|\ \ | |/ |/|