OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/webcrypto/test/test_helpers.h" | 5 #include "components/webcrypto/test/test_helpers.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 EXPECT_EQ(blink::WebCryptoErrorTypeNotSupported, status.error_type()); | 106 EXPECT_EQ(blink::WebCryptoErrorTypeNotSupported, status.error_type()); |
107 return status.IsSuccess(); | 107 return status.IsSuccess(); |
108 } | 108 } |
109 | 109 |
110 bool SupportsRsaOaep() { | 110 bool SupportsRsaOaep() { |
111 #if defined(USE_OPENSSL) | 111 #if defined(USE_OPENSSL) |
112 return true; | 112 return true; |
113 #else | 113 #else |
114 crypto::EnsureNSSInit(); | 114 crypto::EnsureNSSInit(); |
115 // TODO(eroman): Exclude version test for OS_CHROMEOS | 115 // TODO(eroman): Exclude version test for OS_CHROMEOS |
116 #if defined(USE_NSS) | 116 #if defined(USE_NSS_CERTS) |
117 if (!NSS_VersionCheck("3.16.2")) | 117 if (!NSS_VersionCheck("3.16.2")) |
118 return false; | 118 return false; |
119 #endif | 119 #endif |
120 crypto::ScopedPK11Slot slot(PK11_GetInternalKeySlot()); | 120 crypto::ScopedPK11Slot slot(PK11_GetInternalKeySlot()); |
121 return !!PK11_DoesMechanism(slot.get(), CKM_RSA_PKCS_OAEP); | 121 return !!PK11_DoesMechanism(slot.get(), CKM_RSA_PKCS_OAEP); |
122 #endif | 122 #endif |
123 } | 123 } |
124 | 124 |
125 bool SupportsRsaPrivateKeyImport() { | 125 bool SupportsRsaPrivateKeyImport() { |
126 // TODO(eroman): Exclude version test for OS_CHROMEOS | 126 // TODO(eroman): Exclude version test for OS_CHROMEOS |
127 #if defined(USE_NSS) | 127 #if defined(USE_NSS_CERTS) |
128 crypto::EnsureNSSInit(); | 128 crypto::EnsureNSSInit(); |
129 if (!NSS_VersionCheck("3.16.2")) { | 129 if (!NSS_VersionCheck("3.16.2")) { |
130 LOG(WARNING) << "RSA key import is not supported by this version of NSS. " | 130 LOG(WARNING) << "RSA key import is not supported by this version of NSS. " |
131 "Skipping some tests"; | 131 "Skipping some tests"; |
132 return false; | 132 return false; |
133 } | 133 } |
134 #endif | 134 #endif |
135 return true; | 135 return true; |
136 } | 136 } |
137 | 137 |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 return blink::WebCryptoNamedCurveP384; | 679 return blink::WebCryptoNamedCurveP384; |
680 if (curve_str == "P-521") | 680 if (curve_str == "P-521") |
681 return blink::WebCryptoNamedCurveP521; | 681 return blink::WebCryptoNamedCurveP521; |
682 else | 682 else |
683 ADD_FAILURE() << "Unrecognized curve name: " << curve_str; | 683 ADD_FAILURE() << "Unrecognized curve name: " << curve_str; |
684 | 684 |
685 return blink::WebCryptoNamedCurveP384; | 685 return blink::WebCryptoNamedCurveP384; |
686 } | 686 } |
687 | 687 |
688 } // namespace webcrypto | 688 } // namespace webcrypto |
OLD | NEW |