From e0a74420f1e6b79e9dfc209046a3885f611e6cc0 Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Wed, 2 Apr 2025 17:14:09 -0500 Subject: [PATCH] wolfcrypt/src/coding.c: restore support for BASE64_NO_TABLE builds. --- wolfcrypt/src/coding.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/wolfcrypt/src/coding.c b/wolfcrypt/src/coding.c index 39a77799e..c5c15205d 100644 --- a/wolfcrypt/src/coding.c +++ b/wolfcrypt/src/coding.c @@ -82,6 +82,8 @@ static WC_INLINE byte Base64_Char2Val_CT(byte c) return (byte)(v - 1); } +#ifndef BASE64_NO_TABLE + static ALIGN64 const byte base64Decode_table[] = { /* + starts at 0x2B */ /* 0x28: + , - . / */ 62, BAD, BAD, BAD, 63, @@ -120,6 +122,8 @@ static WC_INLINE byte Base64_Char2Val_by_table(byte c) #endif } +#endif /* !BASE64_NO_TABLE */ + int Base64_SkipNewline(const byte* in, word32 *inLen, word32 *outJ) { @@ -168,6 +172,8 @@ int Base64_SkipNewline(const byte* in, word32 *inLen, return 0; } +#ifndef BASE64_NO_TABLE + int Base64_Decode_nonCT(const byte* in, word32 inLen, byte* out, word32* outLen) { word32 i = 0; @@ -269,6 +275,8 @@ int Base64_Decode_nonCT(const byte* in, word32 inLen, byte* out, word32* outLen) return 0; } +#endif /* !BASE64_NO_TABLE */ + int Base64_Decode(const byte* in, word32 inLen, byte* out, word32* outLen) { word32 i = 0; @@ -358,6 +366,12 @@ int Base64_Decode(const byte* in, word32 inLen, byte* out, word32* outLen) return 0; } +#ifdef BASE64_NO_TABLE +int Base64_Decode_nonCT(const byte* in, word32 inLen, byte* out, word32* outLen) { + return Base64_Decode(in, inLen, out, outLen); +} +#endif /* BASE64_NO_TABLE */ + #endif /* WOLFSSL_BASE64_DECODE */ #if defined(WOLFSSL_BASE64_ENCODE)