diff options
Diffstat (limited to 'src/s2k')
-rw-r--r-- | src/s2k/pbkdf1/pbkdf1.cpp | 28 | ||||
-rw-r--r-- | src/s2k/pbkdf1/pbkdf1.h | 10 | ||||
-rw-r--r-- | src/s2k/pbkdf2/pbkdf2.cpp | 28 | ||||
-rw-r--r-- | src/s2k/pbkdf2/pbkdf2.h | 10 | ||||
-rw-r--r-- | src/s2k/pgps2k/pgp_s2k.cpp | 28 | ||||
-rw-r--r-- | src/s2k/pgps2k/pgp_s2k.h | 16 | ||||
-rw-r--r-- | src/s2k/s2k.cpp | 40 | ||||
-rw-r--r-- | src/s2k/s2k.h | 16 |
8 files changed, 96 insertions, 80 deletions
diff --git a/src/s2k/pbkdf1/pbkdf1.cpp b/src/s2k/pbkdf1/pbkdf1.cpp index 00d1ea9ab..04e3aa453 100644 --- a/src/s2k/pbkdf1/pbkdf1.cpp +++ b/src/s2k/pbkdf1/pbkdf1.cpp @@ -1,15 +1,17 @@ -/************************************************* -* PBKDF1 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PBKDF1 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pbkdf1.h> namespace Botan { -/************************************************* -* Return a PKCS#5 PBKDF1 derived key * -*************************************************/ +/* +* Return a PKCS#5 PBKDF1 derived key +*/ OctetString PKCS5_PBKDF1::derive(u32bit key_len, const std::string& passphrase, const byte salt[], u32bit salt_size, @@ -34,17 +36,17 @@ OctetString PKCS5_PBKDF1::derive(u32bit key_len, return OctetString(key, std::min(key_len, key.size())); } -/************************************************* -* Clone this type * -*************************************************/ +/* +* Clone this type +*/ S2K* PKCS5_PBKDF1::clone() const { return new PKCS5_PBKDF1(hash->clone()); } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string PKCS5_PBKDF1::name() const { return "PBKDF1(" + hash->name() + ")"; diff --git a/src/s2k/pbkdf1/pbkdf1.h b/src/s2k/pbkdf1/pbkdf1.h index ccc0a61fe..4e5cafdb0 100644 --- a/src/s2k/pbkdf1/pbkdf1.h +++ b/src/s2k/pbkdf1/pbkdf1.h @@ -1,7 +1,9 @@ -/************************************************* -* PBKDF1 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PBKDF1 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PBKDF1_H__ #define BOTAN_PBKDF1_H__ diff --git a/src/s2k/pbkdf2/pbkdf2.cpp b/src/s2k/pbkdf2/pbkdf2.cpp index baa227526..1de27c9ac 100644 --- a/src/s2k/pbkdf2/pbkdf2.cpp +++ b/src/s2k/pbkdf2/pbkdf2.cpp @@ -1,7 +1,9 @@ -/************************************************* -* PBKDF2 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PBKDF2 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pbkdf2.h> #include <botan/loadstor.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Return a PKCS#5 PBKDF2 derived key * -*************************************************/ +/* +* Return a PKCS#5 PBKDF2 derived key +*/ OctetString PKCS5_PBKDF2::derive(u32bit key_len, const std::string& passphrase, const byte salt[], u32bit salt_size, @@ -57,9 +59,9 @@ OctetString PKCS5_PBKDF2::derive(u32bit key_len, return key; } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string PKCS5_PBKDF2::name() const { return "PBKDF2(" + mac->name() + ")"; @@ -70,9 +72,9 @@ S2K* PKCS5_PBKDF2::clone() const return new PKCS5_PBKDF2(mac->clone()); } -/************************************************* -* PKCS5_PBKDF2 Constructor * -*************************************************/ +/* +* PKCS5_PBKDF2 Constructor +*/ PKCS5_PBKDF2::PKCS5_PBKDF2(MessageAuthenticationCode* m) : mac(m) {} PKCS5_PBKDF2::~PKCS5_PBKDF2() { delete mac; } diff --git a/src/s2k/pbkdf2/pbkdf2.h b/src/s2k/pbkdf2/pbkdf2.h index f9969c0b0..7510338bb 100644 --- a/src/s2k/pbkdf2/pbkdf2.h +++ b/src/s2k/pbkdf2/pbkdf2.h @@ -1,7 +1,9 @@ -/************************************************* -* PBKDF2 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PBKDF2 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PBKDF2_H__ #define BOTAN_PBKDF2_H__ diff --git a/src/s2k/pgps2k/pgp_s2k.cpp b/src/s2k/pgps2k/pgp_s2k.cpp index b96fdf83b..86394d84d 100644 --- a/src/s2k/pgps2k/pgp_s2k.cpp +++ b/src/s2k/pgps2k/pgp_s2k.cpp @@ -1,7 +1,9 @@ -/************************************************* -* OpenPGP S2K Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OpenPGP S2K +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pgp_s2k.h> #include <algorithm> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Derive a key using the OpenPGP S2K algorithm * -*************************************************/ +/* +* Derive a key using the OpenPGP S2K algorithm +*/ OctetString OpenPGP_S2K::derive(u32bit key_len, const std::string& passphrase, const byte salt_buf[], u32bit salt_size, u32bit iterations) const @@ -53,17 +55,17 @@ OctetString OpenPGP_S2K::derive(u32bit key_len, const std::string& passphrase, return key; } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string OpenPGP_S2K::name() const { return "OpenPGP-S2K(" + hash->name() + ")"; } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ S2K* OpenPGP_S2K::clone() const { return new OpenPGP_S2K(hash->clone()); diff --git a/src/s2k/pgps2k/pgp_s2k.h b/src/s2k/pgps2k/pgp_s2k.h index 412ff4281..00e95f7fa 100644 --- a/src/s2k/pgps2k/pgp_s2k.h +++ b/src/s2k/pgps2k/pgp_s2k.h @@ -1,7 +1,9 @@ -/************************************************* -* OpenPGP S2K Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OpenPGP S2K +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_OPENPGP_S2K_H__ #define BOTAN_OPENPGP_S2K_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* OpenPGP S2K * -*************************************************/ +/* +* OpenPGP S2K +*/ class BOTAN_DLL OpenPGP_S2K : public S2K { public: diff --git a/src/s2k/s2k.cpp b/src/s2k/s2k.cpp index 9c67aef10..b8a8ef719 100644 --- a/src/s2k/s2k.cpp +++ b/src/s2k/s2k.cpp @@ -1,48 +1,50 @@ -/************************************************* -* S2K Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S2K +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/s2k.h> namespace Botan { -/************************************************* -* Derive a key from a passphrase * -*************************************************/ +/* +* Derive a key from a passphrase +*/ OctetString S2K::derive_key(u32bit key_len, const std::string& passphrase) const { return derive(key_len, passphrase, salt, salt.size(), iterations()); } -/************************************************* -* Set the number of iterations * -*************************************************/ +/* +* Set the number of iterations +*/ void S2K::set_iterations(u32bit i) { iter = i; } -/************************************************* -* Change the salt * -*************************************************/ +/* +* Change the salt +*/ void S2K::change_salt(const byte new_salt[], u32bit length) { salt.set(new_salt, length); } -/************************************************* -* Change the salt * -*************************************************/ +/* +* Change the salt +*/ void S2K::change_salt(const MemoryRegion<byte>& new_salt) { change_salt(new_salt.begin(), new_salt.size()); } -/************************************************* -* Create a new random salt * -*************************************************/ +/* +* Create a new random salt +*/ void S2K::new_random_salt(RandomNumberGenerator& rng, u32bit length) { diff --git a/src/s2k/s2k.h b/src/s2k/s2k.h index d345d77de..7af92519b 100644 --- a/src/s2k/s2k.h +++ b/src/s2k/s2k.h @@ -1,7 +1,9 @@ -/************************************************* -* S2K Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S2K +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_S2K_H__ #define BOTAN_S2K_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* S2K Interface * -*************************************************/ +/* +* S2K Interface +*/ class BOTAN_DLL S2K { public: |