diff options
| author | Herbert Xu <herbert@gondor.apana.org.au> | 2025-04-18 10:58:43 +0800 |
|---|---|---|
| committer | Herbert Xu <herbert@gondor.apana.org.au> | 2025-04-23 11:33:46 +0800 |
| commit | aa54e17020852858d6e1639f1c7ef516fd217e08 (patch) | |
| tree | 0dac1dacfc058c9adc3cecf35f749dab67a2566b /include/crypto/blake2b.h | |
| parent | 7650f826f7b2d84782f9147c51687ff0364125e9 (diff) | |
| download | linux-aa54e17020852858d6e1639f1c7ef516fd217e08.tar.gz linux-aa54e17020852858d6e1639f1c7ef516fd217e08.tar.bz2 linux-aa54e17020852858d6e1639f1c7ef516fd217e08.zip | |
crypto: blake2b-generic - Use API partial block handling
Use the Crypto API partial block handling.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto/blake2b.h')
| -rw-r--r-- | include/crypto/blake2b.h | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/include/crypto/blake2b.h b/include/crypto/blake2b.h index 0c0176285349..68da368dc182 100644 --- a/include/crypto/blake2b.h +++ b/include/crypto/blake2b.h @@ -11,6 +11,8 @@ enum blake2b_lengths { BLAKE2B_BLOCK_SIZE = 128, BLAKE2B_HASH_SIZE = 64, BLAKE2B_KEY_SIZE = 64, + BLAKE2B_STATE_SIZE = 80, + BLAKE2B_DESC_SIZE = 96, BLAKE2B_160_HASH_SIZE = 20, BLAKE2B_256_HASH_SIZE = 32, @@ -25,7 +27,6 @@ struct blake2b_state { u64 f[2]; u8 buf[BLAKE2B_BLOCK_SIZE]; unsigned int buflen; - unsigned int outlen; }; enum blake2b_iv { @@ -40,7 +41,7 @@ enum blake2b_iv { }; static inline void __blake2b_init(struct blake2b_state *state, size_t outlen, - const void *key, size_t keylen) + size_t keylen) { state->h[0] = BLAKE2B_IV0 ^ (0x01010000 | keylen << 8 | outlen); state->h[1] = BLAKE2B_IV1; @@ -52,15 +53,6 @@ static inline void __blake2b_init(struct blake2b_state *state, size_t outlen, state->h[7] = BLAKE2B_IV7; state->t[0] = 0; state->t[1] = 0; - state->f[0] = 0; - state->f[1] = 0; - state->buflen = 0; - state->outlen = outlen; - if (keylen) { - memcpy(state->buf, key, keylen); - memset(&state->buf[keylen], 0, BLAKE2B_BLOCK_SIZE - keylen); - state->buflen = BLAKE2B_BLOCK_SIZE; - } } #endif /* _CRYPTO_BLAKE2B_H */ |
