aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/math/bigint
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/math/bigint')
-rw-r--r--src/lib/math/bigint/big_code.cpp12
-rw-r--r--src/lib/math/bigint/big_io.cpp2
-rw-r--r--src/lib/math/bigint/big_ops2.cpp6
-rw-r--r--src/lib/math/bigint/big_ops3.cpp2
-rw-r--r--src/lib/math/bigint/big_rand.cpp2
-rw-r--r--src/lib/math/bigint/bigint.h12
6 files changed, 18 insertions, 18 deletions
diff --git a/src/lib/math/bigint/big_code.cpp b/src/lib/math/bigint/big_code.cpp
index 17bb0bb54..299fdc246 100644
--- a/src/lib/math/bigint/big_code.cpp
+++ b/src/lib/math/bigint/big_code.cpp
@@ -24,10 +24,10 @@ void BigInt::encode(byte output[], const BigInt& n, Base base)
else if(base == Hexadecimal)
{
secure_vector<byte> binary(n.encoded_size(Binary));
- n.binary_encode(&binary[0]);
+ n.binary_encode(binary.data());
hex_encode(reinterpret_cast<char*>(output),
- &binary[0], binary.size());
+ binary.data(), binary.size());
}
else if(base == Decimal)
{
@@ -54,7 +54,7 @@ void BigInt::encode(byte output[], const BigInt& n, Base base)
std::vector<byte> BigInt::encode(const BigInt& n, Base base)
{
std::vector<byte> output(n.encoded_size(base));
- encode(&output[0], n, base);
+ encode(output.data(), n, base);
if(base != Binary)
for(size_t j = 0; j != output.size(); ++j)
if(output[j] == 0)
@@ -68,7 +68,7 @@ std::vector<byte> BigInt::encode(const BigInt& n, Base base)
secure_vector<byte> BigInt::encode_locked(const BigInt& n, Base base)
{
secure_vector<byte> output(n.encoded_size(base));
- encode(&output[0], n, base);
+ encode(output.data(), n, base);
if(base != Binary)
for(size_t j = 0; j != output.size(); ++j)
if(output[j] == 0)
@@ -82,7 +82,7 @@ secure_vector<byte> BigInt::encode_locked(const BigInt& n, Base base)
secure_vector<byte> BigInt::encode_1363(const BigInt& n, size_t bytes)
{
secure_vector<byte> output(bytes);
- BigInt::encode_1363(&output[0], output.size(), n);
+ BigInt::encode_1363(output.data(), output.size(), n);
return output;
}
@@ -125,7 +125,7 @@ BigInt BigInt::decode(const byte buf[], size_t length, Base base)
binary = hex_decode_locked(reinterpret_cast<const char*>(buf),
length, false);
- r.binary_decode(&binary[0], binary.size());
+ r.binary_decode(binary.data(), binary.size());
}
else if(base == Decimal)
{
diff --git a/src/lib/math/bigint/big_io.cpp b/src/lib/math/bigint/big_io.cpp
index 9cd0a2cef..3e66f788d 100644
--- a/src/lib/math/bigint/big_io.cpp
+++ b/src/lib/math/bigint/big_io.cpp
@@ -31,7 +31,7 @@ std::ostream& operator<<(std::ostream& stream, const BigInt& n)
size_t skip = 0;
while(skip < buffer.size() && buffer[skip] == '0')
++skip;
- stream.write(reinterpret_cast<const char*>(&buffer[0]) + skip,
+ stream.write(reinterpret_cast<const char*>(buffer.data()) + skip,
buffer.size() - skip);
}
if(!stream.good())
diff --git a/src/lib/math/bigint/big_ops2.cpp b/src/lib/math/bigint/big_ops2.cpp
index bd74b8b0d..9a3408247 100644
--- a/src/lib/math/bigint/big_ops2.cpp
+++ b/src/lib/math/bigint/big_ops2.cpp
@@ -31,7 +31,7 @@ BigInt& BigInt::operator+=(const BigInt& y)
if(relative_size < 0)
{
secure_vector<word> z(reg_size - 1);
- bigint_sub3(&z[0], y.data(), reg_size - 1, data(), x_sw);
+ bigint_sub3(z.data(), y.data(), reg_size - 1, data(), x_sw);
std::swap(m_reg, z);
set_sign(y.sign());
}
@@ -119,8 +119,8 @@ BigInt& BigInt::operator*=(const BigInt& y)
secure_vector<word> z(data(), data() + x_sw);
secure_vector<word> workspace(size());
- bigint_mul(mutable_data(), size(), &workspace[0],
- &z[0], z.size(), x_sw,
+ bigint_mul(mutable_data(), size(), workspace.data(),
+ z.data(), z.size(), x_sw,
y.data(), y.size(), y_sw);
}
diff --git a/src/lib/math/bigint/big_ops3.cpp b/src/lib/math/bigint/big_ops3.cpp
index 35633ee27..6cf837020 100644
--- a/src/lib/math/bigint/big_ops3.cpp
+++ b/src/lib/math/bigint/big_ops3.cpp
@@ -93,7 +93,7 @@ BigInt operator*(const BigInt& x, const BigInt& y)
else if(x_sw && y_sw)
{
secure_vector<word> workspace(z.size());
- bigint_mul(z.mutable_data(), z.size(), &workspace[0],
+ bigint_mul(z.mutable_data(), z.size(), workspace.data(),
x.data(), x.size(), x_sw,
y.data(), y.size(), y_sw);
}
diff --git a/src/lib/math/bigint/big_rand.cpp b/src/lib/math/bigint/big_rand.cpp
index 7a843acd5..ab66c6cdd 100644
--- a/src/lib/math/bigint/big_rand.cpp
+++ b/src/lib/math/bigint/big_rand.cpp
@@ -27,7 +27,7 @@ void BigInt::randomize(RandomNumberGenerator& rng,
if(bitsize % 8)
array[0] &= 0xFF >> (8 - (bitsize % 8));
array[0] |= 0x80 >> ((bitsize % 8) ? (8 - bitsize % 8) : 0);
- binary_decode(&array[0], array.size());
+ binary_decode(array.data(), array.size());
}
}
diff --git a/src/lib/math/bigint/bigint.h b/src/lib/math/bigint/bigint.h
index ba5d7198f..3f329c451 100644
--- a/src/lib/math/bigint/bigint.h
+++ b/src/lib/math/bigint/bigint.h
@@ -384,7 +384,7 @@ class BOTAN_DLL BigInt
*/
size_t sig_words() const
{
- const word* x = &m_reg[0];
+ const word* x = m_reg.data();
size_t sig = m_reg.size();
while(sig && (x[sig-1] == 0))
@@ -408,13 +408,13 @@ class BOTAN_DLL BigInt
* Return a mutable pointer to the register
* @result a pointer to the start of the internal register
*/
- word* mutable_data() { return &m_reg[0]; }
+ word* mutable_data() { return m_reg.data(); }
/**
* Return a const pointer to the register
* @result a pointer to the start of the internal register
*/
- const word* data() const { return &m_reg[0]; }
+ const word* data() const { return m_reg.data(); }
secure_vector<word>& get_word_vector() { return m_reg; }
const secure_vector<word>& get_word_vector() const { return m_reg; }
@@ -455,7 +455,7 @@ class BOTAN_DLL BigInt
*/
void binary_decode(const secure_vector<byte>& buf)
{
- binary_decode(&buf[0], buf.size());
+ binary_decode(buf.data(), buf.size());
}
/**
@@ -531,7 +531,7 @@ class BOTAN_DLL BigInt
static BigInt decode(const secure_vector<byte>& buf,
Base base = Binary)
{
- return BigInt::decode(&buf[0], buf.size(), base);
+ return BigInt::decode(buf.data(), buf.size(), base);
}
/**
@@ -543,7 +543,7 @@ class BOTAN_DLL BigInt
static BigInt decode(const std::vector<byte>& buf,
Base base = Binary)
{
- return BigInt::decode(&buf[0], buf.size(), base);
+ return BigInt::decode(buf.data(), buf.size(), base);
}
/**