summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/engine/hw_cryptodev.c
diff options
context:
space:
mode:
authordjm <>2008-09-06 12:20:16 +0000
committerdjm <>2008-09-06 12:20:16 +0000
commite08b42612a6c7d5705254f96233d4d7fa1907a4f (patch)
tree8bad2049c8c0044c7964fd985794ad61777e7163 /src/lib/libcrypto/engine/hw_cryptodev.c
parent38ce604e3cc97706b876b0525ddff0121115456d (diff)
downloadopenbsd-e08b42612a6c7d5705254f96233d4d7fa1907a4f.tar.gz
openbsd-e08b42612a6c7d5705254f96233d4d7fa1907a4f.tar.bz2
openbsd-e08b42612a6c7d5705254f96233d4d7fa1907a4f.zip
remerge local tweaks, update per-arch configuration headers, update
Makefiles, crank shlib_version
Diffstat (limited to 'src/lib/libcrypto/engine/hw_cryptodev.c')
-rw-r--r--src/lib/libcrypto/engine/hw_cryptodev.c20
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,
114static int cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, 114static 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);
116static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, 116static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I,
117 RSA *rsa); 117 RSA *rsa, BN_CTX *ctx);
118static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa); 118static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,
119 BN_CTX *ctx);
119static int cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, 120static 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);
121static int cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g, 122static int cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g,
@@ -978,19 +979,14 @@ err:
978} 979}
979 980
980static int 981static int
981cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) 982cryptodev_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
992static int 988static int
993cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) 989cryptodev_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 }
1024err: 1020err:
1025 zapparams(&kop); 1021 zapparams(&kop);