libssh  0.7.2
include/libssh/fe25519.h
00001 /* $OpenBSD: fe25519.h,v 1.3 2013/12/09 11:03:45 markus Exp $ */
00002 
00003 /*
00004  * Public Domain, Authors: Daniel J. Bernstein, Niels Duif, Tanja Lange,
00005  * Peter Schwabe, Bo-Yin Yang.
00006  * Copied from supercop-20130419/crypto_sign/ed25519/ref/fe25519.h
00007  */
00008 
00009 #ifndef FE25519_H
00010 #define FE25519_H
00011 
00012 #include "libssh/priv.h"
00013 
00014 #define fe25519              crypto_sign_ed25519_ref_fe25519
00015 #define fe25519_freeze       crypto_sign_ed25519_ref_fe25519_freeze
00016 #define fe25519_unpack       crypto_sign_ed25519_ref_fe25519_unpack
00017 #define fe25519_pack         crypto_sign_ed25519_ref_fe25519_pack
00018 #define fe25519_iszero       crypto_sign_ed25519_ref_fe25519_iszero
00019 #define fe25519_iseq_vartime crypto_sign_ed25519_ref_fe25519_iseq_vartime
00020 #define fe25519_cmov         crypto_sign_ed25519_ref_fe25519_cmov
00021 #define fe25519_setone       crypto_sign_ed25519_ref_fe25519_setone
00022 #define fe25519_setzero      crypto_sign_ed25519_ref_fe25519_setzero
00023 #define fe25519_neg          crypto_sign_ed25519_ref_fe25519_neg
00024 #define fe25519_getparity    crypto_sign_ed25519_ref_fe25519_getparity
00025 #define fe25519_add          crypto_sign_ed25519_ref_fe25519_add
00026 #define fe25519_sub          crypto_sign_ed25519_ref_fe25519_sub
00027 #define fe25519_mul          crypto_sign_ed25519_ref_fe25519_mul
00028 #define fe25519_square       crypto_sign_ed25519_ref_fe25519_square
00029 #define fe25519_invert       crypto_sign_ed25519_ref_fe25519_invert
00030 #define fe25519_pow2523      crypto_sign_ed25519_ref_fe25519_pow2523
00031 
00032 typedef struct {
00033   uint32_t v[32];
00034 } fe25519;
00035 
00036 void fe25519_freeze(fe25519 *r);
00037 
00038 void fe25519_unpack(fe25519 *r, const unsigned char x[32]);
00039 
00040 void fe25519_pack(unsigned char r[32], const fe25519 *x);
00041 
00042 int fe25519_iszero(const fe25519 *x);
00043 
00044 int fe25519_iseq_vartime(const fe25519 *x, const fe25519 *y);
00045 
00046 void fe25519_cmov(fe25519 *r, const fe25519 *x, unsigned char b);
00047 
00048 void fe25519_setone(fe25519 *r);
00049 
00050 void fe25519_setzero(fe25519 *r);
00051 
00052 void fe25519_neg(fe25519 *r, const fe25519 *x);
00053 
00054 unsigned char fe25519_getparity(const fe25519 *x);
00055 
00056 void fe25519_add(fe25519 *r, const fe25519 *x, const fe25519 *y);
00057 
00058 void fe25519_sub(fe25519 *r, const fe25519 *x, const fe25519 *y);
00059 
00060 void fe25519_mul(fe25519 *r, const fe25519 *x, const fe25519 *y);
00061 
00062 void fe25519_square(fe25519 *r, const fe25519 *x);
00063 
00064 void fe25519_invert(fe25519 *r, const fe25519 *x);
00065 
00066 void fe25519_pow2523(fe25519 *r, const fe25519 *x);
00067 
00068 #endif