| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 , m_hasAdditionalData(hasAdditionalData) | 188 , m_hasAdditionalData(hasAdditionalData) |
| 189 , m_additionalData(additionalData, additionalDataSize) | 189 , m_additionalData(additionalData, additionalDataSize) |
| 190 , m_hasTagLength(hasTagLength) | 190 , m_hasTagLength(hasTagLength) |
| 191 , m_tagLength(tagLength) | 191 , m_tagLength(tagLength) |
| 192 { | 192 { |
| 193 } | 193 } |
| 194 | 194 |
| 195 const WebVector<unsigned char>& iv() const { return m_iv; } | 195 const WebVector<unsigned char>& iv() const { return m_iv; } |
| 196 | 196 |
| 197 bool hasAdditionalData() const { return m_hasAdditionalData; } | 197 bool hasAdditionalData() const { return m_hasAdditionalData; } |
| 198 bool getAdditionalData(const WebVector<unsigned char>*& additionalData) | 198 bool getAdditionalData(const WebVector<unsigned char>*& additionalData) cons
t |
| 199 { | 199 { |
| 200 if (!m_hasAdditionalData) | 200 if (!m_hasAdditionalData) |
| 201 return false; | 201 return false; |
| 202 additionalData = &m_additionalData; | 202 additionalData = &m_additionalData; |
| 203 return true; | 203 return true; |
| 204 } | 204 } |
| 205 | 205 |
| 206 bool hasTagLength() const { return m_hasTagLength; } | 206 bool hasTagLength() const { return m_hasTagLength; } |
| 207 bool getTagLength(unsigned& tagLength) | 207 bool getTagLength(unsigned& tagLength) const |
| 208 { | 208 { |
| 209 if (!m_hasTagLength) | 209 if (!m_hasTagLength) |
| 210 return false; | 210 return false; |
| 211 tagLength = m_tagLength; | 211 tagLength = m_tagLength; |
| 212 return true; | 212 return true; |
| 213 } | 213 } |
| 214 | 214 |
| 215 private: | 215 private: |
| 216 const WebVector<unsigned char> m_iv; | 216 const WebVector<unsigned char> m_iv; |
| 217 const bool m_hasAdditionalData; | 217 const bool m_hasAdditionalData; |
| 218 const WebVector<unsigned char> m_additionalData; | 218 const WebVector<unsigned char> m_additionalData; |
| 219 const bool m_hasTagLength; | 219 const bool m_hasTagLength; |
| 220 const unsigned char m_tagLength; | 220 const unsigned char m_tagLength; |
| 221 }; | 221 }; |
| 222 | 222 |
| 223 class WebCryptoRsaOaepParams : public WebCryptoAlgorithmParams { | 223 class WebCryptoRsaOaepParams : public WebCryptoAlgorithmParams { |
| 224 public: | 224 public: |
| 225 WebCryptoRsaOaepParams(const WebCryptoAlgorithm& hash, bool hasLabel, const
unsigned char* label, unsigned labelSize) | 225 WebCryptoRsaOaepParams(const WebCryptoAlgorithm& hash, bool hasLabel, const
unsigned char* label, unsigned labelSize) |
| 226 : WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsTypeRsaOaepParams) | 226 : WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsTypeRsaOaepParams) |
| 227 , m_hash(hash) | 227 , m_hash(hash) |
| 228 , m_hasLabel(hasLabel) | 228 , m_hasLabel(hasLabel) |
| 229 , m_label(label, labelSize) | 229 , m_label(label, labelSize) |
| 230 { | 230 { |
| 231 BLINK_ASSERT(!hash.isNull()); | 231 BLINK_ASSERT(!hash.isNull()); |
| 232 } | 232 } |
| 233 | 233 |
| 234 const WebCryptoAlgorithm& hash() const { return m_hash; } | 234 const WebCryptoAlgorithm& hash() const { return m_hash; } |
| 235 | 235 |
| 236 bool hasLabel() const { return m_hasLabel; } | 236 bool hasLabel() const { return m_hasLabel; } |
| 237 bool getLabel(const WebVector<unsigned char>*& label) | 237 bool getLabel(const WebVector<unsigned char>*& label) const |
| 238 { | 238 { |
| 239 if (!m_hasLabel) | 239 if (!m_hasLabel) |
| 240 return false; | 240 return false; |
| 241 label = &m_label; | 241 label = &m_label; |
| 242 return true; | 242 return true; |
| 243 } | 243 } |
| 244 | 244 |
| 245 private: | 245 private: |
| 246 const WebCryptoAlgorithm m_hash; | 246 const WebCryptoAlgorithm m_hash; |
| 247 const bool m_hasLabel; | 247 const bool m_hasLabel; |
| 248 const WebVector<unsigned char> m_label; | 248 const WebVector<unsigned char> m_label; |
| 249 }; | 249 }; |
| 250 | 250 |
| 251 } // namespace blink | 251 } // namespace blink |
| 252 | 252 |
| 253 #endif | 253 #endif |
| OLD | NEW |