diff options
author | lloyd <[email protected]> | 2010-09-13 12:28:27 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-09-13 12:28:27 +0000 |
commit | 27d79c87365105d6128afe9eaf8a82383976ed44 (patch) | |
tree | 9a4f0e1d5ae7ecd5c058c0293d9b546191990cdb /src/math/numbertheory | |
parent | 9acfc3a50b31044e48d8dee5fc8030ad7f4518d4 (diff) |
Anywhere where we use MemoryRegion::begin to get access to the raw pointer
representation (rather than in an interator context), instead use &buf[0],
which works for both MemoryRegion and std::vector
Diffstat (limited to 'src/math/numbertheory')
-rw-r--r-- | src/math/numbertheory/point_gfp.cpp | 14 | ||||
-rw-r--r-- | src/math/numbertheory/powm_mnt.cpp | 10 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/math/numbertheory/point_gfp.cpp b/src/math/numbertheory/point_gfp.cpp index 93e3392ea..b593443f7 100644 --- a/src/math/numbertheory/point_gfp.cpp +++ b/src/math/numbertheory/point_gfp.cpp @@ -56,7 +56,7 @@ void PointGFp::monty_mult(BigInt& z, p.data(), p_size, p_dash); z.get_reg().resize(p_size); - copy_mem(z.get_reg().begin(), &workspace[p_size], p_size); + copy_mem(&z.get_reg()[0], &workspace[p_size], p_size); } // Montgomery squaring @@ -82,7 +82,7 @@ void PointGFp::monty_sqr(BigInt& z, const BigInt& x, p.data(), p_size, p_dash); z.get_reg().resize(p_size); - copy_mem(z.get_reg().begin(), &workspace[p_size], p_size); + copy_mem(&z.get_reg()[0], &workspace[p_size], p_size); } // Point addition @@ -475,8 +475,8 @@ SecureVector<byte> EC2OSP(const PointGFp& point, byte format) SecureVector<byte> result(2*p_bytes+1); result[0] = 4; - result.copy(1, bX.begin(), p_bytes); - result.copy(p_bytes+1, bY.begin(), p_bytes); + result.copy(1, &bX[0], p_bytes); + result.copy(p_bytes+1, &bY[0], p_bytes); return result; } else if(format == PointGFp::COMPRESSED) @@ -484,7 +484,7 @@ SecureVector<byte> EC2OSP(const PointGFp& point, byte format) SecureVector<byte> result(p_bytes+1); result[0] = 2; - result.copy(1, bX.begin(), bX.size()); + result.copy(1, &bX[0], bX.size()); if(y.get_bit(0)) result[0] |= 1; @@ -496,8 +496,8 @@ SecureVector<byte> EC2OSP(const PointGFp& point, byte format) SecureVector<byte> result(2*p_bytes+1); result[0] = 6; - result.copy(1, bX.begin(), bX.size()); - result.copy(p_bytes+1, bY.begin(), bY.size()); + result.copy(1, &bX[0], bX.size()); + result.copy(p_bytes+1, &bY[0], bY.size()); if(y.get_bit(0)) result[0] |= 1; diff --git a/src/math/numbertheory/powm_mnt.cpp b/src/math/numbertheory/powm_mnt.cpp index 80582eaa8..b565d7a21 100644 --- a/src/math/numbertheory/powm_mnt.cpp +++ b/src/math/numbertheory/powm_mnt.cpp @@ -20,7 +20,7 @@ inline void montgomery_reduce(BigInt& out, MemoryRegion<word>& z_buf, const BigInt& x_bn, u32bit x_size, word u) { const word* x = x_bn.data(); - word* z = z_buf.begin(); + word* z = &z_buf[0]; u32bit z_size = z_buf.size(); bigint_monty_redc(z, z_size, x, x_size, u); @@ -52,7 +52,7 @@ void Montgomery_Exponentiator::set_base(const BigInt& base) SecureVector<word> workspace(z.size()); g[0] = (base >= modulus) ? (base % modulus) : base; - bigint_mul(z.begin(), z.size(), workspace, + bigint_mul(&z[0], z.size(), workspace, g[0].data(), g[0].size(), g[0].sig_words(), R2.data(), R2.size(), R2.sig_words()); @@ -67,7 +67,7 @@ void Montgomery_Exponentiator::set_base(const BigInt& base) const u32bit y_sig = y.sig_words(); zeroise(z); - bigint_mul(z.begin(), z.size(), workspace, + bigint_mul(&z[0], z.size(), workspace, x.data(), x.size(), x_sig, y.data(), y.size(), y_sig); @@ -91,7 +91,7 @@ BigInt Montgomery_Exponentiator::execute() const for(u32bit k = 0; k != window_bits; ++k) { zeroise(z); - bigint_sqr(z.begin(), z.size(), workspace, + bigint_sqr(&z[0], z.size(), workspace, x.data(), x.size(), x.sig_words()); montgomery_reduce(x, z, modulus, mod_words, mod_prime); @@ -103,7 +103,7 @@ BigInt Montgomery_Exponentiator::execute() const const BigInt& y = g[nibble-1]; zeroise(z); - bigint_mul(z.begin(), z.size(), workspace, + bigint_mul(&z[0], z.size(), workspace, x.data(), x.size(), x.sig_words(), y.data(), y.size(), y.sig_words()); |