From 225d1beda88600716773cdc045947a3cdbd68107 Mon Sep 17 00:00:00 2001 From: "William Beasley (The Capable Hub)" Date: Tue, 5 May 2026 12:17:05 +0100 Subject: [PATCH] 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) --- wolfssl/openssl/md5.h | 8 ++++++++ wolfssl/openssl/rc4.h | 4 ++++ wolfssl/openssl/sha.h | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/wolfssl/openssl/md5.h b/wolfssl/openssl/md5.h index 4562020da5..880127d93b 100644 --- a/wolfssl/openssl/md5.h +++ b/wolfssl/openssl/md5.h @@ -43,9 +43,17 @@ typedef struct WOLFSSL_MD5_CTX { /* big enough to hold wolfcrypt md5, but check on init */ #ifdef STM32_HASH +# ifdef WC_NO_PTR_INT_CAST + void* holder[(128 + WC_ASYNC_DEV_SIZE + sizeof(STM32_HASH_Context)) / sizeof(void*)]; +# else void* holder[(112 + WC_ASYNC_DEV_SIZE + sizeof(STM32_HASH_Context)) / sizeof(void*)]; +# endif #else +# ifdef WC_NO_PTR_INT_CAST + void* holder[(128 + WC_ASYNC_DEV_SIZE) / sizeof(void*)]; +# else void* holder[(112 + WC_ASYNC_DEV_SIZE) / sizeof(void*)]; +# endif #endif } WOLFSSL_MD5_CTX; diff --git a/wolfssl/openssl/rc4.h b/wolfssl/openssl/rc4.h index d0fdf336cb..c53c47b6b6 100644 --- a/wolfssl/openssl/rc4.h +++ b/wolfssl/openssl/rc4.h @@ -39,7 +39,11 @@ * the size of RC4_KEY structures. */ typedef struct WOLFSSL_RC4_KEY { /* big enough for Arc4 from wolfssl/wolfcrypt/arc4.h */ +#ifdef WC_NO_PTR_INT_CAST + void* holder[(288 + WC_ASYNC_DEV_SIZE) / sizeof(void*)]; +#else void* holder[(272 + WC_ASYNC_DEV_SIZE) / sizeof(void*)]; +#endif } WOLFSSL_RC4_KEY; WOLFSSL_API void wolfSSL_RC4_set_key(WOLFSSL_RC4_KEY* key, int len, diff --git a/wolfssl/openssl/sha.h b/wolfssl/openssl/sha.h index 47320b5a22..1b863b17e9 100644 --- a/wolfssl/openssl/sha.h +++ b/wolfssl/openssl/sha.h @@ -52,7 +52,11 @@ #ifndef NO_SHA typedef struct WOLFSSL_SHA_CTX { /* big enough to hold wolfcrypt Sha, but check on init */ +#ifdef WC_NO_PTR_INT_CAST + void* holder[(160 + WC_ASYNC_DEV_SIZE + CTX_SHA_HW_ADDER) / sizeof(void*)]; +#else void* holder[(112 + WC_ASYNC_DEV_SIZE + CTX_SHA_HW_ADDER) / sizeof(void*)]; +#endif #if defined(WOLFSSL_DEVCRYPTO_HASH) || defined(WOLFSSL_HASH_KEEP) void* keephash_holder[sizeof(void*) + (2 * sizeof(unsigned int))]; #endif