diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2023-04-15 19:22:35 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2023-04-15 19:22:35 +0000 |
commit | 6756daa7db5009e5cc67a010bcb82305225fdbf4 (patch) | |
tree | d71bc00e0542bc31cb64fbfee9c32fd047b1b549 /lib | |
parent | 27efdac3112c3ba9b3fadd12ecb3e6abe065f71f (diff) |
Provide SHA3 length related defines.
These will make EVP integration easier, as well as being used in the SHA3
implementation itself.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcrypto/sha/sha3_internal.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/libcrypto/sha/sha3_internal.h b/lib/libcrypto/sha/sha3_internal.h index 889f12c8e9f..05a02c8e2c1 100644 --- a/lib/libcrypto/sha/sha3_internal.h +++ b/lib/libcrypto/sha/sha3_internal.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sha3_internal.h,v 1.8 2023/04/15 18:32:55 jsing Exp $ */ +/* $OpenBSD: sha3_internal.h,v 1.9 2023/04/15 19:22:34 jsing Exp $ */ /* * The MIT License (MIT) * @@ -29,6 +29,32 @@ #ifndef HEADER_SHA3_INTERNAL_H #define HEADER_SHA3_INTERNAL_H +#define KECCAK_BIT_WIDTH 1600 +#define KECCAK_BYTE_WIDTH (KECCAK_BIT_WIDTH / 8) + +#define SHA3_224_BIT_LENGTH 224 +#define SHA3_224_BITRATE (2 * SHA3_224_BIT_LENGTH) +#define SHA3_224_CAPACITY (KECCAK_BIT_WIDTH - SHA3_224_BITRATE) +#define SHA3_224_BLOCK_SIZE (SHA3_224_CAPACITY / 8) +#define SHA3_224_DIGEST_LENGTH (SHA3_224_BIT_LENGTH / 8) + +#define SHA3_256_BIT_LENGTH 256 +#define SHA3_256_BITRATE (2 * SHA3_256_BIT_LENGTH) +#define SHA3_256_CAPACITY (KECCAK_BIT_WIDTH - SHA3_256_BITRATE) +#define SHA3_256_BLOCK_SIZE (SHA3_256_CAPACITY / 8) +#define SHA3_256_DIGEST_LENGTH (SHA3_256_BIT_LENGTH / 8) + +#define SHA3_384_BIT_LENGTH 384 +#define SHA3_384_BITRATE (2 * SHA3_384_BIT_LENGTH) +#define SHA3_384_CAPACITY (KECCAK_BIT_WIDTH - SHA3_384_BITRATE) +#define SHA3_384_BLOCK_SIZE (SHA3_384_CAPACITY / 8) +#define SHA3_384_DIGEST_LENGTH (SHA3_384_BIT_LENGTH / 8) + +#define SHA3_512_BIT_LENGTH 512 +#define SHA3_512_BITRATE (2 * SHA3_512_BIT_LENGTH) +#define SHA3_512_CAPACITY (KECCAK_BIT_WIDTH - SHA3_512_BITRATE) +#define SHA3_512_BLOCK_SIZE (SHA3_512_CAPACITY / 8) + typedef struct { union { uint8_t b[200]; /* State as 8 bit bytes. */ |