diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2006-04-17 17:12:23 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2006-04-17 17:12:23 +0000 |
commit | 492a9e241550b537ef3db1719e18e9b795b6d24c (patch) | |
tree | 1246408b271690b8a67816951fc27fdaab0c69a4 /crypto/ec/ec_ameth.c | |
parent | 7bf7333d688264f6d389c1c3c87c127f484b2efa (diff) |
Allow public key ASN1 methods to set PKCS#7 SignerInfo structures.
Diffstat (limited to 'crypto/ec/ec_ameth.c')
-rw-r--r-- | crypto/ec/ec_ameth.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/crypto/ec/ec_ameth.c b/crypto/ec/ec_ameth.c index 18c4265cfc..e4b8aa68bd 100644 --- a/crypto/ec/ec_ameth.c +++ b/crypto/ec/ec_ameth.c @@ -570,6 +570,29 @@ static int old_ec_priv_encode(const EVP_PKEY *pkey, unsigned char **pder) return i2d_ECPrivateKey(pkey->pkey.ec, pder); } +static int ec_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) + { + switch (op) + { + case ASN1_PKEY_CTRL_PKCS7_SIGN: + if (arg1 == 0) + { + X509_ALGOR *alg1, *alg2; + PKCS7_SIGNER_INFO_get0_algs(arg2, NULL, &alg1, &alg2); + X509_ALGOR_set0(alg1, OBJ_nid2obj(NID_sha1), + V_ASN1_NULL, 0); + X509_ALGOR_set0(alg2, OBJ_nid2obj(NID_ecdsa_with_SHA1), + V_ASN1_NULL, 0); + } + return 1; + + default: + return -2; + + } + + } + EVP_PKEY_ASN1_METHOD eckey_asn1_meth = { EVP_PKEY_EC, @@ -598,7 +621,7 @@ EVP_PKEY_ASN1_METHOD eckey_asn1_meth = eckey_param_print, int_ec_free, - 0, + ec_pkey_ctrl, old_ec_priv_decode, old_ec_priv_encode }; |