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

Side by Side Diff: crypto/p224_spake.cc

Issue 9005015: Coverity: Initialize member variables. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build fix. Created 9 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/renderer_host/render_message_filter.cc ('k') | crypto/signature_creator_win.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 }; 92 };
93 93
94 } // anonymous namespace 94 } // anonymous namespace
95 95
96 namespace crypto { 96 namespace crypto {
97 97
98 P224EncryptedKeyExchange::P224EncryptedKeyExchange( 98 P224EncryptedKeyExchange::P224EncryptedKeyExchange(
99 PeerType peer_type, const base::StringPiece& password) 99 PeerType peer_type, const base::StringPiece& password)
100 : state_(kStateInitial), 100 : state_(kStateInitial),
101 is_server_(peer_type == kPeerTypeServer) { 101 is_server_(peer_type == kPeerTypeServer) {
102 memset(&x_, 0, sizeof(x_));
103 memset(&expected_authenticator_, 0, sizeof(expected_authenticator_));
104
102 // x_ is a random scalar. 105 // x_ is a random scalar.
103 base::RandBytes(x_, sizeof(x_)); 106 base::RandBytes(x_, sizeof(x_));
104 107
105 // X = g**x_ 108 // X = g**x_
106 p224::Point X; 109 p224::Point X;
107 p224::ScalarBaseMult(x_, &X); 110 p224::ScalarBaseMult(x_, &X);
108 111
109 // Calculate |password| hash to get SPAKE password value. 112 // Calculate |password| hash to get SPAKE password value.
110 SHA256HashString(std::string(password.data(), password.length()), 113 SHA256HashString(std::string(password.data(), password.length()),
111 pw_, sizeof(pw_)); 114 pw_, sizeof(pw_));
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 const std::string& P224EncryptedKeyExchange::error() const { 239 const std::string& P224EncryptedKeyExchange::error() const {
237 return error_; 240 return error_;
238 } 241 }
239 242
240 const std::string& P224EncryptedKeyExchange::GetKey() { 243 const std::string& P224EncryptedKeyExchange::GetKey() {
241 DCHECK_EQ(state_, kStateDone); 244 DCHECK_EQ(state_, kStateDone);
242 return key_; 245 return key_;
243 } 246 }
244 247
245 } // namespace crypto 248 } // namespace crypto
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_message_filter.cc ('k') | crypto/signature_creator_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698