aboutsummaryrefslogtreecommitdiffstats
path: root/checks
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-07-09 15:06:31 +0000
committerlloyd <[email protected]>2010-07-09 15:06:31 +0000
commitf9162c355d3cee11be911c4cf469044b5c3c4699 (patch)
tree710c305d8e0f965543f56dc06ce2535c842fc524 /checks
parent14bfa0d15fc666b83a0b58a0713abba76c85dc41 (diff)
Rename S2K to PBKDF, because that is by far the most common name - S2K
really is only used by OpenPGP, and largely it was named S2K here because the OpenPGP S2K was implemented years before the ones in PKCS #5. We have a typedef of PBKDF to S2K, and an inlined get_s2k that calls get_pbkdf for source compatability. There doesn't seem to be any reason to have a forward for the renamed s2k.h header - to actually use a PBKDF, you'd have to either include lookup.h and call get_s2k / get_pbkdf, or else include an algorithm-specific header and use it directly. In either case, including s2k.h is neither necessary nor sufficient.
Diffstat (limited to 'checks')
-rw-r--r--checks/common.h3
-rw-r--r--checks/dolook.cpp35
-rw-r--r--checks/validate.dat10
3 files changed, 25 insertions, 23 deletions
diff --git a/checks/common.h b/checks/common.h
index b849ce721..1b1e89bbf 100644
--- a/checks/common.h
+++ b/checks/common.h
@@ -34,7 +34,8 @@ Botan::Filter* lookup_hash(const std::string&);
Botan::Filter* lookup_mac(const std::string&, const std::string&);
Botan::Filter* lookup_rng(const std::string&, const std::string&);
Botan::Filter* lookup_encoder(const std::string&);
-Botan::Filter* lookup_s2k(const std::string&, const std::vector<std::string>&);
+Botan::Filter* lookup_pbkdf(const std::string&,
+ const std::vector<std::string>&);
Botan::Filter* lookup_kdf(const std::string&, const std::string&,
const std::string&);
diff --git a/checks/dolook.cpp b/checks/dolook.cpp
index 1eecfa9fc..71bb65725 100644
--- a/checks/dolook.cpp
+++ b/checks/dolook.cpp
@@ -55,38 +55,39 @@ using namespace Botan;
#include "common.h"
-/* A weird little hack to fit S2K algorithms into the validation suite
- You probably wouldn't ever want to actually use the S2K algorithms like
- this, the raw S2K interface is more convenient for actually using them
+/* A weird little hack to fit PBKDF algorithms into the validation
+* suite You probably wouldn't ever want to actually use the PBKDF
+* algorithms like this, the raw PBKDF interface is more convenient
+* for actually using them
*/
-class S2K_Filter : public Filter
+class PBKDF_Filter : public Filter
{
public:
- std::string name() const { return s2k->name(); }
+ std::string name() const { return pbkdf->name(); }
void write(const byte in[], u32bit len)
{ passphrase += std::string(reinterpret_cast<const char*>(in), len); }
void end_msg()
{
- SymmetricKey x = s2k->derive_key(outlen, passphrase,
+ SymmetricKey x = pbkdf->derive_key(outlen, passphrase,
&salt[0], salt.size(),
iterations);
send(x.bits_of());
}
- S2K_Filter(S2K* algo, const SymmetricKey& s, u32bit o, u32bit i)
+ PBKDF_Filter(PBKDF* algo, const SymmetricKey& s, u32bit o, u32bit i)
{
- s2k = algo;
+ pbkdf = algo;
outlen = o;
iterations = i;
salt = s.bits_of();
}
- ~S2K_Filter() { delete s2k; }
+ ~PBKDF_Filter() { delete pbkdf; }
private:
std::string passphrase;
- S2K* s2k;
+ PBKDF* pbkdf;
SecureVector<byte> salt;
u32bit outlen, iterations;
};
@@ -133,19 +134,19 @@ class KDF_Filter : public Filter
u32bit outlen;
};
-Filter* lookup_s2k(const std::string& algname,
+Filter* lookup_pbkdf(const std::string& algname,
const std::vector<std::string>& params)
{
- S2K* s2k = 0;
+ PBKDF* pbkdf = 0;
try {
- s2k = get_s2k(algname);
+ pbkdf = get_pbkdf(algname);
}
catch(...) { }
- if(s2k)
- return new S2K_Filter(s2k, params[0], to_u32bit(params[1]),
- to_u32bit(params[2]));
+ if(pbkdf)
+ return new PBKDF_Filter(pbkdf, params[0], to_u32bit(params[1]),
+ to_u32bit(params[2]));
return 0;
}
@@ -298,7 +299,7 @@ Filter* lookup(const std::string& algname,
filter = lookup_encoder(algname);
if(filter) return filter;
- filter = lookup_s2k(algname, params);
+ filter = lookup_pbkdf(algname, params);
if(filter) return filter;
return 0;
diff --git a/checks/validate.dat b/checks/validate.dat
index aaeb7f013..cea1f18fc 100644
--- a/checks/validate.dat
+++ b/checks/validate.dat
@@ -1,8 +1,8 @@
# Main Botan validation file
-# This has test vectors for block ciphers in ECB mode, stream ciphers, hash
-# functions, MACs, KDFs, S2K algorithms, encoders/decoders, and block cipher
-# modes (CBC, CTS, CFB, OFB, CTR, and EAX)
+# This has test vectors for block ciphers in ECB mode, stream ciphers,
+# hash functions, MACs, KDFs, PBKDFs, encoders/decoders, and block
+# cipher modes (CBC, CTS, CFB, OFB, CTR, XTS, and EAX)
# MARKER: Block Ciphers
@@ -60553,9 +60553,9 @@ A09661392376F7044D9052A397883246B67F5F1EF63EB5FB::24
0123456789ABCDEFFEDCBA98765432010123456789ABCDEFFEDCBA9876543201\
0123456789ABCDEFFEDCBA98765432010123456789ABCDEFFEDCBA9876543201:16
-# MARKER: S2K Algorithms
+# MARKER: PBKDF Algorithms
-# S2K format: passphrase:output:salt:out_len:iterations
+# PBKDF format: passphrase:output:salt:out_len:iterations
[OpenPGP-S2K(SHA-1)]
666F6F:0BEEC7B5EA3F0FDBC95D0DD47F3C5BC275DA8A335A8CAA4039FDBC02C01A649C::32:0