Chromium Code Reviews| Index: components/webcrypto/algorithms/rsa.cc |
| diff --git a/components/webcrypto/algorithms/rsa.cc b/components/webcrypto/algorithms/rsa.cc |
| index 892a5a0ec134b35f23da0d0a606c67ef22cef40c..af79f663db03775506456400bf2218b8e9563aff 100644 |
| --- a/components/webcrypto/algorithms/rsa.cc |
| +++ b/components/webcrypto/algorithms/rsa.cc |
| @@ -19,6 +19,7 @@ |
| #include "crypto/scoped_openssl_types.h" |
| #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" |
| #include "third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h" |
| +#include "third_party/WebKit/public/platform/WebCryptoUtil.h" |
| namespace webcrypto { |
| @@ -104,26 +105,6 @@ Status ReadRsaKeyJwk(const CryptoData& key_data, |
| return Status::Success(); |
| } |
| -// Converts a (big-endian) WebCrypto BigInteger, with or without leading zeros, |
| -// to unsigned int. |
| -bool BigIntegerToUint(const uint8_t* data, |
| - size_t data_size, |
| - unsigned int* result) { |
| - if (data_size == 0) |
| - return false; |
| - |
| - *result = 0; |
| - for (size_t i = 0; i < data_size; ++i) { |
| - size_t reverse_i = data_size - i - 1; |
| - |
| - if (reverse_i >= sizeof(*result) && data[i]) |
| - return false; // Too large for a uint. |
| - |
| - *result |= data[i] << 8 * reverse_i; |
| - } |
| - return true; |
| -} |
| - |
| // Creates a blink::WebCryptoAlgorithm having the modulus length and public |
| // exponent of |key|. |
| Status CreateRsaHashedKeyAlgorithm( |
| @@ -298,8 +279,7 @@ Status RsaHashedAlgorithm::GenerateKey( |
| } |
| unsigned int public_exponent = 0; |
| - if (!BigIntegerToUint(params->publicExponent().data(), |
| - params->publicExponent().size(), &public_exponent)) { |
| + if (!blink::bigIntegerToUint(params->publicExponent(), public_exponent)) { |
|
eroman
2015/10/28 19:12:41
nit: remove the curly brackets (to match style els
tommi (sloooow) - chröme
2015/10/29 09:01:17
ping
hbos_chromium
2015/10/29 09:26:39
Done.
|
| return Status::ErrorGenerateKeyPublicExponent(); |
| } |