mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
src/{pk.c,x509.c}: style/clarity cleanups from dgarske.
This commit is contained in:
13
src/pk.c
13
src/pk.c
@ -155,7 +155,8 @@ static int wolfssl_print_indent(WOLFSSL_BIO* bio, char* line, int lineLen,
|
|||||||
if (len_wanted >= lineLen) {
|
if (len_wanted >= lineLen) {
|
||||||
WOLFSSL_MSG("Buffer overflow formatting indentation");
|
WOLFSSL_MSG("Buffer overflow formatting indentation");
|
||||||
ret = 0;
|
ret = 0;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Write indents string to BIO */
|
/* Write indents string to BIO */
|
||||||
if (wolfSSL_BIO_write(bio, line, len_wanted) <= 0) {
|
if (wolfSSL_BIO_write(bio, line, len_wanted) <= 0) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -261,7 +262,8 @@ static int wolfssl_print_number(WOLFSSL_BIO* bio, mp_int* num, const char* name,
|
|||||||
if (li >= (int)sizeof(line)) {
|
if (li >= (int)sizeof(line)) {
|
||||||
WOLFSSL_MSG("Buffer overflow formatting name");
|
WOLFSSL_MSG("Buffer overflow formatting name");
|
||||||
ret = 0;
|
ret = 0;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (wolfSSL_BIO_write(bio, line, li) <= 0) {
|
if (wolfSSL_BIO_write(bio, line, li) <= 0) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
@ -306,8 +308,10 @@ static int wolfssl_print_number(WOLFSSL_BIO* bio, mp_int* num, const char* name,
|
|||||||
/* Put the leading spaces on new line. */
|
/* Put the leading spaces on new line. */
|
||||||
XSTRNCPY(line, PRINT_NUM_INDENT, PRINT_NUM_INDENT_CNT + 1);
|
XSTRNCPY(line, PRINT_NUM_INDENT, PRINT_NUM_INDENT_CNT + 1);
|
||||||
li = PRINT_NUM_INDENT_CNT;
|
li = PRINT_NUM_INDENT_CNT;
|
||||||
} else
|
}
|
||||||
|
else {
|
||||||
li += len_wanted;
|
li += len_wanted;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == 1) {
|
if (ret == 1) {
|
||||||
@ -1922,7 +1926,8 @@ int wolfSSL_RSA_print(WOLFSSL_BIO* bio, WOLFSSL_RSA* rsa, int indent)
|
|||||||
if (len >= (int)sizeof(line)) {
|
if (len >= (int)sizeof(line)) {
|
||||||
WOLFSSL_MSG("Buffer overflow while formatting key preamble");
|
WOLFSSL_MSG("Buffer overflow while formatting key preamble");
|
||||||
ret = 0;
|
ret = 0;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (wolfSSL_BIO_write(bio, line, len) <= 0) {
|
if (wolfSSL_BIO_write(bio, line, len) <= 0) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
@ -6244,10 +6244,12 @@ int wolfSSL_X509_signature_print(WOLFSSL_BIO *bp,
|
|||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((sigalg->algorithm->obj == NULL) || (sigalg->algorithm->obj[idx++] != ASN_OBJECT_ID)) {
|
if ((sigalg->algorithm->obj == NULL) ||
|
||||||
|
(sigalg->algorithm->obj[idx] != ASN_OBJECT_ID)) {
|
||||||
WOLFSSL_MSG("Bad ASN1 Object");
|
WOLFSSL_MSG("Bad ASN1 Object");
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
}
|
}
|
||||||
|
idx++; /* skip object id */
|
||||||
|
|
||||||
if (GetLength((const byte*)sigalg->algorithm->obj, &idx, &length,
|
if (GetLength((const byte*)sigalg->algorithm->obj, &idx, &length,
|
||||||
sigalg->algorithm->objSz) < 0 || length < 0) {
|
sigalg->algorithm->objSz) < 0 || length < 0) {
|
||||||
@ -6262,7 +6264,7 @@ int wolfSSL_X509_signature_print(WOLFSSL_BIO *bp,
|
|||||||
for (i = 0; i < length; ++i) {
|
for (i = 0; i < length; ++i) {
|
||||||
char hex_digits[4];
|
char hex_digits[4];
|
||||||
#ifdef XSNPRINTF
|
#ifdef XSNPRINTF
|
||||||
XSNPRINTF(hex_digits, sizeof hex_digits, "%c%02X", i>0 ? ':' : ' ',
|
XSNPRINTF(hex_digits, sizeof(hex_digits), "%c%02X", i>0 ? ':' : ' ',
|
||||||
(unsigned int)sigalg->algorithm->obj[idx+i]);
|
(unsigned int)sigalg->algorithm->obj[idx+i]);
|
||||||
#else
|
#else
|
||||||
XSPRINTF(hex_digits, "%c%02X", i>0 ? ':' : ' ',
|
XSPRINTF(hex_digits, "%c%02X", i>0 ? ':' : ' ',
|
||||||
|
Reference in New Issue
Block a user