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

Side by Side Diff: crypto/p224_spake.cc

Issue 761663004: Allow to get key from SPAKE2 after the first round trip. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « crypto/p224_spake.h ('k') | crypto/p224_spake_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This code implements SPAKE2, a variant of EKE: 5 // This code implements SPAKE2, a variant of EKE:
6 // http://www.di.ens.fr/~pointche/pub.php?reference=AbPo04 6 // http://www.di.ens.fr/~pointche/pub.php?reference=AbPo04
7 7
8 #include <crypto/p224_spake.h> 8 #include <crypto/p224_spake.h>
9 9
10 #include <base/logging.h> 10 #include <base/logging.h>
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 std::string(reinterpret_cast<const char *>(pw_), sizeof(pw_)); 233 std::string(reinterpret_cast<const char *>(pw_), sizeof(pw_));
234 hash_contents += k; 234 hash_contents += k;
235 235
236 SHA256HashString(hash_contents, out_digest, kSHA256Length); 236 SHA256HashString(hash_contents, out_digest, kSHA256Length);
237 } 237 }
238 238
239 const std::string& P224EncryptedKeyExchange::error() const { 239 const std::string& P224EncryptedKeyExchange::error() const {
240 return error_; 240 return error_;
241 } 241 }
242 242
243 const std::string& P224EncryptedKeyExchange::GetKey() { 243 const std::string& P224EncryptedKeyExchange::GetKey() const {
244 DCHECK_EQ(state_, kStateDone); 244 DCHECK_EQ(state_, kStateDone);
245 return GetUnverifiedKey();
246 }
247
248 const std::string& P224EncryptedKeyExchange::GetUnverifiedKey() const {
249 // Key is already final when state is kStateSendHash. Subsequent states are
250 // used only for verification of the key. Some users may combine verification
251 // with sending verifiable data instead of |expected_authenticator_|.
252 DCHECK_GE(state_, kStateSendHash);
245 return key_; 253 return key_;
246 } 254 }
247 255
248 } // namespace crypto 256 } // namespace crypto
OLDNEW
« no previous file with comments | « crypto/p224_spake.h ('k') | crypto/p224_spake_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698