summaryrefslogtreecommitdiffstats
path: root/src/crypto/cipher/cipher_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/cipher/cipher_test.cc')
-rw-r--r--src/crypto/cipher/cipher_test.cc26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/crypto/cipher/cipher_test.cc b/src/crypto/cipher/cipher_test.cc
index 5f04178..1cbfae9 100644
--- a/src/crypto/cipher/cipher_test.cc
+++ b/src/crypto/cipher/cipher_test.cc
@@ -63,7 +63,6 @@
#include "../test/file_test.h"
#include "../test/scoped_types.h"
-#include "../test/stl_compat.h"
static const EVP_CIPHER *GetCipher(const std::string &name) {
@@ -146,7 +145,7 @@ static bool TestOperation(FileTest *t,
}
if (is_aead && !encrypt &&
!EVP_CIPHER_CTX_ctrl(ctx.get(), EVP_CTRL_GCM_SET_TAG, tag.size(),
- const_cast<uint8_t*>(bssl::vector_data(&tag)))) {
+ const_cast<uint8_t*>(tag.data()))) {
return false;
}
// The ciphers are run with no padding. For each of the ciphers we test, the
@@ -162,10 +161,10 @@ static bool TestOperation(FileTest *t,
// |EVP_CipherUpdate| calls when empty.
int unused, result_len1 = 0, result_len2;
if (!EVP_CIPHER_CTX_set_key_length(ctx.get(), key.size()) ||
- !EVP_CipherInit_ex(ctx.get(), nullptr, nullptr, bssl::vector_data(&key),
- bssl::vector_data(&iv), -1) ||
+ !EVP_CipherInit_ex(ctx.get(), nullptr, nullptr, key.data(), iv.data(),
+ -1) ||
(!aad.empty() &&
- !EVP_CipherUpdate(ctx.get(), nullptr, &unused, bssl::vector_data(&aad),
+ !EVP_CipherUpdate(ctx.get(), nullptr, &unused, aad.data(),
aad.size())) ||
!EVP_CIPHER_CTX_set_padding(ctx.get(), 0)) {
t->PrintLine("Operation failed.");
@@ -175,28 +174,27 @@ static bool TestOperation(FileTest *t,
for (size_t i = 0; i < in->size(); i++) {
uint8_t c = (*in)[i];
int len;
- if (!EVP_CipherUpdate(ctx.get(), bssl::vector_data(&result) + result_len1,
- &len, &c, 1)) {
+ if (!EVP_CipherUpdate(ctx.get(), result.data() + result_len1, &len, &c,
+ 1)) {
t->PrintLine("Operation failed.");
return false;
}
result_len1 += len;
}
} else if (!in->empty() &&
- !EVP_CipherUpdate(ctx.get(), bssl::vector_data(&result),
- &result_len1, bssl::vector_data(in),
- in->size())) {
+ !EVP_CipherUpdate(ctx.get(), result.data(), &result_len1,
+ in->data(), in->size())) {
t->PrintLine("Operation failed.");
return false;
}
- if (!EVP_CipherFinal_ex(ctx.get(), bssl::vector_data(&result) + result_len1,
+ if (!EVP_CipherFinal_ex(ctx.get(), result.data() + result_len1,
&result_len2)) {
t->PrintLine("Operation failed.");
return false;
}
result.resize(result_len1 + result_len2);
- if (!t->ExpectBytesEqual(bssl::vector_data(out), out->size(),
- bssl::vector_data(&result), result.size())) {
+ if (!t->ExpectBytesEqual(out->data(), out->size(), result.data(),
+ result.size())) {
return false;
}
if (encrypt && is_aead) {
@@ -207,7 +205,7 @@ static bool TestOperation(FileTest *t,
}
if (!EVP_CIPHER_CTX_ctrl(ctx.get(), EVP_CTRL_GCM_GET_TAG, tag.size(),
rtag) ||
- !t->ExpectBytesEqual(bssl::vector_data(&tag), tag.size(), rtag,
+ !t->ExpectBytesEqual(tag.data(), tag.size(), rtag,
tag.size())) {
return false;
}