diff options
author | jsing <> | 2019-10-24 15:47:15 +0000 |
---|---|---|
committer | jsing <> | 2019-10-24 15:47:15 +0000 |
commit | 50e5605acbcc6e6bf44f795b6e2747dbecef349d (patch) | |
tree | e97555b995bdb0199ee9fe306f2b474d1305fa88 | |
parent | ef4abacfcb7c75a1b082fb154737c8d3af8f14ab (diff) | |
download | openbsd-50e5605acbcc6e6bf44f795b6e2747dbecef349d.tar.gz openbsd-50e5605acbcc6e6bf44f795b6e2747dbecef349d.tar.bz2 openbsd-50e5605acbcc6e6bf44f795b6e2747dbecef349d.zip |
Provide RSA_pkey_ctx_ctrl().
This is a wrapper around EVP_PKEY_CTX_ctrl() which requires the key to be
either RSA or RSA-PSS.
From OpenSSL 1.1.1d.
ok tb@
-rw-r--r-- | src/lib/libcrypto/Symbols.list | 1 | ||||
-rw-r--r-- | src/lib/libcrypto/rsa/rsa.h | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_lib.c | 17 |
3 files changed, 20 insertions, 2 deletions
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list index e56bb9ca5c..4ec01fe9c8 100644 --- a/src/lib/libcrypto/Symbols.list +++ b/src/lib/libcrypto/Symbols.list | |||
@@ -2356,6 +2356,7 @@ RSA_padding_check_PKCS1_type_1 | |||
2356 | RSA_padding_check_PKCS1_type_2 | 2356 | RSA_padding_check_PKCS1_type_2 |
2357 | RSA_padding_check_X931 | 2357 | RSA_padding_check_X931 |
2358 | RSA_padding_check_none | 2358 | RSA_padding_check_none |
2359 | RSA_pkey_ctx_ctrl | ||
2359 | RSA_print | 2360 | RSA_print |
2360 | RSA_print_fp | 2361 | RSA_print_fp |
2361 | RSA_private_decrypt | 2362 | RSA_private_decrypt |
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h index 2aa472f501..1672297266 100644 --- a/src/lib/libcrypto/rsa/rsa.h +++ b/src/lib/libcrypto/rsa/rsa.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa.h,v 1.40 2019/06/05 15:41:33 gilles Exp $ */ | 1 | /* $OpenBSD: rsa.h,v 1.41 2019/10/24 15:47:15 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -294,6 +294,8 @@ const RSA_METHOD *RSA_PKCS1_SSLeay(void); | |||
294 | 294 | ||
295 | const RSA_METHOD *RSA_null_method(void); | 295 | const RSA_METHOD *RSA_null_method(void); |
296 | 296 | ||
297 | int RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2); | ||
298 | |||
297 | RSA *d2i_RSAPublicKey(RSA **a, const unsigned char **in, long len); | 299 | RSA *d2i_RSAPublicKey(RSA **a, const unsigned char **in, long len); |
298 | int i2d_RSAPublicKey(const RSA *a, unsigned char **out); | 300 | int i2d_RSAPublicKey(const RSA *a, unsigned char **out); |
299 | extern const ASN1_ITEM RSAPublicKey_it; | 301 | extern const ASN1_ITEM RSAPublicKey_it; |
diff --git a/src/lib/libcrypto/rsa/rsa_lib.c b/src/lib/libcrypto/rsa/rsa_lib.c index 84e1dc7eaf..bf6865d260 100644 --- a/src/lib/libcrypto/rsa/rsa_lib.c +++ b/src/lib/libcrypto/rsa/rsa_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_lib.c,v 1.37 2018/04/14 07:09:21 tb Exp $ */ | 1 | /* $OpenBSD: rsa_lib.c,v 1.38 2019/10/24 15:47:15 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -63,9 +63,12 @@ | |||
63 | #include <openssl/bn.h> | 63 | #include <openssl/bn.h> |
64 | #include <openssl/crypto.h> | 64 | #include <openssl/crypto.h> |
65 | #include <openssl/err.h> | 65 | #include <openssl/err.h> |
66 | #include <openssl/evp.h> | ||
66 | #include <openssl/lhash.h> | 67 | #include <openssl/lhash.h> |
67 | #include <openssl/rsa.h> | 68 | #include <openssl/rsa.h> |
68 | 69 | ||
70 | #include "evp_locl.h" | ||
71 | |||
69 | #ifndef OPENSSL_NO_ENGINE | 72 | #ifndef OPENSSL_NO_ENGINE |
70 | #include <openssl/engine.h> | 73 | #include <openssl/engine.h> |
71 | #endif | 74 | #endif |
@@ -365,3 +368,15 @@ RSA_set_flags(RSA *r, int flags) | |||
365 | { | 368 | { |
366 | r->flags |= flags; | 369 | r->flags |= flags; |
367 | } | 370 | } |
371 | |||
372 | int | ||
373 | RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2) | ||
374 | { | ||
375 | /* Return an error if the key type is not RSA or RSA-PSS. */ | ||
376 | if (ctx != NULL && ctx->pmeth != NULL && | ||
377 | ctx->pmeth->pkey_id != EVP_PKEY_RSA && | ||
378 | ctx->pmeth->pkey_id != EVP_PKEY_RSA_PSS) | ||
379 | return -1; | ||
380 | |||
381 | return EVP_PKEY_CTX_ctrl(ctx, -1, optype, cmd, p1, p2); | ||
382 | } | ||