]> git.proxmox.com Git - mirror_edk2.git/commitdiff
CryptoPkg: Add some comments for API usage clarification.
authorQin Long <qin.long@intel.com>
Fri, 19 Jun 2015 02:46:51 +0000 (02:46 +0000)
committerqlong <qlong@Edk2>
Fri, 19 Jun 2015 02:46:51 +0000 (02:46 +0000)
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 <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17671 6f19259b-4bc3-4df7-8a09-765794883524

CryptoPkg/Include/Library/BaseCryptLib.h
CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaExt.c
CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c
CryptoPkg/Library/BaseCryptLib/Pk/CryptX509Null.c
CryptoPkg/Library/BaseCryptLibRuntimeCryptProtocol/Pk/CryptX509Null.c

index 364fa3ca157ba5aba71da1d82bf0dabf83510dea..d3b211bec5b67a90d3d8a8417a09e22040cc3dc6 100644 (file)
@@ -1631,6 +1631,8 @@ RsaGenerateKey (
 \r
 /**\r
   Validates key components of RSA context.\r
+  NOTE: This function performs integrity checks on all the RSA key material, so\r
+        the RSA key structure must contain all the private key data.\r
 \r
   This function validates key compoents of RSA context in following aspects:\r
   - Whether p is a prime\r
@@ -1859,7 +1861,7 @@ X509ConstructCertificate (
   If X509Stack is NULL, then return FALSE.\r
   If this interface is not supported, then return FALSE.\r
 \r
-  @param[in, out]  X509Stack  On input, pointer to an existing X509 stack object.\r
+  @param[in, out]  X509Stack  On input, pointer to an existing or NULL X509 stack object.\r
                               On output, pointer to the X509 stack object with new\r
                               inserted X509 certificate.\r
   @param           ...        A list of DER-encoded single certificate data followed\r
index 5c21d121f57fb44f097717c0b8b2315e4246fa80..b890704a2ee8c77215bd08db4393c70f7c430c46 100644 (file)
@@ -243,7 +243,9 @@ _Exit:
 }\r
 \r
 /**\r
-  Validates key components of RSA context.\r
+  Validates key components of RSA context. \r
+  NOTE: This function performs integrity checks on all the RSA key material, so\r
+        the RSA key structure must contain all the private key data.\r
 \r
   This function validates key compoents of RSA context in following aspects:\r
   - Whether p is a prime\r
index 02851d5701498537e0e4a5c1877756ba1b1e2b1b..70b135a754e98e07028de4237c5f510ccc91a9da 100644 (file)
@@ -67,7 +67,7 @@ X509ConstructCertificate (
 \r
   If X509Stack is NULL, then return FALSE.\r
 \r
-  @param[in, out]  X509Stack  On input, pointer to an existing X509 stack object.\r
+  @param[in, out]  X509Stack  On input, pointer to an existing or NULL X509 stack object.\r
                               On output, pointer to the X509 stack object with new\r
                               inserted X509 certificate.\r
   @param           ...        A list of DER-encoded single certificate data followed\r
@@ -132,6 +132,7 @@ X509ConstructCertificateStack (
     //\r
     // Construct X509 Object from the given DER-encoded certificate data.\r
     //\r
+    X509Cert = NULL;\r
     Status = X509ConstructCertificate (\r
                (CONST UINT8 *) Cert,\r
                CertSize,\r
index e1eb84d99b77da3d702d4f46b4d11004dd42fb66..51aa0633a827f0042bc2a004522f9e4438ef5662 100644 (file)
@@ -44,7 +44,7 @@ X509ConstructCertificate (
 \r
   Return FALSE to indicate this interface is not supported.\r
 \r
-  @param[in, out]  X509Stack  On input, pointer to an existing X509 stack object.\r
+  @param[in, out]  X509Stack  On input, pointer to an existing or NULL X509 stack object.\r
                               On output, pointer to the X509 stack object with new\r
                               inserted X509 certificate.\r
   @param           ...        A list of DER-encoded single certificate data followed\r
index c43ca075839037aed65e9837f387ce87b978d24e..f5d9aa107614de37e00e832468ed230a3f2326e4 100644 (file)
@@ -44,7 +44,7 @@ X509ConstructCertificate (
 \r
   Return FALSE to indicate this interface is not supported.\r
 \r
-  @param[in, out]  X509Stack  On input, pointer to an existing X509 stack object.\r
+  @param[in, out]  X509Stack  On input, pointer to an existing or NULL X509 stack object.\r
                               On output, pointer to the X509 stack object with new\r
                               inserted X509 certificate.\r
   @param           ...        A list of DER-encoded single certificate data followed\r