mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
fix qsscertificate test failure
This commit is contained in:
83
src/x509.c
83
src/x509.c
@ -5526,7 +5526,12 @@ static int X509PrintSerial_ex(WOLFSSL_BIO* bio, byte* serial, int sz,
|
|||||||
|
|
||||||
/* serial is larger than int size so print off hex values */
|
/* serial is larger than int size so print off hex values */
|
||||||
if ((scratchLen = XSNPRINTF(
|
if ((scratchLen = XSNPRINTF(
|
||||||
scratch, MAX_WIDTH, "%*s", indent, ""))
|
scratch, MAX_WIDTH,
|
||||||
|
#if defined(WOLFSSL_QT)
|
||||||
|
"\n%*s", indent + 4, ""))
|
||||||
|
#else
|
||||||
|
"%*s", indent, ""))
|
||||||
|
#endif
|
||||||
>= MAX_WIDTH) {
|
>= MAX_WIDTH) {
|
||||||
WOLFSSL_MSG("buffer overrun");
|
WOLFSSL_MSG("buffer overrun");
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
@ -5645,7 +5650,7 @@ static int X509PrintExtensions(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, int indent)
|
|||||||
buf,
|
buf,
|
||||||
(wolfSSL_X509_EXTENSION_get_critical(ext)
|
(wolfSSL_X509_EXTENSION_get_critical(ext)
|
||||||
? ": Critical"
|
? ": Critical"
|
||||||
: ":")))
|
: ": ")))
|
||||||
>= MAX_WIDTH)
|
>= MAX_WIDTH)
|
||||||
{
|
{
|
||||||
ret = WOLFSSL_FAILURE;
|
ret = WOLFSSL_FAILURE;
|
||||||
@ -5725,7 +5730,7 @@ static int X509PrintExtensions(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, int indent)
|
|||||||
if ((valLen = XSNPRINTF(
|
if ((valLen = XSNPRINTF(
|
||||||
val, sizeof(val), "%02X%s",
|
val, sizeof(val), "%02X%s",
|
||||||
x509->authKeyId[j],
|
x509->authKeyId[j],
|
||||||
(j < x509->authKeyIdSz - 1) ? ":" : "\n"))
|
(j < x509->authKeyIdSz - 1) ? ":" : "\n\n"))
|
||||||
>= (int)sizeof(val))
|
>= (int)sizeof(val))
|
||||||
{
|
{
|
||||||
ret = WOLFSSL_FAILURE;
|
ret = WOLFSSL_FAILURE;
|
||||||
@ -5822,6 +5827,7 @@ static int X509PrintSignature_ex(WOLFSSL_BIO* bio, byte* sig,
|
|||||||
int i;
|
int i;
|
||||||
char tmp[100];
|
char tmp[100];
|
||||||
int tmpLen = 0;
|
int tmpLen = 0;
|
||||||
|
int offset = 4; /* additional indent offset */
|
||||||
|
|
||||||
if (sigSz <= 0) {
|
if (sigSz <= 0) {
|
||||||
return WOLFSSL_SUCCESS;
|
return WOLFSSL_SUCCESS;
|
||||||
@ -5871,8 +5877,11 @@ static int X509PrintSignature_ex(WOLFSSL_BIO* bio, byte* sig,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(WOLFSSL_QT)
|
||||||
|
offset = 5;
|
||||||
|
#endif
|
||||||
if (ret == WOLFSSL_SUCCESS) {
|
if (ret == WOLFSSL_SUCCESS) {
|
||||||
if ((tmpLen = XSNPRINTF(tmp, sizeof(tmp), "%*s", indent + 5, ""))
|
if ((tmpLen = XSNPRINTF(tmp, sizeof(tmp), "%*s", indent + offset, ""))
|
||||||
>= (int)sizeof(tmp))
|
>= (int)sizeof(tmp))
|
||||||
{
|
{
|
||||||
ret = WOLFSSL_FAILURE;
|
ret = WOLFSSL_FAILURE;
|
||||||
@ -5899,7 +5908,7 @@ static int X509PrintSignature_ex(WOLFSSL_BIO* bio, byte* sig,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((tmpLen = XSNPRINTF(tmp, sizeof(tmp), ":\n%*s",
|
if ((tmpLen = XSNPRINTF(tmp, sizeof(tmp), ":\n%*s",
|
||||||
indent + 5, ""))
|
indent + offset, ""))
|
||||||
>= (int)sizeof(tmp))
|
>= (int)sizeof(tmp))
|
||||||
{
|
{
|
||||||
ret = WOLFSSL_FAILURE;
|
ret = WOLFSSL_FAILURE;
|
||||||
@ -6001,17 +6010,46 @@ static int X509PrintPubKey(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, int indent)
|
|||||||
int len;
|
int len;
|
||||||
int ret = WOLFSSL_SUCCESS;
|
int ret = WOLFSSL_SUCCESS;
|
||||||
|
|
||||||
len = XSNPRINTF(scratch, MAX_WIDTH, "%*sPublic Key:\n", indent, "");
|
if (bio == NULL || x509 == NULL)
|
||||||
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
|
len = XSNPRINTF(scratch, MAX_WIDTH, "%*sSubject Public Key Info:\n", indent, "");
|
||||||
if (len >= MAX_WIDTH)
|
if (len >= MAX_WIDTH)
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
if (wolfSSL_BIO_write(bio, scratch, len) <= 0)
|
if (wolfSSL_BIO_write(bio, scratch, len) <= 0)
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
|
|
||||||
|
switch (x509->pubKeyOID) {
|
||||||
|
#ifndef NO_RSA
|
||||||
|
case RSAk:
|
||||||
|
len = XSNPRINTF(scratch, MAX_WIDTH,
|
||||||
|
"%*sPublic Key Algorithm: rsaEncryption\n", indent + 4, "");
|
||||||
|
if (len >= MAX_WIDTH)
|
||||||
|
return WOLFSSL_FAILURE;
|
||||||
|
if (wolfSSL_BIO_write(bio, scratch, len) <= 0)
|
||||||
|
return WOLFSSL_FAILURE;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_ECC
|
||||||
|
case ECDSAk:
|
||||||
|
len = XSNPRINTF(scratch, MAX_WIDTH,
|
||||||
|
"%*sPublic Key Algorithm: EC\n", indent + 4, "");
|
||||||
|
if (len >= MAX_WIDTH)
|
||||||
|
return WOLFSSL_FAILURE;
|
||||||
|
if (wolfSSL_BIO_write(bio, scratch, len) <= 0)
|
||||||
|
return WOLFSSL_FAILURE;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
WOLFSSL_MSG("Unknown key type");
|
||||||
|
return WOLFSSL_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
pubKey = wolfSSL_X509_get_pubkey(x509);
|
pubKey = wolfSSL_X509_get_pubkey(x509);
|
||||||
if (pubKey == NULL)
|
if (pubKey == NULL)
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
|
|
||||||
ret = wolfSSL_EVP_PKEY_print_public(bio, pubKey, indent + 4, NULL);
|
ret = wolfSSL_EVP_PKEY_print_public(bio, pubKey, indent + 8, NULL);
|
||||||
|
|
||||||
wolfSSL_EVP_PKEY_free(pubKey);
|
wolfSSL_EVP_PKEY_free(pubKey);
|
||||||
|
|
||||||
@ -6215,8 +6253,8 @@ int wolfSSL_X509_REQ_print(WOLFSSL_BIO* bio, WOLFSSL_X509* x509)
|
|||||||
int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509,
|
int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509,
|
||||||
unsigned long nmflags, unsigned long cflag)
|
unsigned long nmflags, unsigned long cflag)
|
||||||
{
|
{
|
||||||
char issuType[] = "Issuer: ";
|
char issuType[] = "Issuer:";
|
||||||
char subjType[] = "Subject: ";
|
char subjType[] = "Subject:";
|
||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_X509_print_ex");
|
WOLFSSL_ENTER("wolfSSL_X509_print_ex");
|
||||||
|
|
||||||
@ -6337,7 +6375,7 @@ int wolfSSL_X509_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509* x509,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* print out signature */
|
/* print out signature */
|
||||||
if (X509PrintSignature(bio, x509, 0, 8) != WOLFSSL_SUCCESS) {
|
if (X509PrintSignature(bio, x509, 0, 4) != WOLFSSL_SUCCESS) {
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12077,20 +12115,35 @@ int wolfSSL_X509_NAME_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509_NAME* name,
|
|||||||
if (len == 0 || buf == NULL)
|
if (len == 0 || buf == NULL)
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
|
|
||||||
tmpSz = nameStrSz + len + 3; /* + 3 for '=', comma, and '\0' */
|
tmpSz = nameStrSz + len +
|
||||||
|
#if defined(WOLFSSL_QT)
|
||||||
|
4; /* + 4 for '=', comma space and '\0'*/
|
||||||
|
#else
|
||||||
|
3; /* + 3 for '=', comma, and '\0' */
|
||||||
|
#endif
|
||||||
tmp = (char*)XMALLOC(tmpSz, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
tmp = (char*)XMALLOC(tmpSz, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < count - 1) {
|
if (i < count - 1) {
|
||||||
|
#if defined(WOLFSSL_QT)
|
||||||
|
if (XSNPRINTF(tmp, tmpSz, "%s=%s, ", buf, nameStr)
|
||||||
|
#else
|
||||||
if (XSNPRINTF(tmp, tmpSz, "%s=%s,", buf, nameStr)
|
if (XSNPRINTF(tmp, tmpSz, "%s=%s,", buf, nameStr)
|
||||||
|
#endif
|
||||||
>= tmpSz)
|
>= tmpSz)
|
||||||
{
|
{
|
||||||
WOLFSSL_MSG("buffer overrun");
|
WOLFSSL_MSG("buffer overrun");
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
}
|
}
|
||||||
tmpSz = len + nameStrSz + 2; /* 2 for '=', comma */
|
|
||||||
|
tmpSz = len + nameStrSz +
|
||||||
|
#if defined(WOLFSSL_QT)
|
||||||
|
3; /* 3 for '=', comma space */
|
||||||
|
#else
|
||||||
|
2; /* 2 for '=', comma */
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (XSNPRINTF(tmp, tmpSz, "%s=%s", buf, nameStr)
|
if (XSNPRINTF(tmp, tmpSz, "%s=%s", buf, nameStr)
|
||||||
@ -12100,7 +12153,11 @@ int wolfSSL_X509_NAME_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509_NAME* name,
|
|||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
}
|
}
|
||||||
tmpSz = len + nameStrSz + 1; /* 1 for '=' */
|
tmpSz = len + nameStrSz + 1; /* 1 for '=' */
|
||||||
if (bio->type != WOLFSSL_BIO_FILE)
|
if (bio->type != WOLFSSL_BIO_FILE
|
||||||
|
#if defined(WOLFSSL_QT)
|
||||||
|
&& bio->type != WOLFSSL_BIO_MEMORY
|
||||||
|
#endif
|
||||||
|
)
|
||||||
++tmpSz; /* include the terminating null when not writing to a
|
++tmpSz; /* include the terminating null when not writing to a
|
||||||
* file.
|
* file.
|
||||||
*/
|
*/
|
||||||
|
49
tests/api.c
49
tests/api.c
@ -30760,6 +30760,15 @@ static int test_wolfSSL_X509_NAME_print_ex(void)
|
|||||||
X509* x509 = NULL;
|
X509* x509 = NULL;
|
||||||
X509_NAME* name = NULL;
|
X509_NAME* name = NULL;
|
||||||
|
|
||||||
|
#if defined(WOLFSSL_QT)
|
||||||
|
const char* expNormal = "C=US, CN=wolfssl.com";
|
||||||
|
const char* expReverse = "CN=wolfssl.com, C=US";
|
||||||
|
|
||||||
|
const char* expNotEscaped = "C= US,+\"\\ , CN=#wolfssl.com<>;";
|
||||||
|
const char* expNotEscapedRev = "CN=#wolfssl.com<>;, C= US,+\"\\ ";
|
||||||
|
const char* expRFC5523 =
|
||||||
|
"CN=\\#wolfssl.com\\<\\>\\;, C=\\ US\\,\\+\\\"\\\\\\ ";
|
||||||
|
#else
|
||||||
const char* expNormal = "C=US,CN=wolfssl.com";
|
const char* expNormal = "C=US,CN=wolfssl.com";
|
||||||
const char* expReverse = "CN=wolfssl.com,C=US";
|
const char* expReverse = "CN=wolfssl.com,C=US";
|
||||||
|
|
||||||
@ -30767,7 +30776,7 @@ static int test_wolfSSL_X509_NAME_print_ex(void)
|
|||||||
const char* expNotEscapedRev = "CN=#wolfssl.com<>;,C= US,+\"\\ ";
|
const char* expNotEscapedRev = "CN=#wolfssl.com<>;,C= US,+\"\\ ";
|
||||||
const char* expRFC5523 =
|
const char* expRFC5523 =
|
||||||
"CN=\\#wolfssl.com\\<\\>\\;,C=\\ US\\,\\+\\\"\\\\\\ ";
|
"CN=\\#wolfssl.com\\<\\>\\;,C=\\ US\\,\\+\\\"\\\\\\ ";
|
||||||
|
#endif
|
||||||
printf(testingFmt, "wolfSSL_X509_NAME_print_ex");
|
printf(testingFmt, "wolfSSL_X509_NAME_print_ex");
|
||||||
|
|
||||||
/* Test with real cert (svrCertFile) first */
|
/* Test with real cert (svrCertFile) first */
|
||||||
@ -30811,7 +30820,11 @@ static int test_wolfSSL_X509_NAME_print_ex(void)
|
|||||||
AssertNotNull(membio = BIO_new(BIO_s_mem()));
|
AssertNotNull(membio = BIO_new(BIO_s_mem()));
|
||||||
AssertIntEQ(X509_NAME_print_ex(membio, name, 0, 0), WOLFSSL_SUCCESS);
|
AssertIntEQ(X509_NAME_print_ex(membio, name, 0, 0), WOLFSSL_SUCCESS);
|
||||||
AssertIntGE((memSz = BIO_get_mem_data(membio, &mem)), 0);
|
AssertIntGE((memSz = BIO_get_mem_data(membio, &mem)), 0);
|
||||||
|
#if defined(WOLFSSL_QT)
|
||||||
|
AssertIntEQ(memSz, XSTRLEN(expNormal));
|
||||||
|
#else
|
||||||
AssertIntEQ(memSz, XSTRLEN(expNormal)+1);
|
AssertIntEQ(memSz, XSTRLEN(expNormal)+1);
|
||||||
|
#endif
|
||||||
AssertIntEQ(XSTRNCMP((char*)mem, expNormal, XSTRLEN(expNormal)), 0);
|
AssertIntEQ(XSTRNCMP((char*)mem, expNormal, XSTRLEN(expNormal)), 0);
|
||||||
BIO_free(membio);
|
BIO_free(membio);
|
||||||
|
|
||||||
@ -30820,7 +30833,11 @@ static int test_wolfSSL_X509_NAME_print_ex(void)
|
|||||||
AssertIntEQ(X509_NAME_print_ex(membio, name, 0,
|
AssertIntEQ(X509_NAME_print_ex(membio, name, 0,
|
||||||
XN_FLAG_RFC2253), WOLFSSL_SUCCESS);
|
XN_FLAG_RFC2253), WOLFSSL_SUCCESS);
|
||||||
AssertIntGE((memSz = BIO_get_mem_data(membio, &mem)), 0);
|
AssertIntGE((memSz = BIO_get_mem_data(membio, &mem)), 0);
|
||||||
|
#if defined(WOLFSSL_QT)
|
||||||
|
AssertIntEQ(memSz, XSTRLEN(expReverse));
|
||||||
|
#else
|
||||||
AssertIntEQ(memSz, XSTRLEN(expReverse)+1);
|
AssertIntEQ(memSz, XSTRLEN(expReverse)+1);
|
||||||
|
#endif
|
||||||
BIO_free(membio);
|
BIO_free(membio);
|
||||||
|
|
||||||
/* Test flags: XN_FLAG_DN_REV - reversed */
|
/* Test flags: XN_FLAG_DN_REV - reversed */
|
||||||
@ -30828,7 +30845,11 @@ static int test_wolfSSL_X509_NAME_print_ex(void)
|
|||||||
AssertIntEQ(X509_NAME_print_ex(membio, name, 0,
|
AssertIntEQ(X509_NAME_print_ex(membio, name, 0,
|
||||||
XN_FLAG_DN_REV), WOLFSSL_SUCCESS);
|
XN_FLAG_DN_REV), WOLFSSL_SUCCESS);
|
||||||
AssertIntGE((memSz = BIO_get_mem_data(membio, &mem)), 0);
|
AssertIntGE((memSz = BIO_get_mem_data(membio, &mem)), 0);
|
||||||
|
#if defined(WOLFSSL_QT)
|
||||||
|
AssertIntEQ(memSz, XSTRLEN(expReverse));
|
||||||
|
#else
|
||||||
AssertIntEQ(memSz, XSTRLEN(expReverse)+1);
|
AssertIntEQ(memSz, XSTRLEN(expReverse)+1);
|
||||||
|
#endif
|
||||||
AssertIntEQ(XSTRNCMP((char*)mem, expReverse, XSTRLEN(expReverse)), 0);
|
AssertIntEQ(XSTRNCMP((char*)mem, expReverse, XSTRLEN(expReverse)), 0);
|
||||||
BIO_free(membio);
|
BIO_free(membio);
|
||||||
|
|
||||||
@ -30851,7 +30872,11 @@ static int test_wolfSSL_X509_NAME_print_ex(void)
|
|||||||
AssertNotNull(membio = BIO_new(BIO_s_mem()));
|
AssertNotNull(membio = BIO_new(BIO_s_mem()));
|
||||||
AssertIntEQ(X509_NAME_print_ex(membio, name, 0, 0), WOLFSSL_SUCCESS);
|
AssertIntEQ(X509_NAME_print_ex(membio, name, 0, 0), WOLFSSL_SUCCESS);
|
||||||
AssertIntGE((memSz = BIO_get_mem_data(membio, &mem)), 0);
|
AssertIntGE((memSz = BIO_get_mem_data(membio, &mem)), 0);
|
||||||
|
#if defined(WOLFSSL_QT)
|
||||||
|
AssertIntEQ(memSz, XSTRLEN(expNotEscaped));
|
||||||
|
#else
|
||||||
AssertIntEQ(memSz, XSTRLEN(expNotEscaped)+1);
|
AssertIntEQ(memSz, XSTRLEN(expNotEscaped)+1);
|
||||||
|
#endif
|
||||||
AssertIntEQ(XSTRNCMP((char*)mem, expNotEscaped,
|
AssertIntEQ(XSTRNCMP((char*)mem, expNotEscaped,
|
||||||
XSTRLEN(expNotEscaped)), 0);
|
XSTRLEN(expNotEscaped)), 0);
|
||||||
BIO_free(membio);
|
BIO_free(membio);
|
||||||
@ -30861,7 +30886,11 @@ static int test_wolfSSL_X509_NAME_print_ex(void)
|
|||||||
AssertIntEQ(X509_NAME_print_ex(membio, name, 0,
|
AssertIntEQ(X509_NAME_print_ex(membio, name, 0,
|
||||||
XN_FLAG_RFC2253), WOLFSSL_SUCCESS);
|
XN_FLAG_RFC2253), WOLFSSL_SUCCESS);
|
||||||
AssertIntGE((memSz = BIO_get_mem_data(membio, &mem)), 0);
|
AssertIntGE((memSz = BIO_get_mem_data(membio, &mem)), 0);
|
||||||
|
#if defined(WOLFSSL_QT)
|
||||||
|
AssertIntEQ(memSz, XSTRLEN(expRFC5523));
|
||||||
|
#else
|
||||||
AssertIntEQ(memSz, XSTRLEN(expRFC5523)+1);
|
AssertIntEQ(memSz, XSTRLEN(expRFC5523)+1);
|
||||||
|
#endif
|
||||||
AssertIntEQ(XSTRNCMP((char*)mem, expRFC5523, XSTRLEN(expRFC5523)), 0);
|
AssertIntEQ(XSTRNCMP((char*)mem, expRFC5523, XSTRLEN(expRFC5523)), 0);
|
||||||
BIO_free(membio);
|
BIO_free(membio);
|
||||||
|
|
||||||
@ -30870,7 +30899,11 @@ static int test_wolfSSL_X509_NAME_print_ex(void)
|
|||||||
AssertIntEQ(X509_NAME_print_ex(membio, name, 0,
|
AssertIntEQ(X509_NAME_print_ex(membio, name, 0,
|
||||||
XN_FLAG_DN_REV), WOLFSSL_SUCCESS);
|
XN_FLAG_DN_REV), WOLFSSL_SUCCESS);
|
||||||
AssertIntGE((memSz = BIO_get_mem_data(membio, &mem)), 0);
|
AssertIntGE((memSz = BIO_get_mem_data(membio, &mem)), 0);
|
||||||
|
#if defined(WOLFSSL_QT)
|
||||||
|
AssertIntEQ(memSz, XSTRLEN(expNotEscapedRev));
|
||||||
|
#else
|
||||||
AssertIntEQ(memSz, XSTRLEN(expNotEscapedRev)+1);
|
AssertIntEQ(memSz, XSTRLEN(expNotEscapedRev)+1);
|
||||||
|
#endif
|
||||||
AssertIntEQ(XSTRNCMP((char*)mem, expNotEscapedRev,
|
AssertIntEQ(XSTRNCMP((char*)mem, expNotEscapedRev,
|
||||||
XSTRLEN(expNotEscapedRev)), 0);
|
XSTRLEN(expNotEscapedRev)), 0);
|
||||||
BIO_free(membio);
|
BIO_free(membio);
|
||||||
@ -53373,10 +53406,20 @@ static int test_wolfSSL_X509_print(void)
|
|||||||
AssertIntEQ(X509_print(bio, x509), SSL_SUCCESS);
|
AssertIntEQ(X509_print(bio, x509), SSL_SUCCESS);
|
||||||
|
|
||||||
#if defined(OPENSSL_ALL) || defined(WOLFSSL_IP_ALT_NAME)
|
#if defined(OPENSSL_ALL) || defined(WOLFSSL_IP_ALT_NAME)
|
||||||
|
#if defined(WOLFSSL_QT)
|
||||||
|
#if defined(WC_DISABLE_RADIX_ZERO_PAD)
|
||||||
|
/* Will print IP address subject alt name. */
|
||||||
|
AssertIntEQ(BIO_get_mem_data(bio, NULL), 3349);
|
||||||
|
#else
|
||||||
|
/* Will print IP address subject alt name. */
|
||||||
|
AssertIntEQ(BIO_get_mem_data(bio, NULL), 3350);
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
/* Will print IP address subject alt name. */
|
/* Will print IP address subject alt name. */
|
||||||
AssertIntEQ(BIO_get_mem_data(bio, NULL), 3255);
|
AssertIntEQ(BIO_get_mem_data(bio, NULL), 3325);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
AssertIntEQ(BIO_get_mem_data(bio, NULL), 3233);
|
AssertIntEQ(BIO_get_mem_data(bio, NULL), 3303);
|
||||||
#endif
|
#endif
|
||||||
BIO_free(bio);
|
BIO_free(bio);
|
||||||
|
|
||||||
|
@ -8999,10 +8999,11 @@ static int Indent(WOLFSSL_BIO* out, int indents)
|
|||||||
* input buffer holding data to dump
|
* input buffer holding data to dump
|
||||||
* inlen input data size
|
* inlen input data size
|
||||||
* indent the number of spaces for indent
|
* indent the number of spaces for indent
|
||||||
|
* blower true if lower case uses
|
||||||
* Returns 1 on success, 0 on failure.
|
* Returns 1 on success, 0 on failure.
|
||||||
*/
|
*/
|
||||||
static int PrintHexWithColon(WOLFSSL_BIO* out, const byte* input,
|
static int PrintHexWithColon(WOLFSSL_BIO* out, const byte* input,
|
||||||
int inlen, int indent)
|
int inlen, int indent, byte blower)
|
||||||
{
|
{
|
||||||
#ifdef WOLFSSL_SMALL_STACK
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
byte* buff = NULL;
|
byte* buff = NULL;
|
||||||
@ -9053,6 +9054,10 @@ static int PrintHexWithColon(WOLFSSL_BIO* out, const byte* input,
|
|||||||
outHex, &outSz) == 0;
|
outHex, &outSz) == 0;
|
||||||
}
|
}
|
||||||
if (ret == WOLFSSL_SUCCESS) {
|
if (ret == WOLFSSL_SUCCESS) {
|
||||||
|
if (blower) {
|
||||||
|
outHex[0] = (byte)XTOLOWER(outHex[0]);
|
||||||
|
outHex[1] = (byte)XTOLOWER(outHex[1]);
|
||||||
|
}
|
||||||
XMEMCPY(buff + idx, outHex, 2);
|
XMEMCPY(buff + idx, outHex, 2);
|
||||||
idx += 2;
|
idx += 2;
|
||||||
|
|
||||||
@ -9175,7 +9180,14 @@ static int PrintPubKeyRSA(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
|
|||||||
n--;
|
n--;
|
||||||
nSz++;
|
nSz++;
|
||||||
}
|
}
|
||||||
if (PrintHexWithColon(out, n, nSz, indent + 4) != WOLFSSL_SUCCESS) {
|
|
||||||
|
if (PrintHexWithColon(out, n, nSz, indent + 4,
|
||||||
|
#if defined(WOLFSSL_QT)
|
||||||
|
1/* lower case */
|
||||||
|
#else
|
||||||
|
0/* upper case */
|
||||||
|
#endif
|
||||||
|
) != WOLFSSL_SUCCESS) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* print public Exponent */
|
/* print public Exponent */
|
||||||
@ -9378,7 +9390,7 @@ static int PrintPubKeyEC(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
|
|||||||
res = wolfSSL_BIO_write(out, line, (int)XSTRLEN(line)) > 0;
|
res = wolfSSL_BIO_write(out, line, (int)XSTRLEN(line)) > 0;
|
||||||
}
|
}
|
||||||
if (res == WOLFSSL_SUCCESS) {
|
if (res == WOLFSSL_SUCCESS) {
|
||||||
res = PrintHexWithColon(out, pub, pubSz, indent + 4);
|
res = PrintHexWithColon(out, pub, pubSz, indent + 4, 0/* upper case */);
|
||||||
}
|
}
|
||||||
if (res == WOLFSSL_SUCCESS) {
|
if (res == WOLFSSL_SUCCESS) {
|
||||||
res = Indent(out, indent) >= 0;
|
res = Indent(out, indent) >= 0;
|
||||||
@ -9598,7 +9610,8 @@ static int PrintPubKeyDSA(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
|
|||||||
if (wolfSSL_BIO_write(out, line, (int)XSTRLEN(line)) <= 0) {
|
if (wolfSSL_BIO_write(out, line, (int)XSTRLEN(line)) <= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (PrintHexWithColon(out, y, ySz, indent + 4) != WOLFSSL_SUCCESS) {
|
if (PrintHexWithColon(out, y, ySz, indent + 4, 0/* upper case */)
|
||||||
|
!= WOLFSSL_SUCCESS) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* print P element */
|
/* print P element */
|
||||||
@ -9607,7 +9620,8 @@ static int PrintPubKeyDSA(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
|
|||||||
if (wolfSSL_BIO_write(out, line, (int)XSTRLEN(line)) <= 0) {
|
if (wolfSSL_BIO_write(out, line, (int)XSTRLEN(line)) <= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (PrintHexWithColon(out, p, pSz, indent + 4) != WOLFSSL_SUCCESS) {
|
if (PrintHexWithColon(out, p, pSz, indent + 4, 0/* upper case */)
|
||||||
|
!= WOLFSSL_SUCCESS) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* print Q element */
|
/* print Q element */
|
||||||
@ -9616,7 +9630,8 @@ static int PrintPubKeyDSA(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
|
|||||||
if (wolfSSL_BIO_write(out, line, (int)XSTRLEN(line)) <= 0) {
|
if (wolfSSL_BIO_write(out, line, (int)XSTRLEN(line)) <= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (PrintHexWithColon(out, q, qSz, indent + 4) != WOLFSSL_SUCCESS) {
|
if (PrintHexWithColon(out, q, qSz, indent + 4, 0/* upper case */)
|
||||||
|
!= WOLFSSL_SUCCESS) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* print G element */
|
/* print G element */
|
||||||
@ -9625,7 +9640,8 @@ static int PrintPubKeyDSA(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
|
|||||||
if (wolfSSL_BIO_write(out, line, (int)XSTRLEN(line)) <= 0) {
|
if (wolfSSL_BIO_write(out, line, (int)XSTRLEN(line)) <= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (PrintHexWithColon(out, g, gSz, indent + 4) != WOLFSSL_SUCCESS) {
|
if (PrintHexWithColon(out, g, gSz, indent + 4, 0/* upper case */)
|
||||||
|
!= WOLFSSL_SUCCESS) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9803,7 +9819,8 @@ static int PrintPubKeyDH(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
|
|||||||
if (wolfSSL_BIO_write(out, line, (int)XSTRLEN(line)) <= 0) {
|
if (wolfSSL_BIO_write(out, line, (int)XSTRLEN(line)) <= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (PrintHexWithColon(out, publicKey, publicKeySz, indent + 4)
|
if (PrintHexWithColon(out, publicKey,
|
||||||
|
publicKeySz, indent + 4, 0/* upper case */)
|
||||||
!= WOLFSSL_SUCCESS) {
|
!= WOLFSSL_SUCCESS) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -9812,7 +9829,8 @@ static int PrintPubKeyDH(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
|
|||||||
if (wolfSSL_BIO_write(out, line, (int)XSTRLEN(line)) <= 0) {
|
if (wolfSSL_BIO_write(out, line, (int)XSTRLEN(line)) <= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (PrintHexWithColon(out, prime, primeSz, indent + 4)
|
if (PrintHexWithColon(out, prime, primeSz,
|
||||||
|
indent + 4, 0/* upper case */)
|
||||||
!= WOLFSSL_SUCCESS) {
|
!= WOLFSSL_SUCCESS) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user