Use sodium_malloc() for the secretbox_*() tests
This commit is contained in:
parent
e424963ae8
commit
8ee4950eb3
@ -24,12 +24,15 @@ unsigned char m[131]
|
||||
0x60, 0x90, 0x2e, 0x52, 0xf0, 0xa0, 0x89, 0xbc, 0x76, 0x89, 0x70, 0x40,
|
||||
0xe0, 0x82, 0xf9, 0x37, 0x76, 0x38, 0x48, 0x64, 0x5e, 0x07, 0x05 };
|
||||
|
||||
unsigned char c[147 + crypto_secretbox_MACBYTES + 1];
|
||||
unsigned char mac[crypto_secretbox_MACBYTES];
|
||||
|
||||
int main(void)
|
||||
{
|
||||
size_t i;
|
||||
unsigned char *c;
|
||||
unsigned char *mac;
|
||||
size_t i;
|
||||
|
||||
c = sodium_malloc(131 + crypto_secretbox_MACBYTES + 1);
|
||||
mac = sodium_malloc(crypto_secretbox_MACBYTES);
|
||||
assert(c != NULL && mac != NULL);
|
||||
|
||||
crypto_secretbox_easy(c, m, 131, nonce, firstkey);
|
||||
for (i = 0; i < 131 + crypto_secretbox_MACBYTES; ++i) {
|
||||
@ -83,5 +86,8 @@ int main(void)
|
||||
|
||||
assert(crypto_secretbox_easy(c, m, SIZE_MAX - 1U, nonce, firstkey) == -1);
|
||||
|
||||
sodium_free(mac);
|
||||
sodium_free(c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user