diff options
author | lloyd <[email protected]> | 2015-02-18 04:21:21 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2015-02-18 04:21:21 +0000 |
commit | 88285f51ba4fd5bc1a1cc06b0760b3926046f29b (patch) | |
tree | 7443b2b266b8445433b9c63704b7a09e216282f2 /src/lib/pubkey/dlies | |
parent | aced9e88d970546c6324e768ce11b0a483bd3bd0 (diff) |
Modify interfaces of KDF and PBKDF to write output to an array, with
higher level functions on interface handling returning a vector.
Diffstat (limited to 'src/lib/pubkey/dlies')
-rw-r--r-- | src/lib/pubkey/dlies/dlies.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/pubkey/dlies/dlies.cpp b/src/lib/pubkey/dlies/dlies.cpp index 42ecfb561..899ee98aa 100644 --- a/src/lib/pubkey/dlies/dlies.cpp +++ b/src/lib/pubkey/dlies/dlies.cpp @@ -44,14 +44,14 @@ std::vector<byte> DLIES_Encryptor::enc(const byte in[], size_t length, vz += ka.derive_key(0, other_key).bits_of(); const size_t K_LENGTH = length + mac_keylen; - OctetString K = kdf->derive_key(K_LENGTH, vz); + secure_vector<byte> K = kdf->derive_key(K_LENGTH, vz); - if(K.length() != K_LENGTH) + if(K.size() != K_LENGTH) throw Encoding_Error("DLIES: KDF did not provide sufficient output"); byte* C = &out[my_key.size()]; - xor_buf(C, K.begin() + mac_keylen, length); - mac->set_key(K.begin(), mac_keylen); + mac->set_key(&K[0], mac_keylen); + xor_buf(C, &K[mac_keylen], length); mac->update(C, length); for(size_t j = 0; j != 8; ++j) @@ -114,11 +114,11 @@ secure_vector<byte> DLIES_Decryptor::dec(const byte msg[], size_t length) const vz += ka.derive_key(0, v).bits_of(); const size_t K_LENGTH = C.size() + mac_keylen; - OctetString K = kdf->derive_key(K_LENGTH, vz); - if(K.length() != K_LENGTH) + secure_vector<byte> K = kdf->derive_key(K_LENGTH, vz); + if(K.size() != K_LENGTH) throw Encoding_Error("DLIES: KDF did not provide sufficient output"); - mac->set_key(K.begin(), mac_keylen); + mac->set_key(&K[0], mac_keylen); mac->update(C); for(size_t j = 0; j != 8; ++j) mac->update(0); @@ -126,7 +126,7 @@ secure_vector<byte> DLIES_Decryptor::dec(const byte msg[], size_t length) const if(T != T2) throw Decoding_Error("DLIES: message authentication failed"); - xor_buf(C, K.begin() + mac_keylen, C.size()); + xor_buf(C, &K[0] + mac_keylen, C.size()); return C; } |