Skip to content

Commit 63f666a

Browse files
Merge pull request #7659 from embhorn/zd18179
Fixes in ASN1 and X509
2 parents d545253 + d4a90e8 commit 63f666a

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

src/ssl_asn1.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3510,14 +3510,17 @@ WOLFSSL_ASN1_TIME* wolfSSL_ASN1_TIME_to_generalizedtime(WOLFSSL_ASN1_TIME *t,
35103510
if (ret != NULL) {
35113511
/* Set the ASN.1 type and length of string. */
35123512
ret->type = V_ASN1_GENERALIZEDTIME;
3513-
ret->length = ASN_GENERALIZED_TIME_SIZE;
35143513

35153514
if (t->type == V_ASN1_GENERALIZEDTIME) {
3515+
ret->length = ASN_GENERALIZED_TIME_SIZE;
3516+
35163517
/* Just copy as data already appropriately formatted. */
35173518
XMEMCPY(ret->data, t->data, ASN_GENERALIZED_TIME_SIZE);
35183519
}
35193520
else {
35203521
/* Convert UTC TIME to GENERALIZED TIME. */
3522+
ret->length = t->length + 2; /* Add two extra year digits */
3523+
35213524
if (t->data[0] >= '5') {
35223525
/* >= 50 is 1900s. */
35233526
ret->data[0] = '1'; ret->data[1] = '9';
@@ -3527,7 +3530,7 @@ WOLFSSL_ASN1_TIME* wolfSSL_ASN1_TIME_to_generalizedtime(WOLFSSL_ASN1_TIME *t,
35273530
ret->data[0] = '2'; ret->data[1] = '0';
35283531
}
35293532
/* Append rest of the data as it is the same. */
3530-
XMEMCPY(&ret->data[2], t->data, ASN_UTC_TIME_SIZE);
3533+
XMEMCPY(&ret->data[2], t->data, t->length);
35313534
}
35323535

35333536
/* Check for pointer to return result through. */

src/x509.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8236,7 +8236,8 @@ int wolfSSL_X509_CRL_get_signature(WOLFSSL_X509_CRL* crl,
82368236
{
82378237
WOLFSSL_ENTER("wolfSSL_X509_CRL_get_signature");
82388238

8239-
if (crl == NULL || crl->crlList == NULL || bufSz == NULL)
8239+
if (crl == NULL || crl->crlList == NULL ||
8240+
crl->crlList->signature == NULL || bufSz == NULL)
82408241
return BAD_FUNC_ARG;
82418242

82428243
if (buf != NULL)
@@ -12972,6 +12973,14 @@ static int get_dn_attr_by_nid(int n, const char** buf)
1297212973
str = "UID";
1297312974
len = 3;
1297412975
break;
12976+
case NID_serialNumber:
12977+
str = "serialNumber";
12978+
len = 12;
12979+
break;
12980+
case NID_title:
12981+
str = "title";
12982+
len = 5;
12983+
break;
1297512984
default:
1297612985
WOLFSSL_MSG("Attribute type not found");
1297712986
str = NULL;

0 commit comments

Comments
 (0)