vendor/libsodium/test/default/kdf.c in rbnacl-libsodium-1.0.15.1 vs vendor/libsodium/test/default/kdf.c in rbnacl-libsodium-1.0.16
- old
+ new
@@ -8,20 +8,22 @@
unsigned char *master_key;
unsigned char *subkey;
char *context;
char hex[crypto_kdf_BYTES_MAX * 2 + 1];
uint64_t i;
+ int ret;
context = (char *) sodium_malloc(crypto_kdf_CONTEXTBYTES);
memcpy(context, "KDF test", strlen("KDF test"));
master_key = (unsigned char *) sodium_malloc(crypto_kdf_KEYBYTES);
for (i = 0; i < crypto_kdf_KEYBYTES; i++) {
master_key[i] = i;
}
subkey = (unsigned char *) sodium_malloc(crypto_kdf_BYTES_MAX);
for (i = 0; i < 10; i++) {
- assert(crypto_kdf_derive_from_key(subkey, crypto_kdf_BYTES_MAX,
- i, context, master_key) == 0);
+ ret = crypto_kdf_derive_from_key(subkey, crypto_kdf_BYTES_MAX,
+ i, context, master_key);
+ assert(ret == 0);
sodium_bin2hex(hex, sizeof hex, subkey, crypto_kdf_BYTES_MAX);
printf("%s\n", hex);
}
sodium_free(subkey);