From 35ccd880ed66d51584b3b3ad3fe3b6719099fe00 Mon Sep 17 00:00:00 2001 From: David Garske Date: Wed, 9 Nov 2022 15:07:36 -0800 Subject: [PATCH 1/2] Fix for misc `HashObject` to be excluded for `WOLFCRYPT_ONLY`. --- wolfcrypt/src/misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/misc.c b/wolfcrypt/src/misc.c index cf9fe4ee1..8dd50c269 100644 --- a/wolfcrypt/src/misc.c +++ b/wolfcrypt/src/misc.c @@ -834,7 +834,7 @@ WC_STATIC WC_INLINE word32 MakeWordFromHash(const byte* hashID) #endif /* HAVE_SESSION_TICKET || !NO_CERTS || !NO_SESSION_CACHE */ -#if !defined(NO_SESSION_CACHE) || defined(HAVE_SESSION_TICKET) +#if !defined(WOLFCRYPT_ONLY) && (!defined(NO_SESSION_CACHE) || defined(HAVE_SESSION_TICKET)) #include @@ -855,7 +855,7 @@ WC_STATIC WC_INLINE word32 HashObject(const byte* o, word32 len, int* error) return *error == 0 ? MakeWordFromHash(digest) : 0; /* 0 on failure */ } -#endif /* !NO_SESSION_CACHE || HAVE_SESSION_TICKET */ +#endif /* WOLFCRYPT_ONLY && (!NO_SESSION_CACHE || HAVE_SESSION_TICKET) */ #undef WC_STATIC From 77ffacf6d11949b311767626853f3b2c0bd70812 Mon Sep 17 00:00:00 2001 From: David Garske Date: Thu, 10 Nov 2022 11:38:08 -0800 Subject: [PATCH 2/2] Fix for build error with SHA2-256 disabled. --- wolfcrypt/src/wc_encrypt.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/wolfcrypt/src/wc_encrypt.c b/wolfcrypt/src/wc_encrypt.c index 4065a04bd..681996f95 100644 --- a/wolfcrypt/src/wc_encrypt.c +++ b/wolfcrypt/src/wc_encrypt.c @@ -422,20 +422,25 @@ int wc_CryptKey(const char* password, int passwordSz, byte* salt, typeH = WC_SHA; derivedLen = 16; /* may need iv for v1.5 */ break; - + #endif /* !NO_SHA */ + #if !defined(NO_SHA) || !defined(NO_SHA256) case PBE_SHA1_DES3: - switch(shaOid) { + switch (shaOid) { + #ifndef NO_SHA256 case HMAC_SHA256_OID: typeH = WC_SHA256; derivedLen = 32; break; + #endif + #ifndef NO_SHA default: typeH = WC_SHA; derivedLen = 32; /* may need iv for v1.5 */ break; + #endif } break; - #endif /* !NO_SHA */ + #endif #endif /* !NO_DES3 */ #if !defined(NO_SHA) && !defined(NO_RC4) case PBE_SHA1_RC4_128: