1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
# Chrome asumes boringssl, while system installed ssl library may not.
--- a/crypto/openssl_util.cc
+++ b/crypto/openssl_util.cc
@@ -4,6 +4,13 @@
#include "crypto/openssl_util.h"
+#if defined(OPENSSL_IS_BORINGSSL)
+#include <openssl/cpu.h>
+#else
+#include <openssl/ssl.h>
+#endif
+#include <openssl/crypto.h>
+#include <openssl/err.h>
#include <stddef.h>
#include <stdint.h>
@@ -11,8 +18,6 @@
#include "base/logging.h"
#include "base/strings/string_piece.h"
-#include "third_party/boringssl/src/include/openssl/crypto.h"
-#include "third_party/boringssl/src/include/openssl/err.h"
namespace crypto {
@@ -35,8 +40,12 @@ int OpenSSLErrorCallback(const char* str
} // namespace
void EnsureOpenSSLInit() {
+#if defined(OPENSSL_IS_BORINGSSL)
// CRYPTO_library_init may be safely called concurrently.
CRYPTO_library_init();
+#else
+ SSL_library_init();
+#endif
}
void ClearOpenSSLERRStack(const tracked_objects::Location& location) {
--- a/crypto/rsa_private_key.h
+++ b/crypto/rsa_private_key.h
@@ -7,6 +7,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <openssl/base.h>
#include <memory>
#include <vector>
@@ -14,7 +15,6 @@
#include "base/macros.h"
#include "build/build_config.h"
#include "crypto/crypto_export.h"
-#include "third_party/boringssl/src/include/openssl/base.h"
namespace crypto {
--- a/crypto/secure_hash.cc
+++ b/crypto/secure_hash.cc
@@ -4,14 +4,18 @@
#include "crypto/secure_hash.h"
+#if defined(OPENSSL_IS_BORINGSSL)
+#include <openssl/mem.h>
+#else
+#include <openssl/crypto.h>
+#endif
+#include <openssl/sha.h>
#include <stddef.h>
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/pickle.h"
#include "crypto/openssl_util.h"
-#include "third_party/boringssl/src/include/openssl/mem.h"
-#include "third_party/boringssl/src/include/openssl/sha.h"
namespace crypto {
--- a/crypto/signature_verifier.h
+++ b/crypto/signature_verifier.h
@@ -54,9 +54,9 @@ class CRYPTO_EXPORT SignatureVerifier {
// subjectPublicKey BIT STRING }
bool VerifyInit(SignatureAlgorithm signature_algorithm,
const uint8_t* signature,
- size_t signature_len,
+ int signature_len,
const uint8_t* public_key_info,
- size_t public_key_info_len);
+ int public_key_info_len);
// Initiates a RSA-PSS signature verification operation. This should be
// followed by one or more VerifyUpdate calls and a VerifyFinal call.
@@ -76,14 +76,14 @@ class CRYPTO_EXPORT SignatureVerifier {
// subjectPublicKey BIT STRING }
bool VerifyInitRSAPSS(HashAlgorithm hash_alg,
HashAlgorithm mask_hash_alg,
- size_t salt_len,
+ int salt_len,
const uint8_t* signature,
- size_t signature_len,
+ int signature_len,
const uint8_t* public_key_info,
- size_t public_key_info_len);
+ int public_key_info_len);
// Feeds a piece of the data to the signature verifier.
- void VerifyUpdate(const uint8_t* data_part, size_t data_part_len);
+ void VerifyUpdate(const uint8_t* data_part, int data_part_len);
// Concludes a signature verification operation. Returns true if the
// signature is valid. Returns false if the signature is invalid or an
@@ -94,9 +94,9 @@ class CRYPTO_EXPORT SignatureVerifier {
bool CommonInit(int pkey_type,
const EVP_MD* digest,
const uint8_t* signature,
- size_t signature_len,
+ int signature_len,
const uint8_t* public_key_info,
- size_t public_key_info_len,
+ int public_key_info_len,
EVP_PKEY_CTX** pkey_ctx);
void Reset();
|