00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef SC25519_H
00010 #define SC25519_H
00011
00012 #define sc25519 crypto_sign_ed25519_ref_sc25519
00013 #define shortsc25519 crypto_sign_ed25519_ref_shortsc25519
00014 #define sc25519_from32bytes crypto_sign_ed25519_ref_sc25519_from32bytes
00015 #define shortsc25519_from16bytes crypto_sign_ed25519_ref_shortsc25519_from16bytes
00016 #define sc25519_from64bytes crypto_sign_ed25519_ref_sc25519_from64bytes
00017 #define sc25519_from_shortsc crypto_sign_ed25519_ref_sc25519_from_shortsc
00018 #define sc25519_to32bytes crypto_sign_ed25519_ref_sc25519_to32bytes
00019 #define sc25519_iszero_vartime crypto_sign_ed25519_ref_sc25519_iszero_vartime
00020 #define sc25519_isshort_vartime crypto_sign_ed25519_ref_sc25519_isshort_vartime
00021 #define sc25519_lt_vartime crypto_sign_ed25519_ref_sc25519_lt_vartime
00022 #define sc25519_add crypto_sign_ed25519_ref_sc25519_add
00023 #define sc25519_sub_nored crypto_sign_ed25519_ref_sc25519_sub_nored
00024 #define sc25519_mul crypto_sign_ed25519_ref_sc25519_mul
00025 #define sc25519_mul_shortsc crypto_sign_ed25519_ref_sc25519_mul_shortsc
00026 #define sc25519_window3 crypto_sign_ed25519_ref_sc25519_window3
00027 #define sc25519_window5 crypto_sign_ed25519_ref_sc25519_window5
00028 #define sc25519_2interleave2 crypto_sign_ed25519_ref_sc25519_2interleave2
00029
00030 typedef struct {
00031 uint32_t v[32];
00032 } sc25519;
00033
00034 typedef struct {
00035 uint32_t v[16];
00036 } shortsc25519;
00037
00038 void sc25519_from32bytes(sc25519 *r, const unsigned char x[32]);
00039
00040 void shortsc25519_from16bytes(shortsc25519 *r, const unsigned char x[16]);
00041
00042 void sc25519_from64bytes(sc25519 *r, const unsigned char x[64]);
00043
00044 void sc25519_from_shortsc(sc25519 *r, const shortsc25519 *x);
00045
00046 void sc25519_to32bytes(unsigned char r[32], const sc25519 *x);
00047
00048 int sc25519_iszero_vartime(const sc25519 *x);
00049
00050 int sc25519_isshort_vartime(const sc25519 *x);
00051
00052 int sc25519_lt_vartime(const sc25519 *x, const sc25519 *y);
00053
00054 void sc25519_add(sc25519 *r, const sc25519 *x, const sc25519 *y);
00055
00056 void sc25519_sub_nored(sc25519 *r, const sc25519 *x, const sc25519 *y);
00057
00058 void sc25519_mul(sc25519 *r, const sc25519 *x, const sc25519 *y);
00059
00060 void sc25519_mul_shortsc(sc25519 *r, const sc25519 *x, const shortsc25519 *y);
00061
00062
00063
00064
00065 void sc25519_window3(signed char r[85], const sc25519 *s);
00066
00067
00068
00069
00070 void sc25519_window5(signed char r[51], const sc25519 *s);
00071
00072 void sc25519_2interleave2(unsigned char r[127], const sc25519 *s1, const sc25519 *s2);
00073
00074 #endif