Chromium Code Reviews| Index: third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h |
| diff --git a/third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h b/third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h |
| index e90e98d466b11a6cea941a4d5b57e185cca118fa..bb3c80e6f389bfd026e0da963446b3ecd1e2a125 100644 |
| --- a/third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h |
| +++ b/third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h |
| @@ -227,6 +227,23 @@ public: |
| const WebVector<unsigned char>& publicExponent() const { return m_publicExponent; } |
| const WebCryptoAlgorithm& hash() const { return m_hash; } |
| + // Converts the public exponent (big-endian WebCrypto BigInteger), with or without leading zeros, to unsigned int. Returns true on success. |
| + bool publicExponentToUint32(unsigned* result) const |
|
eroman
2015/10/23 19:13:04
Blink style favors the use of references over out
hbos_chromium
2015/10/26 13:21:32
Done.
|
| + { |
| + if (m_publicExponent.size() == 0) |
|
eroman
2015/10/23 19:13:04
While you are editing things, can you delete these
hbos_chromium
2015/10/26 13:21:32
Done.
|
| + return false; |
| + |
| + *result = 0; |
| + for (size_t i = 0; i < m_publicExponent.size(); ++i) { |
| + size_t iReversed = m_publicExponent.size() - i - 1; |
| + |
| + if (iReversed >= sizeof(*result) && m_publicExponent[i]) |
| + return false; // Too large for a uint. |
| + |
| + *result |= m_publicExponent[i] << 8 * iReversed; |
| + } |
| + return true; |
| + } |
| private: |
| const unsigned m_modulusLengthBits; |
| const WebVector<unsigned char> m_publicExponent; |