aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/kdf/prf_tls
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-12-11 15:28:38 -0500
committerJack Lloyd <[email protected]>2016-12-18 16:48:24 -0500
commitf3cb3edb512bdcab498d825886c3366c341b3f78 (patch)
tree645c73ec295a5a34f25d99903b6d9fa9751e86d3 /src/lib/kdf/prf_tls
parentc1dd21253c1f3188ff45d3ad47698efd08235ae8 (diff)
Convert to using standard uintN_t integer types
Renames a couple of functions for somewhat better name consistency, eg make_u32bit becomes make_uint32. The old typedefs remain for now since probably lots of application code uses them.
Diffstat (limited to 'src/lib/kdf/prf_tls')
-rw-r--r--src/lib/kdf/prf_tls/prf_tls.cpp34
-rw-r--r--src/lib/kdf/prf_tls/prf_tls.h16
2 files changed, 25 insertions, 25 deletions
diff --git a/src/lib/kdf/prf_tls/prf_tls.cpp b/src/lib/kdf/prf_tls/prf_tls.cpp
index 6f247ab6e..ead41f505 100644
--- a/src/lib/kdf/prf_tls/prf_tls.cpp
+++ b/src/lib/kdf/prf_tls/prf_tls.cpp
@@ -21,10 +21,10 @@ namespace {
/*
* TLS PRF P_hash function
*/
-void P_hash(byte out[], size_t out_len,
+void P_hash(uint8_t out[], size_t out_len,
MessageAuthenticationCode& mac,
- const byte secret[], size_t secret_len,
- const byte salt[], size_t salt_len)
+ const uint8_t secret[], size_t secret_len,
+ const uint8_t salt[], size_t salt_len)
{
try
{
@@ -37,8 +37,8 @@ void P_hash(byte out[], size_t out_len,
" bytes is too long for the PRF");
}
- secure_vector<byte> A(salt, salt + salt_len);
- secure_vector<byte> h;
+ secure_vector<uint8_t> A(salt, salt + salt_len);
+ secure_vector<uint8_t> h;
size_t offset = 0;
@@ -58,16 +58,16 @@ void P_hash(byte out[], size_t out_len,
}
-size_t TLS_PRF::kdf(byte key[], size_t key_len,
- const byte secret[], size_t secret_len,
- const byte salt[], size_t salt_len,
- const byte label[], size_t label_len) const
+size_t TLS_PRF::kdf(uint8_t key[], size_t key_len,
+ const uint8_t secret[], size_t secret_len,
+ const uint8_t salt[], size_t salt_len,
+ const uint8_t label[], size_t label_len) const
{
const size_t S1_len = (secret_len + 1) / 2,
S2_len = (secret_len + 1) / 2;
- const byte* S1 = secret;
- const byte* S2 = secret + (secret_len - S2_len);
- secure_vector<byte> msg;
+ const uint8_t* S1 = secret;
+ const uint8_t* S2 = secret + (secret_len - S2_len);
+ secure_vector<uint8_t> msg;
msg.reserve(label_len + salt_len);
msg += std::make_pair(label, label_len);
@@ -78,12 +78,12 @@ size_t TLS_PRF::kdf(byte key[], size_t key_len,
return key_len;
}
-size_t TLS_12_PRF::kdf(byte key[], size_t key_len,
- const byte secret[], size_t secret_len,
- const byte salt[], size_t salt_len,
- const byte label[], size_t label_len) const
+size_t TLS_12_PRF::kdf(uint8_t key[], size_t key_len,
+ const uint8_t secret[], size_t secret_len,
+ const uint8_t salt[], size_t salt_len,
+ const uint8_t label[], size_t label_len) const
{
- secure_vector<byte> msg;
+ secure_vector<uint8_t> msg;
msg.reserve(label_len + salt_len);
msg += std::make_pair(label, label_len);
diff --git a/src/lib/kdf/prf_tls/prf_tls.h b/src/lib/kdf/prf_tls/prf_tls.h
index 64891144a..3f1585913 100644
--- a/src/lib/kdf/prf_tls/prf_tls.h
+++ b/src/lib/kdf/prf_tls/prf_tls.h
@@ -23,10 +23,10 @@ class BOTAN_DLL TLS_PRF final : public KDF
KDF* clone() const override { return new TLS_PRF; }
- size_t kdf(byte key[], size_t key_len,
- const byte secret[], size_t secret_len,
- const byte salt[], size_t salt_len,
- const byte label[], size_t label_len) const override;
+ size_t kdf(uint8_t key[], size_t key_len,
+ const uint8_t secret[], size_t secret_len,
+ const uint8_t salt[], size_t salt_len,
+ const uint8_t label[], size_t label_len) const override;
TLS_PRF();
private:
@@ -44,10 +44,10 @@ class BOTAN_DLL TLS_12_PRF final : public KDF
KDF* clone() const override { return new TLS_12_PRF(m_mac->clone()); }
- size_t kdf(byte key[], size_t key_len,
- const byte secret[], size_t secret_len,
- const byte salt[], size_t salt_len,
- const byte label[], size_t label_len) const override;
+ size_t kdf(uint8_t key[], size_t key_len,
+ const uint8_t secret[], size_t secret_len,
+ const uint8_t salt[], size_t salt_len,
+ const uint8_t label[], size_t label_len) const override;
/**
* @param mac MAC algorithm to use