mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-20 02:25:14 -07:00
Add missing sodium_free() calls in the kdf test
This commit is contained in:
parent
99fe302562
commit
b84e4b9ddf
@ -13,8 +13,9 @@ tv_kdf(void)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
context = (char *) sodium_malloc(crypto_kdf_CONTEXTBYTES);
|
context = (char *) sodium_malloc(crypto_kdf_CONTEXTBYTES);
|
||||||
memcpy(context, "KDF test", strlen("KDF test"));
|
|
||||||
master_key = (unsigned char *) sodium_malloc(crypto_kdf_KEYBYTES);
|
master_key = (unsigned char *) sodium_malloc(crypto_kdf_KEYBYTES);
|
||||||
|
|
||||||
|
memcpy(context, "KDF test", strlen("KDF test"));
|
||||||
for (i = 0; i < crypto_kdf_KEYBYTES; i++) {
|
for (i = 0; i < crypto_kdf_KEYBYTES; i++) {
|
||||||
master_key[i] = i;
|
master_key[i] = i;
|
||||||
}
|
}
|
||||||
@ -41,6 +42,9 @@ tv_kdf(void)
|
|||||||
sodium_free(subkey);
|
sodium_free(subkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sodium_free(master_key);
|
||||||
|
sodium_free(context);
|
||||||
|
|
||||||
assert(strcmp(crypto_kdf_primitive(), crypto_kdf_PRIMITIVE) == 0);
|
assert(strcmp(crypto_kdf_primitive(), crypto_kdf_PRIMITIVE) == 0);
|
||||||
assert(crypto_kdf_BYTES_MAX > 0);
|
assert(crypto_kdf_BYTES_MAX > 0);
|
||||||
assert(crypto_kdf_BYTES_MIN <= crypto_kdf_BYTES_MAX);
|
assert(crypto_kdf_BYTES_MIN <= crypto_kdf_BYTES_MAX);
|
||||||
|
Loading…
Reference in New Issue
Block a user