diff options
author | Adam Langley <agl@google.com> | 2016-07-12 00:07:19 +0300 |
---|---|---|
committer | David Benjamin <davidben@google.com> | 2016-07-12 02:04:52 +0300 |
commit | 09feb0f3d95a2bc58ce0faaf14256d3bd30f52a4 (patch) | |
tree | c5d03846c2bffc42b9ab9bd6b6e30e044d7962b6 /crypto/pkcs8 | |
parent | 09eb655e5cb202878b831eadb30c92ab24960d4a (diff) |
Move C++ helpers into |bssl| namespace.
We currently have the situation where the |tool| and |bssl_shim| code
includes scoped_types.h from crypto/test and ssl/test. That's weird and
shouldn't happen. Also, our C++ consumers might quite like to have
access to the scoped types.
Thus this change moves some of the template code to base.h and puts it
all in a |bssl| namespace to prepare for scattering these types into
their respective headers. In order that all the existing test code be
able to access these types, it's all moved into the same namespace.
Change-Id: I3207e29474dc5fcc344ace43119df26dae04eabb
Reviewed-on: https://boringssl-review.googlesource.com/8730
Reviewed-by: David Benjamin <davidben@google.com>
Diffstat (limited to 'crypto/pkcs8')
-rw-r--r-- | crypto/pkcs8/pkcs12_test.cc | 12 | ||||
-rw-r--r-- | crypto/pkcs8/pkcs8_test.cc | 8 |
2 files changed, 14 insertions, 6 deletions
diff --git a/crypto/pkcs8/pkcs12_test.cc b/crypto/pkcs8/pkcs12_test.cc index 17bcd273..10694446 100644 --- a/crypto/pkcs8/pkcs12_test.cc +++ b/crypto/pkcs8/pkcs12_test.cc @@ -681,6 +681,8 @@ static const uint8_t kWindows[] = { 0xfe, 0x3a, 0x66, 0x47, 0x40, 0x49, 0x02, 0x02, 0x07, 0xd0, }; +namespace bssl { + static const char kPassword[] = "foo"; static bool Test(const char *name, const uint8_t *der, size_t der_len) { @@ -755,13 +757,15 @@ static bool TestCompat(const uint8_t *der, size_t der_len) { return true; } +} // namespace bssl + int main(int argc, char **argv) { CRYPTO_library_init(); - if (!Test("OpenSSL", kOpenSSL, sizeof(kOpenSSL)) || - !Test("NSS", kNSS, sizeof(kNSS)) || - !Test("Windows", kWindows, sizeof(kWindows)) || - !TestCompat(kWindows, sizeof(kWindows))) { + if (!bssl::Test("OpenSSL", kOpenSSL, sizeof(kOpenSSL)) || + !bssl::Test("NSS", kNSS, sizeof(kNSS)) || + !bssl::Test("Windows", kWindows, sizeof(kWindows)) || + !bssl::TestCompat(kWindows, sizeof(kWindows))) { return 1; } diff --git a/crypto/pkcs8/pkcs8_test.cc b/crypto/pkcs8/pkcs8_test.cc index 7a88ddf4..e54a6997 100644 --- a/crypto/pkcs8/pkcs8_test.cc +++ b/crypto/pkcs8/pkcs8_test.cc @@ -62,7 +62,9 @@ static const uint8_t kDER[] = { 0xd6, 0x2d, }; -static bool test(const uint8_t *der, size_t der_len) { +namespace bssl { + +static bool Test(const uint8_t *der, size_t der_len) { const uint8_t *data = der; ScopedX509_SIG sig(d2i_X509_SIG(NULL, &data, der_len)); if (sig.get() == NULL || data != der + der_len) { @@ -81,8 +83,10 @@ static bool test(const uint8_t *der, size_t der_len) { return true; } +} // namespace bssl + int main(int argc, char **argv) { - if (!test(kDER, sizeof(kDER))) { + if (!bssl::Test(kDER, sizeof(kDER))) { return 1; } |