[PATCH 3/3] crypt32: Add oids for sha256ECDSA and sha384ECDSA.

Nikolay Sivov nsivov at codeweavers.com
Fri Jun 22 08:26:55 CDT 2018


From: Michael Müller <michael at fds-team.de>

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/crypt32/oid.c       | 15 +++++++++++++++
 dlls/crypt32/tests/oid.c |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/dlls/crypt32/oid.c b/dlls/crypt32/oid.c
index 61b2cbc88e..c9b0b412cf 100644
--- a/dlls/crypt32/oid.c
+++ b/dlls/crypt32/oid.c
@@ -25,6 +25,7 @@
 #define NONAMELESSUNION
 #include "windef.h"
 #include "winbase.h"
+#define CRYPT_OID_INFO_HAS_EXTRA_FIELDS
 #include "wincrypt.h"
 #include "winreg.h"
 #include "winuser.h"
@@ -1080,6 +1081,8 @@ static const WCHAR sha384RSA[] = { 's','h','a','3','8','4','R','S','A',0 };
 static const WCHAR sha512RSA[] = { 's','h','a','5','1','2','R','S','A',0 };
 static const WCHAR mosaicUpdatedSig[] =
  { 'm','o','s','a','i','c','U','p','d','a','t','e','d','S','i','g',0 };
+static const WCHAR sha256ECDSA[] = { 's','h','a','2','5','6','E','C','D','S','A',0 };
+static const WCHAR sha384ECDSA[] = { 's','h','a','3','8','4','E','C','D','S','A',0 };
 static const WCHAR CN[] = { 'C','N',0 };
 static const WCHAR L[] = { 'L',0 };
 static const WCHAR O[] = { 'O',0 };
@@ -1126,12 +1129,14 @@ static const DWORD dssSign[2] = { CALG_DSS_SIGN,
 static const DWORD mosaicSign[2] = { CALG_DSS_SIGN,
  CRYPT_OID_INHIBIT_SIGNATURE_FORMAT_FLAG |
  CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG };
+static const DWORD ecdsaSign[2] = { CALG_OID_INFO_PARAMETERS, CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG };
 static const CRYPT_DATA_BLOB rsaSignBlob = { sizeof(rsaSign),
  (LPBYTE)&rsaSign };
 static const CRYPT_DATA_BLOB dssSignBlob = { sizeof(dssSign),
  (LPBYTE)dssSign };
 static const CRYPT_DATA_BLOB mosaicSignBlob = { sizeof(mosaicSign),
  (LPBYTE)mosaicSign };
+static const CRYPT_DATA_BLOB ecdsaSignBlob = { sizeof(ecdsaSign), (BYTE *)ecdsaSign };
 
 static const DWORD ia5String[] = { CERT_RDN_IA5_STRING, 0 };
 static const DWORD numericString[] = { CERT_RDN_NUMERIC_STRING, 0 };
@@ -1153,6 +1158,8 @@ static const struct OIDInfoConstructor {
     UINT    Algid;
     LPCWSTR pwszName;
     const CRYPT_DATA_BLOB *blob;
+    const WCHAR *pwszCNGAlgid;
+    const WCHAR *pwszCNGExtraAlgid;
 } oidInfoConstructors[] = {
  { 1, szOID_OIWSEC_sha1,               CALG_SHA1,     sha1, NULL },
  { 1, szOID_OIWSEC_sha1,               CALG_SHA1,     sha, NULL },
@@ -1208,6 +1215,10 @@ static const struct OIDInfoConstructor {
  { 4, szOID_OIWSEC_dsaSHA1,            CALG_SHA1,     dsaSHA1, &dssSignBlob },
  { 4, szOID_INFOSEC_mosaicUpdatedSig,  CALG_SHA1,     mosaicUpdatedSig,
    &mosaicSignBlob },
+ { 4, szOID_ECDSA_SHA256,              CALG_OID_INFO_CNG_ONLY, sha256ECDSA, &ecdsaSignBlob,
+   BCRYPT_SHA256_ALGORITHM, CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM },
+ { 4, szOID_ECDSA_SHA384,              CALG_OID_INFO_CNG_ONLY, sha384ECDSA, &ecdsaSignBlob,
+   BCRYPT_SHA384_ALGORITHM, CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM },
 
  { 5, szOID_COMMON_NAME,              0, CN, NULL },
  { 5, szOID_LOCALITY_NAME,            0, L, NULL },
@@ -1422,6 +1433,8 @@ static void init_oid_info(void)
                     info->info.ExtraInfo.pbData =
                      oidInfoConstructors[i].blob->pbData;
                 }
+                info->info.pwszCNGAlgid = oidInfoConstructors[i].pwszCNGAlgid;
+                info->info.pwszCNGExtraAlgid = oidInfoConstructors[i].pwszCNGExtraAlgid;
                 list_add_tail(&oidInfo, &info->entry);
             }
         }
@@ -1454,6 +1467,8 @@ static void init_oid_info(void)
                         info->info.ExtraInfo.pbData =
                          oidInfoConstructors[i].blob->pbData;
                     }
+                    info->info.pwszCNGAlgid = oidInfoConstructors[i].pwszCNGAlgid;
+                    info->info.pwszCNGExtraAlgid = oidInfoConstructors[i].pwszCNGExtraAlgid;
                     list_add_tail(&oidInfo, &info->entry);
                 }
             }
diff --git a/dlls/crypt32/tests/oid.c b/dlls/crypt32/tests/oid.c
index 00a6d5461e..05822478cb 100644
--- a/dlls/crypt32/tests/oid.c
+++ b/dlls/crypt32/tests/oid.c
@@ -611,7 +611,7 @@ static void test_findOIDInfo(void)
            wine_dbgstr_w(CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM), wine_dbgstr_w(info->pwszCNGExtraAlgid));
     }
     else
-        todo_wine win_skip("Host does not support ECDSA_SHA256, skipping test\n");
+        win_skip("Host does not support ECDSA_SHA256, skipping test\n");
 }
 
 START_TEST(oid)
-- 
2.17.1




More information about the wine-devel mailing list