Skip to content

Commit dead287

Browse files
Vge0rgerlubos
authored andcommitted
nrf_security: Order the block/digest hash sizes in Cracen
Order the digest and block sizes for better visilibity in then Cracen sxsymcrypt driver. Also moved them on the top of the file in order to be used later by other macros. Signed-off-by: Georgios Vasilakis <[email protected]>
1 parent c087be8 commit dead287

File tree

1 file changed

+22
-21
lines changed
  • subsys/nrf_security/src/drivers/cracen/sxsymcrypt/include/sxsymcrypt

1 file changed

+22
-21
lines changed

subsys/nrf_security/src/drivers/cracen/sxsymcrypt/include/sxsymcrypt/hashdefs.h

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,28 @@
1212
#include "internal.h"
1313
#include "nrf-psa-crypto-user-config.h"
1414

15+
#define SX_HASH_DIGESTSZ_SHA3_512 64
16+
#define SX_HASH_DIGESTSZ_SHA2_512 64
17+
#define SX_HASH_DIGESTSZ_SHA3_384 48
18+
#define SX_HASH_DIGESTSZ_SHA2_384 48
19+
#define SX_HASH_DIGESTSZ_SHA3_256 32
20+
#define SX_HASH_DIGESTSZ_SHA2_256 32
21+
#define SX_HASH_DIGESTSZ_SM3 32
22+
#define SX_HASH_DIGESTSZ_SHA3_224 28
23+
#define SX_HASH_DIGESTSZ_SHA2_224 28
24+
#define SX_HASH_DIGESTSZ_SHA1 20
25+
26+
#define SX_HASH_BLOCKSZ_SHA3_224 144
27+
#define SX_HASH_BLOCKSZ_SHA3_256 136
28+
#define SX_HASH_BLOCKSZ_SHA2_384 128
29+
#define SX_HASH_BLOCKSZ_SHA2_512 128
30+
#define SX_HASH_BLOCKSZ_SHA3_384 104
31+
#define SX_HASH_BLOCKSZ_SHA3_512 72
32+
#define SX_HASH_BLOCKSZ_SHA2_224 64
33+
#define SX_HASH_BLOCKSZ_SHA2_256 64
34+
#define SX_HASH_BLOCKSZ_SHA1 64
35+
#define SX_HASH_BLOCKSZ_SM3 64
36+
1537
/* These are not magic numbers, the number here is the size in bytes of the
1638
* extramem field of sxhash. The extra memory holds the data for saving/resuming
1739
* the state and should have the size of statesz + maxpadsz.
@@ -80,27 +102,6 @@ struct sxhashalg {
80102
int (*reservehw)(struct sxhash *c, size_t csz);
81103
};
82104

83-
#define SX_HASH_DIGESTSZ_SHA1 20
84-
#define SX_HASH_BLOCKSZ_SHA1 64
85-
#define SX_HASH_DIGESTSZ_SHA2_224 28
86-
#define SX_HASH_DIGESTSZ_SHA2_256 32
87-
#define SX_HASH_DIGESTSZ_SHA2_384 48
88-
#define SX_HASH_DIGESTSZ_SHA2_512 64
89-
#define SX_HASH_BLOCKSZ_SHA2_224 64
90-
#define SX_HASH_BLOCKSZ_SHA2_256 64
91-
#define SX_HASH_BLOCKSZ_SHA2_384 128
92-
#define SX_HASH_BLOCKSZ_SHA2_512 128
93-
#define SX_HASH_DIGESTSZ_SHA3_224 28
94-
#define SX_HASH_DIGESTSZ_SHA3_256 32
95-
#define SX_HASH_DIGESTSZ_SHA3_384 48
96-
#define SX_HASH_DIGESTSZ_SHA3_512 64
97-
#define SX_HASH_BLOCKSZ_SHA3_224 144
98-
#define SX_HASH_BLOCKSZ_SHA3_256 136
99-
#define SX_HASH_BLOCKSZ_SHA3_384 104
100-
#define SX_HASH_BLOCKSZ_SHA3_512 72
101-
#define SX_HASH_DIGESTSZ_SM3 32
102-
#define SX_HASH_BLOCKSZ_SM3 64
103-
104105
/** Hash algorithm SHA-1 (Secure Hash Algorithm 1)
105106
*
106107
* Deprecated algorithm. NIST formally deprecated use of SHA-1 in 2011

0 commit comments

Comments
 (0)