aboutsummaryrefslogtreecommitdiffstats
path: root/src/kdf
diff options
context:
space:
mode:
Diffstat (limited to 'src/kdf')
-rw-r--r--src/kdf/kdf.cpp40
-rw-r--r--src/kdf/kdf.h22
-rw-r--r--src/kdf/kdf1/kdf1.cpp16
-rw-r--r--src/kdf/kdf1/kdf1.h16
-rw-r--r--src/kdf/kdf2/kdf2.cpp16
-rw-r--r--src/kdf/kdf2/kdf2.h16
-rw-r--r--src/kdf/mgf1/mgf1.cpp28
-rw-r--r--src/kdf/mgf1/mgf1.h16
-rw-r--r--src/kdf/ssl_prf/prf_ssl3.cpp22
-rw-r--r--src/kdf/ssl_prf/prf_ssl3.h16
-rw-r--r--src/kdf/tls_prf/prf_tls.cpp28
-rw-r--r--src/kdf/tls_prf/prf_tls.h16
-rw-r--r--src/kdf/x942_prf/prf_x942.cpp28
-rw-r--r--src/kdf/x942_prf/prf_x942.h16
14 files changed, 162 insertions, 134 deletions
diff --git a/src/kdf/kdf.cpp b/src/kdf/kdf.cpp
index a96f86e99..4be8475df 100644
--- a/src/kdf/kdf.cpp
+++ b/src/kdf/kdf.cpp
@@ -1,15 +1,17 @@
-/*************************************************
-* KDF Base Class Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* KDF Base Class
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/kdf.h>
namespace Botan {
-/*************************************************
-* Derive a key *
-*************************************************/
+/*
+* Derive a key
+*/
SecureVector<byte> KDF::derive_key(u32bit key_len,
const MemoryRegion<byte>& secret,
const std::string& salt) const
@@ -19,9 +21,9 @@ SecureVector<byte> KDF::derive_key(u32bit key_len,
salt.length());
}
-/*************************************************
-* Derive a key *
-*************************************************/
+/*
+* Derive a key
+*/
SecureVector<byte> KDF::derive_key(u32bit key_len,
const MemoryRegion<byte>& secret,
const byte salt[], u32bit salt_len) const
@@ -30,9 +32,9 @@ SecureVector<byte> KDF::derive_key(u32bit key_len,
salt, salt_len);
}
-/*************************************************
-* Derive a key *
-*************************************************/
+/*
+* Derive a key
+*/
SecureVector<byte> KDF::derive_key(u32bit key_len,
const MemoryRegion<byte>& secret,
const MemoryRegion<byte>& salt) const
@@ -41,9 +43,9 @@ SecureVector<byte> KDF::derive_key(u32bit key_len,
salt.begin(), salt.size());
}
-/*************************************************
-* Derive a key *
-*************************************************/
+/*
+* Derive a key
+*/
SecureVector<byte> KDF::derive_key(u32bit key_len,
const byte secret[], u32bit secret_len,
const std::string& salt) const
@@ -53,9 +55,9 @@ SecureVector<byte> KDF::derive_key(u32bit key_len,
salt.length());
}
-/*************************************************
-* Derive a key *
-*************************************************/
+/*
+* Derive a key
+*/
SecureVector<byte> KDF::derive_key(u32bit key_len,
const byte secret[], u32bit secret_len,
const byte salt[], u32bit salt_len) const
diff --git a/src/kdf/kdf.h b/src/kdf/kdf.h
index 7d0c1866b..aa6cd94cd 100644
--- a/src/kdf/kdf.h
+++ b/src/kdf/kdf.h
@@ -1,7 +1,9 @@
-/*************************************************
-* KDF/MGF Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* KDF/MGF
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_KDF_BASE_H__
#define BOTAN_KDF_BASE_H__
@@ -11,9 +13,9 @@
namespace Botan {
-/*************************************************
-* Key Derivation Function *
-*************************************************/
+/*
+* Key Derivation Function
+*/
class BOTAN_DLL KDF
{
public:
@@ -35,9 +37,9 @@ class BOTAN_DLL KDF
const byte[], u32bit) const = 0;
};
-/*************************************************
-* Mask Generation Function *
-*************************************************/
+/*
+* Mask Generation Function
+*/
class BOTAN_DLL MGF
{
public:
diff --git a/src/kdf/kdf1/kdf1.cpp b/src/kdf/kdf1/kdf1.cpp
index 0ea375b30..539d9ed50 100644
--- a/src/kdf/kdf1/kdf1.cpp
+++ b/src/kdf/kdf1/kdf1.cpp
@@ -1,15 +1,17 @@
-/*************************************************
-* KDF1 Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* KDF1
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/kdf1.h>
namespace Botan {
-/*************************************************
-* KDF1 Key Derivation Mechanism *
-*************************************************/
+/*
+* KDF1 Key Derivation Mechanism
+*/
SecureVector<byte> KDF1::derive(u32bit,
const byte secret[], u32bit secret_len,
const byte P[], u32bit P_len) const
diff --git a/src/kdf/kdf1/kdf1.h b/src/kdf/kdf1/kdf1.h
index 6099bdd4b..d657cccc2 100644
--- a/src/kdf/kdf1/kdf1.h
+++ b/src/kdf/kdf1/kdf1.h
@@ -1,7 +1,9 @@
-/*************************************************
-* KDF1 Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* KDF1
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_KDF1_H__
#define BOTAN_KDF1_H__
@@ -11,9 +13,9 @@
namespace Botan {
-/*************************************************
-* KDF1 *
-*************************************************/
+/*
+* KDF1
+*/
class BOTAN_DLL KDF1 : public KDF
{
public:
diff --git a/src/kdf/kdf2/kdf2.cpp b/src/kdf/kdf2/kdf2.cpp
index fdeb09869..167f64436 100644
--- a/src/kdf/kdf2/kdf2.cpp
+++ b/src/kdf/kdf2/kdf2.cpp
@@ -1,16 +1,18 @@
-/*************************************************
-* KDF2 Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* KDF2
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/kdf2.h>
#include <botan/loadstor.h>
namespace Botan {
-/*************************************************
-* KDF2 Key Derivation Mechanism *
-*************************************************/
+/*
+* KDF2 Key Derivation Mechanism
+*/
SecureVector<byte> KDF2::derive(u32bit out_len,
const byte secret[], u32bit secret_len,
const byte P[], u32bit P_len) const
diff --git a/src/kdf/kdf2/kdf2.h b/src/kdf/kdf2/kdf2.h
index 8aca285a6..f748bed0f 100644
--- a/src/kdf/kdf2/kdf2.h
+++ b/src/kdf/kdf2/kdf2.h
@@ -1,7 +1,9 @@
-/*************************************************
-* KDF2 Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* KDF2
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_KDF2_H__
#define BOTAN_KDF2_H__
@@ -11,9 +13,9 @@
namespace Botan {
-/*************************************************
-* KDF2 *
-*************************************************/
+/*
+* KDF2
+*/
class BOTAN_DLL KDF2 : public KDF
{
public:
diff --git a/src/kdf/mgf1/mgf1.cpp b/src/kdf/mgf1/mgf1.cpp
index c54675c1e..a26e33a9e 100644
--- a/src/kdf/mgf1/mgf1.cpp
+++ b/src/kdf/mgf1/mgf1.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* MGF1 Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* MGF1
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/mgf1.h>
#include <botan/loadstor.h>
@@ -12,9 +14,9 @@
namespace Botan {
-/*************************************************
-* MGF1 Mask Generation Function *
-*************************************************/
+/*
+* MGF1 Mask Generation Function
+*/
void MGF1::mask(const byte in[], u32bit in_len, byte out[],
u32bit out_len) const
{
@@ -36,18 +38,18 @@ void MGF1::mask(const byte in[], u32bit in_len, byte out[],
}
}
-/*************************************************
-* MGF1 Constructor *
-*************************************************/
+/*
+* MGF1 Constructor
+*/
MGF1::MGF1(HashFunction* h) : hash(h)
{
if(!hash)
throw Invalid_Argument("MGF1 given null hash object");
}
-/*************************************************
-* MGF1 Destructor *
-*************************************************/
+/*
+* MGF1 Destructor
+*/
MGF1::~MGF1()
{
delete hash;
diff --git a/src/kdf/mgf1/mgf1.h b/src/kdf/mgf1/mgf1.h
index e5cbe1d0f..799ba7eed 100644
--- a/src/kdf/mgf1/mgf1.h
+++ b/src/kdf/mgf1/mgf1.h
@@ -1,7 +1,9 @@
-/*************************************************
-* MGF1 Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* MGF1
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_MGF1_H__
#define BOTAN_MGF1_H__
@@ -11,9 +13,9 @@
namespace Botan {
-/*************************************************
-* MGF1 (Mask Generation Function) *
-*************************************************/
+/*
+* MGF1 (Mask Generation Function)
+*/
class BOTAN_DLL MGF1 : public MGF
{
public:
diff --git a/src/kdf/ssl_prf/prf_ssl3.cpp b/src/kdf/ssl_prf/prf_ssl3.cpp
index 3d4444613..2b67644d2 100644
--- a/src/kdf/ssl_prf/prf_ssl3.cpp
+++ b/src/kdf/ssl_prf/prf_ssl3.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* SSLv3 PRF Source File *
-* (C) 2004-2006 Jack Lloyd *
-*************************************************/
+/*
+* SSLv3 PRF
+* (C) 2004-2006 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/prf_ssl3.h>
#include <botan/symkey.h>
@@ -14,9 +16,9 @@ namespace Botan {
namespace {
-/*************************************************
-* Return the next inner hash *
-*************************************************/
+/*
+* Return the next inner hash
+*/
OctetString next_hash(u32bit where, u32bit want,
HashFunction& md5, HashFunction& sha1,
const byte secret[], u32bit secret_len,
@@ -42,9 +44,9 @@ OctetString next_hash(u32bit where, u32bit want,
}
-/*************************************************
-* SSL3 PRF *
-*************************************************/
+/*
+* SSL3 PRF
+*/
SecureVector<byte> SSL3_PRF::derive(u32bit key_len,
const byte secret[], u32bit secret_len,
const byte seed[], u32bit seed_len) const
diff --git a/src/kdf/ssl_prf/prf_ssl3.h b/src/kdf/ssl_prf/prf_ssl3.h
index b8f498832..165fc7c3c 100644
--- a/src/kdf/ssl_prf/prf_ssl3.h
+++ b/src/kdf/ssl_prf/prf_ssl3.h
@@ -1,7 +1,9 @@
-/*************************************************
-* SSLv3 PRF Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* SSLv3 PRF
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_SSLV3_PRF_H__
#define BOTAN_SSLV3_PRF_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* SSL3 PRF *
-*************************************************/
+/*
+* SSL3 PRF
+*/
class BOTAN_DLL SSL3_PRF : public KDF
{
public:
diff --git a/src/kdf/tls_prf/prf_tls.cpp b/src/kdf/tls_prf/prf_tls.cpp
index 8f7063f9f..a04c9045d 100644
--- a/src/kdf/tls_prf/prf_tls.cpp
+++ b/src/kdf/tls_prf/prf_tls.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* TLS PRF Source File *
-* (C) 2004-2006 Jack Lloyd *
-*************************************************/
+/*
+* TLS PRF
+* (C) 2004-2006 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/prf_tls.h>
#include <botan/xor_buf.h>
@@ -11,9 +13,9 @@
namespace Botan {
-/*************************************************
-* TLS PRF Constructor and Destructor *
-*************************************************/
+/*
+* TLS PRF Constructor and Destructor
+*/
TLS_PRF::TLS_PRF()
{
hmac_md5 = new HMAC(new MD5);
@@ -26,9 +28,9 @@ TLS_PRF::~TLS_PRF()
delete hmac_sha1;
}
-/*************************************************
-* TLS PRF *
-*************************************************/
+/*
+* TLS PRF
+*/
SecureVector<byte> TLS_PRF::derive(u32bit key_len,
const byte secret[], u32bit secret_len,
const byte seed[], u32bit seed_len) const
@@ -47,9 +49,9 @@ SecureVector<byte> TLS_PRF::derive(u32bit key_len,
return key1;
}
-/*************************************************
-* TLS PRF P_hash function *
-*************************************************/
+/*
+* TLS PRF P_hash function
+*/
SecureVector<byte> TLS_PRF::P_hash(MessageAuthenticationCode* mac,
u32bit len,
const byte secret[], u32bit secret_len,
diff --git a/src/kdf/tls_prf/prf_tls.h b/src/kdf/tls_prf/prf_tls.h
index 7d29e883b..6b81c155f 100644
--- a/src/kdf/tls_prf/prf_tls.h
+++ b/src/kdf/tls_prf/prf_tls.h
@@ -1,7 +1,9 @@
-/*************************************************
-* TLS v1.0 PRF Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* TLS v1.0 PRF
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_TLS_PRF_H__
#define BOTAN_TLS_PRF_H__
@@ -11,9 +13,9 @@
namespace Botan {
-/*************************************************
-* TLS PRF *
-*************************************************/
+/*
+* TLS PRF
+*/
class BOTAN_DLL TLS_PRF : public KDF
{
public:
diff --git a/src/kdf/x942_prf/prf_x942.cpp b/src/kdf/x942_prf/prf_x942.cpp
index f0b578764..d9ee09d20 100644
--- a/src/kdf/x942_prf/prf_x942.cpp
+++ b/src/kdf/x942_prf/prf_x942.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* X9.42 PRF Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* X9.42 PRF
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/prf_x942.h>
#include <botan/der_enc.h>
@@ -15,9 +17,9 @@ namespace Botan {
namespace {
-/*************************************************
-* Encode an integer as an OCTET STRING *
-*************************************************/
+/*
+* Encode an integer as an OCTET STRING
+*/
MemoryVector<byte> encode_x942_int(u32bit n)
{
byte n_buf[4] = { 0 };
@@ -27,9 +29,9 @@ MemoryVector<byte> encode_x942_int(u32bit n)
}
-/*************************************************
-* X9.42 PRF *
-*************************************************/
+/*
+* X9.42 PRF
+*/
SecureVector<byte> X942_PRF::derive(u32bit key_len,
const byte secret[], u32bit secret_len,
const byte salt[], u32bit salt_len) const
@@ -75,9 +77,9 @@ SecureVector<byte> X942_PRF::derive(u32bit key_len,
return key;
}
-/*************************************************
-* X9.42 Constructor *
-*************************************************/
+/*
+* X9.42 Constructor
+*/
X942_PRF::X942_PRF(const std::string& oid)
{
if(OIDS::have_oid(oid))
diff --git a/src/kdf/x942_prf/prf_x942.h b/src/kdf/x942_prf/prf_x942.h
index 3b5bb93c0..f957566b0 100644
--- a/src/kdf/x942_prf/prf_x942.h
+++ b/src/kdf/x942_prf/prf_x942.h
@@ -1,7 +1,9 @@
-/*************************************************
-* X9.42 PRF Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* X9.42 PRF
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_ANSI_X942_PRF_H__
#define BOTAN_ANSI_X942_PRF_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* X9.42 PRF *
-*************************************************/
+/*
+* X9.42 PRF
+*/
class BOTAN_DLL X942_PRF : public KDF
{
public: