aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/misc
diff options
context:
space:
mode:
authorRenĂ© Korthaus <[email protected]>2015-12-23 11:52:19 +0100
committerJack Lloyd <[email protected]>2016-01-08 19:09:51 -0500
commitd22bc10cd4f67924acd82bcd46a31e3de3b20ce3 (patch)
tree58459585e6675cd799b6ef5900be026825cd6f9d /src/lib/misc
parent2fbfdd7e5afb5e888fd8c0b56c6df09e2bdeaca7 (diff)
Mass-prefix member vars with m_
Diffstat (limited to 'src/lib/misc')
-rw-r--r--src/lib/misc/fpe_fe1/fpe_fe1.cpp28
-rw-r--r--src/lib/misc/srp6/srp6_files.cpp6
-rw-r--r--src/lib/misc/srp6/srp6_files.h7
-rw-r--r--src/lib/misc/tss/tss.cpp34
-rw-r--r--src/lib/misc/tss/tss.h6
5 files changed, 43 insertions, 38 deletions
diff --git a/src/lib/misc/fpe_fe1/fpe_fe1.cpp b/src/lib/misc/fpe_fe1/fpe_fe1.cpp
index 197dbb21a..c59e41e78 100644
--- a/src/lib/misc/fpe_fe1/fpe_fe1.cpp
+++ b/src/lib/misc/fpe_fe1/fpe_fe1.cpp
@@ -85,42 +85,42 @@ class FPE_Encryptor
BigInt operator()(size_t i, const BigInt& R);
private:
- std::unique_ptr<MessageAuthenticationCode> mac;
- std::vector<byte> mac_n_t;
+ std::unique_ptr<MessageAuthenticationCode> m_mac;
+ std::vector<byte> m_mac_n_t;
};
FPE_Encryptor::FPE_Encryptor(const SymmetricKey& key,
const BigInt& n,
const std::vector<byte>& tweak)
{
- mac.reset(new HMAC(new SHA_256));
- mac->set_key(key);
+ m_mac.reset(new HMAC(new SHA_256));
+ m_mac->set_key(key);
std::vector<byte> n_bin = BigInt::encode(n);
if(n_bin.size() > MAX_N_BYTES)
throw Exception("N is too large for FPE encryption");
- mac->update_be(static_cast<u32bit>(n_bin.size()));
- mac->update(n_bin.data(), n_bin.size());
+ m_mac->update_be(static_cast<u32bit>(n_bin.size()));
+ m_mac->update(n_bin.data(), n_bin.size());
- mac->update_be(static_cast<u32bit>(tweak.size()));
- mac->update(tweak.data(), tweak.size());
+ m_mac->update_be(static_cast<u32bit>(tweak.size()));
+ m_mac->update(tweak.data(), tweak.size());
- mac_n_t = unlock(mac->final());
+ m_mac_n_t = unlock(m_mac->final());
}
BigInt FPE_Encryptor::operator()(size_t round_no, const BigInt& R)
{
secure_vector<byte> r_bin = BigInt::encode_locked(R);
- mac->update(mac_n_t);
- mac->update_be(static_cast<u32bit>(round_no));
+ m_mac->update(m_mac_n_t);
+ m_mac->update_be(static_cast<u32bit>(round_no));
- mac->update_be(static_cast<u32bit>(r_bin.size()));
- mac->update(r_bin.data(), r_bin.size());
+ m_mac->update_be(static_cast<u32bit>(r_bin.size()));
+ m_mac->update(r_bin.data(), r_bin.size());
- secure_vector<byte> X = mac->final();
+ secure_vector<byte> X = m_mac->final();
return BigInt(X.data(), X.size());
}
diff --git a/src/lib/misc/srp6/srp6_files.cpp b/src/lib/misc/srp6/srp6_files.cpp
index c028767ad..14ab1ac61 100644
--- a/src/lib/misc/srp6/srp6_files.cpp
+++ b/src/lib/misc/srp6/srp6_files.cpp
@@ -45,7 +45,7 @@ SRP6_Authenticator_File::SRP6_Authenticator_File(const std::string& filename)
else
continue; // unknown group, ignored
- entries[username] = SRP6_Data(v, salt, group_id);
+ m_entries[username] = SRP6_Data(v, salt, group_id);
}
}
@@ -54,9 +54,9 @@ bool SRP6_Authenticator_File::lookup_user(const std::string& username,
std::vector<byte>& salt,
std::string& group_id) const
{
- std::map<std::string, SRP6_Data>::const_iterator i = entries.find(username);
+ std::map<std::string, SRP6_Data>::const_iterator i = m_entries.find(username);
- if(i == entries.end())
+ if(i == m_entries.end())
return false;
v = i->second.v;
diff --git a/src/lib/misc/srp6/srp6_files.h b/src/lib/misc/srp6/srp6_files.h
index 45c3b0bfe..a3b979b87 100644
--- a/src/lib/misc/srp6/srp6_files.h
+++ b/src/lib/misc/srp6/srp6_files.h
@@ -40,12 +40,17 @@ class BOTAN_DLL SRP6_Authenticator_File
const std::string& group_id) :
v(v), salt(salt), group_id(group_id) {}
+ // public member variable:
BigInt v;
+
+ // public member variable:
std::vector<byte> salt;
+
+ // public member variable:
std::string group_id;
};
- std::map<std::string, SRP6_Data> entries;
+ std::map<std::string, SRP6_Data> m_entries;
};
}
diff --git a/src/lib/misc/tss/tss.cpp b/src/lib/misc/tss/tss.cpp
index 6904f9f0a..e1727dc33 100644
--- a/src/lib/misc/tss/tss.cpp
+++ b/src/lib/misc/tss/tss.cpp
@@ -105,7 +105,7 @@ HashFunction* get_rtss_hash_by_id(byte id)
RTSS_Share::RTSS_Share(const std::string& hex_input)
{
- contents = hex_decode_locked(hex_input);
+ m_contents = hex_decode_locked(hex_input);
}
byte RTSS_Share::share_id() const
@@ -113,12 +113,12 @@ byte RTSS_Share::share_id() const
if(!initialized())
throw Invalid_State("RTSS_Share::share_id not initialized");
- return contents[20];
+ return m_contents[20];
}
std::string RTSS_Share::to_string() const
{
- return hex_encode(contents.data(), contents.size());
+ return hex_encode(m_contents.data(), m_contents.size());
}
std::vector<RTSS_Share>
@@ -137,16 +137,16 @@ RTSS_Share::split(byte M, byte N,
// Create RTSS header in each share
for(byte i = 0; i != N; ++i)
{
- shares[i].contents += std::make_pair(identifier, 16);
- shares[i].contents += rtss_hash_id(hash.name());
- shares[i].contents += M;
- shares[i].contents += get_byte(0, S_len);
- shares[i].contents += get_byte(1, S_len);
+ shares[i].m_contents += std::make_pair(identifier, 16);
+ shares[i].m_contents += rtss_hash_id(hash.name());
+ shares[i].m_contents += M;
+ shares[i].m_contents += get_byte(0, S_len);
+ shares[i].m_contents += get_byte(1, S_len);
}
// Choose sequential values for X starting from 1
for(byte i = 0; i != N; ++i)
- shares[i].contents.push_back(i+1);
+ shares[i].m_contents.push_back(i+1);
// secret = S || H(S)
secure_vector<byte> secret(S, S + S_len);
@@ -170,7 +170,7 @@ RTSS_Share::split(byte M, byte N,
X_i = gfp_mul(X_i, X);
}
- shares[j].contents.push_back(sum);
+ shares[j].m_contents.push_back(sum);
}
}
@@ -191,18 +191,18 @@ RTSS_Share::reconstruct(const std::vector<RTSS_Share>& shares)
if(shares[i].size() < RTSS_HEADER_SIZE)
throw Decoding_Error("Missing or malformed RTSS header");
- if(!same_mem(&shares[0].contents[0],
- &shares[i].contents[0], RTSS_HEADER_SIZE))
+ if(!same_mem(&shares[0].m_contents[0],
+ &shares[i].m_contents[0], RTSS_HEADER_SIZE))
throw Decoding_Error("Different RTSS headers detected");
}
- if(shares.size() < shares[0].contents[17])
+ if(shares.size() < shares[0].m_contents[17])
throw Decoding_Error("Insufficient shares to do TSS reconstruction");
- u16bit secret_len = make_u16bit(shares[0].contents[18],
- shares[0].contents[19]);
+ u16bit secret_len = make_u16bit(shares[0].m_contents[18],
+ shares[0].m_contents[19]);
- byte hash_id = shares[0].contents[16];
+ byte hash_id = shares[0].m_contents[16];
std::unique_ptr<HashFunction> hash(get_rtss_hash_by_id(hash_id));
@@ -215,7 +215,7 @@ RTSS_Share::reconstruct(const std::vector<RTSS_Share>& shares)
for(size_t i = RTSS_HEADER_SIZE + 1; i != shares[0].size(); ++i)
{
for(size_t j = 0; j != V.size(); ++j)
- V[j] = shares[j].contents[i];
+ V[j] = shares[j].m_contents[i];
byte r = 0;
for(size_t k = 0; k != shares.size(); ++k)
diff --git a/src/lib/misc/tss/tss.h b/src/lib/misc/tss/tss.h
index 09a5dbe19..68eb5158f 100644
--- a/src/lib/misc/tss/tss.h
+++ b/src/lib/misc/tss/tss.h
@@ -61,14 +61,14 @@ class BOTAN_DLL RTSS_Share
/**
* @return size of this share in bytes
*/
- size_t size() const { return contents.size(); }
+ size_t size() const { return m_contents.size(); }
/**
* @return if this TSS share was initialized or not
*/
- bool initialized() const { return (contents.size() > 0); }
+ bool initialized() const { return (m_contents.size() > 0); }
private:
- secure_vector<byte> contents;
+ secure_vector<byte> m_contents;
};
}