Fixes for clang-tidy.

This commit is contained in:
David Garske
2024-07-26 16:25:50 -07:00
parent afb6fe6c5f
commit bbbc1e074c
3 changed files with 16 additions and 15 deletions

View File

@ -284,7 +284,7 @@ static int GetOcspStatus(WOLFSSL_OCSP* ocsp, OcspRequest* request,
* ocsp Context object for OCSP status. * ocsp Context object for OCSP status.
* response OCSP response message data. * response OCSP response message data.
* responseSz Length of OCSP response message data. * responseSz Length of OCSP response message data.
* reponseBuffer Buffer object to return the response with. * responseBuffer Buffer object to return the response with.
* status The certificate status object. * status The certificate status object.
* entry The OCSP entry for this certificate. * entry The OCSP entry for this certificate.
* ocspRequest Request corresponding to response. * ocspRequest Request corresponding to response.
@ -880,10 +880,8 @@ int wolfSSL_OCSP_basic_verify(WOLFSSL_OCSP_BASICRESP *bs,
return WOLFSSL_FAILURE; return WOLFSSL_FAILURE;
#endif #endif
#ifdef OPENSSL_EXTRA
if (bs->verifyError != OCSP_VERIFY_ERROR_NONE) if (bs->verifyError != OCSP_VERIFY_ERROR_NONE)
goto out; goto out;
#endif
if (flags & OCSP_TRUSTOTHER) { if (flags & OCSP_TRUSTOTHER) {
for (idx = 0; idx < wolfSSL_sk_X509_num(certs); idx++) { for (idx = 0; idx < wolfSSL_sk_X509_num(certs); idx++) {

View File

@ -1426,6 +1426,11 @@ int wolfSSL_X509_add_ext(WOLFSSL_X509 *x509, WOLFSSL_X509_EXTENSION *ext, int lo
break; break;
default: default:
#ifdef WOLFSSL_CUSTOM_OID #ifdef WOLFSSL_CUSTOM_OID
{
char *oid = NULL;
byte *val = NULL;
int err = 0;
if ((ext->obj == NULL) || (ext->value.length == 0)) { if ((ext->obj == NULL) || (ext->value.length == 0)) {
WOLFSSL_MSG("Extension has insufficient information."); WOLFSSL_MSG("Extension has insufficient information.");
return WOLFSSL_FAILURE; return WOLFSSL_FAILURE;
@ -1438,12 +1443,10 @@ int wolfSSL_X509_add_ext(WOLFSSL_X509 *x509, WOLFSSL_X509_EXTENSION *ext, int lo
} }
/* This is a viable custom extension. */ /* This is a viable custom extension. */
char *oid = XMALLOC(MAX_OID_STRING_SZ, x509->heap, oid = (char*)XMALLOC(MAX_OID_STRING_SZ, x509->heap,
DYNAMIC_TYPE_X509_EXT); DYNAMIC_TYPE_X509_EXT);
byte *val = XMALLOC(ext->value.length, x509->heap, val = (byte*)XMALLOC(ext->value.length, x509->heap,
DYNAMIC_TYPE_X509_EXT); DYNAMIC_TYPE_X509_EXT);
int err = 0;
if ((oid == NULL) || (val == NULL)) { if ((oid == NULL) || (val == NULL)) {
WOLFSSL_MSG("Memory allocation failure.\n"); WOLFSSL_MSG("Memory allocation failure.\n");
err = 1; err = 1;
@ -1468,12 +1471,13 @@ int wolfSSL_X509_add_ext(WOLFSSL_X509 *x509, WOLFSSL_X509_EXTENSION *ext, int lo
x509->custom_exts[x509->customExtCount].val = val; x509->custom_exts[x509->customExtCount].val = val;
x509->custom_exts[x509->customExtCount].valSz = ext->value.length; x509->custom_exts[x509->customExtCount].valSz = ext->value.length;
x509->customExtCount++; x509->customExtCount++;
break;
}
#else #else
WOLFSSL_MSG("Unsupported extension to add"); WOLFSSL_MSG("Unsupported extension to add");
return WOLFSSL_FAILURE; return WOLFSSL_FAILURE;
#endif /* WOLFSSL_CUSTOM_OID */ #endif /* WOLFSSL_CUSTOM_OID */
break; } /* switch (nid) */
}
return WOLFSSL_SUCCESS; return WOLFSSL_SUCCESS;
} }

View File

@ -15437,9 +15437,8 @@ int wc_ecc_get_oid(word32 oidSum, const byte** oid, word32* oidSz)
/* find matching OID sum (based on encoded value) */ /* find matching OID sum (based on encoded value) */
for (x = 0; ecc_sets[x].size != 0; x++) { for (x = 0; ecc_sets[x].size != 0; x++) {
if (ecc_sets[x].oidSum == oidSum) { if (ecc_sets[x].oidSum == oidSum) {
int ret;
#ifdef HAVE_OID_ENCODING #ifdef HAVE_OID_ENCODING
ret = 0; int ret = 0;
/* check cache */ /* check cache */
oid_cache_t* o = &ecc_oid_cache[x]; oid_cache_t* o = &ecc_oid_cache[x];
if (o->oidSz == 0) { if (o->oidSz == 0) {
@ -15457,6 +15456,7 @@ int wc_ecc_get_oid(word32 oidSum, const byte** oid, word32* oidSz)
if (ret == 0) { if (ret == 0) {
ret = ecc_sets[x].id; ret = ecc_sets[x].id;
} }
return ret;
#else #else
if (oidSz) { if (oidSz) {
*oidSz = ecc_sets[x].oidSz; *oidSz = ecc_sets[x].oidSz;
@ -15464,9 +15464,8 @@ int wc_ecc_get_oid(word32 oidSum, const byte** oid, word32* oidSz)
if (oid) { if (oid) {
*oid = ecc_sets[x].oid; *oid = ecc_sets[x].oid;
} }
ret = ecc_sets[x].id; return ecc_sets[x].id;
#endif #endif
return ret;
} }
} }