Revision: 17671
          http://sourceforge.net/p/edk2/code/17671
Author:   qlong
Date:     2015-06-19 02:46:51 +0000 (Fri, 19 Jun 2015)
Log Message:
-----------
CryptoPkg: Add some comments for API usage clarification.

This patch adds some comments for API usage clarification, and
adds one object initialization in X509ConstructCertificateStack
implementation to fix possible memory release issue.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <[email protected]>
Reviewed-by: Ting Ye <[email protected]>

Modified Paths:
--------------
    trunk/edk2/CryptoPkg/Include/Library/BaseCryptLib.h
    trunk/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaExt.c
    trunk/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c
    trunk/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509Null.c
    
trunk/edk2/CryptoPkg/Library/BaseCryptLibRuntimeCryptProtocol/Pk/CryptX509Null.c

Modified: trunk/edk2/CryptoPkg/Include/Library/BaseCryptLib.h
===================================================================
--- trunk/edk2/CryptoPkg/Include/Library/BaseCryptLib.h 2015-06-19 02:45:06 UTC 
(rev 17670)
+++ trunk/edk2/CryptoPkg/Include/Library/BaseCryptLib.h 2015-06-19 02:46:51 UTC 
(rev 17671)
@@ -1631,6 +1631,8 @@
 
 /**
   Validates key components of RSA context.
+  NOTE: This function performs integrity checks on all the RSA key material, so
+        the RSA key structure must contain all the private key data.
 
   This function validates key compoents of RSA context in following aspects:
   - Whether p is a prime
@@ -1859,7 +1861,7 @@
   If X509Stack is NULL, then return FALSE.
   If this interface is not supported, then return FALSE.
 
-  @param[in, out]  X509Stack  On input, pointer to an existing X509 stack 
object.
+  @param[in, out]  X509Stack  On input, pointer to an existing or NULL X509 
stack object.
                               On output, pointer to the X509 stack object with 
new
                               inserted X509 certificate.
   @param           ...        A list of DER-encoded single certificate data 
followed

Modified: trunk/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaExt.c
===================================================================
--- trunk/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaExt.c  2015-06-19 
02:45:06 UTC (rev 17670)
+++ trunk/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaExt.c  2015-06-19 
02:46:51 UTC (rev 17671)
@@ -243,7 +243,9 @@
 }
 
 /**
-  Validates key components of RSA context.
+  Validates key components of RSA context. 
+  NOTE: This function performs integrity checks on all the RSA key material, so
+        the RSA key structure must contain all the private key data.
 
   This function validates key compoents of RSA context in following aspects:
   - Whether p is a prime

Modified: trunk/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c
===================================================================
--- trunk/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c    2015-06-19 
02:45:06 UTC (rev 17670)
+++ trunk/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c    2015-06-19 
02:46:51 UTC (rev 17671)
@@ -67,7 +67,7 @@
 
   If X509Stack is NULL, then return FALSE.
 
-  @param[in, out]  X509Stack  On input, pointer to an existing X509 stack 
object.
+  @param[in, out]  X509Stack  On input, pointer to an existing or NULL X509 
stack object.
                               On output, pointer to the X509 stack object with 
new
                               inserted X509 certificate.
   @param           ...        A list of DER-encoded single certificate data 
followed
@@ -132,6 +132,7 @@
     //
     // Construct X509 Object from the given DER-encoded certificate data.
     //
+    X509Cert = NULL;
     Status = X509ConstructCertificate (
                (CONST UINT8 *) Cert,
                CertSize,

Modified: trunk/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509Null.c
===================================================================
--- trunk/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509Null.c        
2015-06-19 02:45:06 UTC (rev 17670)
+++ trunk/edk2/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509Null.c        
2015-06-19 02:46:51 UTC (rev 17671)
@@ -44,7 +44,7 @@
 
   Return FALSE to indicate this interface is not supported.
 
-  @param[in, out]  X509Stack  On input, pointer to an existing X509 stack 
object.
+  @param[in, out]  X509Stack  On input, pointer to an existing or NULL X509 
stack object.
                               On output, pointer to the X509 stack object with 
new
                               inserted X509 certificate.
   @param           ...        A list of DER-encoded single certificate data 
followed

Modified: 
trunk/edk2/CryptoPkg/Library/BaseCryptLibRuntimeCryptProtocol/Pk/CryptX509Null.c
===================================================================
--- 
trunk/edk2/CryptoPkg/Library/BaseCryptLibRuntimeCryptProtocol/Pk/CryptX509Null.c
    2015-06-19 02:45:06 UTC (rev 17670)
+++ 
trunk/edk2/CryptoPkg/Library/BaseCryptLibRuntimeCryptProtocol/Pk/CryptX509Null.c
    2015-06-19 02:46:51 UTC (rev 17671)
@@ -44,7 +44,7 @@
 
   Return FALSE to indicate this interface is not supported.
 
-  @param[in, out]  X509Stack  On input, pointer to an existing X509 stack 
object.
+  @param[in, out]  X509Stack  On input, pointer to an existing or NULL X509 
stack object.
                               On output, pointer to the X509 stack object with 
new
                               inserted X509 certificate.
   @param           ...        A list of DER-encoded single certificate data 
followed


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

Reply via email to