Add crypto_generichash_statebytes()
sizeof() is not always an option when accessing the library from other languages.
This commit is contained in:
parent
4921836512
commit
c9ba75a48f
@ -37,11 +37,18 @@ crypto_generichash_keybytes(void)
|
||||
return crypto_generichash_KEYBYTES;
|
||||
}
|
||||
|
||||
const char *crypto_generichash_primitive(void)
|
||||
const char *
|
||||
crypto_generichash_primitive(void)
|
||||
{
|
||||
return crypto_generichash_PRIMITIVE;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_generichash_statebytes(void)
|
||||
{
|
||||
return sizeof(crypto_generichash_state);
|
||||
}
|
||||
|
||||
int
|
||||
crypto_generichash(unsigned char *out, size_t outlen, const unsigned char *in,
|
||||
unsigned long long inlen, const unsigned char *key,
|
||||
|
@ -42,6 +42,8 @@ SODIUM_EXPORT
|
||||
const char *crypto_generichash_primitive(void);
|
||||
|
||||
typedef crypto_generichash_blake2b_state crypto_generichash_state;
|
||||
SODIUM_EXPORT
|
||||
size_t crypto_generichash_statebytes(void);
|
||||
|
||||
SODIUM_EXPORT
|
||||
int crypto_generichash(unsigned char *out, size_t outlen,
|
||||
|
@ -10,6 +10,7 @@ int main(void)
|
||||
k[crypto_generichash_KEYBYTES_MAX];
|
||||
size_t h, i, j;
|
||||
|
||||
assert(crypto_generichash_statebytes() == sizeof st);
|
||||
for (h = 0; h < crypto_generichash_KEYBYTES_MAX; ++h)
|
||||
k[h] = h;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user