summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn.h
diff options
context:
space:
mode:
authorbeck <>2017-01-21 09:38:59 +0000
committerbeck <>2017-01-21 09:38:59 +0000
commitba7dab5b77b1e4dd797dbe7a4c31b5f4cbea0cd7 (patch)
treea68beae7892dad13fd8d76ba1fc45e6570e3360b /src/lib/libcrypto/bn/bn.h
parent0c45e4e4d42eacefe309063241d5a7f6de6674e7 (diff)
downloadopenbsd-ba7dab5b77b1e4dd797dbe7a4c31b5f4cbea0cd7.tar.gz
openbsd-ba7dab5b77b1e4dd797dbe7a4c31b5f4cbea0cd7.tar.bz2
openbsd-ba7dab5b77b1e4dd797dbe7a4c31b5f4cbea0cd7.zip
Make explicit _ct and _nonct versions of bn_mod_exp funcitons that
matter for constant time, and make the public interface only used external to the library. This moves us to a model where the important things are constant time versions unless you ask for them not to be, rather than the opposite. I'll continue with this method by method. Add regress tests for same. ok jsing@
Diffstat (limited to 'src/lib/libcrypto/bn/bn.h')
-rw-r--r--src/lib/libcrypto/bn/bn.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h
index 5f8278faa8..16ba8ae981 100644
--- a/src/lib/libcrypto/bn/bn.h
+++ b/src/lib/libcrypto/bn/bn.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn.h,v 1.32 2016/12/21 15:49:29 jsing Exp $ */ 1/* $OpenBSD: bn.h,v 1.33 2017/01/21 09:38:58 beck Exp $ */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -418,10 +418,12 @@ int BN_lshift(BIGNUM *r, const BIGNUM *a, int n);
418int BN_lshift1(BIGNUM *r, const BIGNUM *a); 418int BN_lshift1(BIGNUM *r, const BIGNUM *a);
419int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); 419int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
420 420
421#ifndef LIBRESSL_INTERNAL
421int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 422int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
422 const BIGNUM *m, BN_CTX *ctx); 423 const BIGNUM *m, BN_CTX *ctx);
423int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 424int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
424 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); 425 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
426#endif
425int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 427int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
426 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont); 428 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont);
427int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p, 429int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p,