mirror of https://github.com/wolfSSL/wolfssl.git
some infer fixes
parent
f6c3eae1de
commit
a948066f86
|
@ -987,6 +987,9 @@ int wolfSSL_i2d_OCSP_CERTID(WOLFSSL_OCSP_CERTID* id, unsigned char** data)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*data = (unsigned char*)XMALLOC(id->rawCertIdSize, NULL, DYNAMIC_TYPE_OPENSSL);
|
*data = (unsigned char*)XMALLOC(id->rawCertIdSize, NULL, DYNAMIC_TYPE_OPENSSL);
|
||||||
|
if (*data == NULL) {
|
||||||
|
return WOLFSSL_FAILURE;
|
||||||
|
}
|
||||||
XMEMCPY(*data, id->rawCertId, id->rawCertIdSize);
|
XMEMCPY(*data, id->rawCertId, id->rawCertIdSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
38
src/ssl.c
38
src/ssl.c
|
@ -6293,7 +6293,7 @@ int wolfSSL_CertManagerDisableOCSPStapling(WOLFSSL_CERT_MANAGER* cm)
|
||||||
/* require OCSP stapling response */
|
/* require OCSP stapling response */
|
||||||
int wolfSSL_CertManagerEnableOCSPMustStaple(WOLFSSL_CERT_MANAGER* cm)
|
int wolfSSL_CertManagerEnableOCSPMustStaple(WOLFSSL_CERT_MANAGER* cm)
|
||||||
{
|
{
|
||||||
int ret = WOLFSSL_SUCCESS;
|
int ret;
|
||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_CertManagerEnableOCSPMustStaple");
|
WOLFSSL_ENTER("wolfSSL_CertManagerEnableOCSPMustStaple");
|
||||||
|
|
||||||
|
@ -6305,6 +6305,7 @@ int wolfSSL_CertManagerEnableOCSPMustStaple(WOLFSSL_CERT_MANAGER* cm)
|
||||||
#ifndef NO_WOLFSSL_CLIENT
|
#ifndef NO_WOLFSSL_CLIENT
|
||||||
cm->ocspMustStaple = 1;
|
cm->ocspMustStaple = 1;
|
||||||
#endif
|
#endif
|
||||||
|
ret = WOLFSSL_SUCCESS;
|
||||||
#else
|
#else
|
||||||
ret = NOT_COMPILED_IN;
|
ret = NOT_COMPILED_IN;
|
||||||
#endif
|
#endif
|
||||||
|
@ -6314,7 +6315,7 @@ int wolfSSL_CertManagerEnableOCSPMustStaple(WOLFSSL_CERT_MANAGER* cm)
|
||||||
|
|
||||||
int wolfSSL_CertManagerDisableOCSPMustStaple(WOLFSSL_CERT_MANAGER* cm)
|
int wolfSSL_CertManagerDisableOCSPMustStaple(WOLFSSL_CERT_MANAGER* cm)
|
||||||
{
|
{
|
||||||
int ret = WOLFSSL_SUCCESS;
|
int ret;
|
||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_CertManagerDisableOCSPMustStaple");
|
WOLFSSL_ENTER("wolfSSL_CertManagerDisableOCSPMustStaple");
|
||||||
|
|
||||||
|
@ -6326,6 +6327,7 @@ int wolfSSL_CertManagerDisableOCSPMustStaple(WOLFSSL_CERT_MANAGER* cm)
|
||||||
#ifndef NO_WOLFSSL_CLIENT
|
#ifndef NO_WOLFSSL_CLIENT
|
||||||
cm->ocspMustStaple = 0;
|
cm->ocspMustStaple = 0;
|
||||||
#endif
|
#endif
|
||||||
|
ret = WOLFSSL_SUCCESS;
|
||||||
#else
|
#else
|
||||||
ret = NOT_COMPILED_IN;
|
ret = NOT_COMPILED_IN;
|
||||||
#endif
|
#endif
|
||||||
|
@ -14788,11 +14790,13 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
||||||
|
|
||||||
/* Need a persistent copy of the subject name. */
|
/* Need a persistent copy of the subject name. */
|
||||||
node->data.name = wolfSSL_X509_NAME_dup(subjectName);
|
node->data.name = wolfSSL_X509_NAME_dup(subjectName);
|
||||||
/*
|
if (node->data.name != NULL) {
|
||||||
* Original cert will be freed so make sure not to try to access
|
/*
|
||||||
* it in the future.
|
* Original cert will be freed so make sure not to try to access
|
||||||
*/
|
* it in the future.
|
||||||
node->data.name->x509 = NULL;
|
*/
|
||||||
|
node->data.name->x509 = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Put node on the front of the list. */
|
/* Put node on the front of the list. */
|
||||||
node->num = (list == NULL) ? 1 : list->num + 1;
|
node->num = (list == NULL) ? 1 : list->num + 1;
|
||||||
|
@ -32192,6 +32196,11 @@ int wolfSSL_PEM_write_bio_RSAPrivateKey(WOLFSSL_BIO* bio, WOLFSSL_RSA* key,
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (derBuf == NULL) {
|
||||||
|
WOLFSSL_MSG("wolfSSL_RSA_To_Der failed to get buffer");
|
||||||
|
return WOLFSSL_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
pkey->pkey.ptr = (char*)XMALLOC(derSz, bio->heap,
|
pkey->pkey.ptr = (char*)XMALLOC(derSz, bio->heap,
|
||||||
DYNAMIC_TYPE_TMP_BUFFER);
|
DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
if (pkey->pkey.ptr == NULL) {
|
if (pkey->pkey.ptr == NULL) {
|
||||||
|
@ -32247,6 +32256,11 @@ int wolfSSL_PEM_write_bio_RSA_PUBKEY(WOLFSSL_BIO* bio, WOLFSSL_RSA* rsa)
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (derBuf == NULL) {
|
||||||
|
WOLFSSL_MSG("wolfSSL_RSA_To_Der failed to get buffer");
|
||||||
|
return WOLFSSL_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
pkey->pkey.ptr = (char*)XMALLOC(derSz, bio->heap,
|
pkey->pkey.ptr = (char*)XMALLOC(derSz, bio->heap,
|
||||||
DYNAMIC_TYPE_TMP_BUFFER);
|
DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
if (pkey->pkey.ptr == NULL) {
|
if (pkey->pkey.ptr == NULL) {
|
||||||
|
@ -37706,7 +37720,7 @@ void* wolfSSL_GetDhAgreeCtx(WOLFSSL* ssl)
|
||||||
static int CopyX509NameToCert(WOLFSSL_X509_NAME* n, byte* out)
|
static int CopyX509NameToCert(WOLFSSL_X509_NAME* n, byte* out)
|
||||||
{
|
{
|
||||||
unsigned char* der = NULL;
|
unsigned char* der = NULL;
|
||||||
int length = BAD_FUNC_ARG, ret = BAD_FUNC_ARG;
|
int length = BAD_FUNC_ARG, ret;
|
||||||
word32 idx = 0;
|
word32 idx = 0;
|
||||||
|
|
||||||
ret = wolfSSL_i2d_X509_NAME(n, &der);
|
ret = wolfSSL_i2d_X509_NAME(n, &der);
|
||||||
|
@ -39227,9 +39241,11 @@ err:
|
||||||
XMEMCPY(fullName + *idx, "=", 1); *idx = *idx + 1;
|
XMEMCPY(fullName + *idx, "=", 1); *idx = *idx + 1;
|
||||||
|
|
||||||
data = wolfSSL_ASN1_STRING_data(e->value);
|
data = wolfSSL_ASN1_STRING_data(e->value);
|
||||||
sz = (int)XSTRLEN((const char*)data);
|
if (data != NULL) {
|
||||||
XMEMCPY(fullName + *idx, data, sz);
|
sz = (int)XSTRLEN((const char*)data);
|
||||||
*idx += sz;
|
XMEMCPY(fullName + *idx, data, sz);
|
||||||
|
*idx += sz;
|
||||||
|
}
|
||||||
|
|
||||||
ret++;
|
ret++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4072,6 +4072,11 @@ int TLSX_SupportedCurve_CheckPriority(WOLFSSL* ssl)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ext = TLSX_Find(priority, TLSX_SUPPORTED_GROUPS);
|
ext = TLSX_Find(priority, TLSX_SUPPORTED_GROUPS);
|
||||||
|
if (ext == NULL) {
|
||||||
|
WOLFSSL_MSG("Could not find supported groups extension");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
curve = (SupportedCurve*)ext->data;
|
curve = (SupportedCurve*)ext->data;
|
||||||
name = curve->name;
|
name = curve->name;
|
||||||
|
|
||||||
|
|
|
@ -22065,7 +22065,7 @@ static int test_wc_ecc_sig_size_calc (void)
|
||||||
#if defined(HAVE_ECC) && !defined(WC_NO_RNG) && !defined(HAVE_SELFTEST)
|
#if defined(HAVE_ECC) && !defined(WC_NO_RNG) && !defined(HAVE_SELFTEST)
|
||||||
ecc_key key;
|
ecc_key key;
|
||||||
WC_RNG rng;
|
WC_RNG rng;
|
||||||
int sz;
|
int sz = 0;
|
||||||
|
|
||||||
printf(testingFmt, "wc_ecc_sig_size_calc()");
|
printf(testingFmt, "wc_ecc_sig_size_calc()");
|
||||||
|
|
||||||
|
@ -29186,7 +29186,8 @@ static void test_wolfSSL_ASN1_TIME_adj(void)
|
||||||
offset_day = 7;
|
offset_day = 7;
|
||||||
offset_sec = 45 * mini;
|
offset_sec = 45 * mini;
|
||||||
/* offset_sec = -45 * min;*/
|
/* offset_sec = -45 * min;*/
|
||||||
asn_time = wolfSSL_ASN1_TIME_adj(s, t, offset_day, offset_sec);
|
AssertNotNull(asn_time =
|
||||||
|
wolfSSL_ASN1_TIME_adj(s, t, offset_day, offset_sec));
|
||||||
AssertTrue(asn_time->type == asn_utc_time);
|
AssertTrue(asn_time->type == asn_utc_time);
|
||||||
XSTRNCPY(date_str, (const char*)&asn_time->data, CTC_DATE_SIZE);
|
XSTRNCPY(date_str, (const char*)&asn_time->data, CTC_DATE_SIZE);
|
||||||
date_str[CTC_DATE_SIZE] = '\0';
|
date_str[CTC_DATE_SIZE] = '\0';
|
||||||
|
@ -34689,6 +34690,7 @@ static void test_IncCtr(void)
|
||||||
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
|
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
|
||||||
const EVP_CIPHER *init = EVP_des_ede3_cbc();
|
const EVP_CIPHER *init = EVP_des_ede3_cbc();
|
||||||
|
|
||||||
|
AssertNotNull(ctx);
|
||||||
wolfSSL_EVP_CIPHER_CTX_init(ctx);
|
wolfSSL_EVP_CIPHER_CTX_init(ctx);
|
||||||
AssertIntEQ(EVP_CipherInit(ctx, init, key, iv, 1), WOLFSSL_SUCCESS);
|
AssertIntEQ(EVP_CipherInit(ctx, init, key, iv, 1), WOLFSSL_SUCCESS);
|
||||||
|
|
||||||
|
@ -35442,7 +35444,7 @@ static void test_wolfSSL_OCSP_resp_count()
|
||||||
WOLFSSL_OCSP_BASICRESP basicResp;
|
WOLFSSL_OCSP_BASICRESP basicResp;
|
||||||
WOLFSSL_OCSP_SINGLERESP singleRespOne;
|
WOLFSSL_OCSP_SINGLERESP singleRespOne;
|
||||||
WOLFSSL_OCSP_SINGLERESP singleRespTwo;
|
WOLFSSL_OCSP_SINGLERESP singleRespTwo;
|
||||||
int count = 1;
|
int count;
|
||||||
|
|
||||||
printf(testingFmt, "wolfSSL_OCSP_resp_count()");
|
printf(testingFmt, "wolfSSL_OCSP_resp_count()");
|
||||||
|
|
||||||
|
|
|
@ -5301,7 +5301,7 @@ exit:
|
||||||
|
|
||||||
void bench_ecc(int doAsync)
|
void bench_ecc(int doAsync)
|
||||||
{
|
{
|
||||||
int ret = 0, i, times, count, pending = 0;
|
int ret = 0, i, times = 0, count = 0, pending = 0;
|
||||||
const int keySize = bench_ecc_size;
|
const int keySize = bench_ecc_size;
|
||||||
ecc_key genKey[BENCH_MAX_PENDING];
|
ecc_key genKey[BENCH_MAX_PENDING];
|
||||||
#ifdef HAVE_ECC_DHE
|
#ifdef HAVE_ECC_DHE
|
||||||
|
@ -5313,7 +5313,7 @@ void bench_ecc(int doAsync)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
word32 x[BENCH_MAX_PENDING];
|
word32 x[BENCH_MAX_PENDING];
|
||||||
double start;
|
double start = 0;
|
||||||
const char**desc = bench_desc_words[lng_index];
|
const char**desc = bench_desc_words[lng_index];
|
||||||
|
|
||||||
#ifdef HAVE_ECC_DHE
|
#ifdef HAVE_ECC_DHE
|
||||||
|
|
|
@ -17556,7 +17556,7 @@ void FreeOcspRequest(OcspRequest* req)
|
||||||
|
|
||||||
int CompareOcspReqResp(OcspRequest* req, OcspResponse* resp)
|
int CompareOcspReqResp(OcspRequest* req, OcspResponse* resp)
|
||||||
{
|
{
|
||||||
int cmp;
|
int cmp = 0; /* start as matching if both req and resp have no values */
|
||||||
OcspEntry *single, *next, *prev = NULL, *top;
|
OcspEntry *single, *next, *prev = NULL, *top;
|
||||||
|
|
||||||
WOLFSSL_ENTER("CompareOcspReqResp");
|
WOLFSSL_ENTER("CompareOcspReqResp");
|
||||||
|
|
|
@ -6288,7 +6288,7 @@ int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash,
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
word32 keySz;
|
word32 keySz = 0;
|
||||||
#if defined(WOLFSSL_ATECC508A) || defined(WOLFSSL_ATECC608A)
|
#if defined(WOLFSSL_ATECC508A) || defined(WOLFSSL_ATECC608A)
|
||||||
byte sigRS[ATECC_KEY_SIZE*2];
|
byte sigRS[ATECC_KEY_SIZE*2];
|
||||||
#elif defined(WOLFSSL_CRYPTOCELL)
|
#elif defined(WOLFSSL_CRYPTOCELL)
|
||||||
|
|
Loading…
Reference in New Issue