[BCRYPT] Add ECDSA P256 to known algorithms

Add missing structs and handler in BCryptOpenAlgorithmProvider().
Fixes CORE-16741 and similar problems.
This commit is contained in:
Thomas Csovcsity 2021-12-30 21:23:49 +01:00 committed by Stanislav Motylkov
parent d5deacd903
commit e0a47b7b5f
No known key found for this signature in database
GPG key ID: AFE513258CBA9E92

View file

@ -266,7 +266,8 @@ enum alg_id
ALG_ID_SHA1, ALG_ID_SHA1,
ALG_ID_SHA256, ALG_ID_SHA256,
ALG_ID_SHA384, ALG_ID_SHA384,
ALG_ID_SHA512 ALG_ID_SHA512,
ALG_ID_ECDSA_P256,
}; };
static const struct { static const struct {
@ -278,7 +279,8 @@ static const struct {
/* ALG_ID_SHA1 */ { 20, BCRYPT_SHA1_ALGORITHM }, /* ALG_ID_SHA1 */ { 20, BCRYPT_SHA1_ALGORITHM },
/* ALG_ID_SHA256 */ { 32, BCRYPT_SHA256_ALGORITHM }, /* ALG_ID_SHA256 */ { 32, BCRYPT_SHA256_ALGORITHM },
/* ALG_ID_SHA384 */ { 48, BCRYPT_SHA384_ALGORITHM }, /* ALG_ID_SHA384 */ { 48, BCRYPT_SHA384_ALGORITHM },
/* ALG_ID_SHA512 */ { 64, BCRYPT_SHA512_ALGORITHM } /* ALG_ID_SHA512 */ { 64, BCRYPT_SHA512_ALGORITHM },
/* ALG_ID_ECDSA_P256 */ { 0, BCRYPT_ECDSA_P256_ALGORITHM },
}; };
struct algorithm struct algorithm
@ -351,6 +353,7 @@ NTSTATUS WINAPI BCryptOpenAlgorithmProvider( BCRYPT_ALG_HANDLE *handle, LPCWSTR
else if (!strcmpW( id, BCRYPT_SHA256_ALGORITHM )) alg_id = ALG_ID_SHA256; else if (!strcmpW( id, BCRYPT_SHA256_ALGORITHM )) alg_id = ALG_ID_SHA256;
else if (!strcmpW( id, BCRYPT_SHA384_ALGORITHM )) alg_id = ALG_ID_SHA384; else if (!strcmpW( id, BCRYPT_SHA384_ALGORITHM )) alg_id = ALG_ID_SHA384;
else if (!strcmpW( id, BCRYPT_SHA512_ALGORITHM )) alg_id = ALG_ID_SHA512; else if (!strcmpW( id, BCRYPT_SHA512_ALGORITHM )) alg_id = ALG_ID_SHA512;
else if (!strcmpW( id, BCRYPT_ECDSA_P256_ALGORITHM )) alg_id = ALG_ID_ECDSA_P256;
else else
{ {
FIXME( "algorithm %s not supported\n", debugstr_w(id) ); FIXME( "algorithm %s not supported\n", debugstr_w(id) );