| 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 "content/child/webcrypto/test/test_helpers.h" | 5 #include "content/child/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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 EXPECT_EQ(blink::WebCryptoErrorTypeNotSupported, status.error_type()); | 109 EXPECT_EQ(blink::WebCryptoErrorTypeNotSupported, status.error_type()); |
| 110 return status.IsSuccess(); | 110 return status.IsSuccess(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 bool SupportsRsaOaep() { | 113 bool SupportsRsaOaep() { |
| 114 #if defined(USE_OPENSSL) | 114 #if defined(USE_OPENSSL) |
| 115 return true; | 115 return true; |
| 116 #else | 116 #else |
| 117 crypto::EnsureNSSInit(); | 117 crypto::EnsureNSSInit(); |
| 118 // TODO(eroman): Exclude version test for OS_CHROMEOS | 118 // TODO(eroman): Exclude version test for OS_CHROMEOS |
| 119 #if defined(USE_NSS) | 119 #if defined(USE_NSS_CERTS) |
| 120 if (!NSS_VersionCheck("3.16.2")) | 120 if (!NSS_VersionCheck("3.16.2")) |
| 121 return false; | 121 return false; |
| 122 #endif | 122 #endif |
| 123 crypto::ScopedPK11Slot slot(PK11_GetInternalKeySlot()); | 123 crypto::ScopedPK11Slot slot(PK11_GetInternalKeySlot()); |
| 124 return !!PK11_DoesMechanism(slot.get(), CKM_RSA_PKCS_OAEP); | 124 return !!PK11_DoesMechanism(slot.get(), CKM_RSA_PKCS_OAEP); |
| 125 #endif | 125 #endif |
| 126 } | 126 } |
| 127 | 127 |
| 128 bool SupportsRsaPrivateKeyImport() { | 128 bool SupportsRsaPrivateKeyImport() { |
| 129 // TODO(eroman): Exclude version test for OS_CHROMEOS | 129 // TODO(eroman): Exclude version test for OS_CHROMEOS |
| 130 #if defined(USE_NSS) | 130 #if defined(USE_NSS_CERTS) |
| 131 crypto::EnsureNSSInit(); | 131 crypto::EnsureNSSInit(); |
| 132 if (!NSS_VersionCheck("3.16.2")) { | 132 if (!NSS_VersionCheck("3.16.2")) { |
| 133 LOG(WARNING) << "RSA key import is not supported by this version of NSS. " | 133 LOG(WARNING) << "RSA key import is not supported by this version of NSS. " |
| 134 "Skipping some tests"; | 134 "Skipping some tests"; |
| 135 return false; | 135 return false; |
| 136 } | 136 } |
| 137 #endif | 137 #endif |
| 138 return true; | 138 return true; |
| 139 } | 139 } |
| 140 | 140 |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 689 | 689 |
| 690 } // namesapce content | 690 } // namesapce content |
| OLD | NEW |