Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(454)

Side by Side Diff: public/platform/WebCryptoAlgorithmParams.h

Issue 184453005: [webcrypto] Change HMAC key generation length from bytes to bits. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add rebased tests Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « public/platform/WebCrypto.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 explicit WebCryptoHmacImportParams(const WebCryptoAlgorithm& hash) 124 explicit WebCryptoHmacImportParams(const WebCryptoAlgorithm& hash)
125 : WebCryptoAlgorithmParamsWithHash(hash) 125 : WebCryptoAlgorithmParamsWithHash(hash)
126 { 126 {
127 } 127 }
128 128
129 virtual WebCryptoAlgorithmParamsType type() const { return WebCryptoAlgorith mParamsTypeHmacImportParams; } 129 virtual WebCryptoAlgorithmParamsType type() const { return WebCryptoAlgorith mParamsTypeHmacImportParams; }
130 }; 130 };
131 131
132 class WebCryptoHmacKeyGenParams : public WebCryptoAlgorithmParamsWithHash { 132 class WebCryptoHmacKeyGenParams : public WebCryptoAlgorithmParamsWithHash {
133 public: 133 public:
134 WebCryptoHmacKeyGenParams(const WebCryptoAlgorithm& hash, bool hasLengthByte s, unsigned lengthBytes) 134 WebCryptoHmacKeyGenParams(const WebCryptoAlgorithm& hash, bool hasLengthBits , unsigned lengthBits)
135 : WebCryptoAlgorithmParamsWithHash(hash) 135 : WebCryptoAlgorithmParamsWithHash(hash)
136 , m_hasLengthBytes(hasLengthBytes) 136 , m_hasLengthBits(hasLengthBits)
137 , m_optionalLengthBytes(lengthBytes) 137 , m_optionalLengthBits(lengthBits)
138 { 138 {
139 BLINK_ASSERT(hasLengthBytes || !lengthBytes); 139 BLINK_ASSERT(hasLengthBits || !lengthBits);
140 } 140 }
141 141
142 virtual WebCryptoAlgorithmParamsType type() const { return WebCryptoAlgorith mParamsTypeHmacKeyGenParams; } 142 virtual WebCryptoAlgorithmParamsType type() const { return WebCryptoAlgorith mParamsTypeHmacKeyGenParams; }
143 143
144 bool hasLengthBytes() const { return m_hasLengthBytes; } 144 bool hasLengthBits() const { return m_hasLengthBits; }
145 145
146 unsigned optionalLengthBytes() const { return m_optionalLengthBytes; } 146 unsigned optionalLengthBits() const { return m_optionalLengthBits; }
147 147
148 private: 148 private:
149 const bool m_hasLengthBytes; 149 const bool m_hasLengthBits;
150 const unsigned m_optionalLengthBytes; 150 const unsigned m_optionalLengthBits;
151 }; 151 };
152 152
153 class WebCryptoRsaKeyGenParams : public WebCryptoAlgorithmParams { 153 class WebCryptoRsaKeyGenParams : public WebCryptoAlgorithmParams {
154 public: 154 public:
155 WebCryptoRsaKeyGenParams(unsigned modulusLengthBits, const unsigned char* pu blicExponent, unsigned publicExponentSize) 155 WebCryptoRsaKeyGenParams(unsigned modulusLengthBits, const unsigned char* pu blicExponent, unsigned publicExponentSize)
156 : m_modulusLengthBits(modulusLengthBits) 156 : m_modulusLengthBits(modulusLengthBits)
157 , m_publicExponent(publicExponent, publicExponentSize) 157 , m_publicExponent(publicExponent, publicExponentSize)
158 { 158 {
159 } 159 }
160 160
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 const WebVector<unsigned char>& optionalLabel() const { return m_optionalLab el; } 241 const WebVector<unsigned char>& optionalLabel() const { return m_optionalLab el; }
242 242
243 private: 243 private:
244 const bool m_hasLabel; 244 const bool m_hasLabel;
245 const WebVector<unsigned char> m_optionalLabel; 245 const WebVector<unsigned char> m_optionalLabel;
246 }; 246 };
247 247
248 } // namespace blink 248 } // namespace blink
249 249
250 #endif 250 #endif
OLDNEW
« no previous file with comments | « public/platform/WebCrypto.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698