aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2021-01-04 18:59:43 -0500
committerJack Lloyd <[email protected]>2021-04-16 20:08:37 -0400
commit32bf9784bd6ee29cb3ffa173f0a734e9edce2dac (patch)
tree05815c2441c0f6964fa6fe587330fda8ed86b617 /src/lib/pubkey
parent04fc4b81f0ef44bcfe3a64ffd45bb61f0a92b60d (diff)
Make get_byte take a compile-time constant index
Add get_byte_var for the few cases that need a variable index
Diffstat (limited to 'src/lib/pubkey')
-rw-r--r--src/lib/pubkey/mce/mceliece_key.cpp12
-rw-r--r--src/lib/pubkey/mce/polyn_gf2m.cpp4
-rw-r--r--src/lib/pubkey/sm2/sm2.cpp4
3 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/pubkey/mce/mceliece_key.cpp b/src/lib/pubkey/mce/mceliece_key.cpp
index cfac93e3c..8c23bf659 100644
--- a/src/lib/pubkey/mce/mceliece_key.cpp
+++ b/src/lib/pubkey/mce/mceliece_key.cpp
@@ -144,17 +144,17 @@ secure_vector<uint8_t> McEliece_PrivateKey::private_key_bits() const
for(uint16_t Linv : m_Linv)
{
- enc_support.push_back(get_byte(0, Linv));
- enc_support.push_back(get_byte(1, Linv));
+ enc_support.push_back(get_byte<0>(Linv));
+ enc_support.push_back(get_byte<1>(Linv));
}
enc.encode(enc_support, ASN1_Type::OctetString);
secure_vector<uint8_t> enc_H;
for(uint32_t coef : m_coeffs)
{
- enc_H.push_back(get_byte(0, coef));
- enc_H.push_back(get_byte(1, coef));
- enc_H.push_back(get_byte(2, coef));
- enc_H.push_back(get_byte(3, coef));
+ enc_H.push_back(get_byte<0>(coef));
+ enc_H.push_back(get_byte<1>(coef));
+ enc_H.push_back(get_byte<2>(coef));
+ enc_H.push_back(get_byte<3>(coef));
}
enc.encode(enc_H, ASN1_Type::OctetString);
enc.end_cons();
diff --git a/src/lib/pubkey/mce/polyn_gf2m.cpp b/src/lib/pubkey/mce/polyn_gf2m.cpp
index dcaaa6a29..53b21d530 100644
--- a/src/lib/pubkey/mce/polyn_gf2m.cpp
+++ b/src/lib/pubkey/mce/polyn_gf2m.cpp
@@ -781,8 +781,8 @@ secure_vector<uint8_t> polyn_gf2m::encode() const
for(unsigned i = 0; i < len; i++)
{
// "big endian" encoding of the GF(2^m) elements
- result.push_back(get_byte(0, coeff[i]));
- result.push_back(get_byte(1, coeff[i]));
+ result.push_back(get_byte<0>(coeff[i]));
+ result.push_back(get_byte<1>(coeff[i]));
}
return result;
}
diff --git a/src/lib/pubkey/sm2/sm2.cpp b/src/lib/pubkey/sm2/sm2.cpp
index 51214a7e4..a25aa1516 100644
--- a/src/lib/pubkey/sm2/sm2.cpp
+++ b/src/lib/pubkey/sm2/sm2.cpp
@@ -64,8 +64,8 @@ std::vector<uint8_t> sm2_compute_za(HashFunction& hash,
const uint16_t uid_len = static_cast<uint16_t>(8 * user_id.size());
- hash.update(get_byte(0, uid_len));
- hash.update(get_byte(1, uid_len));
+ hash.update(get_byte<0>(uid_len));
+ hash.update(get_byte<1>(uid_len));
hash.update(user_id);
const size_t p_bytes = domain.get_p_bytes();