xref: /openbsd-src/lib/libcrypto/curve25519/curve25519-generic.c (revision 694cb79677271ac3a5dc5cac952bb0504290ad6c)
1*694cb796Stb /*	$OpenBSD: curve25519-generic.c,v 1.2 2019/05/11 15:55:52 tb Exp $ */
25f5d09a5Sjsing /*
35f5d09a5Sjsing  * Copyright (c) 2015, Google Inc.
45f5d09a5Sjsing  *
55f5d09a5Sjsing  * Permission to use, copy, modify, and/or distribute this software for any
65f5d09a5Sjsing  * purpose with or without fee is hereby granted, provided that the above
75f5d09a5Sjsing  * copyright notice and this permission notice appear in all copies.
85f5d09a5Sjsing  *
95f5d09a5Sjsing  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
105f5d09a5Sjsing  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
115f5d09a5Sjsing  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
125f5d09a5Sjsing  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
135f5d09a5Sjsing  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
145f5d09a5Sjsing  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
155f5d09a5Sjsing  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
165f5d09a5Sjsing  */
175f5d09a5Sjsing 
185f5d09a5Sjsing /*
195f5d09a5Sjsing  * This code is mostly taken from the ref10 version of Ed25519 in SUPERCOP
205f5d09a5Sjsing  * 20141124 (http://bench.cr.yp.to/supercop.html). That code is released as
215f5d09a5Sjsing  * public domain but this file has the ISC license just to keep licencing
225f5d09a5Sjsing  * simple.
235f5d09a5Sjsing  *
245f5d09a5Sjsing  * The field functions are shared by Ed25519 and X25519 where possible.
255f5d09a5Sjsing  */
265f5d09a5Sjsing 
275f5d09a5Sjsing #include "curve25519_internal.h"
285f5d09a5Sjsing 
295f5d09a5Sjsing void
x25519_scalar_mult(uint8_t out[32],const uint8_t scalar[32],const uint8_t point[32])305f5d09a5Sjsing x25519_scalar_mult(uint8_t out[32], const uint8_t scalar[32],
315f5d09a5Sjsing     const uint8_t point[32])
325f5d09a5Sjsing {
335f5d09a5Sjsing 	x25519_scalar_mult_generic(out, scalar, point);
345f5d09a5Sjsing }
35