aboutsummaryrefslogtreecommitdiff
path: root/src/pki/fillins
diff options
context:
space:
mode:
Diffstat (limited to 'src/pki/fillins')
-rw-r--r--src/pki/fillins/file_util.cc35
-rw-r--r--src/pki/fillins/file_util.h24
-rw-r--r--src/pki/fillins/fillins_base64.cc48
-rw-r--r--src/pki/fillins/fillins_base64.h27
-rw-r--r--src/pki/fillins/fillins_string_util.cc89
-rw-r--r--src/pki/fillins/fillins_string_util.h41
-rw-r--r--src/pki/fillins/log.h26
-rw-r--r--src/pki/fillins/net_errors.h18
-rw-r--r--src/pki/fillins/openssl_util.cc19
-rw-r--r--src/pki/fillins/openssl_util.h28
-rw-r--r--src/pki/fillins/path_service.cc40
-rw-r--r--src/pki/fillins/path_service.h42
12 files changed, 0 insertions, 437 deletions
diff --git a/src/pki/fillins/file_util.cc b/src/pki/fillins/file_util.cc
deleted file mode 100644
index e2d28fd..0000000
--- a/src/pki/fillins/file_util.cc
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2023 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "file_util.h"
-
-#include <fstream>
-#include <iostream>
-#include <streambuf>
-#include <string>
-
-namespace bssl {
-
-namespace fillins {
-
-bool ReadFileToString(const FilePath &path, std::string *out) {
- std::ifstream file(path.value(), std::ios::binary);
- file.unsetf(std::ios::skipws);
-
- file.seekg(0, std::ios::end);
- if (file.tellg() <= 0) {
- return false;
- }
- out->reserve(file.tellg());
- file.seekg(0, std::ios::beg);
-
- out->assign(std::istreambuf_iterator<char>(file),
- std::istreambuf_iterator<char>());
-
- return true;
-}
-
-} // namespace fillins
-
-} // namespace bssl
diff --git a/src/pki/fillins/file_util.h b/src/pki/fillins/file_util.h
deleted file mode 100644
index 23e9b1a..0000000
--- a/src/pki/fillins/file_util.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2023 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BSSL_FILLINS_FILE_UTIL_H
-#define BSSL_FILLINS_FILE_UTIL_H
-
-#include <openssl/base.h>
-
-#include "path_service.h"
-
-#include <string>
-
-namespace bssl {
-
-namespace fillins {
-
-bool ReadFileToString(const FilePath &path, std::string *out);
-
-} // namespace fillins
-
-} // namespace bssl
-
-#endif // BSSL_FILLINS_FILE_UTIL_H
diff --git a/src/pki/fillins/fillins_base64.cc b/src/pki/fillins/fillins_base64.cc
deleted file mode 100644
index a692cb0..0000000
--- a/src/pki/fillins/fillins_base64.cc
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2023 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <openssl/base64.h>
-
-#include "fillins_base64.h"
-
-#include <vector>
-
-namespace bssl {
-
-namespace fillins {
-
-bool Base64Encode(const std::string_view &input, std::string *output) {
- size_t len;
- if (!EVP_EncodedLength(&len, input.size())) {
- return false;
- }
- std::vector<char> encoded(len);
- len = EVP_EncodeBlock(reinterpret_cast<uint8_t *>(encoded.data()),
- reinterpret_cast<const uint8_t *>(input.data()),
- input.size());
- if (!len) {
- return false;
- }
- output->assign(encoded.data(), len);
- return true;
-}
-
-bool Base64Decode(const std::string_view &input, std::string *output) {
- size_t len;
- if (!EVP_DecodedLength(&len, input.size())) {
- return false;
- }
- std::vector<char> decoded(len);
- if (!EVP_DecodeBase64(reinterpret_cast<uint8_t *>(decoded.data()), &len, len,
- reinterpret_cast<const uint8_t *>(input.data()),
- input.size())) {
- return false;
- }
- output->assign(decoded.data(), len);
- return true;
-}
-
-} // namespace fillins
-
-} // namespace bssl
diff --git a/src/pki/fillins/fillins_base64.h b/src/pki/fillins/fillins_base64.h
deleted file mode 100644
index 440138f..0000000
--- a/src/pki/fillins/fillins_base64.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2023 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BSSL_FILLINS_BASE64_H
-#define BSSL_FILLINS_BASE64_H
-
-#include <openssl/base.h>
-
-#include <string>
-#include <string_view>
-
-namespace bssl {
-
-namespace fillins {
-
-OPENSSL_EXPORT bool Base64Encode(const std::string_view &input,
- std::string *output);
-
-OPENSSL_EXPORT bool Base64Decode(const std::string_view &input,
- std::string *output);
-
-} // namespace fillins
-
-} // namespace bssl
-
-#endif // BSSL_FILLINS_BASE64_H
diff --git a/src/pki/fillins/fillins_string_util.cc b/src/pki/fillins/fillins_string_util.cc
deleted file mode 100644
index cdafcc5..0000000
--- a/src/pki/fillins/fillins_string_util.cc
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright 2023 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "../string_util.h"
-#include <string>
-#include <string_view>
-#include "fillins_string_util.h"
-
-
-namespace bssl {
-
-namespace fillins {
-
-
-// TODO(bbe): get rid of this
-std::string HexEncode(const void *bytes, size_t size) {
- return bssl::string_util::HexEncode((const uint8_t *)bytes, size);
-}
-
-static bool IsUnicodeWhitespace(char c) {
- return c == 9 || c == 10 || c == 11 || c == 12 || c == 13 || c == ' ';
-}
-
-std::string CollapseWhitespaceASCII(std::string_view text,
- bool trim_sequences_with_line_breaks) {
- std::string result;
- result.resize(text.size());
-
- // Set flags to pretend we're already in a trimmed whitespace sequence, so we
- // will trim any leading whitespace.
- bool in_whitespace = true;
- bool already_trimmed = true;
-
- int chars_written = 0;
- for (auto i = text.begin(); i != text.end(); ++i) {
- if (IsUnicodeWhitespace(*i)) {
- if (!in_whitespace) {
- // Reduce all whitespace sequences to a single space.
- in_whitespace = true;
- result[chars_written++] = L' ';
- }
- if (trim_sequences_with_line_breaks && !already_trimmed &&
- ((*i == '\n') || (*i == '\r'))) {
- // Whitespace sequences containing CR or LF are eliminated entirely.
- already_trimmed = true;
- --chars_written;
- }
- } else {
- // Non-whitespace chracters are copied straight across.
- in_whitespace = false;
- already_trimmed = false;
- result[chars_written++] = *i;
- }
- }
-
- if (in_whitespace && !already_trimmed) {
- // Any trailing whitespace is eliminated.
- --chars_written;
- }
-
- result.resize(chars_written);
- return result;
-}
-
-// TODO(bbe): get rid of this (used to be strcasecmp in google3, which
-// causes windows pain because msvc and strings.h)
-bool EqualsCaseInsensitiveASCII(std::string_view a, std::string_view b) {
- return bssl::string_util::IsEqualNoCase(a, b);
-}
-
-bool IsAsciiAlpha(char c) {
- return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
-}
-
-bool IsAsciiDigit(char c) { return c >= '0' && c <= '9'; }
-
-void ReplaceSubstringsAfterOffset(std::string *s, size_t offset,
- std::string_view find,
- std::string_view replace) {
- std::string_view prefix(s->data(), offset);
- std::string suffix =
- bssl::string_util::FindAndReplace(s->substr(offset), find, replace);
- *s = std::string(prefix) + suffix;
-};
-
-} // namespace fillins
-
-} // namespace bssl
diff --git a/src/pki/fillins/fillins_string_util.h b/src/pki/fillins/fillins_string_util.h
deleted file mode 100644
index bf1f2e0..0000000
--- a/src/pki/fillins/fillins_string_util.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2023 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BSSL_FILLINS_STRING_UTIL_H
-#define BSSL_FILLINS_STRING_UTIL_H
-
-#include <openssl/base.h>
-
-#include <string.h>
-#include <cassert>
-#include <string>
-#include <string_view>
-
-namespace bssl {
-
-namespace fillins {
-
-OPENSSL_EXPORT std::string HexEncode(const void *bytes, size_t size);
-
-OPENSSL_EXPORT std::string CollapseWhitespaceASCII(
- std::string_view text, bool trim_sequences_with_line_breaks);
-
-OPENSSL_EXPORT bool EqualsCaseInsensitiveASCII(std::string_view a,
- std::string_view b);
-
-OPENSSL_EXPORT bool IsAsciiAlpha(char c);
-
-OPENSSL_EXPORT bool IsAsciiDigit(char c);
-
-OPENSSL_EXPORT void ReplaceSubstringsAfterOffset(std::string *s, size_t offset,
- std::string_view find,
- std::string_view replace);
-
-OPENSSL_EXPORT std::string HexDecode(std::string_view hex);
-
-} // namespace fillins
-
-} // namespace bssl
-
-#endif // BSSL_FILLINS_STRING_UTIL_H
diff --git a/src/pki/fillins/log.h b/src/pki/fillins/log.h
deleted file mode 100644
index f0bbe61..0000000
--- a/src/pki/fillins/log.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2023 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BSSL_FILLINS_LOG_H_
-#define BSSL_FILLINS_LOG_H_
-
-#include <iostream>
-
-// This header defines the logging macros, inherited from chrome.
-
-// This file is not used in chrome, so check here to make sure we are
-// only compiling inside boringssl.
-#if !defined(_BORINGSSL_LIBPKI_)
-#error "_BORINGSSL_LIBPKI_ is not defined when compiling BoringSSL libpki"
-#endif
-
-#if defined(_BORINGSSL_LIBPKI_VERBOSE_)
-#define DVLOG(l) std::cerr
-#define LOG(l) std::cerr
-#else
-#define DVLOG(l) 0 && std::cerr
-#define LOG(l) 0 && std::cerr
-#endif // _BORINGSSL_LIBPKI_VERBOSE_
-
-#endif // BSSL_FILLINS_LOG_H_
diff --git a/src/pki/fillins/net_errors.h b/src/pki/fillins/net_errors.h
deleted file mode 100644
index 2955888..0000000
--- a/src/pki/fillins/net_errors.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2023 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BSSL_FILLINS_NET_ERRORS_H
-#define BSSL_FILLINS_NET_ERRORS_H
-
-#include <openssl/base.h>
-
-namespace bssl {
-
-enum Error {
- OK = 0,
-};
-
-} // namespace bssl
-
-#endif // BSSL_FILLINS_NET_ERRORS_H
diff --git a/src/pki/fillins/openssl_util.cc b/src/pki/fillins/openssl_util.cc
deleted file mode 100644
index 6c58169..0000000
--- a/src/pki/fillins/openssl_util.cc
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2023 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "openssl_util.h"
-
-#include <openssl/err.h>
-
-namespace bssl {
-
-namespace fillins {
-
-OpenSSLErrStackTracer::OpenSSLErrStackTracer() {}
-
-OpenSSLErrStackTracer::~OpenSSLErrStackTracer() { ERR_clear_error(); }
-
-} // namespace fillins
-
-} // namespace bssl
diff --git a/src/pki/fillins/openssl_util.h b/src/pki/fillins/openssl_util.h
deleted file mode 100644
index f193a51..0000000
--- a/src/pki/fillins/openssl_util.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2023 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BSSL_FILLINS_OPENSSL_UTIL_H
-#define BSSL_FILLINS_OPENSSL_UTIL_H
-
-#include <openssl/base.h>
-
-#include <string>
-
-namespace bssl {
-
-namespace fillins {
-
-// Place an instance of this class on the call stack to automatically clear
-// the OpenSSL error stack on function exit.
-class OPENSSL_EXPORT OpenSSLErrStackTracer {
- public:
- OpenSSLErrStackTracer();
- ~OpenSSLErrStackTracer();
-};
-
-} // namespace fillins
-
-} // namespace bssl
-
-#endif // BSSL_FILLINS_OPENSSL_UTIL_H
diff --git a/src/pki/fillins/path_service.cc b/src/pki/fillins/path_service.cc
deleted file mode 100644
index a915cb1..0000000
--- a/src/pki/fillins/path_service.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2023 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "path_service.h"
-
-#include <stdlib.h>
-#include <iostream>
-
-namespace bssl {
-
-namespace fillins {
-
-FilePath::FilePath() {}
-
-FilePath::FilePath(const std::string &path) : path_(path) {}
-
-const std::string &FilePath::value() const { return path_; }
-
-FilePath FilePath::AppendASCII(const std::string &ascii_path_element) const {
- // Append a path element to a path. Use the \ separator if this appears to
- // be a Windows path, otherwise the Unix one.
- if (path_.find(":\\") != std::string::npos) {
- return FilePath(path_ + "\\" + ascii_path_element);
- }
- return FilePath(path_ + "/" + ascii_path_element);
-}
-
-// static
-void PathService::Get(PathKey key, FilePath *out) {
- // We expect our test data to live in "pki" underneath a
- // test root directory, or in the current directry.
- char *root_from_env = getenv("BORINGSSL_TEST_DATA_ROOT");
- std::string root = root_from_env ? root_from_env : ".";
- *out = FilePath(root + "/pki");
-}
-
-} // namespace fillins
-
-} // namespace bssl
diff --git a/src/pki/fillins/path_service.h b/src/pki/fillins/path_service.h
deleted file mode 100644
index ccc5014..0000000
--- a/src/pki/fillins/path_service.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2023 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BSSL_FILLINS_PATH_SERVICE_H
-#define BSSL_FILLINS_PATH_SERVICE_H
-
-#include <openssl/base.h>
-
-#include <string>
-
-namespace bssl {
-
-namespace fillins {
-
-class FilePath {
- public:
- FilePath();
- FilePath(const std::string &path);
-
- const std::string &value() const;
-
- FilePath AppendASCII(const std::string &ascii_path_element) const;
-
- private:
- std::string path_;
-};
-
-enum PathKey {
- BSSL_TEST_DATA_ROOT = 0,
-};
-
-class PathService {
- public:
- static void Get(PathKey key, FilePath *out);
-};
-
-} // namespace fillins
-
-} // namespace bssl
-
-#endif // BSSL_FILLINS_PATH_SERVICE_H