 beda11a079
			
		
	
	beda11a079
	
	
	
		
			
			The X25519 implementation comes from libsodium. Explicit copyright notices have been added to each file as well as some portability changes (e.g. align.h).
		
			
				
	
	
		
			56 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /*
 | |
|  * ISC License
 | |
|  *
 | |
|  * Copyright (c) 2013-2019
 | |
|  * Frank Denis <j at pureftpd dot org>
 | |
|  *
 | |
|  * Permission to use, copy, modify, and/or distribute this software for any
 | |
|  * purpose with or without fee is hereby granted, provided that the above
 | |
|  * copyright notice and this permission notice appear in all copies.
 | |
|  *
 | |
|  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | |
|  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | |
|  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | |
|  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | |
|  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 | |
|  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 | |
|  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | |
|  */
 | |
| 
 | |
| #ifndef x25519_ref10_H
 | |
| #define x25519_ref10_H
 | |
| 
 | |
| #include <stddef.h>
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| extern "C" {
 | |
| #endif
 | |
| 
 | |
| #define crypto_scalarmult_curve25519_BYTES 32U
 | |
| size_t crypto_scalarmult_curve25519_bytes(void);
 | |
| 
 | |
| #define crypto_scalarmult_curve25519_SCALARBYTES 32U
 | |
| size_t crypto_scalarmult_curve25519_scalarbytes(void);
 | |
| 
 | |
| /*
 | |
|  * NOTE: Do not use the result of this function directly for key exchange.
 | |
|  *
 | |
|  * Hash the result with the public keys in order to compute a shared
 | |
|  * secret key: H(q || client_pk || server_pk)
 | |
|  *
 | |
|  * Or unless this is not an option, use the crypto_kx() API instead.
 | |
|  */
 | |
| #define crypto_scalarmult_curve25519 hc_hcrypto_scalarmult_curve25519
 | |
| int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n,
 | |
|                                  const unsigned char *p);
 | |
| 
 | |
| #define crypto_scalarmult_curve25519_base hc_hcrypto_scalarmult_curve25519_base
 | |
| int crypto_scalarmult_curve25519_base(unsigned char *q,
 | |
|                                       const unsigned char *n);
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| }
 | |
| #endif
 | |
| 
 | |
| #endif
 |