This replaces the earlier commit
4c079dcc64da ("Increment
hmac_sha*_vector() maximum num_elem value to 25") with a smaller
increment of just one extra element since the updated FTE MIC
calculation design does not use separate elements. This reduces stack
memory need. In addition, this starts using a define value for the
maximum number of vector elements to make this easier to change and to
make the code more readable.
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
#ifndef CRYPTO_H
#define CRYPTO_H
+#define HMAC_VECTOR_MAX_ELEM 11
+
/**
* md4_vector - MD4 hash for data vector
* @num_elem: Number of elements in the data vector
{
unsigned char k_pad[64]; /* padding - key XORd with ipad/opad */
unsigned char tk[32];
- const u8 *_addr[26];
- size_t _len[26], i;
+ const u8 *_addr[HMAC_VECTOR_MAX_ELEM + 1];
+ size_t _len[HMAC_VECTOR_MAX_ELEM + 1], i;
int ret;
- if (num_elem > 25) {
+ if (num_elem > HMAC_VECTOR_MAX_ELEM) {
/*
* Fixed limit on the number of fragments to avoid having to
* allocate memory (which could fail).
{
unsigned char k_pad[128]; /* padding - key XORd with ipad/opad */
unsigned char tk[48];
- const u8 *_addr[26];
- size_t _len[26], i;
+ const u8 *_addr[HMAC_VECTOR_MAX_ELEM + 1];
+ size_t _len[HMAC_VECTOR_MAX_ELEM + 1], i;
- if (num_elem > 25) {
+ if (num_elem > HMAC_VECTOR_MAX_ELEM) {
/*
* Fixed limit on the number of fragments to avoid having to
* allocate memory (which could fail).
{
unsigned char k_pad[128]; /* padding - key XORd with ipad/opad */
unsigned char tk[64];
- const u8 *_addr[26];
- size_t _len[26], i;
+ const u8 *_addr[HMAC_VECTOR_MAX_ELEM + 1];
+ size_t _len[HMAC_VECTOR_MAX_ELEM + 1], i;
- if (num_elem > 25) {
+ if (num_elem > HMAC_VECTOR_MAX_ELEM) {
/*
* Fixed limit on the number of fragments to avoid having to
* allocate memory (which could fail).