[xmlsec] minor formatting fixes



commit a1812db322404d2d3d9e1e7327757ebd418ba875
Author: Aleksey Sanin <aleksey aleksey com>
Date:   Sat Apr 24 16:29:06 2010 -0700

    minor formatting fixes

 src/mscrypto/app.c        |    2 +-
 src/mscrypto/certkeys.c   |   19 ++++++++++---------
 src/mscrypto/ciphers.c    |    4 ++--
 src/mscrypto/crypto.c     |   13 ++++++++++---
 src/mscrypto/digests.c    |   29 ++++++++++++++++++-----------
 src/mscrypto/signatures.c |    2 +-
 6 files changed, 42 insertions(+), 27 deletions(-)
---
diff --git a/src/mscrypto/app.c b/src/mscrypto/app.c
index 3752de9..e6ef5ce 100644
--- a/src/mscrypto/app.c
+++ b/src/mscrypto/app.c
@@ -583,7 +583,7 @@ xmlSecMSCryptoAppPkcs12LoadMemory(const xmlSecByte* data,
         goto done;
     }
 
-        wcPwd = xmlSecMSCryptoConvertLocaleToUnicode(pwd);
+    wcPwd = xmlSecMSCryptoConvertLocaleToUnicode(pwd);
     if (wcPwd == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
diff --git a/src/mscrypto/certkeys.c b/src/mscrypto/certkeys.c
index af9eade..fd50709 100644
--- a/src/mscrypto/certkeys.c
+++ b/src/mscrypto/certkeys.c
@@ -443,11 +443,11 @@ xmlSecMSCryptoKeyDataAdoptCert(xmlSecKeyDataPtr data, PCCERT_CONTEXT pCert, xmlS
         BOOL fCallerFreeProv = FALSE;
 
         if (!CryptAcquireCertificatePrivateKey(pCert,
-                                               CRYPT_ACQUIRE_SILENT_FLAG | CRYPT_ACQUIRE_COMPARE_KEY_FLAG,
-                                               NULL,
-                                               &hProv,
-                                               &(ctx->dwKeySpec),
-                                               &fCallerFreeProv)) {
+                    CRYPT_ACQUIRE_SILENT_FLAG | CRYPT_ACQUIRE_COMPARE_KEY_FLAG,
+                    NULL,
+                    &hProv,
+                    &(ctx->dwKeySpec),
+                    &fCallerFreeProv)) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
                             NULL,
                             "CryptAcquireCertificatePrivateKey",
@@ -1003,10 +1003,11 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataRsaKlass = {
  * MUST END with { NULL, 0 } !!!
  */
 static xmlSecMSCryptoProviderInfo xmlSecMSCryptoProviderInfo_Rsa[] = {
-    { XMLSEC_CRYPTO_MS_ENH_RSA_AES_PROV,    PROV_RSA_AES},
-    { XMLSEC_CRYPTO_MS_ENH_RSA_AES_PROV_PROTOTYPE,       PROV_RSA_AES },
-    { MS_STRONG_PROV,               PROV_RSA_FULL },
-    { MS_ENHANCED_PROV,             PROV_RSA_FULL },
+    { XMLSEC_CRYPTO_MS_ENH_RSA_AES_PROV,                PROV_RSA_AES},
+    { XMLSEC_CRYPTO_MS_ENH_RSA_AES_PROV_PROTOTYPE,      PROV_RSA_AES },
+    { MS_STRONG_PROV,                                   PROV_RSA_FULL },
+    { MS_ENHANCED_PROV,                                 PROV_RSA_FULL },
+    { MS_DEF_PROV,                                      PROV_RSA_FULL },
     { NULL, 0 }
 };
 
diff --git a/src/mscrypto/ciphers.c b/src/mscrypto/ciphers.c
index f6e8297..66d10d5 100644
--- a/src/mscrypto/ciphers.c
+++ b/src/mscrypto/ciphers.c
@@ -482,8 +482,8 @@ static xmlSecMSCryptoProviderInfo xmlSecMSCryptoProviderInfo_Des[] = {
 
 #ifndef XMLSEC_NO_AES
 static xmlSecMSCryptoProviderInfo xmlSecMSCryptoProviderInfo_Aes[] = {
-    { XMLSEC_CRYPTO_MS_ENH_RSA_AES_PROV,    PROV_RSA_AES},
-    { XMLSEC_CRYPTO_MS_ENH_RSA_AES_PROV_PROTOTYPE,       PROV_RSA_AES },
+    { XMLSEC_CRYPTO_MS_ENH_RSA_AES_PROV,                PROV_RSA_AES},
+    { XMLSEC_CRYPTO_MS_ENH_RSA_AES_PROV_PROTOTYPE,      PROV_RSA_AES },
     { NULL, 0 }
 };
 #endif /* XMLSEC_NO_AES */
diff --git a/src/mscrypto/crypto.c b/src/mscrypto/crypto.c
index 62e2530..b3d9e8d 100644
--- a/src/mscrypto/crypto.c
+++ b/src/mscrypto/crypto.c
@@ -263,6 +263,12 @@ xmlSecMSCryptoKeysMngrInit(xmlSecKeysMngrPtr mngr) {
 }
 
 
+static xmlSecMSCryptoProviderInfo xmlSecMSCryptoProviderInfo_Random[] = {
+    { MS_STRONG_PROV,               PROV_RSA_FULL },
+    { MS_ENHANCED_PROV,             PROV_RSA_FULL },
+    { NULL, 0 }
+};
+
 /**
  * xmlSecMSCryptoGenerateRandom:
  * @buffer:             the destination buffer.
@@ -291,11 +297,12 @@ xmlSecMSCryptoGenerateRandom(xmlSecBufferPtr buffer, size_t size) {
         return(-1);
     }
 
-    if (FALSE == CryptAcquireContext(&hProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
+    hProv = xmlSecMSCryptoFindProvider(xmlSecMSCryptoProviderInfo_Random, NULL, CRYPT_VERIFYCONTEXT, FALSE);
+    if (0 == hProv) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "CryptAcquireContext",
-                    XMLSEC_ERRORS_R_CRYPTO_FAILED,
+                    "xmlSecMSCryptoFindProvider",
+                    XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
diff --git a/src/mscrypto/digests.c b/src/mscrypto/digests.c
index d476a0d..7fa7581 100644
--- a/src/mscrypto/digests.c
+++ b/src/mscrypto/digests.c
@@ -65,17 +65,24 @@ static int      xmlSecMSCryptoDigestCheckId     (xmlSecTransformPtr transform);
  *
  * MUST END with { NULL, 0 } !!!
  */
-static xmlSecMSCryptoProviderInfo xmlSecMSCryptoProviderInfo_Sha[] = {
-    { XMLSEC_CRYPTO_MS_ENH_RSA_AES_PROV,    PROV_RSA_AES},
-    { XMLSEC_CRYPTO_MS_ENH_RSA_AES_PROV_PROTOTYPE,       PROV_RSA_AES },
-    { MS_STRONG_PROV,               PROV_RSA_FULL },
-    { MS_ENHANCED_PROV,             PROV_RSA_FULL },
+static xmlSecMSCryptoProviderInfo xmlSecMSCryptoProviderInfo_Sha1[] = {
+    { XMLSEC_CRYPTO_MS_ENH_RSA_AES_PROV,                PROV_RSA_AES},
+    { XMLSEC_CRYPTO_MS_ENH_RSA_AES_PROV_PROTOTYPE,      PROV_RSA_AES },
+    { MS_STRONG_PROV,                                   PROV_RSA_FULL },
+    { MS_ENHANCED_PROV,                                 PROV_RSA_FULL },
+    { MS_DEF_PROV,                                      PROV_RSA_FULL },
+    { NULL, 0 }
+};
+
+static xmlSecMSCryptoProviderInfo xmlSecMSCryptoProviderInfo_Sha2[] = {
+    { XMLSEC_CRYPTO_MS_ENH_RSA_AES_PROV,                PROV_RSA_AES},
+    { XMLSEC_CRYPTO_MS_ENH_RSA_AES_PROV_PROTOTYPE,      PROV_RSA_AES },
     { NULL, 0 }
 };
 
 static xmlSecMSCryptoProviderInfo xmlSecMSCryptoProviderInfo_Gost[] = {
-    { MAGPRO_CSP,                   PROV_MAGPRO_GOST },
-    { CRYPTOPRO_CSP,                PROV_CRYPTOPRO_GOST },
+    { MAGPRO_CSP,                                       PROV_MAGPRO_GOST },
+    { CRYPTOPRO_CSP,                                    PROV_CRYPTOPRO_GOST },
     { NULL, 0 }
 };
 
@@ -130,28 +137,28 @@ xmlSecMSCryptoDigestInitialize(xmlSecTransformPtr transform) {
 #ifndef XMLSEC_NO_SHA1
     if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformSha1Id)) {
         ctx->alg_id = CALG_SHA;
-        ctx->providers = xmlSecMSCryptoProviderInfo_Sha;
+        ctx->providers = xmlSecMSCryptoProviderInfo_Sha1;
     } else
 #endif /* XMLSEC_NO_SHA1 */
 
 #ifndef XMLSEC_NO_SHA256
     if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformSha256Id)) {
         ctx->alg_id = CALG_SHA_256;
-        ctx->providers = xmlSecMSCryptoProviderInfo_Sha;
+        ctx->providers = xmlSecMSCryptoProviderInfo_Sha2;
     } else
 #endif /* XMLSEC_NO_SHA256 */
 
 #ifndef XMLSEC_NO_SHA384
     if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformSha384Id)) {
         ctx->alg_id = CALG_SHA_384;
-        ctx->providers = xmlSecMSCryptoProviderInfo_Sha;
+        ctx->providers = xmlSecMSCryptoProviderInfo_Sha2;
     } else
 #endif /* XMLSEC_NO_SHA384 */
 
 #ifndef XMLSEC_NO_SHA512
     if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformSha512Id)) {
         ctx->alg_id = CALG_SHA_512;
-        ctx->providers = xmlSecMSCryptoProviderInfo_Sha;
+        ctx->providers = xmlSecMSCryptoProviderInfo_Sha2;
     } else
 #endif /* XMLSEC_NO_SHA512 */
 
diff --git a/src/mscrypto/signatures.c b/src/mscrypto/signatures.c
index e542a13..005ea6c 100644
--- a/src/mscrypto/signatures.c
+++ b/src/mscrypto/signatures.c
@@ -407,7 +407,7 @@ xmlSecMSCryptoSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTra
     xmlSecSize inSize, outSize;
     int ret;
     DWORD dwSigLen;
-    BYTE *tmpBuf, *outBuf, *i, *j, *m, *n;
+    BYTE *tmpBuf, *outBuf;
 
     xmlSecAssert2(xmlSecMSCryptoSignatureCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) || (transform->operation == xmlSecTransformOperationVerify), -1);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]