untab
This commit is contained in:
parent
7f7e7235c5
commit
7e5d64834c
@ -39,7 +39,7 @@ int crypto_kdf_blake2b_derive_from_key(unsigned char *subkey, size_t subkey_len,
|
||||
memcpy(ctx_padded, ctx, crypto_kdf_blake2b_CONTEXTBYTES);
|
||||
memset(ctx_padded + crypto_kdf_blake2b_CONTEXTBYTES, 0, sizeof ctx_padded - crypto_kdf_blake2b_CONTEXTBYTES);
|
||||
STORE64_LE(salt, subkey_id);
|
||||
memset(salt + 8, 0, (sizeof salt) - 8);
|
||||
memset(salt + 8, 0, (sizeof salt) - 8);
|
||||
if (subkey_len < crypto_kdf_blake2b_BYTES_MIN ||
|
||||
subkey_len > crypto_kdf_blake2b_BYTES_MAX) {
|
||||
errno = EINVAL;
|
||||
|
@ -26,7 +26,7 @@ size_t crypto_kdf_bytes_max(void);
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_kdf_contextbytes(void);
|
||||
|
||||
#define crypto_kdf_KEYBYTES crypto_kdf_blake2b_KEYBYTES
|
||||
#define crypto_kdf_KEYBYTES crypto_kdf_blake2b_KEYBYTES
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_kdf_keybytes(void);
|
||||
|
||||
|
@ -12,8 +12,8 @@ tv_kdf(void)
|
||||
uint64_t i;
|
||||
|
||||
context = (char *) sodium_malloc(crypto_kdf_CONTEXTBYTES);
|
||||
memcpy(context, "KDF test", strlen("KDF test"));
|
||||
master_key = (unsigned char *) sodium_malloc(crypto_kdf_KEYBYTES);
|
||||
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;
|
||||
}
|
||||
@ -27,7 +27,7 @@ tv_kdf(void)
|
||||
sodium_free(subkey);
|
||||
|
||||
for (i = 0; i < crypto_kdf_BYTES_MAX + 2; i++) {
|
||||
subkey = (unsigned char *) sodium_malloc(crypto_kdf_BYTES_MAX);
|
||||
subkey = (unsigned char *) sodium_malloc(crypto_kdf_BYTES_MAX);
|
||||
if (crypto_kdf_blake2b_derive_from_key(subkey, (size_t) i,
|
||||
i, context, master_key) == 0) {
|
||||
sodium_bin2hex(hex, sizeof hex, subkey, (size_t) i);
|
||||
@ -36,9 +36,9 @@ tv_kdf(void)
|
||||
printf("Failure -- probably expected for output length=%u\n",
|
||||
(unsigned int) i);
|
||||
}
|
||||
sodium_free(subkey);
|
||||
sodium_free(subkey);
|
||||
}
|
||||
printf("tv_kdf: ok\n");
|
||||
printf("tv_kdf: ok\n");
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user