Index: net/ssl/ssl_platform_key_mac.cc |
diff --git a/net/ssl/ssl_platform_key_mac.cc b/net/ssl/ssl_platform_key_mac.cc |
index 1f7e3efd5b318278b0c18ba24bc5fcda711edc9e..c4be83d30b1bf9a3456056a283a07d245d390f5f 100644 |
--- a/net/ssl/ssl_platform_key_mac.cc |
+++ b/net/ssl/ssl_platform_key_mac.cc |
@@ -36,6 +36,7 @@ |
#include "net/ssl/ssl_private_key.h" |
#include "net/ssl/threaded_ssl_private_key.h" |
#include "third_party/boringssl/src/include/openssl/ecdsa.h" |
+#include "third_party/boringssl/src/include/openssl/evp.h" |
#include "third_party/boringssl/src/include/openssl/mem.h" |
#include "third_party/boringssl/src/include/openssl/nid.h" |
#include "third_party/boringssl/src/include/openssl/rsa.h" |
@@ -173,27 +174,22 @@ base::LazyInstance<SecKeyAPIs>::Leaky g_sec_key_apis = |
class SSLPlatformKeyCSSM : public ThreadedSSLPrivateKey::Delegate { |
public: |
- SSLPlatformKeyCSSM(SSLPrivateKey::Type type, |
+ SSLPlatformKeyCSSM(int type, |
size_t max_length, |
SecKeyRef key, |
const CSSM_KEY* cssm_key) |
- : type_(type), |
- max_length_(max_length), |
+ : max_length_(max_length), |
key_(key, base::scoped_policy::RETAIN), |
cssm_key_(cssm_key) {} |
~SSLPlatformKeyCSSM() override {} |
- SSLPrivateKey::Type GetType() override { return type_; } |
- |
std::vector<SSLPrivateKey::Hash> GetDigestPreferences() override { |
return std::vector<SSLPrivateKey::Hash>{ |
SSLPrivateKey::Hash::SHA512, SSLPrivateKey::Hash::SHA384, |
SSLPrivateKey::Hash::SHA256, SSLPrivateKey::Hash::SHA1}; |
} |
- size_t GetMaxSignatureLengthInBytes() override { return max_length_; } |
- |
Error SignDigest(SSLPrivateKey::Hash hash, |
const base::StringPiece& input, |
std::vector<uint8_t>* signature) override { |
@@ -282,7 +278,6 @@ class SSLPlatformKeyCSSM : public ThreadedSSLPrivateKey::Delegate { |
} |
private: |
- SSLPrivateKey::Type type_; |
size_t max_length_; |
base::ScopedCFTypeRef<SecKeyRef> key_; |
const CSSM_KEY* cssm_key_; |
@@ -292,25 +287,17 @@ class SSLPlatformKeyCSSM : public ThreadedSSLPrivateKey::Delegate { |
class SSLPlatformKeySecKey : public ThreadedSSLPrivateKey::Delegate { |
public: |
- SSLPlatformKeySecKey(SSLPrivateKey::Type type, |
- size_t max_length, |
- SecKeyRef key) |
- : type_(type), |
- max_length_(max_length), |
- key_(key, base::scoped_policy::RETAIN) {} |
+ SSLPlatformKeySecKey(int type, size_t max_length, SecKeyRef key) |
+ : type_(type), key_(key, base::scoped_policy::RETAIN) {} |
~SSLPlatformKeySecKey() override {} |
- SSLPrivateKey::Type GetType() override { return type_; } |
- |
std::vector<SSLPrivateKey::Hash> GetDigestPreferences() override { |
return std::vector<SSLPrivateKey::Hash>{ |
SSLPrivateKey::Hash::SHA512, SSLPrivateKey::Hash::SHA384, |
SSLPrivateKey::Hash::SHA256, SSLPrivateKey::Hash::SHA1}; |
} |
- size_t GetMaxSignatureLengthInBytes() override { return max_length_; } |
- |
Error SignDigest(SSLPrivateKey::Hash hash, |
const base::StringPiece& input, |
std::vector<uint8_t>* signature) override { |
@@ -321,7 +308,7 @@ class SSLPlatformKeySecKey : public ThreadedSSLPrivateKey::Delegate { |
} |
SecKeyAlgorithm algorithm = nullptr; |
- if (type_ == SSLPrivateKey::Type::RSA) { |
+ if (type_ == EVP_PKEY_RSA) { |
switch (hash) { |
case SSLPrivateKey::Hash::SHA512: |
algorithm = apis.kSecKeyAlgorithmRSASignatureDigestPKCS1v15SHA512; |
@@ -339,7 +326,7 @@ class SSLPlatformKeySecKey : public ThreadedSSLPrivateKey::Delegate { |
algorithm = apis.kSecKeyAlgorithmRSASignatureDigestPKCS1v15Raw; |
break; |
} |
- } else if (SSLPrivateKey::IsECDSAType(type_)) { |
+ } else if (type_ == EVP_PKEY_EC) { |
switch (hash) { |
case SSLPrivateKey::Hash::SHA512: |
algorithm = apis.kSecKeyAlgorithmECDSASignatureDigestX962SHA512; |
@@ -383,8 +370,7 @@ class SSLPlatformKeySecKey : public ThreadedSSLPrivateKey::Delegate { |
} |
private: |
- SSLPrivateKey::Type type_; |
- size_t max_length_; |
+ int type_; |
base::ScopedCFTypeRef<SecKeyRef> key_; |
DISALLOW_COPY_AND_ASSIGN(SSLPlatformKeySecKey); |
@@ -401,7 +387,7 @@ scoped_refptr<SSLPrivateKey> FetchClientCertPrivateKeyFromKeychain( |
if (!private_key) |
return nullptr; |
- SSLPrivateKey::Type key_type; |
+ int key_type; |
size_t max_length; |
if (!GetClientCertInfo(certificate, &key_type, &max_length)) |
return nullptr; |