Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | util.poll: Return early if given zero timeout and no pending events | Kim Alvefur | 2023-11-21 | 1 | -0/+6 |
| | | | | | Should have been part of f33887f925e1 to ensure it won't skip processing timers at all when very busy. | ||||
* | util.pposix: Add remove_blocks() for deleting parts of files | Kim Alvefur | 2023-06-07 | 1 | -0/+36 |
| | | | | | | Allows implementing e.g. a FIFO Will probably only work on some Linux file systems like ext4. | ||||
* | util.pposix: Use Lua enum API for resource limit name argument | Kim Alvefur | 2023-06-14 | 1 | -47/+33 |
| | | | | Because diffstat. | ||||
* | util: Add compat for prosody module name change to C sources | Kim Alvefur | 2023-03-17 | 14 | -14/+64 |
| | |||||
* | util.poll: Include unistd.h only for epoll | Kim Alvefur | 2023-02-10 | 1 | -1/+1 |
| | | | | | This defines close(), which is only used with epoll, hence we don't need to include it when building in poll or select mode. | ||||
* | util.crypto: Preemptively silence 'strict-prototypes' warning | Kim Alvefur | 2023-01-31 | 1 | -1/+1 |
| | | | | | | | | With `gcc-12 -Wstrict-prototypes` the following warning is shown: crypto.c:43:13: warning: function declaration isn't a prototype [-Wstrict-prototypes] 43 | static BIO* new_memory_BIO() { | ^~~~~~~~~~~~~~ | ||||
* | util.struct: Fix typo in comment | Kim Alvefur | 2023-01-20 | 1 | -1/+1 |
| | |||||
* | util.hashes: Silence compiler warning about char pointer signedness | Kim Alvefur | 2023-01-17 | 1 | -1/+1 |
| | | | | Introduced in dbe9781fd278 | ||||
* | util.crypto: Add support for AES-256-CTR | Matthew Wild | 2023-01-13 | 1 | -21/+44 |
| | | | | This is required by PASETO v3.local | ||||
* | util.hashes: Add HKDF-HMAC-SHA256/HKDF-HMAC-SHA384 | Matthew Wild | 2023-01-13 | 1 | -0/+59 |
| | | | | These are needed for PASETO v3.local. | ||||
* | util.crypto, util.jwt: Generate consistent signature sizes (via padding) | Matthew Wild | 2022-09-29 | 1 | -10/+17 |
| | | | | | | This fixes the signature parsing and building to work correctly. Sometimes a signature was one or two bytes too short, and needed to be padded. OpenSSL can do this for us. | ||||
* | util.crypto: Use Lua 5.2 API for predictable buffer size | Kim Alvefur | 2022-07-11 | 1 | -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 buffers | Kim Alvefur | 2022-07-11 | 1 | -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/consistency | Matthew Wild | 2022-07-02 | 1 | -32/+40 |
| | |||||
* | util.crypto: Friendlier error message on incorrect key types | Matthew Wild | 2022-07-02 | 1 | -1/+6 |
| | |||||
* | util.crypto: Add support for RSA signatures (PKCS1-v1.5 + PSS) | Matthew Wild | 2022-07-02 | 1 | -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 libcrypto | Matthew Wild | 2022-06-24 | 2 | -2/+557 |
| | | | | | Specifically, ED25519 key generation/import/export, sign/verify operations, and AES encrypt/decrypt. | ||||
* | util-src: Add new utility header managed_pointer.h | Matthew Wild | 2022-07-01 | 1 | -0/+61 |
| | | | | | The macros in this header allow creation of GC-managed objects from manually- managed C alloc/free APIs. | ||||
* | util.table: Fix inaccurate comment | Kim Alvefur | 2022-07-11 | 1 | -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 macros | Kim Alvefur | 2022-07-01 | 12 | -56/+2 |
| | | | | Part of #1600 | ||||
* | util.hashes: Revert to HMAC() convenience function | Kim Alvefur | 2022-06-24 | 1 | -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 constants | Kim Alvefur | 2022-06-24 | 1 | -3/+0 |
| | |||||
* | util.hashes: Remove unused struct | Kim Alvefur | 2022-06-24 | 1 | -8/+0 |
| | | | | Unused since 9f1c5ae8d70b | ||||
* | util.hashes: Return OpenSSL error messages on failure | Kim Alvefur | 2022-06-24 | 1 | -3/+4 |
| | | | | With luck, might contain more details than just "failed" | ||||
* | util.hashes: Add SHA3 bindings | Kim Alvefur | 2020-09-10 | 1 | -0/+19 |
| | |||||
* | util.hashes: Bind BLAKE2 algoritms supported by OpenSSL | Kim Alvefur | 2020-09-10 | 1 | -0/+21 |
| | |||||
* | util.hashes: Refactor PBKDF2 to deduplicate code | Kim Alvefur | 2020-09-10 | 1 | -17/+8 |
| | |||||
* | util.hashes: Expose sha224 and sha384 HMAC functions | Kim Alvefur | 2020-11-29 | 1 | -0/+10 |
| | | | | For completeness and consistency with set of plain hash functions | ||||
* | util.hashes: Refactor HMAC bindings (fixes #1589) | Kim Alvefur | 2020-11-29 | 1 | -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 Alvefur | 2020-09-10 | 1 | -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 too | Kim Alvefur | 2022-04-23 | 1 | -2/+2 |
| | | | | Same as previous commit | ||||
* | util.strbitop: Reduce scope of functions | Kim Alvefur | 2022-04-23 | 1 | -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_equals | Matthew Wild | 2022-03-18 | 1 | -1/+5 |
| | |||||
* | util.table: Backport table.move() from Lua 5.4 | Matthew Wild | 2022-03-18 | 1 | -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 Alvefur | 2022-03-07 | 1 | -1/+1 |
| | | | | | | Words, sometimes I wonder how they even work Maybe I missed something. | ||||
* | make: Fix build of util.struct on *BSD | Kim Alvefur | 2022-03-04 | 1 | -1/+2 |
| | |||||
* | Merge config-updates+check-turn from timber | Matthew Wild | 2022-03-04 | 2 | -1/+424 |
|\ | |||||
| * | util.struct: Import Roberto 'struct' library v0.3 | Matthew Wild | 2022-03-04 | 2 | -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() API | Kim Alvefur | 2022-02-23 | 1 | -1/+129 |
| | | | | | | | | Might be better than select(), more portable than epoll. | ||||
* | | util.poll: Expose API (epoll or select) used | Kim Alvefur | 2022-02-27 | 1 | -6/+6 |
| | | | | | | | | Could he handy to know for debugging or decisions | ||||
* | | util.poll: Restructure to make adding additional system APIs easier | Kim Alvefur | 2022-02-23 | 1 | -11/+23 |
|/ | |||||
* | util.pposix: Use mallinfo2() on glibc 2.33, fix #1649 | Kim Alvefur | 2022-01-06 | 1 | -5/+12 |
| | |||||
* | util.pposix: Bind isatty(3) | Kim Alvefur | 2021-07-04 | 1 | -0/+9 |
| | | | | | Useful for disabling certain behavior, ANSI colors etc when not connected to a terminal. | ||||
* | util.hashes: Expose OpenSSL version | Kim Alvefur | 2021-05-12 | 1 | -0/+4 |
| | |||||
* | Merge 0.11->trunk | Matthew Wild | 2021-05-13 | 1 | -0/+14 |
|\ | |||||
| * | util.hashes: Add constant-time string comparison (binding to CRYPTO_memcmp) | Matthew Wild | 2021-05-10 | 1 | -0/+14 |
| | | |||||
* | | Merge 0.11->trunk | Kim Alvefur | 2020-10-15 | 1 | -0/+4 |
|\| | |||||
| * | Back out changeset 2c1583bb0e0f | Kim Alvefur | 2020-10-15 | 1 | -0/+4 |
| | | | | | | | | Same reason as 712b2e6a09d9 | ||||
* | | Merge 0.11->trunk | Kim Alvefur | 2020-10-15 | 1 | -17/+6 |
|\| | |||||
| * | Back out 6dde2c9fa272: Doesn't work on Lua 5.1 | Kim Alvefur | 2020-10-15 | 1 | -13/+6 |
| | |