Merge pull request #3088 from kaleb-himes/ZD10539

Change Hash union to wc_Hmac_Hash
This commit is contained in:
toddouska
2020-07-14 11:23:30 -07:00
committed by GitHub
6 changed files with 11 additions and 9 deletions

View File

@ -23051,11 +23051,11 @@ int wolfSSL_X509_verify_cert(WOLFSSL_X509_STORE_CTX* ctx)
afterDate = ctx->current_cert->notAfter.data; afterDate = ctx->current_cert->notAfter.data;
beforeDate = ctx->current_cert->notBefore.data; beforeDate = ctx->current_cert->notBefore.data;
if (ValidateDate(afterDate, (byte)ctx->current_cert->notAfter.type, if (XVALIDATE_DATE(afterDate, (byte)ctx->current_cert->notAfter.type,
AFTER) < 1) { AFTER) < 1) {
error = X509_V_ERR_CERT_HAS_EXPIRED; error = X509_V_ERR_CERT_HAS_EXPIRED;
} }
else if (ValidateDate(beforeDate, else if (XVALIDATE_DATE(beforeDate,
(byte)ctx->current_cert->notBefore.type, BEFORE) < 1) { (byte)ctx->current_cert->notBefore.type, BEFORE) < 1) {
error = X509_V_ERR_CERT_NOT_YET_VALID; error = X509_V_ERR_CERT_NOT_YET_VALID;
} }

View File

@ -6354,7 +6354,7 @@ static WC_INLINE int DateLessThan(const struct tm* a, const struct tm* b)
/* like atoi but only use first byte */ /* like atoi but only use first byte */
/* Make sure before and after dates are valid */ /* Make sure before and after dates are valid */
int ValidateDate(const byte* date, byte format, int dateType) int wc_ValidateDate(const byte* date, byte format, int dateType)
{ {
time_t ltime; time_t ltime;
struct tm certTime; struct tm certTime;

View File

@ -918,9 +918,11 @@ WOLFSSL_API int wolfSSL_SetServerID(WOLFSSL*, const unsigned char*, int, int);
WOLFSSL_API int wolfSSL_BIO_new_bio_pair(WOLFSSL_BIO**, size_t, WOLFSSL_API int wolfSSL_BIO_new_bio_pair(WOLFSSL_BIO**, size_t,
WOLFSSL_BIO**, size_t); WOLFSSL_BIO**, size_t);
WOLFSSL_API int wolfSSL_RSA_padding_add_PKCS1_PSS(WOLFSSL_RSA *rsa, unsigned char *EM, WOLFSSL_API int wolfSSL_RSA_padding_add_PKCS1_PSS(WOLFSSL_RSA *rsa,
unsigned char *EM,
const unsigned char *mHash, const unsigned char *mHash,
const WOLFSSL_EVP_MD *Hash, int saltLen); const WOLFSSL_EVP_MD *hashAlg,
int saltLen);
WOLFSSL_API int wolfSSL_RSA_verify_PKCS1_PSS(WOLFSSL_RSA *rsa, const unsigned char *mHash, WOLFSSL_API int wolfSSL_RSA_verify_PKCS1_PSS(WOLFSSL_RSA *rsa, const unsigned char *mHash,
const WOLFSSL_EVP_MD *hashAlg, const WOLFSSL_EVP_MD *hashAlg,
const unsigned char *EM, int saltLen); const unsigned char *EM, int saltLen);

View File

@ -1120,7 +1120,7 @@ WOLFSSL_LOCAL int GetAsnTimeString(void* currTime, byte* buf, word32 len);
WOLFSSL_LOCAL int ExtractDate(const unsigned char* date, unsigned char format, WOLFSSL_LOCAL int ExtractDate(const unsigned char* date, unsigned char format,
wolfssl_tm* certTime, int* idx); wolfssl_tm* certTime, int* idx);
WOLFSSL_LOCAL int DateGreaterThan(const struct tm* a, const struct tm* b); WOLFSSL_LOCAL int DateGreaterThan(const struct tm* a, const struct tm* b);
WOLFSSL_LOCAL int ValidateDate(const byte* date, byte format, int dateType); WOLFSSL_LOCAL int wc_ValidateDate(const byte* date, byte format, int dateType);
WOLFSSL_LOCAL int wc_OBJ_sn2nid(const char *sn); WOLFSSL_LOCAL int wc_OBJ_sn2nid(const char *sn);
/* ASN.1 helper functions */ /* ASN.1 helper functions */

View File

@ -131,11 +131,11 @@ typedef union {
#ifdef WOLFSSL_SHA3 #ifdef WOLFSSL_SHA3
wc_Sha3 sha3; wc_Sha3 sha3;
#endif #endif
} Hash; } wc_Hmac_Hash;
/* Hmac digest */ /* Hmac digest */
struct Hmac { struct Hmac {
Hash hash; wc_Hmac_Hash hash;
word32 ipad[WC_HMAC_BLOCK_SIZE / sizeof(word32)]; /* same block size all*/ word32 ipad[WC_HMAC_BLOCK_SIZE / sizeof(word32)]; /* same block size all*/
word32 opad[WC_HMAC_BLOCK_SIZE / sizeof(word32)]; word32 opad[WC_HMAC_BLOCK_SIZE / sizeof(word32)];
word32 innerHash[WC_MAX_DIGEST_SIZE / sizeof(word32)]; word32 innerHash[WC_MAX_DIGEST_SIZE / sizeof(word32)];

View File

@ -688,7 +688,7 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
#endif #endif
#if !defined(XVALIDATE_DATE) && !defined(HAVE_VALIDATE_DATE) #if !defined(XVALIDATE_DATE) && !defined(HAVE_VALIDATE_DATE)
#define USE_WOLF_VALIDDATE #define USE_WOLF_VALIDDATE
#define XVALIDATE_DATE(d, f, t) ValidateDate((d), (f), (t)) #define XVALIDATE_DATE(d, f, t) wc_ValidateDate((d), (f), (t))
#endif #endif
/* wolf struct tm and time_t */ /* wolf struct tm and time_t */