aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/misc/rfc3394
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-06-24 20:18:56 +0200
committerSimon Warta <[email protected]>2015-06-25 01:50:52 +0200
commit1033054c1495d4a10afc33f2747d24d9c32b6907 (patch)
tree776c291a37b5d86d82739591d62e3602ee294f38 /src/lib/misc/rfc3394
parentf3e2ba1c8273e439f4d18dabc253d6aad47ac622 (diff)
lib/misc: Convert &vec[0] to vec.data()
Diffstat (limited to 'src/lib/misc/rfc3394')
-rw-r--r--src/lib/misc/rfc3394/rfc3394.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/misc/rfc3394/rfc3394.cpp b/src/lib/misc/rfc3394/rfc3394.cpp
index 11791418b..a199cc599 100644
--- a/src/lib/misc/rfc3394/rfc3394.cpp
+++ b/src/lib/misc/rfc3394/rfc3394.cpp
@@ -34,7 +34,7 @@ secure_vector<byte> rfc3394_keywrap(const secure_vector<byte>& key,
for(size_t i = 0; i != 8; ++i)
A[i] = 0xA6;
- copy_mem(&R[8], &key[0], key.size());
+ copy_mem(&R[8], key.data(), key.size());
for(size_t j = 0; j <= 5; ++j)
{
@@ -44,16 +44,16 @@ secure_vector<byte> rfc3394_keywrap(const secure_vector<byte>& key,
copy_mem(&A[8], &R[8*i], 8);
- aes->encrypt(&A[0]);
+ aes->encrypt(A.data());
copy_mem(&R[8*i], &A[8], 8);
byte t_buf[4] = { 0 };
store_be(t, t_buf);
- xor_buf(&A[4], &t_buf[0], 4);
+ xor_buf(&A[4], t_buf, 4);
}
}
- copy_mem(&R[0], &A[0], 8);
+ copy_mem(R.data(), A.data(), 8);
return R;
}
@@ -78,7 +78,7 @@ secure_vector<byte> rfc3394_keyunwrap(const secure_vector<byte>& key,
for(size_t i = 0; i != 8; ++i)
A[i] = key[i];
- copy_mem(&R[0], &key[8], key.size() - 8);
+ copy_mem(R.data(), &key[8], key.size() - 8);
for(size_t j = 0; j <= 5; ++j)
{
@@ -89,17 +89,17 @@ secure_vector<byte> rfc3394_keyunwrap(const secure_vector<byte>& key,
byte t_buf[4] = { 0 };
store_be(t, t_buf);
- xor_buf(&A[4], &t_buf[0], 4);
+ xor_buf(&A[4], t_buf, 4);
copy_mem(&A[8], &R[8*(i-1)], 8);
- aes->decrypt(&A[0]);
+ aes->decrypt(A.data());
copy_mem(&R[8*(i-1)], &A[8], 8);
}
}
- if(load_be<u64bit>(&A[0], 0) != 0xA6A6A6A6A6A6A6A6)
+ if(load_be<u64bit>(A.data(), 0) != 0xA6A6A6A6A6A6A6A6)
throw Integrity_Failure("NIST key unwrap failed");
return R;