Revision: 19556
          http://sourceforge.net/p/edk2/code/19556
Author:   vanjeff
Date:     2015-12-29 03:11:37 +0000 (Tue, 29 Dec 2015)
Log Message:
-----------
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.

(Sync patch r18699 from main trunk.)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Woodhouse <[email protected]>
Tested-by: Laszlo Ersek <[email protected]>
Reviewed-by: Qin Long <[email protected]>

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/18699

Modified Paths:
--------------
    branches/UDK2015/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c

Modified: branches/UDK2015/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c
===================================================================
--- branches/UDK2015/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c      
2015-12-29 03:11:08 UTC (rev 19555)
+++ branches/UDK2015/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c      
2015-12-29 03:11:37 UTC (rev 19556)
@@ -245,6 +245,7 @@
   BOOLEAN    Status;
   X509       *X509Cert;
   X509_NAME  *X509Name;
+  UINTN      X509NameSize;
 
   //
   // Check input parameters.
@@ -274,13 +275,14 @@
     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;
   }
 


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to