aboutsummaryrefslogtreecommitdiffstats
path: root/src/wrap
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 /src/wrap
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 'src/wrap')
-rw-r--r--src/wrap/sqlite/codec.cpp8
-rw-r--r--src/wrap/sqlite/codec.h8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/wrap/sqlite/codec.cpp b/src/wrap/sqlite/codec.cpp
index 5dfcea82e..60c8f6a21 100644
--- a/src/wrap/sqlite/codec.cpp
+++ b/src/wrap/sqlite/codec.cpp
@@ -54,12 +54,12 @@ Codec::InitializeCodec(void *db)
void
Codec::GenerateWriteKey(const char* userPassword, int passwordLength)
{
- S2K* s2k = get_s2k(S2K_STR);
- s2k->set_iterations(S2K_ITERATIONS);
- s2k->change_salt((const byte*)SALT_STR.c_str(), SALT_SIZE);
+ PBKDF* pbkdf = get_pbkdf(PBKDF_STR);
+ pbkdf->set_iterations(PBKDF_ITERATIONS);
+ pbkdf->change_salt((const byte*)SALT_STR.c_str(), SALT_SIZE);
SymmetricKey masterKey =
- s2k->derive_key(KEY_SIZE + IV_DERIVATION_KEY_SIZE, std::string(userPassword, passwordLength));
+ pbkdf->derive_key(KEY_SIZE + IV_DERIVATION_KEY_SIZE, std::string(userPassword, passwordLength));
m_writeKey = SymmetricKey(masterKey.bits_of(), KEY_SIZE);
m_ivWriteKey = SymmetricKey(masterKey.bits_of() + KEY_SIZE, IV_DERIVATION_KEY_SIZE);
diff --git a/src/wrap/sqlite/codec.h b/src/wrap/sqlite/codec.h
index 8b753be62..c254f9fde 100644
--- a/src/wrap/sqlite/codec.h
+++ b/src/wrap/sqlite/codec.h
@@ -50,9 +50,9 @@ using namespace Botan;
//make sure to add "/NoPadding" for modes that use padding schemes
const string BLOCK_CIPHER_STR = "Twofish/XTS";
-//S2K_STR: Key derivation function used to derive both the encryption
+//PBKDF_STR: Key derivation function used to derive both the encryption
//and IV derivation keys from the given database passphrase
-const string S2K_STR = "PBKDF2(SHA-160)";
+const string PBKDF_STR = "PBKDF2(SHA-160)";
//SALT_STR: Hard coded salt used to derive the key from the passphrase.
const string SALT_STR = "&g#nB'9]";
@@ -61,9 +61,9 @@ const string SALT_STR = "&g#nB'9]";
//encryption
const string MAC_STR = "CMAC(Twofish)";
-//S2K_ITERATIONS: Number of hash iterations used in the key derivation
+//PBKDF_ITERATIONS: Number of hash iterations used in the key derivation
//process.
-const int S2K_ITERATIONS = 10000;
+const int PBKDF_ITERATIONS = 10000;
//SALT_SIZE: Size of the salt in bytes (as given in SALT_STR)
const int SALT_SIZE = 64/8; //64 bit, 8 byte salt