diff options
author | Pauli <ppzgs1@gmail.com> | 2021-02-25 00:52:26 +0100 |
---|---|---|
committer | Pauli <ppzgs1@gmail.com> | 2021-02-28 08:25:48 +0100 |
commit | ae7d90a1594dabf72123f395f9f2436452ab5d9a (patch) | |
tree | f625489fa5173e2cd166d7fda37138ecb754c6f7 /crypto/siphash | |
parent | crypto/asn1/i2d_evp.c: Fix i2d_provided() to return a proper length (diff) | |
download | openssl-ae7d90a1594dabf72123f395f9f2436452ab5d9a.tar.xz openssl-ae7d90a1594dabf72123f395f9f2436452ab5d9a.zip |
siphash: Add the C and D round parameters for SipHash.
This represents a gap in functionality from the low level APIs.
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14310)
Diffstat (limited to 'crypto/siphash')
-rw-r--r-- | crypto/siphash/siphash.c | 8 | ||||
-rw-r--r-- | crypto/siphash/siphash_local.h | 11 |
2 files changed, 10 insertions, 9 deletions
diff --git a/crypto/siphash/siphash.c b/crypto/siphash/siphash.c index 03f9b4982d..eaad0a8e4a 100644 --- a/crypto/siphash/siphash.c +++ b/crypto/siphash/siphash.c @@ -30,10 +30,6 @@ #include "crypto/siphash.h" #include "siphash_local.h" -/* default: SipHash-2-4 */ -#define SIPHASH_C_ROUNDS 2 -#define SIPHASH_D_ROUNDS 4 - #define ROTL(x, b) (uint64_t)(((x) << (b)) | ((x) >> (64 - (b)))) #define U32TO8_LE(p, v) \ @@ -146,7 +142,7 @@ void SipHash_Update(SIPHASH *ctx, const unsigned char *in, size_t inlen) uint64_t m; const uint8_t *end; int left; - int i; + unsigned int i; uint64_t v0 = ctx->v0; uint64_t v1 = ctx->v1; uint64_t v2 = ctx->v2; @@ -202,7 +198,7 @@ void SipHash_Update(SIPHASH *ctx, const unsigned char *in, size_t inlen) int SipHash_Final(SIPHASH *ctx, unsigned char *out, size_t outlen) { /* finalize hash */ - int i; + unsigned int i; uint64_t b = ctx->total_inlen << 56; uint64_t v0 = ctx->v0; uint64_t v1 = ctx->v1; diff --git a/crypto/siphash/siphash_local.h b/crypto/siphash/siphash_local.h index 4841284c04..8cd7c208cc 100644 --- a/crypto/siphash/siphash_local.h +++ b/crypto/siphash/siphash_local.h @@ -16,8 +16,13 @@ struct siphash_st { uint64_t v2; uint64_t v3; unsigned int len; - int hash_size; - int crounds; - int drounds; + unsigned int hash_size; + unsigned int crounds; + unsigned int drounds; unsigned char leavings[SIPHASH_BLOCK_SIZE]; }; + +/* default: SipHash-2-4 */ +#define SIPHASH_C_ROUNDS 2 +#define SIPHASH_D_ROUNDS 4 + |