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

Side by Side Diff: crypto/p224.h

Issue 8499032: net: add low-entropy, shared secret authentication protocol. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... 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 | « crypto/crypto.gyp ('k') | crypto/p224_spake.h » ('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 #ifndef CRYPTO_P224_H_ 5 #ifndef CRYPTO_P224_H_
6 #define CRYPTO_P224_H_ 6 #define CRYPTO_P224_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 18 matching lines...) Expand all
29 // number < p. 29 // number < p.
30 bool SetFromString(const base::StringPiece& in); 30 bool SetFromString(const base::StringPiece& in);
31 31
32 // ToString returns an external representation of the Point. 32 // ToString returns an external representation of the Point.
33 std::string ToString() const; 33 std::string ToString() const;
34 34
35 // An Point is represented in Jacobian form (x/z², y/z³). 35 // An Point is represented in Jacobian form (x/z², y/z³).
36 FieldElement x, y, z; 36 FieldElement x, y, z;
37 }; 37 };
38 38
39 // kScalarBytes is the number of bytes needed to represent an element of the
40 // P224 field.
41 static const size_t kScalarBytes = 28;
42
39 // ScalarMult computes *out = in*scalar where scalar is a 28-byte, big-endian 43 // ScalarMult computes *out = in*scalar where scalar is a 28-byte, big-endian
40 // number. 44 // number.
41 void CRYPTO_EXPORT ScalarMult(const Point& in, const uint8* scalar, Point* out); 45 void CRYPTO_EXPORT ScalarMult(const Point& in, const uint8* scalar, Point* out);
42 46
43 // ScalarBaseMult computes *out = g*scalar where g is the base point of the 47 // ScalarBaseMult computes *out = g*scalar where g is the base point of the
44 // curve and scalar is a 28-byte, big-endian number. 48 // curve and scalar is a 28-byte, big-endian number.
45 void CRYPTO_EXPORT ScalarBaseMult(const uint8* scalar, Point* out); 49 void CRYPTO_EXPORT ScalarBaseMult(const uint8* scalar, Point* out);
46 50
47 // Add computes *out = a+b. 51 // Add computes *out = a+b.
48 void CRYPTO_EXPORT Add(const Point& a, const Point& b, Point* out); 52 void CRYPTO_EXPORT Add(const Point& a, const Point& b, Point* out);
49 53
50 // Negate calculates out = -a; 54 // Negate calculates out = -a;
51 void CRYPTO_EXPORT Negate(const Point& a, Point* out); 55 void CRYPTO_EXPORT Negate(const Point& a, Point* out);
52 56
53 } // namespace p224 57 } // namespace p224
54 58
55 } // namespace crypto 59 } // namespace crypto
56 60
57 #endif // CRYPTO_P224_H_ 61 #endif // CRYPTO_P224_H_
OLDNEW
« no previous file with comments | « crypto/crypto.gyp ('k') | crypto/p224_spake.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698