diff options
Diffstat (limited to 'src/lib/math/numbertheory')
-rw-r--r-- | src/lib/math/numbertheory/dsa_gen.cpp | 14 | ||||
-rw-r--r-- | src/lib/math/numbertheory/jacobi.cpp | 4 | ||||
-rw-r--r-- | src/lib/math/numbertheory/make_prm.cpp | 4 | ||||
-rw-r--r-- | src/lib/math/numbertheory/numthry.cpp | 2 | ||||
-rw-r--r-- | src/lib/math/numbertheory/numthry.h | 8 | ||||
-rw-r--r-- | src/lib/math/numbertheory/powm_fw.cpp | 2 | ||||
-rw-r--r-- | src/lib/math/numbertheory/powm_mnt.cpp | 2 | ||||
-rw-r--r-- | src/lib/math/numbertheory/primes.cpp | 2 |
8 files changed, 19 insertions, 19 deletions
diff --git a/src/lib/math/numbertheory/dsa_gen.cpp b/src/lib/math/numbertheory/dsa_gen.cpp index 29d1fe9bc..a01810025 100644 --- a/src/lib/math/numbertheory/dsa_gen.cpp +++ b/src/lib/math/numbertheory/dsa_gen.cpp @@ -39,7 +39,7 @@ bool fips186_3_valid_size(size_t pbits, size_t qbits) bool generate_dsa_primes(RandomNumberGenerator& rng, BigInt& p, BigInt& q, size_t pbits, size_t qbits, - const std::vector<byte>& seed_c) + const std::vector<uint8_t>& seed_c) { if(!fips186_3_valid_size(pbits, qbits)) throw Invalid_Argument( @@ -59,9 +59,9 @@ bool generate_dsa_primes(RandomNumberGenerator& rng, class Seed { public: - explicit Seed(const std::vector<byte>& s) : m_seed(s) {} + explicit Seed(const std::vector<uint8_t>& s) : m_seed(s) {} - operator std::vector<byte>& () { return m_seed; } + operator std::vector<uint8_t>& () { return m_seed; } Seed& operator++() { @@ -71,7 +71,7 @@ bool generate_dsa_primes(RandomNumberGenerator& rng, return (*this); } private: - std::vector<byte> m_seed; + std::vector<uint8_t> m_seed; }; Seed seed(seed_c); @@ -87,7 +87,7 @@ bool generate_dsa_primes(RandomNumberGenerator& rng, b = (pbits-1) % (HASH_SIZE * 8); BigInt X; - std::vector<byte> V(HASH_SIZE * (n+1)); + std::vector<uint8_t> V(HASH_SIZE * (n+1)); for(size_t j = 0; j != 4*pbits; ++j) { @@ -113,13 +113,13 @@ bool generate_dsa_primes(RandomNumberGenerator& rng, /* * Generate DSA Primes */ -std::vector<byte> generate_dsa_primes(RandomNumberGenerator& rng, +std::vector<uint8_t> generate_dsa_primes(RandomNumberGenerator& rng, BigInt& p, BigInt& q, size_t pbits, size_t qbits) { while(true) { - std::vector<byte> seed(qbits / 8); + std::vector<uint8_t> seed(qbits / 8); rng.randomize(seed.data(), seed.size()); if(generate_dsa_primes(rng, p, q, pbits, qbits, seed)) diff --git a/src/lib/math/numbertheory/jacobi.cpp b/src/lib/math/numbertheory/jacobi.cpp index 0077fb10e..d3e8d7557 100644 --- a/src/lib/math/numbertheory/jacobi.cpp +++ b/src/lib/math/numbertheory/jacobi.cpp @@ -12,7 +12,7 @@ namespace Botan { /* * Calculate the Jacobi symbol */ -s32bit jacobi(const BigInt& a, const BigInt& n) +int32_t jacobi(const BigInt& a, const BigInt& n) { if(a.is_negative()) throw Invalid_Argument("jacobi: first argument must be non-negative"); @@ -20,7 +20,7 @@ s32bit jacobi(const BigInt& a, const BigInt& n) throw Invalid_Argument("jacobi: second argument must be odd and > 1"); BigInt x = a, y = n; - s32bit J = 1; + int32_t J = 1; while(y > 1) { diff --git a/src/lib/math/numbertheory/make_prm.cpp b/src/lib/math/numbertheory/make_prm.cpp index acd187063..9443bb9a1 100644 --- a/src/lib/math/numbertheory/make_prm.cpp +++ b/src/lib/math/numbertheory/make_prm.cpp @@ -63,10 +63,10 @@ BigInt random_prime(RandomNumberGenerator& rng, p += (modulo - p % modulo) + equiv; const size_t sieve_size = std::min(bits / 2, PRIME_TABLE_SIZE); - secure_vector<u16bit> sieve(sieve_size); + secure_vector<uint16_t> sieve(sieve_size); for(size_t j = 0; j != sieve.size(); ++j) - sieve[j] = static_cast<u16bit>(p % PRIMES[j]); + sieve[j] = static_cast<uint16_t>(p % PRIMES[j]); size_t counter = 0; while(true) diff --git a/src/lib/math/numbertheory/numthry.cpp b/src/lib/math/numbertheory/numthry.cpp index 71dbf6aba..4e8a5d8cc 100644 --- a/src/lib/math/numbertheory/numthry.cpp +++ b/src/lib/math/numbertheory/numthry.cpp @@ -449,7 +449,7 @@ bool is_prime(const BigInt& n, RandomNumberGenerator& rng, // Fast path testing for small numbers (<= 65521) if(n <= PRIMES[PRIME_TABLE_SIZE-1]) { - const u16bit num = static_cast<u16bit>(n.word_at(0)); + const uint16_t num = static_cast<uint16_t>(n.word_at(0)); return std::binary_search(PRIMES, PRIMES + PRIME_TABLE_SIZE, num); } diff --git a/src/lib/math/numbertheory/numthry.h b/src/lib/math/numbertheory/numthry.h index 172c56a34..6d6991c15 100644 --- a/src/lib/math/numbertheory/numthry.h +++ b/src/lib/math/numbertheory/numthry.h @@ -116,7 +116,7 @@ BigInt BOTAN_DLL normalized_montgomery_inverse(const BigInt& a, const BigInt& b) * @param n is an odd integer > 1 * @return (n / m) */ -s32bit BOTAN_DLL jacobi(const BigInt& a, +int32_t BOTAN_DLL jacobi(const BigInt& a, const BigInt& n); /** @@ -210,7 +210,7 @@ BigInt BOTAN_DLL random_safe_prime(RandomNumberGenerator& rng, * @param qbits how long q will be in bits * @return random seed used to generate this parameter set */ -std::vector<byte> BOTAN_DLL +std::vector<uint8_t> BOTAN_DLL generate_dsa_primes(RandomNumberGenerator& rng, BigInt& p_out, BigInt& q_out, size_t pbits, size_t qbits); @@ -230,7 +230,7 @@ bool BOTAN_DLL generate_dsa_primes(RandomNumberGenerator& rng, BigInt& p_out, BigInt& q_out, size_t pbits, size_t qbits, - const std::vector<byte>& seed); + const std::vector<uint8_t>& seed); /** * The size of the PRIMES[] array @@ -240,7 +240,7 @@ const size_t PRIME_TABLE_SIZE = 6541; /** * A const array of all primes less than 65535 */ -extern const u16bit BOTAN_DLL PRIMES[]; +extern const uint16_t BOTAN_DLL PRIMES[]; } diff --git a/src/lib/math/numbertheory/powm_fw.cpp b/src/lib/math/numbertheory/powm_fw.cpp index 7d69a2602..770f345c6 100644 --- a/src/lib/math/numbertheory/powm_fw.cpp +++ b/src/lib/math/numbertheory/powm_fw.cpp @@ -48,7 +48,7 @@ BigInt Fixed_Window_Exponentiator::execute() const for(size_t j = 0; j != m_window_bits; ++j) x = m_reducer.square(x); - const u32bit nibble = m_exp.get_substring(m_window_bits*(i-1), m_window_bits); + const uint32_t nibble = m_exp.get_substring(m_window_bits*(i-1), m_window_bits); x = m_reducer.multiply(x, m_g[nibble]); } diff --git a/src/lib/math/numbertheory/powm_mnt.cpp b/src/lib/math/numbertheory/powm_mnt.cpp index 546a2739a..ba7fddef2 100644 --- a/src/lib/math/numbertheory/powm_mnt.cpp +++ b/src/lib/math/numbertheory/powm_mnt.cpp @@ -86,7 +86,7 @@ BigInt Montgomery_Exponentiator::execute() const x = z; } - const u32bit nibble = m_exp.get_substring(m_window_bits*(i-1), m_window_bits); + const uint32_t nibble = m_exp.get_substring(m_window_bits*(i-1), m_window_bits); const BigInt& y = m_g[nibble]; diff --git a/src/lib/math/numbertheory/primes.cpp b/src/lib/math/numbertheory/primes.cpp index 50229ad15..4a3eb46f2 100644 --- a/src/lib/math/numbertheory/primes.cpp +++ b/src/lib/math/numbertheory/primes.cpp @@ -9,7 +9,7 @@ namespace Botan { -const u16bit PRIMES[PRIME_TABLE_SIZE+1] = { +const uint16_t PRIMES[PRIME_TABLE_SIZE+1] = { 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, |