1 |
|
|
/* |
2 |
|
|
* Copyright (c) 2015, Google Inc. |
3 |
|
|
* |
4 |
|
|
* Permission to use, copy, modify, and/or distribute this software for any |
5 |
|
|
* purpose with or without fee is hereby granted, provided that the above |
6 |
|
|
* copyright notice and this permission notice appear in all copies. |
7 |
|
|
* |
8 |
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
9 |
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
10 |
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
11 |
|
|
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
12 |
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION |
13 |
|
|
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
14 |
|
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 |
|
|
*/ |
16 |
|
|
|
17 |
|
|
/* |
18 |
|
|
* This code is mostly taken from the ref10 version of Ed25519 in SUPERCOP |
19 |
|
|
* 20141124 (http://bench.cr.yp.to/supercop.html). That code is released as |
20 |
|
|
* public domain but this file has the ISC license just to keep licencing |
21 |
|
|
* simple. |
22 |
|
|
* |
23 |
|
|
* The field functions are shared by Ed25519 and X25519 where possible. |
24 |
|
|
*/ |
25 |
|
|
|
26 |
|
|
#include "curve25519_internal.h" |
27 |
|
|
|
28 |
|
|
void |
29 |
|
|
x25519_scalar_mult(uint8_t out[32], const uint8_t scalar[32], |
30 |
|
|
const uint8_t point[32]) |
31 |
|
|
{ |
32 |
|
12196 |
x25519_scalar_mult_generic(out, scalar, point); |
33 |
|
6098 |
} |