Skip to content

Commit bbbc1e0

Browse files
committed
Fixes for clang-tidy.
1 parent afb6fe6 commit bbbc1e0

3 files changed

Lines changed: 16 additions & 15 deletions

File tree

src/ocsp.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ static int GetOcspStatus(WOLFSSL_OCSP* ocsp, OcspRequest* request,
284284
* ocsp Context object for OCSP status.
285285
* response OCSP response message data.
286286
* responseSz Length of OCSP response message data.
287-
* reponseBuffer Buffer object to return the response with.
287+
* responseBuffer Buffer object to return the response with.
288288
* status The certificate status object.
289289
* entry The OCSP entry for this certificate.
290290
* ocspRequest Request corresponding to response.
@@ -880,10 +880,8 @@ int wolfSSL_OCSP_basic_verify(WOLFSSL_OCSP_BASICRESP *bs,
880880
return WOLFSSL_FAILURE;
881881
#endif
882882

883-
#ifdef OPENSSL_EXTRA
884883
if (bs->verifyError != OCSP_VERIFY_ERROR_NONE)
885884
goto out;
886-
#endif
887885

888886
if (flags & OCSP_TRUSTOTHER) {
889887
for (idx = 0; idx < wolfSSL_sk_X509_num(certs); idx++) {

src/x509.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,6 +1426,11 @@ int wolfSSL_X509_add_ext(WOLFSSL_X509 *x509, WOLFSSL_X509_EXTENSION *ext, int lo
14261426
break;
14271427
default:
14281428
#ifdef WOLFSSL_CUSTOM_OID
1429+
{
1430+
char *oid = NULL;
1431+
byte *val = NULL;
1432+
int err = 0;
1433+
14291434
if ((ext->obj == NULL) || (ext->value.length == 0)) {
14301435
WOLFSSL_MSG("Extension has insufficient information.");
14311436
return WOLFSSL_FAILURE;
@@ -1438,12 +1443,10 @@ int wolfSSL_X509_add_ext(WOLFSSL_X509 *x509, WOLFSSL_X509_EXTENSION *ext, int lo
14381443
}
14391444

14401445
/* This is a viable custom extension. */
1441-
char *oid = XMALLOC(MAX_OID_STRING_SZ, x509->heap,
1442-
DYNAMIC_TYPE_X509_EXT);
1443-
byte *val = XMALLOC(ext->value.length, x509->heap,
1444-
DYNAMIC_TYPE_X509_EXT);
1445-
int err = 0;
1446-
1446+
oid = (char*)XMALLOC(MAX_OID_STRING_SZ, x509->heap,
1447+
DYNAMIC_TYPE_X509_EXT);
1448+
val = (byte*)XMALLOC(ext->value.length, x509->heap,
1449+
DYNAMIC_TYPE_X509_EXT);
14471450
if ((oid == NULL) || (val == NULL)) {
14481451
WOLFSSL_MSG("Memory allocation failure.\n");
14491452
err = 1;
@@ -1468,12 +1471,13 @@ int wolfSSL_X509_add_ext(WOLFSSL_X509 *x509, WOLFSSL_X509_EXTENSION *ext, int lo
14681471
x509->custom_exts[x509->customExtCount].val = val;
14691472
x509->custom_exts[x509->customExtCount].valSz = ext->value.length;
14701473
x509->customExtCount++;
1474+
break;
1475+
}
14711476
#else
14721477
WOLFSSL_MSG("Unsupported extension to add");
14731478
return WOLFSSL_FAILURE;
14741479
#endif /* WOLFSSL_CUSTOM_OID */
1475-
break;
1476-
}
1480+
} /* switch (nid) */
14771481

14781482
return WOLFSSL_SUCCESS;
14791483
}

wolfcrypt/src/ecc.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15437,9 +15437,8 @@ int wc_ecc_get_oid(word32 oidSum, const byte** oid, word32* oidSz)
1543715437
/* find matching OID sum (based on encoded value) */
1543815438
for (x = 0; ecc_sets[x].size != 0; x++) {
1543915439
if (ecc_sets[x].oidSum == oidSum) {
15440-
int ret;
1544115440
#ifdef HAVE_OID_ENCODING
15442-
ret = 0;
15441+
int ret = 0;
1544315442
/* check cache */
1544415443
oid_cache_t* o = &ecc_oid_cache[x];
1544515444
if (o->oidSz == 0) {
@@ -15457,16 +15456,16 @@ int wc_ecc_get_oid(word32 oidSum, const byte** oid, word32* oidSz)
1545715456
if (ret == 0) {
1545815457
ret = ecc_sets[x].id;
1545915458
}
15459+
return ret;
1546015460
#else
1546115461
if (oidSz) {
1546215462
*oidSz = ecc_sets[x].oidSz;
1546315463
}
1546415464
if (oid) {
1546515465
*oid = ecc_sets[x].oid;
1546615466
}
15467-
ret = ecc_sets[x].id;
15467+
return ecc_sets[x].id;
1546815468
#endif
15469-
return ret;
1547015469
}
1547115470
}
1547215471

0 commit comments

Comments
 (0)