Merge pull request #4511 from JacobBarthelmeh/Testing

build fixes and PKCS7 BER encoding fix
pull/4525/head
David Garske 2021-10-28 10:52:58 -07:00 committed by GitHub
commit 6bb7e3900e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 7 deletions

View File

@ -27503,7 +27503,7 @@ int wolfSSL_ASN1_TIME_to_tm(const WOLFSSL_ASN1_TIME* asnTime, struct tm* tm)
}
currentTime = XTIME(0);
if (currentTime < 0) {
if (currentTime <= 0) {
WOLFSSL_MSG("Failed to get current time.");
return WOLFSSL_FAILURE;
}
@ -30259,7 +30259,7 @@ int wolfSSL_ASN1_TIME_diff(int *days, int *secs, const WOLFSSL_ASN1_TIME *from,
}
fromSecs = XMKTIME(fromTm);
if (fromSecs < 0) {
if (fromSecs <= 0) {
WOLFSSL_MSG("XMKTIME for from time failed.");
return WOLFSSL_FAILURE;
}
@ -30278,7 +30278,7 @@ int wolfSSL_ASN1_TIME_diff(int *days, int *secs, const WOLFSSL_ASN1_TIME *from,
}
toSecs = XMKTIME(toTm);
if (toSecs < 0) {
if (toSecs <= 0) {
WOLFSSL_MSG("XMKTIME for to time failed.");
return WOLFSSL_FAILURE;
}
@ -35689,6 +35689,7 @@ static int wolfSSL_RSA_To_Der(WOLFSSL_RSA* rsa, byte** outBuf, int publicKey, vo
}
}
(void)heap; /* unused if memory is disabled */
WOLFSSL_LEAVE("wolfSSL_RSA_To_Der", derSz);
return derSz;
}
@ -46873,10 +46874,18 @@ int wolfSSL_CRYPTO_set_mem_functions(
wolfSSL_Realloc_cb r,
wolfSSL_Free_cb f)
{
#ifdef USE_WOLFSSL_MEMORY
if (wolfSSL_SetAllocators(m, f, r) == 0)
return WOLFSSL_SUCCESS;
else
return WOLFSSL_FAILURE;
#else
(void)m;
(void)r;
(void)f;
WOLFSSL_MSG("wolfSSL allocator callback functions not compiled in");
return WOLFSSL_FAILURE;
#endif
}
#if defined(WOLFSSL_KEY_GEN) && !defined(HAVE_SELFTEST) && !defined(NO_DH)

View File

@ -28222,7 +28222,7 @@ static void test_wc_PKCS7_EncodeDecodeEnvelopedData (void)
static void test_wc_PKCS7_EncodeEncryptedData (void)
{
#if defined(HAVE_PKCS7) && !defined(NO_PKCS7_ENCRYPTED_DATA)
PKCS7* pkcs7;
PKCS7* pkcs7 = NULL;
byte* tmpBytePtr = NULL;
byte encrypted[TWOK_BUF];
byte decoded[TWOK_BUF];

View File

@ -10186,7 +10186,7 @@ static int wc_PKCS7_ParseToRecipientInfoSet(PKCS7* pkcs7, byte* in,
return ret;
pkiMsg = in = pkcs7->der;
pkiMsgSz = pkcs7->derSz = len;
pkiMsgSz = pkcs7->derSz = inSz = len;
*idx = 0;
if (GetSequence(pkiMsg, idx, &length, pkiMsgSz) < 0)

View File

@ -3728,10 +3728,9 @@ int wc_RsaPSS_CheckPadding_ex2(const byte* in, word32 inSz, byte* sig,
if (sigCheck != NULL && sigCheck != sigCheckBuf) {
XFREE(sigCheck, heap, DYNAMIC_TYPE_RSA_BUFFER);
}
#else
(void)heap;
#endif
(void)heap; /* unused if memory is disabled */
return ret;
}
int wc_RsaPSS_CheckPadding_ex(const byte* in, word32 inSz, byte* sig,

View File

@ -320,6 +320,9 @@
#elif defined(WOLFSSL_LINUXKM)
#define SEND_FUNCTION linuxkm_send
#define RECV_FUNCTION linuxkm_recv
#elif defined(WOLFSSL_SGX)
#define SEND_FUNCTION send
#define RECV_FUNCTION recv
#else
#define SEND_FUNCTION send
#define RECV_FUNCTION recv