From 8bc6bf9424e8c494f447d30abdfc2d135e99f172 Mon Sep 17 00:00:00 2001 From: toddouska Date: Thu, 20 Mar 2014 10:31:52 -0700 Subject: [PATCH] add lower case support to Base16 decode for better known answer test support, export --- ctaocrypt/src/coding.c | 7 ++++++- cyassl/ctaocrypt/aes.h | 2 +- cyassl/ctaocrypt/coding.h | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ctaocrypt/src/coding.c b/ctaocrypt/src/coding.c index c18c7ee05..68bf4a7ae 100644 --- a/ctaocrypt/src/coding.c +++ b/ctaocrypt/src/coding.c @@ -327,7 +327,12 @@ int Base64_EncodeEsc(const byte* in, word32 inLen, byte* out, word32* outLen) static const byte hexDecode[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, BAD, BAD, BAD, BAD, BAD, BAD, BAD, - 10, 11, 12, 13, 14, 15 + 10, 11, 12, 13, 14, 15, /* upper case A-F */ + BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, + BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, + BAD, BAD, BAD, BAD, BAD, BAD, BAD, BAD, + BAD, BAD, /* G - ` */ + 10, 11, 12, 13, 14, 15 /* lower case a-f */ }; /* A starts at 0x41 not 0x3A */ int Base16_Decode(const byte* in, word32 inLen, byte* out, word32* outLen) diff --git a/cyassl/ctaocrypt/aes.h b/cyassl/ctaocrypt/aes.h index 371778b62..5c6323e08 100644 --- a/cyassl/ctaocrypt/aes.h +++ b/cyassl/ctaocrypt/aes.h @@ -159,7 +159,7 @@ CYASSL_API int AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz, CYASSL_API int AesCbcDecrypt_fips(Aes* aes, byte* out, const byte* in, word32 sz); #ifndef FIPS_NO_WRAPPERS - /* if not internal or fips.c consumer force fips calls if fips build */ + /* if not impl or fips.c impl wrapper force fips calls if fips build */ #define AesSetKey AesSetKey_fips #define AesCbcEncrypt AesCbcEncrypt_fips #define AesCbcDecrypt AesCbcDecrypt_fips diff --git a/cyassl/ctaocrypt/coding.h b/cyassl/ctaocrypt/coding.h index 911163794..0a72d414b 100644 --- a/cyassl/ctaocrypt/coding.h +++ b/cyassl/ctaocrypt/coding.h @@ -42,7 +42,7 @@ CYASSL_LOCAL int Base64_Decode(const byte* in, word32 inLen, byte* out, CYASSL_API int Base64_EncodeEsc(const byte* in, word32 inLen, byte* out, word32* outLen); - CYASSL_LOCAL + CYASSL_API int Base16_Decode(const byte* in, word32 inLen, byte* out, word32* outLen); #endif