summaryrefslogtreecommitdiffstats
path: root/lib/libcrypto/engine/hw_cryptodev.c
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2008-09-06 12:20:07 +0000
committerdjm <djm@openbsd.org>2008-09-06 12:20:07 +0000
commitad4707829d99325926b9ba93f85042451635891b (patch)
tree2b595cd12d7e027ce1152c0b94b860e2ee6d4b83 /lib/libcrypto/engine/hw_cryptodev.c
parentresolve conflicts (diff)
downloadwireguard-openbsd-ad4707829d99325926b9ba93f85042451635891b.tar.xz
wireguard-openbsd-ad4707829d99325926b9ba93f85042451635891b.zip
remerge local tweaks, update per-arch configuration headers, update
Makefiles, crank shlib_version
Diffstat (limited to 'lib/libcrypto/engine/hw_cryptodev.c')
-rw-r--r--lib/libcrypto/engine/hw_cryptodev.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/libcrypto/engine/hw_cryptodev.c b/lib/libcrypto/engine/hw_cryptodev.c
index a98f5d7e578..4af40cdfc34 100644
--- a/lib/libcrypto/engine/hw_cryptodev.c
+++ b/lib/libcrypto/engine/hw_cryptodev.c
@@ -114,8 +114,9 @@ static int cryptodev_asym(struct crypt_kop *kop, int rlen, BIGNUM *r,
static int cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a,
const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I,
- RSA *rsa);
-static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa);
+ RSA *rsa, BN_CTX *ctx);
+static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,
+ BN_CTX *ctx);
static int cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a,
const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
static int cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g,
@@ -978,19 +979,14 @@ err:
}
static int
-cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
+cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,
+ BN_CTX *ctx)
{
- int r;
- BN_CTX *ctx;
-
- ctx = BN_CTX_new();
- r = cryptodev_bn_mod_exp(r0, I, rsa->d, rsa->n, ctx, NULL);
- BN_CTX_free(ctx);
- return (r);
+ return (RSA_PKCS1_SSLeay()->rsa_mod_exp)(r0, I, rsa, ctx);
}
static int
-cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
+cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
{
struct crypt_kop kop;
int ret = 1;
@@ -1019,7 +1015,7 @@ cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
if (cryptodev_asym(&kop, BN_num_bytes(rsa->n), r0, 0, NULL) == -1) {
const RSA_METHOD *meth = RSA_PKCS1_SSLeay();
- ret = (*meth->rsa_mod_exp)(r0, I, rsa);
+ ret = (*meth->rsa_mod_exp)(r0, I, rsa, ctx);
}
err:
zapparams(&kop);