diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2012-02-15 14:14:01 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2012-02-15 14:14:01 +0000 |
commit | 0cd7a0325fa31189d155c2789f1a38cad72d0982 (patch) | |
tree | 6317eb25673511ced67b5e56ef56bc6944e4fc14 /crypto/rsa | |
parent | 16b7c81d55e528edd5186004ec0691e1461faeab (diff) |
Additional compatibility fix for MDC2 signature format.
Update RSA EVP_PKEY_METHOD to use the OCTET STRING form of MDC2 signature:
this will make all versions of MDC2 signature equivalent.
Diffstat (limited to 'crypto/rsa')
-rw-r--r-- | crypto/rsa/rsa_pmeth.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/crypto/rsa/rsa_pmeth.c b/crypto/rsa/rsa_pmeth.c index 2177f3f5c5..5b2ecf56ad 100644 --- a/crypto/rsa/rsa_pmeth.c +++ b/crypto/rsa/rsa_pmeth.c @@ -222,7 +222,20 @@ static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, return ret; } #endif - if (rctx->pad_mode == RSA_X931_PADDING) + + if (EVP_MD_type(rctx->md) == NID_mdc2) + { + unsigned int sltmp; + if (rctx->pad_mode != RSA_PKCS1_PADDING) + return -1; + ret = RSA_sign_ASN1_OCTET_STRING(NID_mdc2, + tbs, tbslen, sig, &sltmp, rsa); + + if (ret <= 0) + return ret; + ret = sltmp; + } + else if (rctx->pad_mode == RSA_X931_PADDING) { if (!setup_tbuf(rctx, ctx)) return -1; |