From f2606938c7fe74347142eecffc8fb1bf0d77cdd6 Mon Sep 17 00:00:00 2001 From: tb Date: Wed, 9 Aug 2023 09:23:03 +0000 Subject: [PATCH] Move bn_blind.c to rsa_blinding.c discussed with jsing --- lib/libcrypto/Makefile | 4 ++-- lib/libcrypto/bn/bn_local.h | 10 +--------- lib/libcrypto/{bn/bn_blind.c => rsa/rsa_blinding.c} | 4 +++- lib/libcrypto/rsa/rsa_local.h | 9 ++++++++- 4 files changed, 14 insertions(+), 13 deletions(-) rename lib/libcrypto/{bn/bn_blind.c => rsa/rsa_blinding.c} (98%) diff --git a/lib/libcrypto/Makefile b/lib/libcrypto/Makefile index c882c1a9dd0..a0d60b25fb0 100644 --- a/lib/libcrypto/Makefile +++ b/lib/libcrypto/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.153 2023/07/29 06:46:20 tb Exp $ +# $OpenBSD: Makefile,v 1.154 2023/08/09 09:23:03 tb Exp $ LIB= crypto LIBREBUILD=y @@ -168,7 +168,6 @@ SRCS+= bss_sock.c # bn/ SRCS+= bn_add.c -SRCS+= bn_blind.c SRCS+= bn_bpsw.c SRCS+= bn_const.c SRCS+= bn_convert.c @@ -534,6 +533,7 @@ SRCS+= ripemd.c # rsa/ SRCS+= rsa_ameth.c SRCS+= rsa_asn1.c +SRCS+= rsa_blinding.c SRCS+= rsa_chk.c SRCS+= rsa_crpt.c SRCS+= rsa_eay.c diff --git a/lib/libcrypto/bn/bn_local.h b/lib/libcrypto/bn/bn_local.h index 4269f801569..a9ce466db38 100644 --- a/lib/libcrypto/bn/bn_local.h +++ b/lib/libcrypto/bn/bn_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_local.h,v 1.37 2023/08/09 09:20:00 tb Exp $ */ +/* $OpenBSD: bn_local.h,v 1.38 2023/08/09 09:23:03 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -292,14 +292,6 @@ int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, BN_RECP_CTX *recp, BN_CTX *ctx); -BN_BLINDING *BN_BLINDING_new(const BIGNUM *e, const BIGNUM *mod, BN_CTX *ctx, - int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), BN_MONT_CTX *m_ctx); -void BN_BLINDING_free(BN_BLINDING *b); -int BN_BLINDING_convert(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *); -int BN_BLINDING_invert(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *); -CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *); - /* Explicitly const time / non-const time versions for internal use */ int BN_mod_exp_ct(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx); diff --git a/lib/libcrypto/bn/bn_blind.c b/lib/libcrypto/rsa/rsa_blinding.c similarity index 98% rename from lib/libcrypto/bn/bn_blind.c rename to lib/libcrypto/rsa/rsa_blinding.c index 1d0835b27ff..bc267b1c514 100644 --- a/lib/libcrypto/bn/bn_blind.c +++ b/lib/libcrypto/rsa/rsa_blinding.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_blind.c,v 1.43 2023/08/09 09:20:00 tb Exp $ */ +/* $OpenBSD: rsa_blinding.c,v 1.1 2023/08/09 09:23:03 tb Exp $ */ /* ==================================================================== * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * @@ -114,8 +114,10 @@ #include #include +#include #include "bn_local.h" +#include "rsa_local.h" #define BN_BLINDING_COUNTER 32 diff --git a/lib/libcrypto/rsa/rsa_local.h b/lib/libcrypto/rsa/rsa_local.h index e4c3040b6f1..30d18bfa926 100644 --- a/lib/libcrypto/rsa/rsa_local.h +++ b/lib/libcrypto/rsa/rsa_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_local.h,v 1.4 2023/07/28 10:05:16 tb Exp $ */ +/* $OpenBSD: rsa_local.h,v 1.5 2023/08/09 09:23:03 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -153,6 +153,13 @@ int RSA_padding_check_X931(unsigned char *to, int tlen, const unsigned char *f, int fl, int rsa_len); int RSA_X931_hash_id(int nid); +BN_BLINDING *BN_BLINDING_new(const BIGNUM *e, const BIGNUM *mod, BN_CTX *ctx, + int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), BN_MONT_CTX *m_ctx); +void BN_BLINDING_free(BN_BLINDING *b); +int BN_BLINDING_convert(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *); +int BN_BLINDING_invert(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *); +CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *); BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx); __END_HIDDEN_DECLS -- 2.20.1