Remove the remaining bssl::Main wrappers.
We've taken to writing bssl::UniquePtr in full, so it's not buying
us much.
Change-Id: Ia2689366cbb17282c8063608dddcc675518ec0ca
Reviewed-on: https://boringssl-review.googlesource.com/12628
Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/crypto/bio/bio_test.cc b/crypto/bio/bio_test.cc
index a3bfb2b..5cc75b5 100644
--- a/crypto/bio/bio_test.cc
+++ b/crypto/bio/bio_test.cc
@@ -263,7 +263,7 @@
return true;
}
-int main(void) {
+int main() {
CRYPTO_library_init();
#if defined(OPENSSL_WINDOWS)
diff --git a/crypto/bytestring/bytestring_test.cc b/crypto/bytestring/bytestring_test.cc
index 563c6b0..6ce071a 100644
--- a/crypto/bytestring/bytestring_test.cc
+++ b/crypto/bytestring/bytestring_test.cc
@@ -28,7 +28,6 @@
#include "internal.h"
#include "../internal.h"
-namespace bssl {
static bool TestSkip() {
static const uint8_t kData[] = {1, 2, 3};
@@ -317,7 +316,7 @@
}
static bool TestCBBFixed() {
- ScopedCBB cbb;
+ bssl::ScopedCBB cbb;
uint8_t buf[1];
uint8_t *out_buf;
size_t out_size;
@@ -401,7 +400,7 @@
}
static bool TestCBBDiscardChild() {
- ScopedCBB cbb;
+ bssl::ScopedCBB cbb;
CBB contents, inner_contents, inner_inner_contents;
if (!CBB_init(cbb.get(), 0) ||
@@ -804,7 +803,7 @@
uint8_t buf[10];
uint8_t *ptr;
size_t len;
- ScopedCBB cbb;
+ bssl::ScopedCBB cbb;
if (!CBB_init_fixed(cbb.get(), buf, sizeof(buf)) ||
// Too large.
CBB_reserve(cbb.get(), &ptr, 11)) {
@@ -827,7 +826,7 @@
static bool TestStickyError() {
// Write an input that exceeds the limit for its length prefix.
- ScopedCBB cbb;
+ bssl::ScopedCBB cbb;
CBB child;
static const uint8_t kZeros[256] = {0};
if (!CBB_init(cbb.get(), 0) ||
@@ -890,7 +889,7 @@
return true;
}
-static int Main() {
+int main() {
CRYPTO_library_init();
if (!TestSkip() ||
@@ -918,9 +917,3 @@
printf("PASS\n");
return 0;
}
-
-} // namespace bssl
-
-int main() {
- return bssl::Main();
-}
diff --git a/crypto/cipher/aead_test.cc b/crypto/cipher/aead_test.cc
index 8dbc8a2..313f041 100644
--- a/crypto/cipher/aead_test.cc
+++ b/crypto/cipher/aead_test.cc
@@ -33,8 +33,6 @@
}
#endif
-namespace bssl {
-
// This program tests an AEAD against a series of test vectors from a file,
// using the FileTest format. As an example, here's a valid test case:
//
@@ -58,7 +56,7 @@
return false;
}
- ScopedEVP_AEAD_CTX ctx;
+ bssl::ScopedEVP_AEAD_CTX ctx;
if (!EVP_AEAD_CTX_init_with_direction(ctx.get(), aead, key.data(), key.size(),
tag.size(), evp_aead_seal)) {
t->PrintLine("Failed to init AEAD.");
@@ -208,7 +206,7 @@
const size_t max_overhead = EVP_AEAD_max_overhead(aead);
std::vector<uint8_t> key(key_len, 'a');
- ScopedEVP_AEAD_CTX ctx;
+ bssl::ScopedEVP_AEAD_CTX ctx;
if (!EVP_AEAD_CTX_init(ctx.get(), aead, key.data(), key_len,
EVP_AEAD_DEFAULT_TAG_LENGTH, nullptr)) {
return false;
@@ -333,7 +331,7 @@
{ "", NULL, false },
};
-static int Main(int argc, char **argv) {
+int main(int argc, char **argv) {
CRYPTO_library_init();
if (argc != 3) {
@@ -371,9 +369,3 @@
return FileTestMain(TestAEAD, const_cast<EVP_AEAD*>(aead), argv[2]);
}
-
-} // namespace bssl
-
-int main(int argc, char **argv) {
- return bssl::Main(argc, argv);
-}
diff --git a/crypto/cipher/cipher_test.cc b/crypto/cipher/cipher_test.cc
index cb42fc5..09802c2 100644
--- a/crypto/cipher/cipher_test.cc
+++ b/crypto/cipher/cipher_test.cc
@@ -63,7 +63,6 @@
#include "../test/file_test.h"
-namespace bssl {
static const EVP_CIPHER *GetCipher(const std::string &name) {
if (name == "DES-CBC") {
@@ -127,7 +126,7 @@
bool is_aead = EVP_CIPHER_mode(cipher) == EVP_CIPH_GCM_MODE;
- ScopedEVP_CIPHER_CTX ctx;
+ bssl::ScopedEVP_CIPHER_CTX ctx;
if (!EVP_CipherInit_ex(ctx.get(), cipher, nullptr, nullptr, nullptr,
encrypt ? 1 : 0)) {
return false;
@@ -284,7 +283,7 @@
return true;
}
-static int Main(int argc, char **argv) {
+int main(int argc, char **argv) {
CRYPTO_library_init();
if (argc != 2) {
@@ -294,9 +293,3 @@
return FileTestMain(TestCipher, nullptr, argv[1]);
}
-
-} // namespace bssl
-
-int main(int argc, char **argv) {
- return bssl::Main(argc, argv);
-}
diff --git a/crypto/dh/dh_test.cc b/crypto/dh/dh_test.cc
index 9a3d780..99bb945 100644
--- a/crypto/dh/dh_test.cc
+++ b/crypto/dh/dh_test.cc
@@ -68,7 +68,6 @@
#include <openssl/err.h>
#include <openssl/mem.h>
-namespace bssl {
static bool RunBasicTests();
static bool RunRFC5114Tests();
@@ -76,7 +75,7 @@
static bool TestASN1();
static bool TestRFC3526();
-static int Main() {
+int main() {
CRYPTO_library_init();
if (!RunBasicTests() ||
@@ -568,7 +567,7 @@
return false;
}
- ScopedCBB cbb;
+ bssl::ScopedCBB cbb;
uint8_t *der;
size_t der_len;
if (!CBB_init(cbb.get(), 0) ||
@@ -661,9 +660,3 @@
return true;
}
-
-} // namespace bssl
-
-int main() {
- return bssl::Main();
-}
diff --git a/crypto/digest/digest_test.cc b/crypto/digest/digest_test.cc
index ecf0308..0d3f16e 100644
--- a/crypto/digest/digest_test.cc
+++ b/crypto/digest/digest_test.cc
@@ -28,8 +28,6 @@
#include "../internal.h"
-namespace bssl {
-
struct MD {
// name is the name of the digest.
const char* name;
@@ -161,7 +159,7 @@
}
static int TestDigest(const TestVector *test) {
- ScopedEVP_MD_CTX ctx;
+ bssl::ScopedEVP_MD_CTX ctx;
// Test the input provided.
if (!EVP_DigestInit_ex(ctx.get(), test->md.func(), NULL)) {
@@ -246,7 +244,7 @@
return true;
}
-static int Main() {
+int main() {
CRYPTO_library_init();
for (size_t i = 0; i < OPENSSL_ARRAY_SIZE(kTestVectors); i++) {
@@ -263,9 +261,3 @@
printf("PASS\n");
return 0;
}
-
-} // namespace bssl
-
-int main() {
- return bssl::Main();
-}
diff --git a/crypto/evp/evp_extra_test.cc b/crypto/evp/evp_extra_test.cc
index 755fa83..4d41760 100644
--- a/crypto/evp/evp_extra_test.cc
+++ b/crypto/evp/evp_extra_test.cc
@@ -27,7 +27,6 @@
#include <openssl/pkcs8.h>
#include <openssl/rsa.h>
-namespace bssl {
// kExampleRSAKeyDER is an RSA private key in ASN.1, DER format. Of course, you
// should never use this key anywhere but in an example.
@@ -371,7 +370,7 @@
static bool TestEVP_DigestSignInit(void) {
bssl::UniquePtr<EVP_PKEY> pkey = LoadExampleRSAKey();
- ScopedEVP_MD_CTX md_ctx;
+ bssl::ScopedEVP_MD_CTX md_ctx;
if (!pkey ||
!EVP_DigestSignInit(md_ctx.get(), NULL, EVP_sha256(), NULL, pkey.get()) ||
!EVP_DigestSignUpdate(md_ctx.get(), kMsg, sizeof(kMsg))) {
@@ -409,7 +408,7 @@
static bool TestEVP_DigestVerifyInit(void) {
bssl::UniquePtr<EVP_PKEY> pkey = LoadExampleRSAKey();
- ScopedEVP_MD_CTX md_ctx;
+ bssl::ScopedEVP_MD_CTX md_ctx;
if (!pkey ||
!EVP_DigestVerifyInit(md_ctx.get(), NULL, EVP_sha256(), NULL,
pkey.get()) ||
@@ -591,7 +590,7 @@
if (!empty) {
return false;
}
- ScopedCBB cbb;
+ bssl::ScopedCBB cbb;
if (EVP_marshal_public_key(cbb.get(), empty.get())) {
fprintf(stderr, "Marshalled empty public key.\n");
return false;
@@ -670,7 +669,7 @@
return true;
}
-static int Main(void) {
+int main() {
CRYPTO_library_init();
if (!TestEVP_DigestSignInit()) {
@@ -718,9 +717,3 @@
printf("PASS\n");
return 0;
}
-
-} // namespace bssl
-
-int main() {
- return bssl::Main();
-}
diff --git a/crypto/evp/evp_test.cc b/crypto/evp/evp_test.cc
index 68b869a..bfaa38a 100644
--- a/crypto/evp/evp_test.cc
+++ b/crypto/evp/evp_test.cc
@@ -75,7 +75,6 @@
#include "../test/file_test.h"
-namespace bssl {
// evp_test dispatches between multiple test types. PrivateKey tests take a key
// name parameter and single block, decode it as a PEM private key, and save it
@@ -141,7 +140,7 @@
}
// The key must re-encode correctly.
- ScopedCBB cbb;
+ bssl::ScopedCBB cbb;
uint8_t *der;
size_t der_len;
if (!CBB_init(cbb.get(), 0) ||
@@ -253,7 +252,7 @@
return true;
}
-static int Main(int argc, char *argv[]) {
+int main(int argc, char *argv[]) {
CRYPTO_library_init();
if (argc != 2) {
fprintf(stderr, "%s <test file.txt>\n", argv[0]);
@@ -263,9 +262,3 @@
KeyMap map;
return FileTestMain(TestEVP, &map, argv[1]);
}
-
-} // namespace bssl
-
-int main(int argc, char *argv[]) {
- return bssl::Main(argc, argv);
-}
diff --git a/crypto/hmac/hmac_test.cc b/crypto/hmac/hmac_test.cc
index 60a9581..7b216e2 100644
--- a/crypto/hmac/hmac_test.cc
+++ b/crypto/hmac/hmac_test.cc
@@ -67,7 +67,6 @@
#include "../test/file_test.h"
-namespace bssl {
static const EVP_MD *GetDigest(const std::string &name) {
if (name == "MD5") {
@@ -117,7 +116,7 @@
}
// Test using HMAC_CTX.
- ScopedHMAC_CTX ctx;
+ bssl::ScopedHMAC_CTX ctx;
if (!HMAC_Init_ex(ctx.get(), key.data(), key.size(), digest, nullptr) ||
!HMAC_Update(ctx.get(), input.data(), input.size()) ||
!HMAC_Final(ctx.get(), mac.get(), &mac_len) ||
@@ -158,7 +157,7 @@
return true;
}
-static int Main(int argc, char *argv[]) {
+int main(int argc, char *argv[]) {
CRYPTO_library_init();
if (argc != 2) {
@@ -168,9 +167,3 @@
return FileTestMain(TestHMAC, nullptr, argv[1]);
}
-
-} // namespace bssl
-
-int main(int argc, char **argv) {
- return bssl::Main(argc, argv);
-}
diff --git a/crypto/x509/x509_test.cc b/crypto/x509/x509_test.cc
index c39d98d..3e2d3f7 100644
--- a/crypto/x509/x509_test.cc
+++ b/crypto/x509/x509_test.cc
@@ -25,7 +25,6 @@
#include <openssl/pool.h>
#include <openssl/x509.h>
-namespace bssl {
static const char kCrossSigningRootPEM[] =
"-----BEGIN CERTIFICATE-----\n"
@@ -724,7 +723,7 @@
}
// Test PKCS#1 v1.5.
- ScopedEVP_MD_CTX md_ctx;
+ bssl::ScopedEVP_MD_CTX md_ctx;
if (!EVP_DigestSignInit(md_ctx.get(), NULL, EVP_sha256(), NULL, pkey.get()) ||
!SignatureRoundTrips(md_ctx.get(), pkey.get())) {
fprintf(stderr, "RSA PKCS#1 with SHA-256 failed\n");
@@ -941,7 +940,7 @@
return true;
}
-static int Main() {
+int main() {
CRYPTO_library_init();
if (!TestVerify() ||
@@ -959,9 +958,3 @@
printf("PASS\n");
return 0;
}
-
-} // namespace bssl
-
-int main() {
- return bssl::Main();
-}
diff --git a/ssl/test/bssl_shim.cc b/ssl/test/bssl_shim.cc
index a12fe7b..27405d5 100644
--- a/ssl/test/bssl_shim.cc
+++ b/ssl/test/bssl_shim.cc
@@ -65,7 +65,6 @@
#include "packeted_bio.h"
#include "test_config.h"
-namespace bssl {
#if !defined(OPENSSL_WINDOWS)
static int closesocket(int sock) {
@@ -246,7 +245,7 @@
return ssl_private_key_failure;
}
- ScopedEVP_MD_CTX ctx;
+ bssl::ScopedEVP_MD_CTX ctx;
EVP_PKEY_CTX *pctx;
if (!EVP_DigestSignInit(ctx.get(), &pctx, md, nullptr,
test_state->private_key.get())) {
@@ -1873,7 +1872,7 @@
~StderrDelimiter() { fprintf(stderr, "--- DONE ---\n"); }
};
-static int Main(int argc, char **argv) {
+int main(int argc, char **argv) {
// To distinguish ASan's output from ours, add a trailing message to stderr.
// Anything following this line will be considered an error.
StderrDelimiter delimiter;
@@ -1941,9 +1940,3 @@
return 0;
}
-
-} // namespace bssl
-
-int main(int argc, char **argv) {
- return bssl::Main(argc, argv);
-}