aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/math
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/math')
-rw-r--r--src/lib/math/bigint/big_code.cpp30
-rw-r--r--src/lib/math/bigint/big_io.cpp2
-rw-r--r--src/lib/math/bigint/big_ops2.cpp4
-rw-r--r--src/lib/math/bigint/big_ops3.cpp4
-rw-r--r--src/lib/math/bigint/big_rand.cpp2
-rw-r--r--src/lib/math/bigint/bigint.cpp30
-rw-r--r--src/lib/math/bigint/bigint.h48
-rw-r--r--src/lib/math/bigint/divide.cpp2
-rw-r--r--src/lib/math/ec_gfp/curve_nistp.cpp216
-rw-r--r--src/lib/math/ec_gfp/point_gfp.cpp26
-rw-r--r--src/lib/math/ec_gfp/point_gfp.h6
-rw-r--r--src/lib/math/mp/mp_core.cpp2
-rw-r--r--src/lib/math/mp/mp_core.h2
-rw-r--r--src/lib/math/mp/mp_karat.cpp6
-rw-r--r--src/lib/math/mp/mp_madd.h6
-rw-r--r--src/lib/math/mp/mp_types.h8
-rw-r--r--src/lib/math/numbertheory/dsa_gen.cpp14
-rw-r--r--src/lib/math/numbertheory/jacobi.cpp4
-rw-r--r--src/lib/math/numbertheory/make_prm.cpp4
-rw-r--r--src/lib/math/numbertheory/numthry.cpp2
-rw-r--r--src/lib/math/numbertheory/numthry.h8
-rw-r--r--src/lib/math/numbertheory/powm_fw.cpp2
-rw-r--r--src/lib/math/numbertheory/powm_mnt.cpp2
-rw-r--r--src/lib/math/numbertheory/primes.cpp2
24 files changed, 216 insertions, 216 deletions
diff --git a/src/lib/math/bigint/big_code.cpp b/src/lib/math/bigint/big_code.cpp
index c8687715d..f7ab53291 100644
--- a/src/lib/math/bigint/big_code.cpp
+++ b/src/lib/math/bigint/big_code.cpp
@@ -15,7 +15,7 @@ namespace Botan {
/*
* Encode a BigInt
*/
-void BigInt::encode(byte output[], const BigInt& n, Base base)
+void BigInt::encode(uint8_t output[], const BigInt& n, Base base)
{
if(base == Binary)
{
@@ -23,7 +23,7 @@ void BigInt::encode(byte output[], const BigInt& n, Base base)
}
else if(base == Hexadecimal)
{
- secure_vector<byte> binary(n.encoded_size(Binary));
+ secure_vector<uint8_t> binary(n.encoded_size(Binary));
n.binary_encode(binary.data());
hex_encode(reinterpret_cast<char*>(output),
@@ -39,7 +39,7 @@ void BigInt::encode(byte output[], const BigInt& n, Base base)
{
divide(copy, 10, copy, remainder);
output[output_size - 1 - j] =
- Charset::digit2char(static_cast<byte>(remainder.word_at(0)));
+ Charset::digit2char(static_cast<uint8_t>(remainder.word_at(0)));
if(copy.is_zero())
break;
}
@@ -51,9 +51,9 @@ void BigInt::encode(byte output[], const BigInt& n, Base base)
/*
* Encode a BigInt
*/
-std::vector<byte> BigInt::encode(const BigInt& n, Base base)
+std::vector<uint8_t> BigInt::encode(const BigInt& n, Base base)
{
- std::vector<byte> output(n.encoded_size(base));
+ std::vector<uint8_t> output(n.encoded_size(base));
encode(output.data(), n, base);
if(base != Binary)
for(size_t j = 0; j != output.size(); ++j)
@@ -65,9 +65,9 @@ std::vector<byte> BigInt::encode(const BigInt& n, Base base)
/*
* Encode a BigInt
*/
-secure_vector<byte> BigInt::encode_locked(const BigInt& n, Base base)
+secure_vector<uint8_t> BigInt::encode_locked(const BigInt& n, Base base)
{
- secure_vector<byte> output(n.encoded_size(base));
+ secure_vector<uint8_t> output(n.encoded_size(base));
encode(output.data(), n, base);
if(base != Binary)
for(size_t j = 0; j != output.size(); ++j)
@@ -79,15 +79,15 @@ secure_vector<byte> BigInt::encode_locked(const BigInt& n, Base base)
/*
* Encode a BigInt, with leading 0s if needed
*/
-secure_vector<byte> BigInt::encode_1363(const BigInt& n, size_t bytes)
+secure_vector<uint8_t> BigInt::encode_1363(const BigInt& n, size_t bytes)
{
- secure_vector<byte> output(bytes);
+ secure_vector<uint8_t> output(bytes);
BigInt::encode_1363(output.data(), output.size(), n);
return output;
}
//static
-void BigInt::encode_1363(byte output[], size_t bytes, const BigInt& n)
+void BigInt::encode_1363(uint8_t output[], size_t bytes, const BigInt& n)
{
const size_t n_bytes = n.bytes();
if(n_bytes > bytes)
@@ -100,9 +100,9 @@ void BigInt::encode_1363(byte output[], size_t bytes, const BigInt& n)
/*
* Encode two BigInt, with leading 0s if needed, and concatenate
*/
-secure_vector<byte> BigInt::encode_fixed_length_int_pair(const BigInt& n1, const BigInt& n2, size_t bytes)
+secure_vector<uint8_t> BigInt::encode_fixed_length_int_pair(const BigInt& n1, const BigInt& n2, size_t bytes)
{
- secure_vector<byte> output(2 * bytes);
+ secure_vector<uint8_t> output(2 * bytes);
BigInt::encode_1363(output.data(), bytes, n1);
BigInt::encode_1363(output.data() + bytes, bytes, n2);
return output;
@@ -111,14 +111,14 @@ secure_vector<byte> BigInt::encode_fixed_length_int_pair(const BigInt& n1, const
/*
* Decode a BigInt
*/
-BigInt BigInt::decode(const byte buf[], size_t length, Base base)
+BigInt BigInt::decode(const uint8_t buf[], size_t length, Base base)
{
BigInt r;
if(base == Binary)
r.binary_decode(buf, length);
else if(base == Hexadecimal)
{
- secure_vector<byte> binary;
+ secure_vector<uint8_t> binary;
if(length % 2)
{
@@ -149,7 +149,7 @@ BigInt BigInt::decode(const byte buf[], size_t length, Base base)
throw Invalid_Argument("BigInt::decode: "
"Invalid character in decimal input");
- const byte x = Charset::char2digit(buf[i]);
+ const uint8_t x = Charset::char2digit(buf[i]);
if(x >= 10)
throw Invalid_Argument("BigInt: Invalid decimal string");
diff --git a/src/lib/math/bigint/big_io.cpp b/src/lib/math/bigint/big_io.cpp
index 779f8ccb7..088b1daf7 100644
--- a/src/lib/math/bigint/big_io.cpp
+++ b/src/lib/math/bigint/big_io.cpp
@@ -27,7 +27,7 @@ std::ostream& operator<<(std::ostream& stream, const BigInt& n)
{
if(n < 0)
stream.write("-", 1);
- const std::vector<byte> buffer = BigInt::encode(n, base);
+ const std::vector<uint8_t> buffer = BigInt::encode(n, base);
size_t skip = 0;
while(skip < buffer.size() && buffer[skip] == '0')
++skip;
diff --git a/src/lib/math/bigint/big_ops2.cpp b/src/lib/math/bigint/big_ops2.cpp
index 6e234f036..48d547af0 100644
--- a/src/lib/math/bigint/big_ops2.cpp
+++ b/src/lib/math/bigint/big_ops2.cpp
@@ -27,7 +27,7 @@ BigInt& BigInt::operator+=(const BigInt& y)
bigint_add2(mutable_data(), reg_size - 1, y.data(), y_sw);
else
{
- s32bit relative_size = bigint_cmp(data(), x_sw, y.data(), y_sw);
+ int32_t relative_size = bigint_cmp(data(), x_sw, y.data(), y_sw);
if(relative_size < 0)
{
@@ -55,7 +55,7 @@ BigInt& BigInt::operator-=(const BigInt& y)
{
const size_t x_sw = sig_words(), y_sw = y.sig_words();
- s32bit relative_size = bigint_cmp(data(), x_sw, y.data(), y_sw);
+ int32_t relative_size = bigint_cmp(data(), x_sw, y.data(), y_sw);
const size_t reg_size = std::max(x_sw, y_sw) + 1;
grow_to(reg_size);
diff --git a/src/lib/math/bigint/big_ops3.cpp b/src/lib/math/bigint/big_ops3.cpp
index 24927b4fc..a864fa96c 100644
--- a/src/lib/math/bigint/big_ops3.cpp
+++ b/src/lib/math/bigint/big_ops3.cpp
@@ -27,7 +27,7 @@ BigInt operator+(const BigInt& x, const BigInt& y)
bigint_add3(z.mutable_data(), x.data(), x_sw, y.data(), y_sw);
else
{
- s32bit relative_size = bigint_cmp(x.data(), x_sw, y.data(), y_sw);
+ int32_t relative_size = bigint_cmp(x.data(), x_sw, y.data(), y_sw);
if(relative_size < 0)
{
@@ -50,7 +50,7 @@ BigInt operator-(const BigInt& x, const BigInt& y)
{
const size_t x_sw = x.sig_words(), y_sw = y.sig_words();
- s32bit relative_size = bigint_cmp(x.data(), x_sw, y.data(), y_sw);
+ int32_t relative_size = bigint_cmp(x.data(), x_sw, y.data(), y_sw);
BigInt z(BigInt::Positive, std::max(x_sw, y_sw) + 1);
diff --git a/src/lib/math/bigint/big_rand.cpp b/src/lib/math/bigint/big_rand.cpp
index 73f3cf070..506e9776a 100644
--- a/src/lib/math/bigint/big_rand.cpp
+++ b/src/lib/math/bigint/big_rand.cpp
@@ -25,7 +25,7 @@ void BigInt::randomize(RandomNumberGenerator& rng,
}
else
{
- secure_vector<byte> array = rng.random_vec(round_up(bitsize, 8) / 8);
+ secure_vector<uint8_t> array = rng.random_vec(round_up(bitsize, 8) / 8);
// Always cut unwanted bits
if(bitsize % 8)
diff --git a/src/lib/math/bigint/bigint.cpp b/src/lib/math/bigint/bigint.cpp
index 2acfabb99..a91a685e0 100644
--- a/src/lib/math/bigint/bigint.cpp
+++ b/src/lib/math/bigint/bigint.cpp
@@ -17,12 +17,12 @@ namespace Botan {
/*
* Construct a BigInt from a regular number
*/
-BigInt::BigInt(u64bit n)
+BigInt::BigInt(uint64_t n)
{
if(n == 0)
return;
- const size_t limbs_needed = sizeof(u64bit) / sizeof(word);
+ const size_t limbs_needed = sizeof(uint64_t) / sizeof(word);
m_reg.resize(4*limbs_needed);
for(size_t i = 0; i != limbs_needed; ++i)
@@ -69,7 +69,7 @@ BigInt::BigInt(const std::string& str)
base = Hexadecimal;
}
- *this = decode(reinterpret_cast<const byte*>(str.data()) + markers,
+ *this = decode(reinterpret_cast<const uint8_t*>(str.data()) + markers,
str.length() - markers, base);
if(negative) set_sign(Negative);
@@ -79,7 +79,7 @@ BigInt::BigInt(const std::string& str)
/*
* Construct a BigInt from an encoded BigInt
*/
-BigInt::BigInt(const byte input[], size_t length, Base base)
+BigInt::BigInt(const uint8_t input[], size_t length, Base base)
{
*this = decode(input, length, base);
}
@@ -95,7 +95,7 @@ BigInt::BigInt(RandomNumberGenerator& rng, size_t bits, bool set_high_bit)
/*
* Comparison Function
*/
-s32bit BigInt::cmp(const BigInt& other, bool check_signs) const
+int32_t BigInt::cmp(const BigInt& other, bool check_signs) const
{
if(check_signs)
{
@@ -117,35 +117,35 @@ s32bit BigInt::cmp(const BigInt& other, bool check_signs) const
/*
* Return bits {offset...offset+length}
*/
-u32bit BigInt::get_substring(size_t offset, size_t length) const
+uint32_t BigInt::get_substring(size_t offset, size_t length) const
{
if(length > 32)
throw Invalid_Argument("BigInt::get_substring: Substring size too big");
- u64bit piece = 0;
+ uint64_t piece = 0;
for(size_t i = 0; i != 8; ++i)
{
- const byte part = byte_at((offset / 8) + (7-i));
+ const uint8_t part = byte_at((offset / 8) + (7-i));
piece = (piece << 8) | part;
}
- const u64bit mask = (static_cast<u64bit>(1) << length) - 1;
+ const uint64_t mask = (static_cast<uint64_t>(1) << length) - 1;
const size_t shift = (offset % 8);
- return static_cast<u32bit>((piece >> shift) & mask);
+ return static_cast<uint32_t>((piece >> shift) & mask);
}
/*
-* Convert this number to a u32bit, if possible
+* Convert this number to a uint32_t, if possible
*/
-u32bit BigInt::to_u32bit() const
+uint32_t BigInt::to_u32bit() const
{
if(is_negative())
throw Encoding_Error("BigInt::to_u32bit: Number is negative");
if(bits() > 32)
throw Encoding_Error("BigInt::to_u32bit: Number is too big to convert");
- u32bit out = 0;
+ uint32_t out = 0;
for(size_t i = 0; i != 4; ++i)
out = (out << 8) | byte_at(3-i);
return out;
@@ -267,7 +267,7 @@ void BigInt::grow_to(size_t n)
/*
* Encode this number into bytes
*/
-void BigInt::binary_encode(byte output[]) const
+void BigInt::binary_encode(uint8_t output[]) const
{
const size_t sig_bytes = bytes();
for(size_t i = 0; i != sig_bytes; ++i)
@@ -277,7 +277,7 @@ void BigInt::binary_encode(byte output[]) const
/*
* Set this number to the value in buf
*/
-void BigInt::binary_decode(const byte buf[], size_t length)
+void BigInt::binary_decode(const uint8_t buf[], size_t length)
{
const size_t WORD_BYTES = sizeof(word);
diff --git a/src/lib/math/bigint/bigint.h b/src/lib/math/bigint/bigint.h
index a61bee39c..42fe60e41 100644
--- a/src/lib/math/bigint/bigint.h
+++ b/src/lib/math/bigint/bigint.h
@@ -48,7 +48,7 @@ class BOTAN_DLL BigInt
* Create BigInt from 64 bit integer
* @param n initial value of this BigInt
*/
- BigInt(u64bit n);
+ BigInt(uint64_t n);
/**
* Copy Constructor
@@ -71,7 +71,7 @@ class BOTAN_DLL BigInt
* @param length size of buf
* @param base is the number base of the integer in buf
*/
- BigInt(const byte buf[], size_t length, Base base = Binary);
+ BigInt(const uint8_t buf[], size_t length, Base base = Binary);
/**
* \brief Create a random BigInt of the specified size
@@ -223,7 +223,7 @@ class BOTAN_DLL BigInt
* @result if (this<n) return -1, if (this>n) return 1, if both
* values are identical return 0 [like Perl's <=> operator]
*/
- s32bit cmp(const BigInt& n, bool check_signs = true) const;
+ int32_t cmp(const BigInt& n, bool check_signs = true) const;
/**
* Test if the integer has an even value
@@ -308,20 +308,20 @@ class BOTAN_DLL BigInt
* @result the integer extracted from the register starting at
* offset with specified length
*/
- u32bit get_substring(size_t offset, size_t length) const;
+ uint32_t get_substring(size_t offset, size_t length) const;
/**
- * Convert this value into a u32bit, if it is in the range
+ * Convert this value into a uint32_t, if it is in the range
* [0 ... 2**32-1], or otherwise throw an exception.
- * @result the value as a u32bit if conversion is possible
+ * @result the value as a uint32_t if conversion is possible
*/
- u32bit to_u32bit() const;
+ uint32_t to_u32bit() const;
/**
* @param n the offset to get a byte from
* @result byte at offset n
*/
- byte byte_at(size_t n) const
+ uint8_t byte_at(size_t n) const
{
return get_byte(sizeof(word) - (n % sizeof(word)) - 1,
word_at(n / sizeof(word)));
@@ -450,20 +450,20 @@ class BOTAN_DLL BigInt
* Store BigInt-value in a given byte array
* @param buf destination byte array for the integer value
*/
- void binary_encode(byte buf[]) const;
+ void binary_encode(uint8_t buf[]) const;
/**
* Read integer value from a byte array with given size
* @param buf byte array buffer containing the integer
* @param length size of buf
*/
- void binary_decode(const byte buf[], size_t length);
+ void binary_decode(const uint8_t buf[], size_t length);
/**
- * Read integer value from a byte array (secure_vector<byte>)
+ * Read integer value from a byte array (secure_vector<uint8_t>)
* @param buf the array to load from
*/
- void binary_decode(const secure_vector<byte>& buf)
+ void binary_decode(const secure_vector<uint8_t>& buf)
{
binary_decode(buf.data(), buf.size());
}
@@ -502,7 +502,7 @@ class BOTAN_DLL BigInt
* @param base number-base of resulting byte array representation
* @result secure_vector of bytes containing the integer with given base
*/
- static std::vector<byte> encode(const BigInt& n, Base base = Binary);
+ static std::vector<uint8_t> encode(const BigInt& n, Base base = Binary);
/**
* Encode the integer value from a BigInt to a secure_vector of bytes
@@ -510,7 +510,7 @@ class BOTAN_DLL BigInt
* @param base number-base of resulting byte array representation
* @result secure_vector of bytes containing the integer with given base
*/
- static secure_vector<byte> encode_locked(const BigInt& n,
+ static secure_vector<uint8_t> encode_locked(const BigInt& n,
Base base = Binary);
/**
@@ -520,7 +520,7 @@ class BOTAN_DLL BigInt
* @param n the BigInt to use as integer source
* @param base number-base of resulting byte array representation
*/
- static void encode(byte buf[], const BigInt& n, Base base = Binary);
+ static void encode(uint8_t buf[], const BigInt& n, Base base = Binary);
/**
* Create a BigInt from an integer in a byte array
@@ -529,7 +529,7 @@ class BOTAN_DLL BigInt
* @param base number-base of the integer in buf
* @result BigInt representing the integer in the byte array
*/
- static BigInt decode(const byte buf[], size_t length,
+ static BigInt decode(const uint8_t buf[], size_t length,
Base base = Binary);
/**
@@ -538,7 +538,7 @@ class BOTAN_DLL BigInt
* @param base number-base of the integer in buf
* @result BigInt representing the integer in the byte array
*/
- static BigInt decode(const secure_vector<byte>& buf,
+ static BigInt decode(const secure_vector<uint8_t>& buf,
Base base = Binary)
{
return BigInt::decode(buf.data(), buf.size(), base);
@@ -550,7 +550,7 @@ class BOTAN_DLL BigInt
* @param base number-base of the integer in buf
* @result BigInt representing the integer in the byte array
*/
- static BigInt decode(const std::vector<byte>& buf,
+ static BigInt decode(const std::vector<uint8_t>& buf,
Base base = Binary)
{
return BigInt::decode(buf.data(), buf.size(), base);
@@ -559,21 +559,21 @@ class BOTAN_DLL BigInt
/**
* Encode a BigInt to a byte array according to IEEE 1363
* @param n the BigInt to encode
- * @param bytes the length of the resulting secure_vector<byte>
- * @result a secure_vector<byte> containing the encoded BigInt
+ * @param bytes the length of the resulting secure_vector<uint8_t>
+ * @result a secure_vector<uint8_t> containing the encoded BigInt
*/
- static secure_vector<byte> encode_1363(const BigInt& n, size_t bytes);
+ static secure_vector<uint8_t> encode_1363(const BigInt& n, size_t bytes);
- static void encode_1363(byte out[], size_t bytes, const BigInt& n);
+ static void encode_1363(uint8_t out[], size_t bytes, const BigInt& n);
/**
* Encode two BigInt to a byte array according to IEEE 1363
* @param n1 the first BigInt to encode
* @param n2 the second BigInt to encode
* @param bytes the length of the encoding of each single BigInt
- * @result a secure_vector<byte> containing the concatenation of the two encoded BigInt
+ * @result a secure_vector<uint8_t> containing the concatenation of the two encoded BigInt
*/
- static secure_vector<byte> encode_fixed_length_int_pair(const BigInt& n1, const BigInt& n2, size_t bytes);
+ static secure_vector<uint8_t> encode_fixed_length_int_pair(const BigInt& n1, const BigInt& n2, size_t bytes);
private:
secure_vector<word> m_reg;
diff --git a/src/lib/math/bigint/divide.cpp b/src/lib/math/bigint/divide.cpp
index ec4ba3f9f..13696d6d3 100644
--- a/src/lib/math/bigint/divide.cpp
+++ b/src/lib/math/bigint/divide.cpp
@@ -69,7 +69,7 @@ void divide(const BigInt& x, const BigInt& y_arg, BigInt& q, BigInt& r)
r.set_sign(BigInt::Positive);
y.set_sign(BigInt::Positive);
- s32bit compare = r.cmp(y);
+ int32_t compare = r.cmp(y);
if(compare == 0)
{
diff --git a/src/lib/math/ec_gfp/curve_nistp.cpp b/src/lib/math/ec_gfp/curve_nistp.cpp
index 176409dbf..fb94a81d2 100644
--- a/src/lib/math/ec_gfp/curve_nistp.cpp
+++ b/src/lib/math/ec_gfp/curve_nistp.cpp
@@ -89,12 +89,12 @@ namespace {
* Treating this MPI as a sequence of 32-bit words in big-endian
* order, return word i (or 0 if out of range)
*/
-inline u32bit get_u32bit(const BigInt& x, size_t i)
+inline uint32_t get_uint32_t(const BigInt& x, size_t i)
{
#if (BOTAN_MP_WORD_BITS == 32)
return x.word_at(i);
#elif (BOTAN_MP_WORD_BITS == 64)
- return static_cast<u32bit>(x.word_at(i/2) >> ((i % 2)*32));
+ return static_cast<uint32_t>(x.word_at(i/2) >> ((i % 2)*32));
#else
#error "Not implemented"
#endif
@@ -105,9 +105,9 @@ inline u32bit get_u32bit(const BigInt& x, size_t i)
* order, set word i to the value x
*/
template<typename T>
-inline void set_u32bit(BigInt& x, size_t i, T v_in)
+inline void set_uint32_t(BigInt& x, size_t i, T v_in)
{
- const u32bit v = static_cast<u32bit>(v_in);
+ const uint32_t v = static_cast<uint32_t>(v_in);
#if (BOTAN_MP_WORD_BITS == 32)
x.set_word_at(i, v);
#elif (BOTAN_MP_WORD_BITS == 64)
@@ -129,56 +129,56 @@ const BigInt& prime_p192()
void redc_p192(BigInt& x, secure_vector<word>& ws)
{
- const u32bit X6 = get_u32bit(x, 6);
- const u32bit X7 = get_u32bit(x, 7);
- const u32bit X8 = get_u32bit(x, 8);
- const u32bit X9 = get_u32bit(x, 9);
- const u32bit X10 = get_u32bit(x, 10);
- const u32bit X11 = get_u32bit(x, 11);
+ const uint32_t X6 = get_uint32_t(x, 6);
+ const uint32_t X7 = get_uint32_t(x, 7);
+ const uint32_t X8 = get_uint32_t(x, 8);
+ const uint32_t X9 = get_uint32_t(x, 9);
+ const uint32_t X10 = get_uint32_t(x, 10);
+ const uint32_t X11 = get_uint32_t(x, 11);
x.mask_bits(192);
- u64bit S = 0;
+ uint64_t S = 0;
- S += get_u32bit(x, 0);
+ S += get_uint32_t(x, 0);
S += X6;
S += X10;
- set_u32bit(x, 0, S);
+ set_uint32_t(x, 0, S);
S >>= 32;
- S += get_u32bit(x, 1);
+ S += get_uint32_t(x, 1);
S += X7;
S += X11;
- set_u32bit(x, 1, S);
+ set_uint32_t(x, 1, S);
S >>= 32;
- S += get_u32bit(x, 2);
+ S += get_uint32_t(x, 2);
S += X6;
S += X8;
S += X10;
- set_u32bit(x, 2, S);
+ set_uint32_t(x, 2, S);
S >>= 32;
- S += get_u32bit(x, 3);
+ S += get_uint32_t(x, 3);
S += X7;
S += X9;
S += X11;
- set_u32bit(x, 3, S);
+ set_uint32_t(x, 3, S);
S >>= 32;
- S += get_u32bit(x, 4);
+ S += get_uint32_t(x, 4);
S += X8;
S += X10;
- set_u32bit(x, 4, S);
+ set_uint32_t(x, 4, S);
S >>= 32;
- S += get_u32bit(x, 5);
+ S += get_uint32_t(x, 5);
S += X9;
S += X11;
- set_u32bit(x, 5, S);
+ set_uint32_t(x, 5, S);
S >>= 32;
- set_u32bit(x, 6, S);
+ set_uint32_t(x, 6, S);
// No underflow possible
@@ -193,13 +193,13 @@ const BigInt& prime_p224()
void redc_p224(BigInt& x, secure_vector<word>& ws)
{
- const u32bit X7 = get_u32bit(x, 7);
- const u32bit X8 = get_u32bit(x, 8);
- const u32bit X9 = get_u32bit(x, 9);
- const u32bit X10 = get_u32bit(x, 10);
- const u32bit X11 = get_u32bit(x, 11);
- const u32bit X12 = get_u32bit(x, 12);
- const u32bit X13 = get_u32bit(x, 13);
+ const uint32_t X7 = get_uint32_t(x, 7);
+ const uint32_t X8 = get_uint32_t(x, 8);
+ const uint32_t X9 = get_uint32_t(x, 9);
+ const uint32_t X10 = get_uint32_t(x, 10);
+ const uint32_t X11 = get_uint32_t(x, 11);
+ const uint32_t X12 = get_uint32_t(x, 12);
+ const uint32_t X13 = get_uint32_t(x, 13);
x.mask_bits(224);
@@ -207,56 +207,56 @@ void redc_p224(BigInt& x, secure_vector<word>& ws)
int64_t S = 0;
- S += get_u32bit(x, 0);
+ S += get_uint32_t(x, 0);
S += 1;
S -= X7;
S -= X11;
- set_u32bit(x, 0, S);
+ set_uint32_t(x, 0, S);
S >>= 32;
- S += get_u32bit(x, 1);
+ S += get_uint32_t(x, 1);
S -= X8;
S -= X12;
- set_u32bit(x, 1, S);
+ set_uint32_t(x, 1, S);
S >>= 32;
- S += get_u32bit(x, 2);
+ S += get_uint32_t(x, 2);
S -= X9;
S -= X13;
- set_u32bit(x, 2, S);
+ set_uint32_t(x, 2, S);
S >>= 32;
- S += get_u32bit(x, 3);
+ S += get_uint32_t(x, 3);
S += 0xFFFFFFFF;
S += X7;
S += X11;
S -= X10;
- set_u32bit(x, 3, S);
+ set_uint32_t(x, 3, S);
S >>= 32;
- S += get_u32bit(x, 4);
+ S += get_uint32_t(x, 4);
S += 0xFFFFFFFF;
S += X8;
S += X12;
S -= X11;
- set_u32bit(x, 4, S);
+ set_uint32_t(x, 4, S);
S >>= 32;
- S += get_u32bit(x, 5);
+ S += get_uint32_t(x, 5);
S += 0xFFFFFFFF;
S += X9;
S += X13;
S -= X12;
- set_u32bit(x, 5, S);
+ set_uint32_t(x, 5, S);
S >>= 32;
- S += get_u32bit(x, 6);
+ S += get_uint32_t(x, 6);
S += 0xFFFFFFFF;
S += X10;
S -= X13;
- set_u32bit(x, 6, S);
+ set_uint32_t(x, 6, S);
S >>= 32;
- set_u32bit(x, 7, S);
+ set_uint32_t(x, 7, S);
BOTAN_ASSERT_EQUAL(S >> 32, 0, "No underflow");
@@ -271,14 +271,14 @@ const BigInt& prime_p256()
void redc_p256(BigInt& x, secure_vector<word>& ws)
{
- const u32bit X8 = get_u32bit(x, 8);
- const u32bit X9 = get_u32bit(x, 9);
- const u32bit X10 = get_u32bit(x, 10);
- const u32bit X11 = get_u32bit(x, 11);
- const u32bit X12 = get_u32bit(x, 12);
- const u32bit X13 = get_u32bit(x, 13);
- const u32bit X14 = get_u32bit(x, 14);
- const u32bit X15 = get_u32bit(x, 15);
+ const uint32_t X8 = get_uint32_t(x, 8);
+ const uint32_t X9 = get_uint32_t(x, 9);
+ const uint32_t X10 = get_uint32_t(x, 10);
+ const uint32_t X11 = get_uint32_t(x, 11);
+ const uint32_t X12 = get_uint32_t(x, 12);
+ const uint32_t X13 = get_uint32_t(x, 13);
+ const uint32_t X14 = get_uint32_t(x, 14);
+ const uint32_t X15 = get_uint32_t(x, 15);
x.mask_bits(256);
@@ -286,7 +286,7 @@ void redc_p256(BigInt& x, secure_vector<word>& ws)
// Adds 6 * P-256 to prevent underflow
- S = get_u32bit(x, 0);
+ S = get_uint32_t(x, 0);
S += 0xFFFFFFFA;
S += X8;
S += X9;
@@ -294,10 +294,10 @@ void redc_p256(BigInt& x, secure_vector<word>& ws)
S -= X12;
S -= X13;
S -= X14;
- set_u32bit(x, 0, S);
+ set_uint32_t(x, 0, S);
S >>= 32;
- S += get_u32bit(x, 1);
+ S += get_uint32_t(x, 1);
S += 0xFFFFFFFF;
S += X9;
S += X10;
@@ -305,20 +305,20 @@ void redc_p256(BigInt& x, secure_vector<word>& ws)
S -= X13;
S -= X14;
S -= X15;
- set_u32bit(x, 1, S);
+ set_uint32_t(x, 1, S);
S >>= 32;
- S += get_u32bit(x, 2);
+ S += get_uint32_t(x, 2);
S += 0xFFFFFFFF;
S += X10;
S += X11;
S -= X13;
S -= X14;
S -= X15;
- set_u32bit(x, 2, S);
+ set_uint32_t(x, 2, S);
S >>= 32;
- S += get_u32bit(x, 3);
+ S += get_uint32_t(x, 3);
S += 5;
S += X11;
S += X11;
@@ -328,10 +328,10 @@ void redc_p256(BigInt& x, secure_vector<word>& ws)
S -= X15;
S -= X8;
S -= X9;
- set_u32bit(x, 3, S);
+ set_uint32_t(x, 3, S);
S >>= 32;
- S += get_u32bit(x, 4);
+ S += get_uint32_t(x, 4);
S += X12;
S += X12;
S += X13;
@@ -339,10 +339,10 @@ void redc_p256(BigInt& x, secure_vector<word>& ws)
S += X14;
S -= X9;
S -= X10;
- set_u32bit(x, 4, S);
+ set_uint32_t(x, 4, S);
S >>= 32;
- S += get_u32bit(x, 5);
+ S += get_uint32_t(x, 5);
S += X13;
S += X13;
S += X14;
@@ -350,10 +350,10 @@ void redc_p256(BigInt& x, secure_vector<word>& ws)
S += X15;
S -= X10;
S -= X11;
- set_u32bit(x, 5, S);
+ set_uint32_t(x, 5, S);
S >>= 32;
- S += get_u32bit(x, 6);
+ S += get_uint32_t(x, 6);
S += 6;
S += X14;
S += X14;
@@ -363,10 +363,10 @@ void redc_p256(BigInt& x, secure_vector<word>& ws)
S += X13;
S -= X8;
S -= X9;
- set_u32bit(x, 6, S);
+ set_uint32_t(x, 6, S);
S >>= 32;
- S += get_u32bit(x, 7);
+ S += get_uint32_t(x, 7);
S += 0xFFFFFFFA;
S += X15;
S += X15;
@@ -376,11 +376,11 @@ void redc_p256(BigInt& x, secure_vector<word>& ws)
S -= X11;
S -= X12;
S -= X13;
- set_u32bit(x, 7, S);
+ set_uint32_t(x, 7, S);
S >>= 32;
S += 5;
- set_u32bit(x, 8, S);
+ set_uint32_t(x, 8, S);
BOTAN_ASSERT_EQUAL(S >> 32, 0, "No underflow");
@@ -414,51 +414,51 @@ const BigInt& prime_p384()
void redc_p384(BigInt& x, secure_vector<word>& ws)
{
- const u32bit X12 = get_u32bit(x, 12);
- const u32bit X13 = get_u32bit(x, 13);
- const u32bit X14 = get_u32bit(x, 14);
- const u32bit X15 = get_u32bit(x, 15);
- const u32bit X16 = get_u32bit(x, 16);
- const u32bit X17 = get_u32bit(x, 17);
- const u32bit X18 = get_u32bit(x, 18);
- const u32bit X19 = get_u32bit(x, 19);
- const u32bit X20 = get_u32bit(x, 20);
- const u32bit X21 = get_u32bit(x, 21);
- const u32bit X22 = get_u32bit(x, 22);
- const u32bit X23 = get_u32bit(x, 23);
+ const uint32_t X12 = get_uint32_t(x, 12);
+ const uint32_t X13 = get_uint32_t(x, 13);
+ const uint32_t X14 = get_uint32_t(x, 14);
+ const uint32_t X15 = get_uint32_t(x, 15);
+ const uint32_t X16 = get_uint32_t(x, 16);
+ const uint32_t X17 = get_uint32_t(x, 17);
+ const uint32_t X18 = get_uint32_t(x, 18);
+ const uint32_t X19 = get_uint32_t(x, 19);
+ const uint32_t X20 = get_uint32_t(x, 20);
+ const uint32_t X21 = get_uint32_t(x, 21);
+ const uint32_t X22 = get_uint32_t(x, 22);
+ const uint32_t X23 = get_uint32_t(x, 23);
x.mask_bits(384);
int64_t S = 0;
// One copy of P-384 is added to prevent underflow
- S = get_u32bit(x, 0);
+ S = get_uint32_t(x, 0);
S += 0xFFFFFFFF;
S += X12;
S += X21;
S += X20;
S -= X23;
- set_u32bit(x, 0, S);
+ set_uint32_t(x, 0, S);
S >>= 32;
- S += get_u32bit(x, 1);
+ S += get_uint32_t(x, 1);
S += X13;
S += X22;
S += X23;
S -= X12;
S -= X20;
- set_u32bit(x, 1, S);
+ set_uint32_t(x, 1, S);
S >>= 32;
- S += get_u32bit(x, 2);
+ S += get_uint32_t(x, 2);
S += X14;
S += X23;
S -= X13;
S -= X21;
- set_u32bit(x, 2, S);
+ set_uint32_t(x, 2, S);
S >>= 32;
- S += get_u32bit(x, 3);
+ S += get_uint32_t(x, 3);
S += 0xFFFFFFFF;
S += X15;
S += X12;
@@ -467,10 +467,10 @@ void redc_p384(BigInt& x, secure_vector<word>& ws)
S -= X14;
S -= X22;
S -= X23;
- set_u32bit(x, 3, S);
+ set_uint32_t(x, 3, S);
S >>= 32;
- S += get_u32bit(x, 4);
+ S += get_uint32_t(x, 4);
S += 0xFFFFFFFE;
S += X21;
S += X21;
@@ -482,10 +482,10 @@ void redc_p384(BigInt& x, secure_vector<word>& ws)
S -= X15;
S -= X23;
S -= X23;
- set_u32bit(x, 4, S);
+ set_uint32_t(x, 4, S);
S >>= 32;
- S += get_u32bit(x, 5);
+ S += get_uint32_t(x, 5);
S += 0xFFFFFFFF;
S += X22;
S += X22;
@@ -495,10 +495,10 @@ void redc_p384(BigInt& x, secure_vector<word>& ws)
S += X21;
S += X23;
S -= X16;
- set_u32bit(x, 5, S);
+ set_uint32_t(x, 5, S);
S >>= 32;
- S += get_u32bit(x, 6);
+ S += get_uint32_t(x, 6);
S += 0xFFFFFFFF;
S += X23;
S += X23;
@@ -507,56 +507,56 @@ void redc_p384(BigInt& x, secure_vector<word>& ws)
S += X14;
S += X22;
S -= X17;
- set_u32bit(x, 6, S);
+ set_uint32_t(x, 6, S);
S >>= 32;
- S += get_u32bit(x, 7);
+ S += get_uint32_t(x, 7);
S += 0xFFFFFFFF;
S += X19;
S += X16;
S += X15;
S += X23;
S -= X18;
- set_u32bit(x, 7, S);
+ set_uint32_t(x, 7, S);
S >>= 32;
- S += get_u32bit(x, 8);
+ S += get_uint32_t(x, 8);
S += 0xFFFFFFFF;
S += X20;
S += X17;
S += X16;
S -= X19;
- set_u32bit(x, 8, S);
+ set_uint32_t(x, 8, S);
S >>= 32;
- S += get_u32bit(x, 9);
+ S += get_uint32_t(x, 9);
S += 0xFFFFFFFF;
S += X21;
S += X18;
S += X17;
S -= X20;
- set_u32bit(x, 9, S);
+ set_uint32_t(x, 9, S);
S >>= 32;
- S += get_u32bit(x, 10);
+ S += get_uint32_t(x, 10);
S += 0xFFFFFFFF;
S += X22;
S += X19;
S += X18;
S -= X21;
- set_u32bit(x, 10, S);
+ set_uint32_t(x, 10, S);
S >>= 32;
- S += get_u32bit(x, 11);
+ S += get_uint32_t(x, 11);
S += 0xFFFFFFFF;
S += X23;
S += X20;
S += X19;
S -= X22;
- set_u32bit(x, 11, S);
+ set_uint32_t(x, 11, S);
S >>= 32;
BOTAN_ASSERT_EQUAL(S >> 32, 0, "No underflow");
- set_u32bit(x, 12, S);
+ set_uint32_t(x, 12, S);
#if 0
if(S >= 2)
diff --git a/src/lib/math/ec_gfp/point_gfp.cpp b/src/lib/math/ec_gfp/point_gfp.cpp
index f15911db0..bb446566e 100644
--- a/src/lib/math/ec_gfp/point_gfp.cpp
+++ b/src/lib/math/ec_gfp/point_gfp.cpp
@@ -406,7 +406,7 @@ PointGFp Blinded_Point_Multiply::blinded_multiply(const BigInt& scalar_in,
if(windows > 0)
{
windows--;
- const u32bit nibble = scalar.get_substring(windows*m_h, m_h);
+ const uint32_t nibble = scalar.get_substring(windows*m_h, m_h);
R.add(m_U[nibble], m_ws);
/*
@@ -421,7 +421,7 @@ PointGFp Blinded_Point_Multiply::blinded_multiply(const BigInt& scalar_in,
for(size_t i = 0; i != m_h; ++i)
R.mult2(m_ws);
- const u32bit inner_nibble = scalar.get_substring((windows-1)*m_h, m_h);
+ const uint32_t inner_nibble = scalar.get_substring((windows-1)*m_h, m_h);
R.add(m_U[inner_nibble], m_ws);
windows--;
}
@@ -513,22 +513,22 @@ bool PointGFp::operator==(const PointGFp& other) const
}
// encoding and decoding
-secure_vector<byte> EC2OSP(const PointGFp& point, byte format)
+secure_vector<uint8_t> EC2OSP(const PointGFp& point, uint8_t format)
{
if(point.is_zero())
- return secure_vector<byte>(1); // single 0 byte
+ return secure_vector<uint8_t>(1); // single 0 byte
const size_t p_bytes = point.get_curve().get_p().bytes();
BigInt x = point.get_affine_x();
BigInt y = point.get_affine_y();
- secure_vector<byte> bX = BigInt::encode_1363(x, p_bytes);
- secure_vector<byte> bY = BigInt::encode_1363(y, p_bytes);
+ secure_vector<uint8_t> bX = BigInt::encode_1363(x, p_bytes);
+ secure_vector<uint8_t> bY = BigInt::encode_1363(y, p_bytes);
if(format == PointGFp::UNCOMPRESSED)
{
- secure_vector<byte> result;
+ secure_vector<uint8_t> result;
result.push_back(0x04);
result += bX;
@@ -538,8 +538,8 @@ secure_vector<byte> EC2OSP(const PointGFp& point, byte format)
}
else if(format == PointGFp::COMPRESSED)
{
- secure_vector<byte> result;
- result.push_back(0x02 | static_cast<byte>(y.get_bit(0)));
+ secure_vector<uint8_t> result;
+ result.push_back(0x02 | static_cast<uint8_t>(y.get_bit(0)));
result += bX;
@@ -547,8 +547,8 @@ secure_vector<byte> EC2OSP(const PointGFp& point, byte format)
}
else if(format == PointGFp::HYBRID)
{
- secure_vector<byte> result;
- result.push_back(0x06 | static_cast<byte>(y.get_bit(0)));
+ secure_vector<uint8_t> result;
+ result.push_back(0x06 | static_cast<uint8_t>(y.get_bit(0)));
result += bX;
result += bY;
@@ -587,13 +587,13 @@ BigInt decompress_point(bool yMod2,
}
-PointGFp OS2ECP(const byte data[], size_t data_len,
+PointGFp OS2ECP(const uint8_t data[], size_t data_len,
const CurveGFp& curve)
{
if(data_len <= 1)
return PointGFp(curve); // return zero
- const byte pc = data[0];
+ const uint8_t pc = data[0];
BigInt x, y;
diff --git a/src/lib/math/ec_gfp/point_gfp.h b/src/lib/math/ec_gfp/point_gfp.h
index c64963683..6f4c7e5f9 100644
--- a/src/lib/math/ec_gfp/point_gfp.h
+++ b/src/lib/math/ec_gfp/point_gfp.h
@@ -274,13 +274,13 @@ inline PointGFp operator*(const PointGFp& point, const BigInt& scalar)
}
// encoding and decoding
-secure_vector<byte> BOTAN_DLL EC2OSP(const PointGFp& point, byte format);
+secure_vector<uint8_t> BOTAN_DLL EC2OSP(const PointGFp& point, uint8_t format);
-PointGFp BOTAN_DLL OS2ECP(const byte data[], size_t data_len,
+PointGFp BOTAN_DLL OS2ECP(const uint8_t data[], size_t data_len,
const CurveGFp& curve);
template<typename Alloc>
-PointGFp OS2ECP(const std::vector<byte, Alloc>& data, const CurveGFp& curve)
+PointGFp OS2ECP(const std::vector<uint8_t, Alloc>& data, const CurveGFp& curve)
{ return OS2ECP(data.data(), data.size(), curve); }
/**
diff --git a/src/lib/math/mp/mp_core.cpp b/src/lib/math/mp/mp_core.cpp
index 2a0b08f67..ff4efd945 100644
--- a/src/lib/math/mp/mp_core.cpp
+++ b/src/lib/math/mp/mp_core.cpp
@@ -375,7 +375,7 @@ void bigint_shr2(word y[], const word x[], size_t x_size,
/*
* Compare two MP integers
*/
-s32bit bigint_cmp(const word x[], size_t x_size,
+int32_t bigint_cmp(const word x[], size_t x_size,
const word y[], size_t y_size)
{
if(x_size < y_size) { return (-bigint_cmp(y, y_size, x, x_size)); }
diff --git a/src/lib/math/mp/mp_core.h b/src/lib/math/mp/mp_core.h
index c4ce005ba..a22d3b6ad 100644
--- a/src/lib/math/mp/mp_core.h
+++ b/src/lib/math/mp/mp_core.h
@@ -150,7 +150,7 @@ void bigint_monty_sqr(BigInt& z, const BigInt& x,
/**
* Compare x and y
*/
-s32bit bigint_cmp(const word x[], size_t x_size,
+int32_t bigint_cmp(const word x[], size_t x_size,
const word y[], size_t y_size);
/**
diff --git a/src/lib/math/mp/mp_karat.cpp b/src/lib/math/mp/mp_karat.cpp
index 62a52b88c..994100c9b 100644
--- a/src/lib/math/mp/mp_karat.cpp
+++ b/src/lib/math/mp/mp_karat.cpp
@@ -75,8 +75,8 @@ void karatsuba_mul(word z[], const word x[], const word y[], size_t N,
word* z0 = z;
word* z1 = z + N;
- const s32bit cmp0 = bigint_cmp(x0, N2, x1, N2);
- const s32bit cmp1 = bigint_cmp(y1, N2, y0, N2);
+ const int32_t cmp0 = bigint_cmp(x0, N2, x1, N2);
+ const int32_t cmp1 = bigint_cmp(y1, N2, y0, N2);
clear_mem(workspace, 2*N);
@@ -143,7 +143,7 @@ void karatsuba_sqr(word z[], const word x[], size_t N, word workspace[])
word* z0 = z;
word* z1 = z + N;
- const s32bit cmp = bigint_cmp(x0, N2, x1, N2);
+ const int32_t cmp = bigint_cmp(x0, N2, x1, N2);
clear_mem(workspace, 2*N);
diff --git a/src/lib/math/mp/mp_madd.h b/src/lib/math/mp/mp_madd.h
index 0567622d9..2fa1d88ce 100644
--- a/src/lib/math/mp/mp_madd.h
+++ b/src/lib/math/mp/mp_madd.h
@@ -15,13 +15,13 @@
namespace Botan {
#if (BOTAN_MP_WORD_BITS == 8)
- typedef u16bit dword;
+ typedef uint16_t dword;
#define BOTAN_HAS_MP_DWORD
#elif (BOTAN_MP_WORD_BITS == 16)
- typedef u32bit dword;
+ typedef uint32_t dword;
#define BOTAN_HAS_MP_DWORD
#elif (BOTAN_MP_WORD_BITS == 32)
- typedef u64bit dword;
+ typedef uint64_t dword;
#define BOTAN_HAS_MP_DWORD
#elif (BOTAN_MP_WORD_BITS == 64)
#if defined(BOTAN_TARGET_HAS_NATIVE_UINT128)
diff --git a/src/lib/math/mp/mp_types.h b/src/lib/math/mp/mp_types.h
index 69dc911fd..0b5c5055e 100644
--- a/src/lib/math/mp/mp_types.h
+++ b/src/lib/math/mp/mp_types.h
@@ -13,13 +13,13 @@
namespace Botan {
#if (BOTAN_MP_WORD_BITS == 8)
- typedef byte word;
+ typedef uint8_t word;
#elif (BOTAN_MP_WORD_BITS == 16)
- typedef u16bit word;
+ typedef uint16_t word;
#elif (BOTAN_MP_WORD_BITS == 32)
- typedef u32bit word;
+ typedef uint32_t word;
#elif (BOTAN_MP_WORD_BITS == 64)
- typedef u64bit word;
+ typedef uint64_t word;
#else
#error BOTAN_MP_WORD_BITS must be 8, 16, 32, or 64
#endif
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,