diff options
Diffstat (limited to 'src/pbkdf')
-rw-r--r-- | src/pbkdf/pbkdf1/pbkdf1.cpp | 2 | ||||
-rw-r--r-- | src/pbkdf/pbkdf2/pbkdf2.cpp | 10 | ||||
-rw-r--r-- | src/pbkdf/pgps2k/pgp_s2k.cpp | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/pbkdf/pbkdf1/pbkdf1.cpp b/src/pbkdf/pbkdf1/pbkdf1.cpp index 16de435e9..7f0939b8f 100644 --- a/src/pbkdf/pbkdf1/pbkdf1.cpp +++ b/src/pbkdf/pbkdf1/pbkdf1.cpp @@ -26,7 +26,7 @@ OctetString PKCS5_PBKDF1::derive_key(size_t key_len, hash->update(passphrase); hash->update(salt, salt_size); - SecureVector<byte> key = hash->final(); + secure_vector<byte> key = hash->final(); for(size_t j = 1; j != iterations; ++j) { diff --git a/src/pbkdf/pbkdf2/pbkdf2.cpp b/src/pbkdf/pbkdf2/pbkdf2.cpp index 7e4d1cd8a..699ce7c6b 100644 --- a/src/pbkdf/pbkdf2/pbkdf2.cpp +++ b/src/pbkdf/pbkdf2/pbkdf2.cpp @@ -30,14 +30,14 @@ OctetString PKCS5_PBKDF2::derive_key(size_t key_len, catch(Invalid_Key_Length) { throw Exception(name() + " cannot accept passphrases of length " + - to_string(passphrase.length())); + std::to_string(passphrase.length())); } - SecureVector<byte> key(key_len); + secure_vector<byte> key(key_len); byte* T = &key[0]; - SecureVector<byte> U(mac->output_length()); + secure_vector<byte> U(mac->output_length()); u32bit counter = 1; while(key_len) @@ -48,13 +48,13 @@ OctetString PKCS5_PBKDF2::derive_key(size_t key_len, mac->update_be(counter); mac->final(&U[0]); - xor_buf(T, U, T_size); + xor_buf(T, &U[0], T_size); for(size_t j = 1; j != iterations; ++j) { mac->update(U); mac->final(&U[0]); - xor_buf(T, U, T_size); + xor_buf(T, &U[0], T_size); } key_len -= T_size; diff --git a/src/pbkdf/pgps2k/pgp_s2k.cpp b/src/pbkdf/pgps2k/pgp_s2k.cpp index 9cec7304c..6f6de58e2 100644 --- a/src/pbkdf/pgps2k/pgp_s2k.cpp +++ b/src/pbkdf/pgps2k/pgp_s2k.cpp @@ -17,7 +17,7 @@ OctetString OpenPGP_S2K::derive_key(size_t key_len, const byte salt_buf[], size_t salt_size, size_t iterations) const { - SecureVector<byte> key(key_len), hash_buf; + secure_vector<byte> key(key_len), hash_buf; size_t pass = 0, generated = 0, total_size = passphrase.size() + salt_size; @@ -46,7 +46,7 @@ OctetString OpenPGP_S2K::derive_key(size_t key_len, } hash_buf = hash->final(); - key.copy(generated, &hash_buf[0], hash->output_length()); + buffer_insert(key, generated, &hash_buf[0], hash->output_length()); generated += hash->output_length(); ++pass; } |