OLD | NEW |
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 }; | 96 }; |
97 | 97 |
98 class WebCryptoAesKeyGenParams : public WebCryptoAlgorithmParams { | 98 class WebCryptoAesKeyGenParams : public WebCryptoAlgorithmParams { |
99 public: | 99 public: |
100 explicit WebCryptoAesKeyGenParams(unsigned short lengthBits) | 100 explicit WebCryptoAesKeyGenParams(unsigned short lengthBits) |
101 : WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsTypeAesKeyGenParams) | 101 : WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsTypeAesKeyGenParams) |
102 , m_lengthBits(lengthBits) | 102 , m_lengthBits(lengthBits) |
103 { | 103 { |
104 } | 104 } |
105 | 105 |
106 // FIXME: Delete once no longer referenced by chromium. | |
107 unsigned short length() const { return m_lengthBits; } | |
108 | |
109 unsigned short lengthBits() const { return m_lengthBits; } | 106 unsigned short lengthBits() const { return m_lengthBits; } |
110 | 107 |
111 private: | 108 private: |
112 const unsigned short m_lengthBits; | 109 const unsigned short m_lengthBits; |
113 }; | 110 }; |
114 | 111 |
115 class WebCryptoHmacParams : public WebCryptoAlgorithmParams { | 112 class WebCryptoHmacParams : public WebCryptoAlgorithmParams { |
116 public: | 113 public: |
117 explicit WebCryptoHmacParams(const WebCryptoAlgorithm& hash) | 114 explicit WebCryptoHmacParams(const WebCryptoAlgorithm& hash) |
118 : WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsTypeHmacParams) | 115 : WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsTypeHmacParams) |
(...skipping 17 matching lines...) Expand all Loading... |
136 , m_optionalLengthBytes(lengthBytes) | 133 , m_optionalLengthBytes(lengthBytes) |
137 { | 134 { |
138 BLINK_ASSERT(!hash.isNull()); | 135 BLINK_ASSERT(!hash.isNull()); |
139 BLINK_ASSERT(hasLengthBytes || !lengthBytes); | 136 BLINK_ASSERT(hasLengthBytes || !lengthBytes); |
140 } | 137 } |
141 | 138 |
142 const WebCryptoAlgorithm& hash() const { return m_hash; } | 139 const WebCryptoAlgorithm& hash() const { return m_hash; } |
143 | 140 |
144 bool hasLengthBytes() const { return m_hasLengthBytes; } | 141 bool hasLengthBytes() const { return m_hasLengthBytes; } |
145 | 142 |
146 // FIXME: Delete once no longer referenced by chromium. | |
147 bool getLength(unsigned& length) const | |
148 { | |
149 if (!m_hasLengthBytes) | |
150 return false; | |
151 length = m_optionalLengthBytes; | |
152 return true; | |
153 } | |
154 | |
155 unsigned optionalLengthBytes() const { return m_optionalLengthBytes; } | 143 unsigned optionalLengthBytes() const { return m_optionalLengthBytes; } |
156 | 144 |
157 private: | 145 private: |
158 const WebCryptoAlgorithm m_hash; | 146 const WebCryptoAlgorithm m_hash; |
159 const bool m_hasLengthBytes; | 147 const bool m_hasLengthBytes; |
160 const unsigned m_optionalLengthBytes; | 148 const unsigned m_optionalLengthBytes; |
161 }; | 149 }; |
162 | 150 |
163 class WebCryptoRsaSsaParams : public WebCryptoAlgorithmParams { | 151 class WebCryptoRsaSsaParams : public WebCryptoAlgorithmParams { |
164 public: | 152 public: |
(...skipping 12 matching lines...) Expand all Loading... |
177 | 165 |
178 class WebCryptoRsaKeyGenParams : public WebCryptoAlgorithmParams { | 166 class WebCryptoRsaKeyGenParams : public WebCryptoAlgorithmParams { |
179 public: | 167 public: |
180 WebCryptoRsaKeyGenParams(unsigned modulusLengthBits, const unsigned char* pu
blicExponent, unsigned publicExponentSize) | 168 WebCryptoRsaKeyGenParams(unsigned modulusLengthBits, const unsigned char* pu
blicExponent, unsigned publicExponentSize) |
181 : WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsTypeRsaKeyGenParams) | 169 : WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsTypeRsaKeyGenParams) |
182 , m_modulusLengthBits(modulusLengthBits) | 170 , m_modulusLengthBits(modulusLengthBits) |
183 , m_publicExponent(publicExponent, publicExponentSize) | 171 , m_publicExponent(publicExponent, publicExponentSize) |
184 { | 172 { |
185 } | 173 } |
186 | 174 |
187 // FIXME: Delete once no longer referenced by chromium. | |
188 unsigned modulusLength() const { return m_modulusLengthBits; } | |
189 | |
190 unsigned modulusLengthBits() const { return m_modulusLengthBits; } | 175 unsigned modulusLengthBits() const { return m_modulusLengthBits; } |
191 const WebVector<unsigned char>& publicExponent() const { return m_publicExpo
nent; } | 176 const WebVector<unsigned char>& publicExponent() const { return m_publicExpo
nent; } |
192 | 177 |
193 private: | 178 private: |
194 const unsigned m_modulusLengthBits; | 179 const unsigned m_modulusLengthBits; |
195 const WebVector<unsigned char> m_publicExponent; | 180 const WebVector<unsigned char> m_publicExponent; |
196 }; | 181 }; |
197 | 182 |
198 class WebCryptoAesGcmParams : public WebCryptoAlgorithmParams { | 183 class WebCryptoAesGcmParams : public WebCryptoAlgorithmParams { |
199 public: | 184 public: |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 229 |
245 private: | 230 private: |
246 const WebCryptoAlgorithm m_hash; | 231 const WebCryptoAlgorithm m_hash; |
247 const bool m_hasLabel; | 232 const bool m_hasLabel; |
248 const WebVector<unsigned char> m_optionalLabel; | 233 const WebVector<unsigned char> m_optionalLabel; |
249 }; | 234 }; |
250 | 235 |
251 } // namespace blink | 236 } // namespace blink |
252 | 237 |
253 #endif | 238 #endif |
OLD | NEW |