aboutsummaryrefslogtreecommitdiffstats
path: root/util-src
Commit message (Collapse)AuthorAgeFilesLines
* util.crypto: Use Lua 5.2 API for predictable buffer sizeKim Alvefur2022-07-111-6/+1
| | | | | | | | In Lua 5.3 LUAL_BUFFERSIZE is a macro computed from sizeof and is thus not known at pre-processing time, so this does not work. Since Lua 5.1 is no longer supported, we can use luaL_prepbuffsize() which is available from Lua 5.2
* util.crypto: Use stack space buffersKim Alvefur2022-07-111-14/+11
| | | | | | | | | Removes assumption that LUAL_BUFFERSIZE is known at pre-processing time, which it is not in Lua 5.3 and 5.4, where it is a computed macro based on sizeof. Allocation of stack space is safer and faster, no need to worry about luaL_prepbuffer failing to allocate memory and skipping free()
* util.crypto: More digests for sign/verify, use macros for clarity/consistencyMatthew Wild2022-07-021-32/+40
|
* util.crypto: Friendlier error message on incorrect key typesMatthew Wild2022-07-021-1/+6
|
* util.crypto: Add support for RSA signatures (PKCS1-v1.5 + PSS)Matthew Wild2022-07-021-3/+31
| | | | These are used by the RS*** and PS*** family of JOSE algorithms (e.g. in JWTs)
* util.crypto: New wrapper for some operations in OpenSSL's libcryptoMatthew Wild2022-06-242-2/+557
| | | | | Specifically, ED25519 key generation/import/export, sign/verify operations, and AES encrypt/decrypt.
* util-src: Add new utility header managed_pointer.hMatthew Wild2022-07-011-0/+61
| | | | | The macros in this header allow creation of GC-managed objects from manually- managed C alloc/free APIs.
* util.table: Fix inaccurate commentKim Alvefur2022-07-111-1/+1
| | | | | | | Probably a duplicate of the comment next to Lmove, recorded by mistake Lpack can probably be removed at some point in the near future once we are confident it is not used anywhere.
* 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.