mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-05 21:54:41 +02:00
Maintenance: X509
1. Fix for issue #2718. Added a flag to the X509 structure when someone sets the issuer name. 2. When making a certificate out of the X509, if the issuer name is set clear the self-signed flag in the cert. 3. Propigate the flat X509_NAMEs to the string the cert building code uses.
This commit is contained in:
@@ -37157,6 +37157,8 @@ void* wolfSSL_GetDhAgreeCtx(WOLFSSL* ssl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* copy over Name structures */
|
/* copy over Name structures */
|
||||||
|
if (x509->issuerSet)
|
||||||
|
cert->selfSigned = 0;
|
||||||
if ((ret = CopyX509NameToCertName(&(x509->issuer), &(cert->issuer)))
|
if ((ret = CopyX509NameToCertName(&(x509->issuer), &(cert->issuer)))
|
||||||
!= WOLFSSL_SUCCESS) {
|
!= WOLFSSL_SUCCESS) {
|
||||||
WOLFSSL_MSG("Error copying over issuer names");
|
WOLFSSL_MSG("Error copying over issuer names");
|
||||||
@@ -38517,7 +38519,7 @@ err:
|
|||||||
if (dName->fullName != NULL)
|
if (dName->fullName != NULL)
|
||||||
XFREE(dName->fullName, NULL, DYNAMIC_TYPE_X509);
|
XFREE(dName->fullName, NULL, DYNAMIC_TYPE_X509);
|
||||||
dName->fullName = fullName;
|
dName->fullName = fullName;
|
||||||
dName->fullNameLen = idx;
|
dName->fullNameLen = idx + 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -47919,6 +47921,8 @@ int wolfSSL_X509_set_subject_name(WOLFSSL_X509 *cert, WOLFSSL_X509_NAME *name)
|
|||||||
wolfSSL_X509_NAME_add_entry(&cert->subject, ne, i, 1);
|
wolfSSL_X509_NAME_add_entry(&cert->subject, ne, i, 1);
|
||||||
}
|
}
|
||||||
cert->subject.x509 = cert;
|
cert->subject.x509 = cert;
|
||||||
|
cert->subject.name = cert->subject.fullName.fullName;
|
||||||
|
cert->subject.sz = cert->subject.fullName.fullNameLen;
|
||||||
|
|
||||||
return WOLFSSL_SUCCESS;
|
return WOLFSSL_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -47949,6 +47953,9 @@ int wolfSSL_X509_set_issuer_name(WOLFSSL_X509 *cert, WOLFSSL_X509_NAME *name)
|
|||||||
wolfSSL_X509_NAME_add_entry(&cert->issuer, ne, i, 1);
|
wolfSSL_X509_NAME_add_entry(&cert->issuer, ne, i, 1);
|
||||||
}
|
}
|
||||||
cert->issuer.x509 = cert;
|
cert->issuer.x509 = cert;
|
||||||
|
cert->issuer.name = cert->issuer.fullName.fullName;
|
||||||
|
cert->issuer.sz = cert->issuer.fullName.fullNameLen;
|
||||||
|
cert->issuerSet = 1;
|
||||||
|
|
||||||
return WOLFSSL_SUCCESS;
|
return WOLFSSL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@@ -3646,6 +3646,7 @@ struct WOLFSSL_X509 {
|
|||||||
WOLFSSL_X509_ALGOR algor;
|
WOLFSSL_X509_ALGOR algor;
|
||||||
WOLFSSL_X509_PUBKEY key;
|
WOLFSSL_X509_PUBKEY key;
|
||||||
#endif
|
#endif
|
||||||
|
byte issuerSet:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user