mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
Reject impossible lengths in crypto_box
This commit is contained in:
@@ -29,6 +29,9 @@ crypto_box_seal(unsigned char *c, const unsigned char *m,
|
||||
unsigned char esk[crypto_box_SECRETKEYBYTES];
|
||||
int ret;
|
||||
|
||||
if (mlen > crypto_box_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (crypto_box_keypair(epk, esk) != 0) {
|
||||
return -1; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
+3
@@ -35,6 +35,9 @@ crypto_box_curve25519xchacha20poly1305_seal(unsigned char *c, const unsigned cha
|
||||
unsigned char esk[crypto_box_curve25519xchacha20poly1305_SECRETKEYBYTES];
|
||||
int ret;
|
||||
|
||||
if (mlen > crypto_box_curve25519xchacha20poly1305_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (crypto_box_curve25519xchacha20poly1305_keypair(epk, esk) != 0) {
|
||||
return -1; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user