Commit 224e3f43 authored by Michael Müller's avatar Michael Müller Committed by Alexandre Julliard

crypt32: Add oids for sha256ECDSA and sha384ECDSA.

parent 3b168abc
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#define NONAMELESSUNION #define NONAMELESSUNION
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#define CRYPT_OID_INFO_HAS_EXTRA_FIELDS
#include "wincrypt.h" #include "wincrypt.h"
#include "winreg.h" #include "winreg.h"
#include "winuser.h" #include "winuser.h"
...@@ -1080,6 +1081,8 @@ static const WCHAR sha384RSA[] = { 's','h','a','3','8','4','R','S','A',0 }; ...@@ -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 sha512RSA[] = { 's','h','a','5','1','2','R','S','A',0 };
static const WCHAR mosaicUpdatedSig[] = static const WCHAR mosaicUpdatedSig[] =
{ 'm','o','s','a','i','c','U','p','d','a','t','e','d','S','i','g',0 }; { '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 CN[] = { 'C','N',0 };
static const WCHAR L[] = { 'L',0 }; static const WCHAR L[] = { 'L',0 };
static const WCHAR O[] = { 'O',0 }; static const WCHAR O[] = { 'O',0 };
...@@ -1126,12 +1129,14 @@ static const DWORD dssSign[2] = { CALG_DSS_SIGN, ...@@ -1126,12 +1129,14 @@ static const DWORD dssSign[2] = { CALG_DSS_SIGN,
static const DWORD mosaicSign[2] = { CALG_DSS_SIGN, static const DWORD mosaicSign[2] = { CALG_DSS_SIGN,
CRYPT_OID_INHIBIT_SIGNATURE_FORMAT_FLAG | CRYPT_OID_INHIBIT_SIGNATURE_FORMAT_FLAG |
CRYPT_OID_NO_NULL_ALGORITHM_PARA_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), static const CRYPT_DATA_BLOB rsaSignBlob = { sizeof(rsaSign),
(LPBYTE)&rsaSign }; (LPBYTE)&rsaSign };
static const CRYPT_DATA_BLOB dssSignBlob = { sizeof(dssSign), static const CRYPT_DATA_BLOB dssSignBlob = { sizeof(dssSign),
(LPBYTE)dssSign }; (LPBYTE)dssSign };
static const CRYPT_DATA_BLOB mosaicSignBlob = { sizeof(mosaicSign), static const CRYPT_DATA_BLOB mosaicSignBlob = { sizeof(mosaicSign),
(LPBYTE)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 ia5String[] = { CERT_RDN_IA5_STRING, 0 };
static const DWORD numericString[] = { CERT_RDN_NUMERIC_STRING, 0 }; static const DWORD numericString[] = { CERT_RDN_NUMERIC_STRING, 0 };
...@@ -1153,6 +1158,8 @@ static const struct OIDInfoConstructor { ...@@ -1153,6 +1158,8 @@ static const struct OIDInfoConstructor {
UINT Algid; UINT Algid;
LPCWSTR pwszName; LPCWSTR pwszName;
const CRYPT_DATA_BLOB *blob; const CRYPT_DATA_BLOB *blob;
const WCHAR *pwszCNGAlgid;
const WCHAR *pwszCNGExtraAlgid;
} oidInfoConstructors[] = { } oidInfoConstructors[] = {
{ 1, szOID_OIWSEC_sha1, CALG_SHA1, sha1, NULL }, { 1, szOID_OIWSEC_sha1, CALG_SHA1, sha1, NULL },
{ 1, szOID_OIWSEC_sha1, CALG_SHA1, sha, NULL }, { 1, szOID_OIWSEC_sha1, CALG_SHA1, sha, NULL },
...@@ -1208,6 +1215,10 @@ static const struct OIDInfoConstructor { ...@@ -1208,6 +1215,10 @@ static const struct OIDInfoConstructor {
{ 4, szOID_OIWSEC_dsaSHA1, CALG_SHA1, dsaSHA1, &dssSignBlob }, { 4, szOID_OIWSEC_dsaSHA1, CALG_SHA1, dsaSHA1, &dssSignBlob },
{ 4, szOID_INFOSEC_mosaicUpdatedSig, CALG_SHA1, mosaicUpdatedSig, { 4, szOID_INFOSEC_mosaicUpdatedSig, CALG_SHA1, mosaicUpdatedSig,
&mosaicSignBlob }, &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_COMMON_NAME, 0, CN, NULL },
{ 5, szOID_LOCALITY_NAME, 0, L, NULL }, { 5, szOID_LOCALITY_NAME, 0, L, NULL },
...@@ -1422,6 +1433,8 @@ static void init_oid_info(void) ...@@ -1422,6 +1433,8 @@ static void init_oid_info(void)
info->info.ExtraInfo.pbData = info->info.ExtraInfo.pbData =
oidInfoConstructors[i].blob->pbData; oidInfoConstructors[i].blob->pbData;
} }
info->info.pwszCNGAlgid = oidInfoConstructors[i].pwszCNGAlgid;
info->info.pwszCNGExtraAlgid = oidInfoConstructors[i].pwszCNGExtraAlgid;
list_add_tail(&oidInfo, &info->entry); list_add_tail(&oidInfo, &info->entry);
} }
} }
...@@ -1454,6 +1467,8 @@ static void init_oid_info(void) ...@@ -1454,6 +1467,8 @@ static void init_oid_info(void)
info->info.ExtraInfo.pbData = info->info.ExtraInfo.pbData =
oidInfoConstructors[i].blob->pbData; oidInfoConstructors[i].blob->pbData;
} }
info->info.pwszCNGAlgid = oidInfoConstructors[i].pwszCNGAlgid;
info->info.pwszCNGExtraAlgid = oidInfoConstructors[i].pwszCNGExtraAlgid;
list_add_tail(&oidInfo, &info->entry); list_add_tail(&oidInfo, &info->entry);
} }
} }
......
...@@ -611,7 +611,7 @@ static void test_findOIDInfo(void) ...@@ -611,7 +611,7 @@ static void test_findOIDInfo(void)
wine_dbgstr_w(CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM), wine_dbgstr_w(info->pwszCNGExtraAlgid)); wine_dbgstr_w(CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM), wine_dbgstr_w(info->pwszCNGExtraAlgid));
} }
else 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) START_TEST(oid)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment