Skip to content

Commit 225d1be

Browse files
cheri: Increase OpenSSL compat holder sizes for MD5, SHA and RC4
wc_Md5, wc_Sha & Arc4 have all increased in size on CHERI Signed-off-by: William Beasley (The Capable Hub) <wbeasley@thegoodpenguin.co.uk>
1 parent fd59db0 commit 225d1be

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

wolfssl/openssl/md5.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,17 @@
4343
typedef struct WOLFSSL_MD5_CTX {
4444
/* big enough to hold wolfcrypt md5, but check on init */
4545
#ifdef STM32_HASH
46+
# ifdef WC_NO_PTR_INT_CAST
47+
void* holder[(128 + WC_ASYNC_DEV_SIZE + sizeof(STM32_HASH_Context)) / sizeof(void*)];
48+
# else
4649
void* holder[(112 + WC_ASYNC_DEV_SIZE + sizeof(STM32_HASH_Context)) / sizeof(void*)];
50+
# endif
4751
#else
52+
# ifdef WC_NO_PTR_INT_CAST
53+
void* holder[(128 + WC_ASYNC_DEV_SIZE) / sizeof(void*)];
54+
# else
4855
void* holder[(112 + WC_ASYNC_DEV_SIZE) / sizeof(void*)];
56+
# endif
4957
#endif
5058
} WOLFSSL_MD5_CTX;
5159

wolfssl/openssl/rc4.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@
3939
* the size of RC4_KEY structures. */
4040
typedef struct WOLFSSL_RC4_KEY {
4141
/* big enough for Arc4 from wolfssl/wolfcrypt/arc4.h */
42+
#ifdef WC_NO_PTR_INT_CAST
43+
void* holder[(288 + WC_ASYNC_DEV_SIZE) / sizeof(void*)];
44+
#else
4245
void* holder[(272 + WC_ASYNC_DEV_SIZE) / sizeof(void*)];
46+
#endif
4347
} WOLFSSL_RC4_KEY;
4448

4549
WOLFSSL_API void wolfSSL_RC4_set_key(WOLFSSL_RC4_KEY* key, int len,

wolfssl/openssl/sha.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@
5252
#ifndef NO_SHA
5353
typedef struct WOLFSSL_SHA_CTX {
5454
/* big enough to hold wolfcrypt Sha, but check on init */
55+
#ifdef WC_NO_PTR_INT_CAST
56+
void* holder[(160 + WC_ASYNC_DEV_SIZE + CTX_SHA_HW_ADDER) / sizeof(void*)];
57+
#else
5558
void* holder[(112 + WC_ASYNC_DEV_SIZE + CTX_SHA_HW_ADDER) / sizeof(void*)];
59+
#endif
5660
#if defined(WOLFSSL_DEVCRYPTO_HASH) || defined(WOLFSSL_HASH_KEEP)
5761
void* keephash_holder[sizeof(void*) + (2 * sizeof(unsigned int))];
5862
#endif

0 commit comments

Comments
 (0)