[RFC 1/3] common/cnxk: replace variable length state array
Stephen Hemminger
stephen at networkplumber.org
Thu Oct 23 21:41:31 CEST 2025
The cipher function is always called with in_len = 16
and there is an existing define for that.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
drivers/common/cnxk/roc_aes.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/common/cnxk/roc_aes.c b/drivers/common/cnxk/roc_aes.c
index d84feb546a..e51cf532d7 100644
--- a/drivers/common/cnxk/roc_aes.c
+++ b/drivers/common/cnxk/roc_aes.c
@@ -157,9 +157,10 @@ static void
cipher(uint8_t *in, uint8_t *out, uint32_t *ks, uint32_t key_rounds, uint8_t in_len)
{
uint8_t data_word_len = in_len / sizeof(uint32_t);
- uint32_t state[data_word_len];
+ uint32_t state[AES_HASH_KEY_LEN / sizeof(uint32_t)];
unsigned int i, round;
+ RTE_ASSERT(data_word_len <= AES_HASH_KEY_LEN);
memcpy(state, in, sizeof(state));
/* AddRoundKey(state, w[0, Nb-1]) // See Sec. 5.1.4 */
--
2.51.0
More information about the dev
mailing list