OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 #include "crypto/curve25519.h" | 5 #include "crypto/curve25519.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "crypto/secure_util.h" | 9 #include "crypto/secure_util.h" |
8 | 10 |
9 // Curve25519 is specified in terms of byte strings, not numbers, so all | 11 // Curve25519 is specified in terms of byte strings, not numbers, so all |
10 // implementations take and return the same sequence of bits. So the byte | 12 // implementations take and return the same sequence of bits. So the byte |
11 // order is implicitly specified as in, say, SHA1. | 13 // order is implicitly specified as in, say, SHA1. |
12 // | 14 // |
13 // Prototype for |curve25519_donna| function in | 15 // Prototype for |curve25519_donna| function in |
14 // third_party/curve25519-donna/curve25519-donna.c | 16 // third_party/curve25519-donna/curve25519-donna.c |
15 extern "C" int curve25519_donna(uint8_t*, const uint8_t*, const uint8_t*); | 17 extern "C" int curve25519_donna(uint8_t*, const uint8_t*, const uint8_t*); |
16 | 18 |
(...skipping 16 matching lines...) Expand all Loading... |
33 // See "Computing public keys" section of http://cr.yp.to/ecdh.html. | 35 // See "Computing public keys" section of http://cr.yp.to/ecdh.html. |
34 static const uint8_t kBasePoint[32] = {9}; | 36 static const uint8_t kBasePoint[32] = {9}; |
35 | 37 |
36 void ScalarBaseMult(const uint8_t* private_key, uint8_t* public_key) { | 38 void ScalarBaseMult(const uint8_t* private_key, uint8_t* public_key) { |
37 curve25519_donna(public_key, private_key, kBasePoint); | 39 curve25519_donna(public_key, private_key, kBasePoint); |
38 } | 40 } |
39 | 41 |
40 } // namespace curve25519 | 42 } // namespace curve25519 |
41 | 43 |
42 } // namespace crypto | 44 } // namespace crypto |
OLD | NEW |