Skip to content

Commit

Permalink
Fixes for clang-tidy.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarske committed Jul 29, 2024
1 parent fde4308 commit 85f6b6a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
4 changes: 1 addition & 3 deletions src/ocsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ static int GetOcspStatus(WOLFSSL_OCSP* ocsp, OcspRequest* request,
* ocsp Context object for OCSP status.
* response 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.
* entry The OCSP entry for this certificate.
* ocspRequest Request corresponding to response.
Expand Down Expand Up @@ -880,10 +880,8 @@ int wolfSSL_OCSP_basic_verify(WOLFSSL_OCSP_BASICRESP *bs,
return WOLFSSL_FAILURE;
#endif

#ifdef OPENSSL_EXTRA
if (bs->verifyError != OCSP_VERIFY_ERROR_NONE)
goto out;
#endif

if (flags & OCSP_TRUSTOTHER) {
for (idx = 0; idx < wolfSSL_sk_X509_num(certs); idx++) {
Expand Down
20 changes: 12 additions & 8 deletions src/x509.c
Original file line number Diff line number Diff line change
Expand Up @@ -1426,6 +1426,11 @@ int wolfSSL_X509_add_ext(WOLFSSL_X509 *x509, WOLFSSL_X509_EXTENSION *ext, int lo
break;
default:
#ifdef WOLFSSL_CUSTOM_OID
{
char *oid = NULL;
byte *val = NULL;
int err = 0;

if ((ext->obj == NULL) || (ext->value.length == 0)) {
WOLFSSL_MSG("Extension has insufficient information.");
return WOLFSSL_FAILURE;
Expand All @@ -1438,12 +1443,10 @@ int wolfSSL_X509_add_ext(WOLFSSL_X509 *x509, WOLFSSL_X509_EXTENSION *ext, int lo
}

/* This is a viable custom extension. */
char *oid = XMALLOC(MAX_OID_STRING_SZ, x509->heap,
DYNAMIC_TYPE_X509_EXT);
byte *val = XMALLOC(ext->value.length, x509->heap,
DYNAMIC_TYPE_X509_EXT);
int err = 0;

oid = (char*)XMALLOC(MAX_OID_STRING_SZ, x509->heap,
DYNAMIC_TYPE_X509_EXT);
val = (byte*)XMALLOC(ext->value.length, x509->heap,
DYNAMIC_TYPE_X509_EXT);
if ((oid == NULL) || (val == NULL)) {
WOLFSSL_MSG("Memory allocation failure.\n");
err = 1;
Expand All @@ -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].valSz = ext->value.length;
x509->customExtCount++;
break;
}
#else
WOLFSSL_MSG("Unsupported extension to add");
return WOLFSSL_FAILURE;
#endif /* WOLFSSL_CUSTOM_OID */
break;
}
} /* switch (nid) */

return WOLFSSL_SUCCESS;
}
Expand Down
7 changes: 3 additions & 4 deletions wolfcrypt/src/ecc.c
Original file line number Diff line number Diff line change
Expand Up @@ -15437,9 +15437,8 @@ int wc_ecc_get_oid(word32 oidSum, const byte** oid, word32* oidSz)
/* find matching OID sum (based on encoded value) */
for (x = 0; ecc_sets[x].size != 0; x++) {
if (ecc_sets[x].oidSum == oidSum) {
int ret;
#ifdef HAVE_OID_ENCODING
ret = 0;
int ret = 0;
/* check cache */
oid_cache_t* o = &ecc_oid_cache[x];
if (o->oidSz == 0) {
Expand All @@ -15457,16 +15456,16 @@ int wc_ecc_get_oid(word32 oidSum, const byte** oid, word32* oidSz)
if (ret == 0) {
ret = ecc_sets[x].id;
}
return ret;
#else
if (oidSz) {
*oidSz = ecc_sets[x].oidSz;
}
if (oid) {
*oid = ecc_sets[x].oid;
}
ret = ecc_sets[x].id;
return ecc_sets[x].id;
#endif
return ret;
}
}

Expand Down

0 comments on commit 85f6b6a

Please sign in to comment.