diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2016-11-21 00:44:01 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2017-01-08 01:42:47 +0000 |
commit | e5e04ee3983dcf5283c99ce63f3fe37093921747 (patch) | |
tree | b81377a2ebc908fdc110a599a1423d2c1eef0fe8 /crypto | |
parent | 6577e00892fc7b2ce02223e1eff77330e05ea660 (diff) |
Support RSA operations in PSS.
Add support for common operations in PSS by adding a new function
RSA_pkey_ctx_ctrl() which calls EVP_PKEY_CTX_ctrl if the key type
is RSA or PSS.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2177)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/rsa/rsa_lib.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crypto/rsa/rsa_lib.c b/crypto/rsa/rsa_lib.c index 8f934d8abc..0fbda9a9b1 100644 --- a/crypto/rsa/rsa_lib.c +++ b/crypto/rsa/rsa_lib.c @@ -13,6 +13,8 @@ #include <openssl/lhash.h> #include "internal/bn_int.h" #include <openssl/engine.h> +#include <openssl/evp.h> +#include "internal/evp_int.h" #include "rsa_locl.h" static const RSA_METHOD *default_RSA_meth = NULL; @@ -309,3 +311,13 @@ ENGINE *RSA_get0_engine(const RSA *r) { return r->engine; } + +int RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2) +{ + /* If key type not RSA or RSA-PSS return error */ + if (ctx != NULL && ctx->pmeth != NULL + && ctx->pmeth->pkey_id != EVP_PKEY_RSA + && ctx->pmeth->pkey_id != EVP_PKEY_RSA_PSS) + return -1; + return EVP_PKEY_CTX_ctrl(ctx, -1, optype, cmd, p1, p2); +} |