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

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

Issue 23455017: Refactor how "length" parameter is obtained for HmacKeyParams. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | « Source/modules/crypto/HmacKeyParams.cpp ('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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 , m_hash(hash) 108 , m_hash(hash)
109 , m_hasLength(hasLength) 109 , m_hasLength(hasLength)
110 , m_length(length) 110 , m_length(length)
111 { 111 {
112 } 112 }
113 113
114 const WebCryptoAlgorithm& hash() const { return m_hash; } 114 const WebCryptoAlgorithm& hash() const { return m_hash; }
115 115
116 bool hasLength() const { return m_hasLength; } 116 bool hasLength() const { return m_hasLength; }
117 117
118 unsigned length() const 118 bool getLength(unsigned& length) const
119 { 119 {
120 WEBKIT_ASSERT(m_length); 120 if (!m_hasLength)
121 return m_length; 121 return false;
122 length = m_length;
123 return true;
122 } 124 }
123 125
124 private: 126 private:
125 WebCryptoAlgorithm m_hash; 127 WebCryptoAlgorithm m_hash;
126 bool m_hasLength; 128 bool m_hasLength;
127 int m_length; 129 unsigned m_length;
128 }; 130 };
129 131
130 class WebCryptoRsaSsaParams : public WebCryptoAlgorithmParams { 132 class WebCryptoRsaSsaParams : public WebCryptoAlgorithmParams {
131 public: 133 public:
132 explicit WebCryptoRsaSsaParams(const WebCryptoAlgorithm& hash) 134 explicit WebCryptoRsaSsaParams(const WebCryptoAlgorithm& hash)
133 : WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsTypeRsaSsaParams) 135 : WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsTypeRsaSsaParams)
134 , m_hash(hash) 136 , m_hash(hash)
135 { 137 {
136 } 138 }
137 139
(...skipping 16 matching lines...) Expand all
154 const WebVector<unsigned char>& publicExponent() const { return m_publicExpo nent; } 156 const WebVector<unsigned char>& publicExponent() const { return m_publicExpo nent; }
155 157
156 private: 158 private:
157 const unsigned m_modulusLength; 159 const unsigned m_modulusLength;
158 const WebVector<unsigned char> m_publicExponent; 160 const WebVector<unsigned char> m_publicExponent;
159 }; 161 };
160 162
161 } // namespace WebKit 163 } // namespace WebKit
162 164
163 #endif 165 #endif
OLDNEW
« no previous file with comments | « Source/modules/crypto/HmacKeyParams.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698