aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/kdf
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/kdf')
-rw-r--r--src/lib/kdf/hkdf/hkdf.cpp34
-rw-r--r--src/lib/kdf/hkdf/hkdf.h24
-rw-r--r--src/lib/kdf/kdf.h50
-rw-r--r--src/lib/kdf/kdf1/kdf1.cpp10
-rw-r--r--src/lib/kdf/kdf1/kdf1.h8
-rw-r--r--src/lib/kdf/kdf1_iso18033/kdf1_iso18033.cpp12
-rw-r--r--src/lib/kdf/kdf1_iso18033/kdf1_iso18033.h8
-rw-r--r--src/lib/kdf/kdf2/kdf2.cpp12
-rw-r--r--src/lib/kdf/kdf2/kdf2.h8
-rw-r--r--src/lib/kdf/prf_tls/prf_tls.cpp34
-rw-r--r--src/lib/kdf/prf_tls/prf_tls.h16
-rw-r--r--src/lib/kdf/prf_x942/prf_x942.cpp20
-rw-r--r--src/lib/kdf/prf_x942/prf_x942.h8
-rw-r--r--src/lib/kdf/sp800_108/sp800_108.cpp56
-rw-r--r--src/lib/kdf/sp800_108/sp800_108.h24
-rw-r--r--src/lib/kdf/sp800_56c/sp800_56c.cpp10
-rw-r--r--src/lib/kdf/sp800_56c/sp800_56c.h8
17 files changed, 171 insertions, 171 deletions
diff --git a/src/lib/kdf/hkdf/hkdf.cpp b/src/lib/kdf/hkdf/hkdf.cpp
index f44ed81bd..20215125b 100644
--- a/src/lib/kdf/hkdf/hkdf.cpp
+++ b/src/lib/kdf/hkdf/hkdf.cpp
@@ -10,28 +10,28 @@
namespace Botan {
-size_t HKDF::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 HKDF::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
{
HKDF_Extract extract(m_prf->clone());
HKDF_Expand expand(m_prf->clone());
- secure_vector<byte> prk(m_prf->output_length());
+ secure_vector<uint8_t> prk(m_prf->output_length());
extract.kdf(prk.data(), prk.size(), secret, secret_len, salt, salt_len, nullptr, 0);
return expand.kdf(key, key_len, prk.data(), prk.size(), nullptr, 0, label, label_len);
}
-size_t HKDF_Extract::kdf(byte key[], size_t key_len,
- const byte secret[], size_t secret_len,
- const byte salt[], size_t salt_len,
- const byte[], size_t) const
+size_t HKDF_Extract::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[], size_t) const
{
- secure_vector<byte> prk;
+ secure_vector<uint8_t> prk;
if(salt_len == 0)
{
- m_prf->set_key(std::vector<byte>(m_prf->output_length()));
+ m_prf->set_key(std::vector<uint8_t>(m_prf->output_length()));
}
else
{
@@ -46,15 +46,15 @@ size_t HKDF_Extract::kdf(byte key[], size_t key_len,
return written;
}
-size_t HKDF_Expand::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 HKDF_Expand::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
{
m_prf->set_key(secret, secret_len);
- byte counter = 1;
- secure_vector<byte> h;
+ uint8_t counter = 1;
+ secure_vector<uint8_t> h;
size_t offset = 0;
while(offset != key_len && counter != 0)
diff --git a/src/lib/kdf/hkdf/hkdf.h b/src/lib/kdf/hkdf/hkdf.h
index 5ad389aeb..7a07f94e1 100644
--- a/src/lib/kdf/hkdf/hkdf.h
+++ b/src/lib/kdf/hkdf/hkdf.h
@@ -30,10 +30,10 @@ class BOTAN_DLL HKDF final : public KDF
std::string name() const override { return "HKDF(" + m_prf->name() + ")"; }
- 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;
private:
std::unique_ptr<MessageAuthenticationCode> m_prf;
@@ -54,10 +54,10 @@ class BOTAN_DLL HKDF_Extract final : public KDF
std::string name() const override { return "HKDF-Extract(" + m_prf->name() + ")"; }
- 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;
private:
std::unique_ptr<MessageAuthenticationCode> m_prf;
@@ -78,10 +78,10 @@ class BOTAN_DLL HKDF_Expand final : public KDF
std::string name() const override { return "HKDF-Expand(" + m_prf->name() + ")"; }
- 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;
private:
std::unique_ptr<MessageAuthenticationCode> m_prf;
diff --git a/src/lib/kdf/kdf.h b/src/lib/kdf/kdf.h
index 15336a966..8c188bfb4 100644
--- a/src/lib/kdf/kdf.h
+++ b/src/lib/kdf/kdf.h
@@ -64,10 +64,10 @@ class BOTAN_DLL KDF
* @param label_len size of label in bytes
* @return the derived key
*/
- virtual 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 = 0;
+ virtual 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 = 0;
/**
* Derive a key
@@ -80,15 +80,15 @@ class BOTAN_DLL KDF
* @param label_len size of label in bytes
* @return the derived key
*/
- secure_vector<byte> derive_key(size_t key_len,
- const byte secret[],
+ secure_vector<uint8_t> derive_key(size_t key_len,
+ const uint8_t secret[],
size_t secret_len,
- const byte salt[],
+ const uint8_t salt[],
size_t salt_len,
- const byte label[] = nullptr,
+ const uint8_t label[] = nullptr,
size_t label_len = 0) const
{
- secure_vector<byte> key(key_len);
+ secure_vector<uint8_t> key(key_len);
key.resize(kdf(key.data(), key.size(), secret, secret_len, salt, salt_len, label, label_len));
return key;
}
@@ -101,15 +101,15 @@ class BOTAN_DLL KDF
* @param label purpose for the derived keying material
* @return the derived key
*/
- secure_vector<byte> derive_key(size_t key_len,
- const secure_vector<byte>& secret,
+ secure_vector<uint8_t> derive_key(size_t key_len,
+ const secure_vector<uint8_t>& secret,
const std::string& salt = "",
const std::string& label = "") const
{
return derive_key(key_len, secret.data(), secret.size(),
- reinterpret_cast<const byte*>(salt.data()),
+ reinterpret_cast<const uint8_t*>(salt.data()),
salt.length(),
- reinterpret_cast<const byte*>(label.data()),
+ reinterpret_cast<const uint8_t*>(label.data()),
label.length());
}
@@ -123,10 +123,10 @@ class BOTAN_DLL KDF
* @return the derived key
*/
template<typename Alloc, typename Alloc2, typename Alloc3>
- secure_vector<byte> derive_key(size_t key_len,
- const std::vector<byte, Alloc>& secret,
- const std::vector<byte, Alloc2>& salt,
- const std::vector<byte, Alloc3>& label) const
+ secure_vector<uint8_t> derive_key(size_t key_len,
+ const std::vector<uint8_t, Alloc>& secret,
+ const std::vector<uint8_t, Alloc2>& salt,
+ const std::vector<uint8_t, Alloc3>& label) const
{
return derive_key(key_len,
secret.data(), secret.size(),
@@ -143,16 +143,16 @@ class BOTAN_DLL KDF
* @param label purpose for the derived keying material
* @return the derived key
*/
- secure_vector<byte> derive_key(size_t key_len,
- const secure_vector<byte>& secret,
- const byte salt[],
+ secure_vector<uint8_t> derive_key(size_t key_len,
+ const secure_vector<uint8_t>& secret,
+ const uint8_t salt[],
size_t salt_len,
const std::string& label = "") const
{
return derive_key(key_len,
secret.data(), secret.size(),
salt, salt_len,
- reinterpret_cast<const byte*>(label.data()),
+ reinterpret_cast<const uint8_t*>(label.data()),
label.size());
}
@@ -165,16 +165,16 @@ class BOTAN_DLL KDF
* @param label purpose for the derived keying material
* @return the derived key
*/
- secure_vector<byte> derive_key(size_t key_len,
- const byte secret[],
+ secure_vector<uint8_t> derive_key(size_t key_len,
+ const uint8_t secret[],
size_t secret_len,
const std::string& salt = "",
const std::string& label = "") const
{
return derive_key(key_len, secret, secret_len,
- reinterpret_cast<const byte*>(salt.data()),
+ reinterpret_cast<const uint8_t*>(salt.data()),
salt.length(),
- reinterpret_cast<const byte*>(label.data()),
+ reinterpret_cast<const uint8_t*>(label.data()),
label.length());
}
diff --git a/src/lib/kdf/kdf1/kdf1.cpp b/src/lib/kdf/kdf1/kdf1.cpp
index 14dddc5f4..be22b1e9f 100644
--- a/src/lib/kdf/kdf1/kdf1.cpp
+++ b/src/lib/kdf/kdf1/kdf1.cpp
@@ -9,10 +9,10 @@
namespace Botan {
-size_t KDF1::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 KDF1::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
{
m_hash->update(secret, secret_len);
m_hash->update(label, label_len);
@@ -20,7 +20,7 @@ size_t KDF1::kdf(byte key[], size_t key_len,
if(key_len < m_hash->output_length())
{
- secure_vector<byte> v = m_hash->final();
+ secure_vector<uint8_t> v = m_hash->final();
copy_mem(key, v.data(), key_len);
return key_len;
}
diff --git a/src/lib/kdf/kdf1/kdf1.h b/src/lib/kdf/kdf1/kdf1.h
index db8b3b062..2dc9dbb33 100644
--- a/src/lib/kdf/kdf1/kdf1.h
+++ b/src/lib/kdf/kdf1/kdf1.h
@@ -23,10 +23,10 @@ class BOTAN_DLL KDF1 final : public KDF
KDF* clone() const override { return new KDF1(m_hash->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 h hash function to use
diff --git a/src/lib/kdf/kdf1_iso18033/kdf1_iso18033.cpp b/src/lib/kdf/kdf1_iso18033/kdf1_iso18033.cpp
index 7beca0862..05565e404 100644
--- a/src/lib/kdf/kdf1_iso18033/kdf1_iso18033.cpp
+++ b/src/lib/kdf/kdf1_iso18033/kdf1_iso18033.cpp
@@ -9,13 +9,13 @@
namespace Botan {
-size_t KDF1_18033::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 KDF1_18033::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
{
- u32bit counter = 0;
- secure_vector<byte> h;
+ uint32_t counter = 0;
+ secure_vector<uint8_t> h;
size_t offset = 0;
while(offset != key_len && counter != 0xFFFFFFFF)
diff --git a/src/lib/kdf/kdf1_iso18033/kdf1_iso18033.h b/src/lib/kdf/kdf1_iso18033/kdf1_iso18033.h
index 08e2d5c61..d77399aa4 100644
--- a/src/lib/kdf/kdf1_iso18033/kdf1_iso18033.h
+++ b/src/lib/kdf/kdf1_iso18033/kdf1_iso18033.h
@@ -23,10 +23,10 @@ class BOTAN_DLL KDF1_18033 : public KDF
KDF* clone() const override { return new KDF1_18033(m_hash->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 h hash function to use
diff --git a/src/lib/kdf/kdf2/kdf2.cpp b/src/lib/kdf/kdf2/kdf2.cpp
index 760ebfc83..0f10b7b8f 100644
--- a/src/lib/kdf/kdf2/kdf2.cpp
+++ b/src/lib/kdf/kdf2/kdf2.cpp
@@ -9,13 +9,13 @@
namespace Botan {
-size_t KDF2::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 KDF2::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
{
- u32bit counter = 1;
- secure_vector<byte> h;
+ uint32_t counter = 1;
+ secure_vector<uint8_t> h;
size_t offset = 0;
while(offset != key_len && counter != 0)
diff --git a/src/lib/kdf/kdf2/kdf2.h b/src/lib/kdf/kdf2/kdf2.h
index 2ead49530..5683aeb8a 100644
--- a/src/lib/kdf/kdf2/kdf2.h
+++ b/src/lib/kdf/kdf2/kdf2.h
@@ -23,10 +23,10 @@ class BOTAN_DLL KDF2 final : public KDF
KDF* clone() const override { return new KDF2(m_hash->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 h hash function to use
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
diff --git a/src/lib/kdf/prf_x942/prf_x942.cpp b/src/lib/kdf/prf_x942/prf_x942.cpp
index 206cf6ce6..1abb4e77e 100644
--- a/src/lib/kdf/prf_x942/prf_x942.cpp
+++ b/src/lib/kdf/prf_x942/prf_x942.cpp
@@ -19,27 +19,27 @@ namespace {
/*
* Encode an integer as an OCTET STRING
*/
-std::vector<byte> encode_x942_int(u32bit n)
+std::vector<uint8_t> encode_x942_int(uint32_t n)
{
- byte n_buf[4] = { 0 };
+ uint8_t n_buf[4] = { 0 };
store_be(n, n_buf);
return DER_Encoder().encode(n_buf, 4, OCTET_STRING).get_contents_unlocked();
}
}
-size_t X942_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 X942_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
{
std::unique_ptr<HashFunction> hash(HashFunction::create("SHA-160"));
const OID kek_algo(m_key_wrap_oid);
- secure_vector<byte> h;
- secure_vector<byte> in;
+ secure_vector<uint8_t> h;
+ secure_vector<uint8_t> in;
size_t offset = 0;
- u32bit counter = 1;
+ uint32_t counter = 1;
in.reserve(salt_len + label_len);
in += std::make_pair(label,label_len);
@@ -65,7 +65,7 @@ size_t X942_PRF::kdf(byte key[], size_t key_len,
)
.start_explicit(2)
- .raw_bytes(encode_x942_int(static_cast<u32bit>(8 * key_len)))
+ .raw_bytes(encode_x942_int(static_cast<uint32_t>(8 * key_len)))
.end_explicit()
.end_cons().get_contents()
diff --git a/src/lib/kdf/prf_x942/prf_x942.h b/src/lib/kdf/prf_x942/prf_x942.h
index 2c02f3b9e..fbc931637 100644
--- a/src/lib/kdf/prf_x942/prf_x942.h
+++ b/src/lib/kdf/prf_x942/prf_x942.h
@@ -22,10 +22,10 @@ class BOTAN_DLL X942_PRF final : public KDF
KDF* clone() const override { return new X942_PRF(m_key_wrap_oid); }
- 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;
explicit X942_PRF(const std::string& oid);
private:
diff --git a/src/lib/kdf/sp800_108/sp800_108.cpp b/src/lib/kdf/sp800_108/sp800_108.cpp
index 77973600a..8b1af2ea7 100644
--- a/src/lib/kdf/sp800_108/sp800_108.cpp
+++ b/src/lib/kdf/sp800_108/sp800_108.cpp
@@ -12,18 +12,18 @@
namespace Botan {
-size_t SP800_108_Counter::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 SP800_108_Counter::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 std::size_t prf_len = m_prf->output_length();
- const byte delim = 0;
- byte *p = key;
+ const uint8_t delim = 0;
+ uint8_t *p = key;
uint32_t counter = 1;
uint32_t length = key_len * 8;
- byte be_len[4] = { 0 };
- secure_vector<byte> tmp;
+ uint8_t be_len[4] = { 0 };
+ secure_vector<uint8_t> tmp;
store_be(length, be_len);
m_prf->set_key(secret, secret_len);
@@ -31,7 +31,7 @@ size_t SP800_108_Counter::kdf(byte key[], size_t key_len,
while(p < key + key_len && counter != 0)
{
const std::size_t to_copy = std::min< std::size_t >(key + key_len - p, prf_len);
- byte be_cnt[4] = { 0 };
+ uint8_t be_cnt[4] = { 0 };
store_be(counter, be_cnt);
@@ -54,21 +54,21 @@ size_t SP800_108_Counter::kdf(byte key[], size_t key_len,
return key_len;
}
-size_t SP800_108_Feedback::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 SP800_108_Feedback::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 std::size_t prf_len = m_prf->output_length();
const std::size_t iv_len = (salt_len >= prf_len ? prf_len : 0);
- const byte delim = 0;
+ const uint8_t delim = 0;
- byte *p = key;
+ uint8_t *p = key;
uint32_t counter = 1;
uint32_t length = key_len * 8;
- byte be_len[4] = { 0 };
- secure_vector< byte > prev(salt, salt + iv_len);
- secure_vector< byte > ctx(salt + iv_len, salt + salt_len);
+ uint8_t be_len[4] = { 0 };
+ secure_vector< uint8_t > prev(salt, salt + iv_len);
+ secure_vector< uint8_t > ctx(salt + iv_len, salt + salt_len);
store_be(length, be_len);
m_prf->set_key(secret, secret_len);
@@ -76,7 +76,7 @@ size_t SP800_108_Feedback::kdf(byte key[], size_t key_len,
while(p < key + key_len && counter != 0)
{
const std::size_t to_copy = std::min< std::size_t >(key + key_len - p, prf_len);
- byte be_cnt[4] = { 0 };
+ uint8_t be_cnt[4] = { 0 };
store_be(counter, be_cnt);
@@ -100,19 +100,19 @@ size_t SP800_108_Feedback::kdf(byte key[], size_t key_len,
return key_len;
}
-size_t SP800_108_Pipeline::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 SP800_108_Pipeline::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 std::size_t prf_len = m_prf->output_length();
- const byte delim = 0;
+ const uint8_t delim = 0;
- byte *p = key;
+ uint8_t *p = key;
uint32_t counter = 1;
uint32_t length = key_len * 8;
- byte be_len[4] = { 0 };
- secure_vector<byte> ai, ki;
+ uint8_t be_len[4] = { 0 };
+ secure_vector<uint8_t> ai, ki;
store_be(length, be_len);
m_prf->set_key(secret,secret_len);
@@ -131,7 +131,7 @@ size_t SP800_108_Pipeline::kdf(byte key[], size_t key_len,
// K(i)
const std::size_t to_copy = std::min< std::size_t >(key + key_len - p, prf_len);
- byte be_cnt[4] = { 0 };
+ uint8_t be_cnt[4] = { 0 };
store_be(counter, be_cnt);
diff --git a/src/lib/kdf/sp800_108/sp800_108.h b/src/lib/kdf/sp800_108/sp800_108.h
index e368457b4..848b9e2a2 100644
--- a/src/lib/kdf/sp800_108/sp800_108.h
+++ b/src/lib/kdf/sp800_108/sp800_108.h
@@ -40,10 +40,10 @@ class BOTAN_DLL SP800_108_Counter : public KDF
*
* @throws Invalid_Argument key_len > 2^32
*/
- 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
@@ -80,10 +80,10 @@ class BOTAN_DLL SP800_108_Feedback : public KDF
*
* @throws Invalid_Argument key_len > 2^32
*/
- 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;
SP800_108_Feedback(MessageAuthenticationCode* mac) : m_prf(mac) {}
private:
@@ -117,10 +117,10 @@ class BOTAN_DLL SP800_108_Pipeline : public KDF
*
* @throws Invalid_Argument key_len > 2^32
*/
- 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;
SP800_108_Pipeline(MessageAuthenticationCode* mac) : m_prf(mac) {}
diff --git a/src/lib/kdf/sp800_56c/sp800_56c.cpp b/src/lib/kdf/sp800_56c/sp800_56c.cpp
index f6d01ec2f..30a49e8ee 100644
--- a/src/lib/kdf/sp800_56c/sp800_56c.cpp
+++ b/src/lib/kdf/sp800_56c/sp800_56c.cpp
@@ -11,13 +11,13 @@
namespace Botan {
-size_t SP800_56C::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 SP800_56C::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
{
// Randomness Extraction
- secure_vector< byte > k_dk;
+ secure_vector< uint8_t > k_dk;
m_prf->set_key(salt, salt_len);
m_prf->update(secret, secret_len);
diff --git a/src/lib/kdf/sp800_56c/sp800_56c.h b/src/lib/kdf/sp800_56c/sp800_56c.h
index 5c5acb075..aa3087974 100644
--- a/src/lib/kdf/sp800_56c/sp800_56c.h
+++ b/src/lib/kdf/sp800_56c/sp800_56c.h
@@ -40,10 +40,10 @@ class BOTAN_DLL SP800_56C : public KDF
*
* @throws Invalid_Argument key_len > 2^32
*/
- 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 used for randomness extraction