[php-src] PR #13679: ext/sodium: Add onetimeauth functions
| From: | Ayesh | Date: | Tue, 12 Mar 2024 03:00:18 +0000 |
| Subject: | [php-src] PR #13679: ext/sodium: Add onetimeauth functions | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-25380@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/13679
Author: Ayesh
Libsodium supports onetimeauth functions (
crypto_onetimeauth_*) to calcualte a 16-byte
Poly1305 MAC, generate a key of appripriate size (32 bytes), and to verify them.
They are similar to the crypto_auth_* functions, in that they both take a 32 byte key.
However, crypto_auth calculates an HMAC-SHA512-256 of 32 bytes while
crypto_onetimeauth is a Poly1305 MAC of 16 bytes.
The implementation is quite similar to the one of crypt_auth; in fact the tests are
copied and modified to adapt.
ext-sodium requires libsodium version 1.0.8, which already supports
crypto_onetimeauth. However, crypto_onetimeauth_keygen is only available
on libsodium 1.0.12, so the _keygen() function uses the RNG. This is simialr to other
*_keygen() functions, except AEGIS functions which requires libsodium 1.0.18 anyway.