CryptoPkg/BaseCryptLib: Use i2d_X509_NAME() instead of abusing X509_NAME

In OpenSSL 1.1, the X509_NAME becomes an opaque structure and we will no
longer get away with accessing its members directly. Use i2d_X509_NAME()
instead.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Qin Long <qin.long@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18699 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
David Woodhouse 2015-10-29 14:16:15 +00:00 committed by qlong
parent 1cae0c83bb
commit eeb8928a26

View File

@ -245,6 +245,7 @@ X509GetSubjectName (
BOOLEAN Status;
X509 *X509Cert;
X509_NAME *X509Name;
UINTN X509NameSize;
//
// Check input parameters.
@ -274,13 +275,14 @@ X509GetSubjectName (
goto _Exit;
}
if (*SubjectSize < (UINTN) X509Name->bytes->length) {
*SubjectSize = (UINTN) X509Name->bytes->length;
X509NameSize = i2d_X509_NAME(X509Name, NULL);
if (*SubjectSize < X509NameSize) {
*SubjectSize = X509NameSize;
goto _Exit;
}
*SubjectSize = (UINTN) X509Name->bytes->length;
*SubjectSize = X509NameSize;
if (CertSubject != NULL) {
CopyMem (CertSubject, (UINT8 *) X509Name->bytes->data, *SubjectSize);
i2d_X509_NAME(X509Name, &CertSubject);
Status = TRUE;
}