Browse Source

Fix issues with keyed hash API.

tags/1.0.7
Vsevolod Stakhov 8 years ago
parent
commit
293fbe463c
3 changed files with 6 additions and 11 deletions
  1. 4
    10
      src/libcryptobox/blake2/blake2.c
  2. 1
    1
      src/libcryptobox/blake2/blake2.h
  3. 1
    0
      src/libcryptobox/cryptobox.h

+ 4
- 10
src/libcryptobox/blake2/blake2.c View File

@@ -140,15 +140,9 @@ void
blake2b_keyed_init (blake2b_state *S, const unsigned char *key, size_t keylen)
{
unsigned char k[BLAKE2B_BLOCKBYTES] = {0};
if (keylen > BLAKE2B_KEYBYTES) {
fprintf (stderr,
"key size larger than %u passed to blake2b_keyed_init",
BLAKE2B_KEYBYTES);
exit (-1);
}
else {
memcpy (k, key, keylen);
}

g_assert (keylen <= BLAKE2B_KEYBYTES);
memcpy (k, key, keylen);
blake2b_init (S);
blake2b_update (S, k, BLAKE2B_BLOCKBYTES);
}
@@ -278,4 +272,4 @@ blake2b_load (void)
}
}
}
}
}

+ 1
- 1
src/libcryptobox/blake2/blake2.h View File

@@ -65,7 +65,7 @@ void blake2b_keyed (unsigned char *hash,
const unsigned char *key,
size_t keylen);

int blake2b_load (void);
void blake2b_load (void);

#if defined(__cplusplus)
}

+ 1
- 0
src/libcryptobox/cryptobox.h View File

@@ -37,6 +37,7 @@ struct rspamd_cryptobox_segment {
#define rspamd_cryptobox_MAX_NMBYTES 32
#define rspamd_cryptobox_SIPKEYBYTES 16
#define rspamd_cryptobox_HASHBYTES 64
#define rspamd_cryptobox_HASHKEYBYTES 64
#define rspamd_cryptobox_HASHSTATEBYTES 256

typedef guchar rspamd_pk_t[rspamd_cryptobox_MAX_PKBYTES];

Loading…
Cancel
Save