tsc25519.h - sick - sign and check files using ed25519
 (HTM) git clone git://z3bra.org/sick
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       tsc25519.h (2827B)
       ---
            1 /*
            2  * Public Domain, Authors: Daniel J. Bernstein, Niels Duif, Tanja Lange,
            3  * Peter Schwabe, Bo-Yin Yang.
            4  * Copied from supercop-20230530/crypto_sign/ed25519/ref/sc25519.h
            5  */
            6 
            7 #ifndef SC25519_H
            8 #define SC25519_H
            9 
           10 #include "crypto_api.h"
           11 
           12 #define sc25519                  crypto_sign_ed25519_ref_sc25519
           13 #define shortsc25519             crypto_sign_ed25519_ref_shortsc25519
           14 #define sc25519_from32bytes      crypto_sign_ed25519_ref_sc25519_from32bytes
           15 #define shortsc25519_from16bytes crypto_sign_ed25519_ref_shortsc25519_from16bytes
           16 #define sc25519_from64bytes      crypto_sign_ed25519_ref_sc25519_from64bytes
           17 #define sc25519_from_shortsc     crypto_sign_ed25519_ref_sc25519_from_shortsc
           18 #define sc25519_to32bytes        crypto_sign_ed25519_ref_sc25519_to32bytes
           19 #define sc25519_iszero_vartime   crypto_sign_ed25519_ref_sc25519_iszero_vartime
           20 #define sc25519_isshort_vartime  crypto_sign_ed25519_ref_sc25519_isshort_vartime
           21 #define sc25519_lt_vartime       crypto_sign_ed25519_ref_sc25519_lt_vartime
           22 #define sc25519_add              crypto_sign_ed25519_ref_sc25519_add
           23 #define sc25519_sub_nored        crypto_sign_ed25519_ref_sc25519_sub_nored
           24 #define sc25519_mul              crypto_sign_ed25519_ref_sc25519_mul
           25 #define sc25519_mul_shortsc      crypto_sign_ed25519_ref_sc25519_mul_shortsc
           26 #define sc25519_window3          crypto_sign_ed25519_ref_sc25519_window3
           27 #define sc25519_window5          crypto_sign_ed25519_ref_sc25519_window5
           28 #define sc25519_2interleave2     crypto_sign_ed25519_ref_sc25519_2interleave2
           29 
           30 typedef struct 
           31 {
           32   crypto_uint32 v[32]; 
           33 }
           34 sc25519;
           35 
           36 typedef struct 
           37 {
           38   crypto_uint32 v[16]; 
           39 }
           40 shortsc25519;
           41 
           42 void sc25519_from32bytes(sc25519 *r, const unsigned char x[32]);
           43 
           44 void shortsc25519_from16bytes(shortsc25519 *r, const unsigned char x[16]);
           45 
           46 void sc25519_from64bytes(sc25519 *r, const unsigned char x[64]);
           47 
           48 void sc25519_from_shortsc(sc25519 *r, const shortsc25519 *x);
           49 
           50 void sc25519_to32bytes(unsigned char r[32], const sc25519 *x);
           51 
           52 int sc25519_iszero_vartime(const sc25519 *x);
           53 
           54 int sc25519_isshort_vartime(const sc25519 *x);
           55 
           56 int sc25519_lt_vartime(const sc25519 *x, const sc25519 *y);
           57 
           58 void sc25519_add(sc25519 *r, const sc25519 *x, const sc25519 *y);
           59 
           60 void sc25519_sub_nored(sc25519 *r, const sc25519 *x, const sc25519 *y);
           61 
           62 void sc25519_mul(sc25519 *r, const sc25519 *x, const sc25519 *y);
           63 
           64 void sc25519_mul_shortsc(sc25519 *r, const sc25519 *x, const shortsc25519 *y);
           65 
           66 /* Convert s into a representation of the form \sum_{i=0}^{84}r[i]2^3
           67  * with r[i] in {-4,...,3}
           68  */
           69 void sc25519_window3(signed char r[85], const sc25519 *s);
           70 
           71 /* Convert s into a representation of the form \sum_{i=0}^{50}r[i]2^5
           72  * with r[i] in {-16,...,15}
           73  */
           74 void sc25519_window5(signed char r[51], const sc25519 *s);
           75 
           76 void sc25519_2interleave2(unsigned char r[127], const sc25519 *s1, const sc25519 *s2);
           77 
           78 #endif