diff options
Diffstat (limited to 'src/lib/libcrypto/engine/hw_cryptodev.c')
-rw-r--r-- | src/lib/libcrypto/engine/hw_cryptodev.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/lib/libcrypto/engine/hw_cryptodev.c b/src/lib/libcrypto/engine/hw_cryptodev.c index a98f5d7e57..4af40cdfc3 100644 --- a/src/lib/libcrypto/engine/hw_cryptodev.c +++ b/src/lib/libcrypto/engine/hw_cryptodev.c | |||
@@ -114,8 +114,9 @@ static int cryptodev_asym(struct crypt_kop *kop, int rlen, BIGNUM *r, | |||
114 | static int cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, | 114 | static int cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, |
115 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | 115 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); |
116 | static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, | 116 | static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, |
117 | RSA *rsa); | 117 | RSA *rsa, BN_CTX *ctx); |
118 | static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa); | 118 | static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, |
119 | BN_CTX *ctx); | ||
119 | static int cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, | 120 | static int cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, |
120 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | 121 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); |
121 | static int cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g, | 122 | static int cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g, |
@@ -978,19 +979,14 @@ err: | |||
978 | } | 979 | } |
979 | 980 | ||
980 | static int | 981 | static int |
981 | cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | 982 | cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, |
983 | BN_CTX *ctx) | ||
982 | { | 984 | { |
983 | int r; | 985 | return (RSA_PKCS1_SSLeay()->rsa_mod_exp)(r0, I, rsa, ctx); |
984 | BN_CTX *ctx; | ||
985 | |||
986 | ctx = BN_CTX_new(); | ||
987 | r = cryptodev_bn_mod_exp(r0, I, rsa->d, rsa->n, ctx, NULL); | ||
988 | BN_CTX_free(ctx); | ||
989 | return (r); | ||
990 | } | 986 | } |
991 | 987 | ||
992 | static int | 988 | static int |
993 | cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | 989 | cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) |
994 | { | 990 | { |
995 | struct crypt_kop kop; | 991 | struct crypt_kop kop; |
996 | int ret = 1; | 992 | int ret = 1; |
@@ -1019,7 +1015,7 @@ cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | |||
1019 | 1015 | ||
1020 | if (cryptodev_asym(&kop, BN_num_bytes(rsa->n), r0, 0, NULL) == -1) { | 1016 | if (cryptodev_asym(&kop, BN_num_bytes(rsa->n), r0, 0, NULL) == -1) { |
1021 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); | 1017 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); |
1022 | ret = (*meth->rsa_mod_exp)(r0, I, rsa); | 1018 | ret = (*meth->rsa_mod_exp)(r0, I, rsa, ctx); |
1023 | } | 1019 | } |
1024 | err: | 1020 | err: |
1025 | zapparams(&kop); | 1021 | zapparams(&kop); |