Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up includes #4575

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib/math/numbertheory/dsa_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <botan/internal/primality.h>

#include <botan/bigint.h>
#include <botan/hash.h>
#include <botan/numthry.h>
#include <botan/reducer.h>
Expand Down
1 change: 1 addition & 0 deletions src/lib/math/numbertheory/monty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <botan/internal/monty.h>

#include <botan/numthry.h>
#include <botan/reducer.h>
#include <botan/internal/mp_core.h>

Expand Down
2 changes: 0 additions & 2 deletions src/lib/math/numbertheory/monty_exp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

#include <botan/internal/monty_exp.h>

#include <botan/numthry.h>
#include <botan/reducer.h>
#include <botan/internal/ct_utils.h>
#include <botan/internal/monty.h>
#include <botan/internal/rounding.h>
Expand Down
1 change: 1 addition & 0 deletions src/lib/math/numbertheory/primality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <botan/internal/primality.h>

#include <botan/bigint.h>
#include <botan/numthry.h>
#include <botan/reducer.h>
#include <botan/rng.h>
#include <botan/internal/monty.h>
Expand Down
9 changes: 9 additions & 0 deletions src/lib/math/numbertheory/reducer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ BigInt Modular_Reducer::reduce(const BigInt& x) const {
return r;
}

BigInt Modular_Reducer::square(const BigInt& x) const {
secure_vector<word> ws;
BigInt x2 = x;
x2.square(ws);
BigInt r;
reduce(r, x2, ws);
return r;
}

namespace {

/*
Expand Down
9 changes: 6 additions & 3 deletions src/lib/math/numbertheory/reducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#ifndef BOTAN_MODULAR_REDUCER_H_
#define BOTAN_MODULAR_REDUCER_H_

#include <botan/numthry.h>
#include <botan/bigint.h>

BOTAN_FUTURE_INTERNAL_HEADER(reducer.h)

Expand Down Expand Up @@ -42,7 +42,7 @@ class BOTAN_PUBLIC_API(2, 0) Modular_Reducer final {
* @param x the value to square
* @return (x * x) % p
*/
BigInt square(const BigInt& x) const { return reduce(Botan::square(x)); }
BigInt square(const BigInt& x) const;

/**
* Cube mod p
Expand All @@ -54,7 +54,10 @@ class BOTAN_PUBLIC_API(2, 0) Modular_Reducer final {
/**
* Low level reduction function. Mostly for internal use.
* Sometimes useful for performance by reducing temporaries
* Reduce x mod p and place the output in out. ** X and out must not reference each other **
* Reduce x mod p and place the output in out.
*
* @warning X and out must not reference each other
*
* ws is a temporary workspace.
*/
void reduce(BigInt& out, const BigInt& x, secure_vector<word>& ws) const;
Expand Down
1 change: 0 additions & 1 deletion src/lib/misc/srp6/srp6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include <botan/dl_group.h>
#include <botan/hash.h>
#include <botan/numthry.h>
#include <botan/internal/fmt.h>

namespace Botan {
Expand Down
1 change: 1 addition & 0 deletions src/lib/prov/pkcs11/p11_rsa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#if defined(BOTAN_HAS_RSA)

#include <botan/numthry.h>
#include <botan/p11_mechanism.h>
#include <botan/pubkey.h>
#include <botan/rng.h>
Expand Down
1 change: 0 additions & 1 deletion src/lib/pubkey/dsa/dsa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include <botan/dsa.h>

#include <botan/numthry.h>
#include <botan/internal/divide.h>
#include <botan/internal/dl_scheme.h>
#include <botan/internal/keypair.h>
Expand Down
6 changes: 4 additions & 2 deletions src/lib/pubkey/ec_group/ec_inner_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@

#include <botan/asn1_obj.h>
#include <botan/bigint.h>
#include <botan/reducer.h>
#include <botan/internal/mod_inv.h>
#include <botan/internal/monty.h>
#include <botan/internal/stl_util.h>
#include <memory>
#include <span>

#if defined(BOTAN_HAS_LEGACY_EC_POINT)
#include <botan/reducer.h>
#endif

namespace Botan {

#if defined(BOTAN_HAS_LEGACY_EC_POINT)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pubkey/ec_group/legacy_ec_point/ec_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
#include <botan/ec_point.h>

#include <botan/numthry.h>
#include <botan/reducer.h>
#include <botan/rng.h>
#include <botan/internal/ct_utils.h>
#include <botan/internal/ec_inner_data.h>
#include <botan/internal/mod_inv.h>
#include <botan/internal/monty.h>
#include <botan/internal/mp_core.h>
#include <botan/internal/stl_util.h>
Expand Down
1 change: 0 additions & 1 deletion src/lib/pubkey/ecc_key/ecc_key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include <botan/ber_dec.h>
#include <botan/der_enc.h>
#include <botan/numthry.h>
#include <botan/secmem.h>
#include <botan/internal/ec_key_data.h>
#include <botan/internal/fmt.h>
Expand Down
1 change: 0 additions & 1 deletion src/lib/pubkey/ecdh/ecdh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include <botan/ecdh.h>

#include <botan/numthry.h>
#include <botan/internal/pk_ops_impl.h>

namespace Botan {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pubkey/rsa/rsa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

#include <botan/ber_dec.h>
#include <botan/der_enc.h>
#include <botan/numthry.h>
#include <botan/pss_params.h>
#include <botan/reducer.h>
#include <botan/internal/blinding.h>
#include <botan/internal/divide.h>
#include <botan/internal/emsa.h>
Expand Down
1 change: 0 additions & 1 deletion src/lib/pubkey/sm2/sm2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <botan/sm2.h>

#include <botan/hash.h>
#include <botan/numthry.h>
#include <botan/internal/keypair.h>
#include <botan/internal/loadstor.h>
#include <botan/internal/parsing.h>
Expand Down
Loading