summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa
diff options
context:
space:
mode:
authorbeck <>2015-02-11 04:05:14 +0000
committerbeck <>2015-02-11 04:05:14 +0000
commit74b6aedb7d6d115e1fa81e96806190a780392341 (patch)
treeaa9f1278214f1d7d996d30cf1959f3878cb48be1 /src/lib/libcrypto/rsa
parent16aad183ce9bacab429bd62937373a0da02849ec (diff)
downloadopenbsd-74b6aedb7d6d115e1fa81e96806190a780392341.tar.gz
openbsd-74b6aedb7d6d115e1fa81e96806190a780392341.tar.bz2
openbsd-74b6aedb7d6d115e1fa81e96806190a780392341.zip
Guenther has plans for OPENSSL_NO_CMS, so revert this for the moment.
Diffstat (limited to 'src/lib/libcrypto/rsa')
-rw-r--r--src/lib/libcrypto/rsa/rsa_ameth.c16
-rw-r--r--src/lib/libcrypto/rsa/rsa_pmeth.c25
2 files changed, 39 insertions, 2 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_ameth.c b/src/lib/libcrypto/rsa/rsa_ameth.c
index a68fcbeb11..528b72b4b9 100644
--- a/src/lib/libcrypto/rsa/rsa_ameth.c
+++ b/src/lib/libcrypto/rsa/rsa_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_ameth.c,v 1.13 2015/02/11 03:55:42 beck Exp $ */ 1/* $OpenBSD: rsa_ameth.c,v 1.14 2015/02/11 04:05:14 beck Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -66,6 +66,9 @@
66#include <openssl/rsa.h> 66#include <openssl/rsa.h>
67#include <openssl/x509.h> 67#include <openssl/x509.h>
68 68
69#ifndef OPENSSL_NO_CMS
70#include <openssl/cms.h>
71#endif
69 72
70#include "asn1_locl.h" 73#include "asn1_locl.h"
71 74
@@ -417,6 +420,17 @@ rsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
417 if (arg1 == 0) 420 if (arg1 == 0)
418 PKCS7_RECIP_INFO_get0_alg(arg2, &alg); 421 PKCS7_RECIP_INFO_get0_alg(arg2, &alg);
419 break; 422 break;
423#ifndef OPENSSL_NO_CMS
424 case ASN1_PKEY_CTRL_CMS_SIGN:
425 if (arg1 == 0)
426 CMS_SignerInfo_get0_algs(arg2, NULL, NULL, NULL, &alg);
427 break;
428
429 case ASN1_PKEY_CTRL_CMS_ENVELOPE:
430 if (arg1 == 0)
431 CMS_RecipientInfo_ktri_get0_algs(arg2, NULL, NULL, &alg);
432 break;
433#endif
420 434
421 case ASN1_PKEY_CTRL_DEFAULT_MD_NID: 435 case ASN1_PKEY_CTRL_DEFAULT_MD_NID:
422 *(int *)arg2 = NID_sha1; 436 *(int *)arg2 = NID_sha1;
diff --git a/src/lib/libcrypto/rsa/rsa_pmeth.c b/src/lib/libcrypto/rsa/rsa_pmeth.c
index 6d38a7c923..09166e105b 100644
--- a/src/lib/libcrypto/rsa/rsa_pmeth.c
+++ b/src/lib/libcrypto/rsa/rsa_pmeth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_pmeth.c,v 1.15 2015/02/11 03:55:42 beck Exp $ */ 1/* $OpenBSD: rsa_pmeth.c,v 1.16 2015/02/11 04:05:14 beck Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -69,6 +69,9 @@
69#include <openssl/rsa.h> 69#include <openssl/rsa.h>
70#include <openssl/x509.h> 70#include <openssl/x509.h>
71 71
72#ifndef OPENSSL_NO_CMS
73#include <openssl/cms.h>
74#endif
72 75
73#include "evp_locl.h" 76#include "evp_locl.h"
74#include "rsa_locl.h" 77#include "rsa_locl.h"
@@ -459,6 +462,26 @@ bad_pad:
459 case EVP_PKEY_CTRL_PKCS7_DECRYPT: 462 case EVP_PKEY_CTRL_PKCS7_DECRYPT:
460 case EVP_PKEY_CTRL_PKCS7_SIGN: 463 case EVP_PKEY_CTRL_PKCS7_SIGN:
461 return 1; 464 return 1;
465#ifndef OPENSSL_NO_CMS
466 case EVP_PKEY_CTRL_CMS_DECRYPT:
467 {
468 X509_ALGOR *alg = NULL;
469 ASN1_OBJECT *encalg = NULL;
470
471 if (p2)
472 CMS_RecipientInfo_ktri_get0_algs(p2, NULL,
473 NULL, &alg);
474 if (alg)
475 X509_ALGOR_get0(&encalg, NULL, NULL, alg);
476 if (encalg && OBJ_obj2nid(encalg) == NID_rsaesOaep)
477 rctx->pad_mode = RSA_PKCS1_OAEP_PADDING;
478 }
479 /* FALLTHROUGH */
480
481 case EVP_PKEY_CTRL_CMS_ENCRYPT:
482 case EVP_PKEY_CTRL_CMS_SIGN:
483 return 1;
484#endif
462 case EVP_PKEY_CTRL_PEER_KEY: 485 case EVP_PKEY_CTRL_PEER_KEY:
463 RSAerr(RSA_F_PKEY_RSA_CTRL, 486 RSAerr(RSA_F_PKEY_RSA_CTRL,
464 RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); 487 RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);