OLD | NEW |
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 <algorithm> | 10 #include <algorithm> |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // find_seed(kSeed1); | 75 // find_seed(kSeed1); |
76 // find_seed(kSeed2); | 76 // find_seed(kSeed2); |
77 // return 0; | 77 // return 0; |
78 // } | 78 // } |
79 | 79 |
80 const crypto::p224::Point kM = { | 80 const crypto::p224::Point kM = { |
81 {174237515, 77186811, 235213682, 33849492, | 81 {174237515, 77186811, 235213682, 33849492, |
82 33188520, 48266885, 177021753, 81038478}, | 82 33188520, 48266885, 177021753, 81038478}, |
83 {104523827, 245682244, 266509668, 236196369, | 83 {104523827, 245682244, 266509668, 236196369, |
84 28372046, 145351378, 198520366, 113345994}, | 84 28372046, 145351378, 198520366, 113345994}, |
85 {1, 0, 0, 0, 0, 0, 0}, | 85 {1, 0, 0, 0, 0, 0, 0, 0}, |
86 }; | 86 }; |
87 | 87 |
88 const crypto::p224::Point kN = { | 88 const crypto::p224::Point kN = { |
89 {136176322, 263523628, 251628795, 229292285, | 89 {136176322, 263523628, 251628795, 229292285, |
90 5034302, 185981975, 171998428, 11653062}, | 90 5034302, 185981975, 171998428, 11653062}, |
91 {197567436, 51226044, 60372156, 175772188, | 91 {197567436, 51226044, 60372156, 175772188, |
92 42075930, 8083165, 160827401, 65097570}, | 92 42075930, 8083165, 160827401, 65097570}, |
93 {1, 0, 0, 0, 0, 0, 0}, | 93 {1, 0, 0, 0, 0, 0, 0, 0}, |
94 }; | 94 }; |
95 | 95 |
96 } // anonymous namespace | 96 } // anonymous namespace |
97 | 97 |
98 namespace crypto { | 98 namespace crypto { |
99 | 99 |
100 P224EncryptedKeyExchange::P224EncryptedKeyExchange( | 100 P224EncryptedKeyExchange::P224EncryptedKeyExchange( |
101 PeerType peer_type, const base::StringPiece& password) | 101 PeerType peer_type, const base::StringPiece& password) |
102 : state_(kStateInitial), | 102 : state_(kStateInitial), |
103 is_server_(peer_type == kPeerTypeServer) { | 103 is_server_(peer_type == kPeerTypeServer) { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 return key_; | 259 return key_; |
260 } | 260 } |
261 | 261 |
262 void P224EncryptedKeyExchange::SetXForTesting(const std::string& x) { | 262 void P224EncryptedKeyExchange::SetXForTesting(const std::string& x) { |
263 memset(&x_, 0, sizeof(x_)); | 263 memset(&x_, 0, sizeof(x_)); |
264 memcpy(&x_, x.data(), std::min(x.size(), sizeof(x_))); | 264 memcpy(&x_, x.data(), std::min(x.size(), sizeof(x_))); |
265 Init(); | 265 Init(); |
266 } | 266 } |
267 | 267 |
268 } // namespace crypto | 268 } // namespace crypto |
OLD | NEW |