added support for SIGN_ECDSA_WITH_SHA1 signature scheme in openssl

This commit is contained in:
Martin Willi
2009-08-27 13:59:30 +02:00
parent eb73685dac
commit 82749537e2
@@ -73,6 +73,7 @@ typedef struct {
* Signature schemes * Signature schemes
*/ */
static openssl_ecdsa_scheme_t ecdsa_schemes[] = { static openssl_ecdsa_scheme_t ecdsa_schemes[] = {
{SIGN_ECDSA_WITH_SHA1, NID_sha1, -1},
{SIGN_ECDSA_256, NID_sha256, NID_X9_62_prime256v1}, {SIGN_ECDSA_256, NID_sha256, NID_X9_62_prime256v1},
{SIGN_ECDSA_384, NID_sha384, NID_secp384r1}, {SIGN_ECDSA_384, NID_sha384, NID_secp384r1},
{SIGN_ECDSA_521, NID_sha512, NID_secp521r1}, {SIGN_ECDSA_521, NID_sha512, NID_secp521r1},
@@ -163,14 +164,15 @@ static bool sign(private_openssl_ec_private_key_t *this, signature_scheme_t sche
return FALSE; return FALSE;
} }
if (curve != -1)
{
req_group = EC_GROUP_new_by_curve_name(curve); req_group = EC_GROUP_new_by_curve_name(curve);
if (!req_group) if (!req_group)
{ {
DBG1("signature scheme %N not supported in EC (required curve not supported)", DBG1("signature scheme %N not supported in EC (required curve "
signature_scheme_names, scheme); "not supported)", signature_scheme_names, scheme);
return FALSE; return FALSE;
} }
my_group = EC_KEY_get0_group(this->ec); my_group = EC_KEY_get0_group(this->ec);
if (EC_GROUP_cmp(my_group, req_group, NULL) != 0) if (EC_GROUP_cmp(my_group, req_group, NULL) != 0)
{ {
@@ -179,7 +181,7 @@ static bool sign(private_openssl_ec_private_key_t *this, signature_scheme_t sche
return FALSE; return FALSE;
} }
EC_GROUP_free(req_group); EC_GROUP_free(req_group);
}
if (!openssl_hash_chunk(hash_type, data, &hash)) if (!openssl_hash_chunk(hash_type, data, &hash))
{ {
return FALSE; return FALSE;