Annotation of embedaddon/strongswan/src/libstrongswan/plugins/curve25519/ref10/ref10.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2016 Andreas Steffen
                      3:  * HSR Hochschule fuer Technik Rapperswil
                      4:  *
                      5:  * Based on the public domain libsodium adaptation by Frank Denis
                      6:  * of the SUPERCOP ref10 implementation by  Daniel J. Bernstein,
                      7:  * Niels Duif, Peter Schwabe, Tanja Lange and Bo-Yin Yang.
                      8:  */
                      9: 
                     10: /**
                     11:  * @defgroup curve25519_ref10 curve25519_ref10
                     12:  * @{ @ingroup curve25519_p
                     13:  */
                     14: 
                     15: #ifndef REF10_H_
                     16: #define REF10_H_
                     17: 
                     18: #include <stddef.h>
                     19: #include <stdint.h>
                     20: 
                     21: typedef int32_t fe[10];
                     22: 
                     23: /**
                     24:  * fe means field element.
                     25:  * Here the field is \\Z/(2^255-19).
                     26:  * An element t, entries t[0]...t[9], represents the integer
                     27:  * t[0]+2^26 t[1]+2^51 t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9].
                     28:  * Bounds on each t[i] vary depending on context.
                     29:  */
                     30: 
                     31: /**
                     32:  * ge means group element.
                     33:  *
                     34:  * Here the group is the set of pairs (x,y) of field elements (see fe.h)
                     35:  * satisfying -x^2 + y^2 = 1 + d x^2y^2
                     36:  * where d = -121665/121666.
                     37:  *
                     38:  * Representations:
                     39:  * ge_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z
                     40:  * ge_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT
                     41:  * ge_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T
                     42:  * ge_precomp (Duif): (y+x,y-x,2dxy)
                     43:  */
                     44: 
                     45: typedef struct {
                     46:        fe X;
                     47:        fe Y;
                     48:        fe Z;
                     49: } ge_p2;
                     50: 
                     51: typedef struct {
                     52:        fe X;
                     53:        fe Y;
                     54:        fe Z;
                     55:        fe T;
                     56: } ge_p3;
                     57: 
                     58: typedef struct {
                     59:        fe X;
                     60:        fe Y;
                     61:        fe Z;
                     62:        fe T;
                     63: } ge_p1p1;
                     64: 
                     65: typedef struct {
                     66:        fe yplusx;
                     67:        fe yminusx;
                     68:        fe xy2d;
                     69: } ge_precomp;
                     70: 
                     71: typedef struct {
                     72:        fe YplusX;
                     73:        fe YminusX;
                     74:        fe Z;
                     75:        fe T2d;
                     76: } ge_cached;
                     77: 
                     78: extern void ge_tobytes(uint8_t *, const ge_p2 *);
                     79: extern void ge_p3_tobytes(uint8_t *, const ge_p3 *);
                     80: extern  int ge_frombytes_negate_vartime(ge_p3 *, const uint8_t *);
                     81: extern void ge_scalarmult_base(ge_p3 *, const uint8_t *);
                     82: extern void ge_double_scalarmult_vartime(ge_p2 *, const uint8_t *,
                     83:                        const ge_p3 *, const uint8_t *);
                     84: 
                     85: /**
                     86:  * The set of scalars is \\Z/l
                     87:  * where l = 2^252 + 27742317777372353535851937790883648493.
                     88:  */
                     89: 
                     90: extern void sc_reduce(uint8_t *);
                     91: extern void sc_muladd(uint8_t *, const uint8_t *, const uint8_t *, const uint8_t *);
                     92: 
                     93: #endif /** REF10_H_ @}*/

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>