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

Side by Side Diff: crypto/curve25519.cc

Issue 12457004: Curve25519-donna changes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 9 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 | « crypto/curve25519.h ('k') | crypto/curve25519-donna.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "crypto/curve25519.h"
6
7 // Curve25519 is specified in terms of byte strings, not numbers, so all
8 // implementations take and return the same sequence of bits. So the byte
9 // order is implicitly specified as in, say, SHA1.
10 //
11 // Prototype for |curve25519_donna| function in
12 // third_party/curve25519-donna/curve25519-donna.c
13 extern "C" int curve25519_donna(uint8*, const uint8*, const uint8*);
14
15 namespace crypto {
16
17 namespace curve25519 {
18
19 void ScalarMult(const uint8* private_key,
20 const uint8* peer_public_key,
21 uint8* shared_key) {
22 curve25519_donna(shared_key, private_key, peer_public_key);
23 }
24
25 // kBasePoint is the base point (generator) of the elliptic curve group.
26 // It is little-endian version of '9' followed by 31 zeros.
27 // See "Computing public keys" section of http://cr.yp.to/ecdh.html.
28 static const unsigned char kBasePoint[32] = {9};
29
30 void ScalarBaseMult(const uint8* private_key, uint8* public_key) {
31 curve25519_donna(public_key, private_key, kBasePoint);
32 }
33
34 } // namespace curve25519
35
36 } // namespace crypto
OLDNEW
« no previous file with comments | « crypto/curve25519.h ('k') | crypto/curve25519-donna.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698