Skip to content

Commit adc9146

Browse files
committed
Fix from testing
1 parent 83336e3 commit adc9146

4 files changed

Lines changed: 9 additions & 40 deletions

File tree

src/ssl_bn.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,8 @@ int wolfSSL_BN_cmp(const WOLFSSL_BIGNUM* a, const WOLFSSL_BIGNUM* b)
11381138
ret = 1;
11391139
}
11401140
else {
1141+
PRAGMA_GCC_DIAG_PUSH
1142+
PRAGMA_GCC("GCC diagnostic ignored \"-Werror=duplicated-branches\"")
11411143
/* Compare big numbers with wolfCrypt. */
11421144
ret = mp_cmp((mp_int*)a->internal, (mp_int*)b->internal);
11431145
/* Convert wolfCrypt return value. */
@@ -1151,13 +1153,11 @@ int wolfSSL_BN_cmp(const WOLFSSL_BIGNUM* a, const WOLFSSL_BIGNUM* b)
11511153
ret = -1;
11521154
}
11531155
else {
1154-
PRAGMA_GCC_DIAG_PUSH
1155-
PRAGMA_GCC("GCC diagnostic ignored \"-Werror=duplicated-branches\"")
11561156
/* ignored warning here because the same return value
11571157
was intentional */
11581158
ret = WOLFSSL_FATAL_ERROR; /* also -1 */
1159-
PRAGMA_GCC_DIAG_POP
11601159
}
1160+
PRAGMA_GCC_DIAG_POP
11611161
}
11621162

11631163
return ret;

src/x509.c

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#endif
2828
#else
2929

30+
#pragma GCC diagnostic ignored "-Wformat-truncation"
31+
3032
#ifndef WOLFCRYPT_ONLY
3133

3234
#ifndef NO_CERTS
@@ -1474,12 +1476,6 @@ static WOLFSSL_ASN1_STRING* wolfSSL_X509_EXTENSION_get_data_internal(
14741476

14751477

14761478
#ifndef NO_BIO
1477-
1478-
#ifndef MAX_INDENT
1479-
#define MAX_INDENT 40
1480-
#endif
1481-
1482-
14831479
/* Return 0 on success and 1 on failure. Copies ext data to bio, using indent
14841480
* to pad the output. flag is ignored. */
14851481
int wolfSSL_X509V3_EXT_print(WOLFSSL_BIO *out, WOLFSSL_X509_EXTENSION *ext,
@@ -1494,9 +1490,6 @@ int wolfSSL_X509V3_EXT_print(WOLFSSL_BIO *out, WOLFSSL_X509_EXTENSION *ext,
14941490
int tmpLen = 0;
14951491
WOLFSSL_ENTER("wolfSSL_X509V3_EXT_print");
14961492

1497-
if (indent < 0) indent = 0;
1498-
if (indent > MAX_INDENT) indent = MAX_INDENT;
1499-
15001493
if ((out == NULL) || (ext == NULL)) {
15011494
WOLFSSL_MSG("NULL parameter error");
15021495
return rc;
@@ -6329,9 +6322,6 @@ static int X509PrintKeyUsage(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, int indent)
63296322
"Decipher Only"
63306323
};
63316324

6332-
if (indent < 0) indent = 0;
6333-
if (indent > MAX_INDENT) indent = MAX_INDENT;
6334-
63356325
if (bio == NULL || x509 == NULL) {
63366326
ret = WOLFSSL_FAILURE;
63376327
}
@@ -6503,9 +6493,6 @@ static int X509PrintSerial(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, int indent)
65036493
unsigned char serial[32];
65046494
int sz = sizeof(serial);
65056495

6506-
if (indent < 0) indent = 0;
6507-
if (indent > MAX_INDENT) indent = MAX_INDENT;
6508-
65096496
XMEMSET(serial, 0, sz);
65106497
if (wolfSSL_X509_get_serial_number(x509, serial, &sz) == WOLFSSL_SUCCESS) {
65116498
X509PrintSerial_ex(bio, serial, sz, 1, indent);
@@ -6598,9 +6585,6 @@ static int X509PrintExtensions(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, int indent)
65986585
int count, i;
65996586
char* buf = NULL;
66006587

6601-
if (indent < 0) indent = 0;
6602-
if (indent > MAX_INDENT) indent = MAX_INDENT;
6603-
66046588
count = wolfSSL_X509_get_ext_count(x509);
66056589
if (count <= 0)
66066590
return WOLFSSL_SUCCESS;
@@ -7014,9 +6998,6 @@ static int X509PrintPubKey(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, int indent)
70146998
int len;
70156999
int ret = WOLFSSL_SUCCESS;
70167000

7017-
if (indent < 0) indent = 0;
7018-
if (indent > MAX_INDENT) indent = MAX_INDENT;
7019-
70207001
if (bio == NULL || x509 == NULL)
70217002
return BAD_FUNC_ARG;
70227003

@@ -7104,9 +7085,6 @@ static int X509PrintVersion(WOLFSSL_BIO* bio, int version, int indent)
71047085
char scratch[MAX_WIDTH];
71057086
int scratchLen;
71067087

7107-
if (indent < 0) indent = 0;
7108-
if (indent > MAX_INDENT) indent = MAX_INDENT;
7109-
71107088
scratchLen = XSNPRINTF(scratch, MAX_WIDTH, "%*s%s", indent, "", "Version:");
71117089
if ((scratchLen < 0) || (scratchLen >= MAX_WIDTH)) {
71127090
return WOLFSSL_FAILURE;
@@ -7140,9 +7118,6 @@ static int X509PrintReqAttributes(WOLFSSL_BIO* bio, WOLFSSL_X509* x509,
71407118
int scratchLen;
71417119
int i = 0;
71427120

7143-
if (indent < 0) indent = 0;
7144-
if (indent > MAX_INDENT) indent = MAX_INDENT;
7145-
71467121
if ((scratchLen = XSNPRINTF(scratch, MAX_WIDTH,
71477122
"%*s%s", indent, "", "Attributes: \n"))
71487123
>= MAX_WIDTH)
@@ -8890,9 +8865,6 @@ static int X509RevokedPrintSerial(WOLFSSL_BIO* bio, RevokedCert* rev,
88908865
unsigned char serial[32];
88918866
int sz = sizeof(serial);
88928867

8893-
if (indent < 0) indent = 0;
8894-
if (indent > MAX_INDENT) indent = MAX_INDENT;
8895-
88968868
XMEMSET(serial, 0, sz);
88978869
if (wolfSSL_X509_REVOKED_get_serial_number(rev, serial, &sz)
88988870
== WOLFSSL_SUCCESS) {
@@ -8951,12 +8923,9 @@ static int X509CRLPrintSignature(WOLFSSL_BIO* bio, WOLFSSL_X509_CRL* crl,
89518923
static int X509CRLPrintExtensions(WOLFSSL_BIO* bio, WOLFSSL_X509_CRL* crl,
89528924
int indent)
89538925
{
8954-
char tmp[MAX_WIDTH];
8926+
char tmp[MAX_WIDTH]; /* buffer for XSNPRINTF */
89558927
int ret = 0;
89568928

8957-
if (indent < 0) indent = 0;
8958-
if (indent > MAX_INDENT) indent = MAX_INDENT;
8959-
89608929
if (XSNPRINTF(tmp, MAX_WIDTH, "%*s%s\n", indent, "",
89618930
"CRL extensions:") >= MAX_WIDTH) {
89628931
ret = WOLFSSL_FAILURE;

wolfcrypt/src/evp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8517,8 +8517,8 @@ void wolfSSL_EVP_init(void)
85178517
}
85188518

85198519
/* Return length on ok */
8520-
int wolfSSL_EVP_Cipher(WOLFSSL_EVP_CIPHER_CTX* ctx, byte* dst, byte* src,
8521-
word32 len)
8520+
int wolfSSL_EVP_Cipher(WOLFSSL_EVP_CIPHER_CTX* ctx, byte* dst,
8521+
const byte* src, word32 len)
85228522
{
85238523
int ret = WC_NO_ERR_TRACE(WOLFSSL_FAILURE);
85248524

wolfssl/openssl/evp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ WOLFSSL_API int wolfSSL_EVP_CIPHER_CTX_set_iv(WOLFSSL_EVP_CIPHER_CTX* ctx, byte
892892
WOLFSSL_API int wolfSSL_EVP_CIPHER_CTX_get_iv(WOLFSSL_EVP_CIPHER_CTX* ctx, byte* iv,
893893
int ivLen);
894894
WOLFSSL_API int wolfSSL_EVP_Cipher(WOLFSSL_EVP_CIPHER_CTX* ctx,
895-
unsigned char* dst, unsigned char* src,
895+
unsigned char* dst, const unsigned char* src,
896896
unsigned int len);
897897

898898
WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_get_cipherbynid(int id);

0 commit comments

Comments
 (0)