gnunet-android

GNUnet for Android
Log | Files | Refs | README

crypto_core_ristretto255.h (3140B)


      1 #ifndef crypto_core_ristretto255_H
      2 #define crypto_core_ristretto255_H
      3 
      4 #include <stddef.h>
      5 #include "export.h"
      6 
      7 #ifdef __cplusplus
      8 extern "C" {
      9 #endif
     10 
     11 #define crypto_core_ristretto255_BYTES 32
     12 SODIUM_EXPORT
     13 size_t crypto_core_ristretto255_bytes(void);
     14 
     15 #define crypto_core_ristretto255_HASHBYTES 64
     16 SODIUM_EXPORT
     17 size_t crypto_core_ristretto255_hashbytes(void);
     18 
     19 #define crypto_core_ristretto255_SCALARBYTES 32
     20 SODIUM_EXPORT
     21 size_t crypto_core_ristretto255_scalarbytes(void);
     22 
     23 #define crypto_core_ristretto255_NONREDUCEDSCALARBYTES 64
     24 SODIUM_EXPORT
     25 size_t crypto_core_ristretto255_nonreducedscalarbytes(void);
     26 
     27 SODIUM_EXPORT
     28 int crypto_core_ristretto255_is_valid_point(const unsigned char *p)
     29             __attribute__ ((nonnull));
     30 
     31 SODIUM_EXPORT
     32 int crypto_core_ristretto255_add(unsigned char *r,
     33                                  const unsigned char *p, const unsigned char *q)
     34             __attribute__ ((nonnull));
     35 
     36 SODIUM_EXPORT
     37 int crypto_core_ristretto255_sub(unsigned char *r,
     38                                  const unsigned char *p, const unsigned char *q)
     39             __attribute__ ((nonnull));
     40 
     41 SODIUM_EXPORT
     42 int crypto_core_ristretto255_from_hash(unsigned char *p,
     43                                        const unsigned char *r)
     44             __attribute__ ((nonnull));
     45 
     46 SODIUM_EXPORT
     47 void crypto_core_ristretto255_random(unsigned char *p)
     48             __attribute__ ((nonnull));
     49 
     50 SODIUM_EXPORT
     51 void crypto_core_ristretto255_scalar_random(unsigned char *r)
     52             __attribute__ ((nonnull));
     53 
     54 SODIUM_EXPORT
     55 int crypto_core_ristretto255_scalar_invert(unsigned char *recip,
     56                                            const unsigned char *s)
     57             __attribute__ ((nonnull));
     58 
     59 SODIUM_EXPORT
     60 void crypto_core_ristretto255_scalar_negate(unsigned char *neg,
     61                                             const unsigned char *s)
     62             __attribute__ ((nonnull));
     63 
     64 SODIUM_EXPORT
     65 void crypto_core_ristretto255_scalar_complement(unsigned char *comp,
     66                                                 const unsigned char *s)
     67             __attribute__ ((nonnull));
     68 
     69 SODIUM_EXPORT
     70 void crypto_core_ristretto255_scalar_add(unsigned char *z,
     71                                          const unsigned char *x,
     72                                          const unsigned char *y)
     73             __attribute__ ((nonnull));
     74 
     75 SODIUM_EXPORT
     76 void crypto_core_ristretto255_scalar_sub(unsigned char *z,
     77                                          const unsigned char *x,
     78                                          const unsigned char *y)
     79             __attribute__ ((nonnull));
     80 
     81 SODIUM_EXPORT
     82 void crypto_core_ristretto255_scalar_mul(unsigned char *z,
     83                                          const unsigned char *x,
     84                                          const unsigned char *y)
     85             __attribute__ ((nonnull));
     86 
     87 /*
     88  * The interval `s` is sampled from should be at least 317 bits to ensure almost
     89  * uniformity of `r` over `L`.
     90  */
     91 SODIUM_EXPORT
     92 void crypto_core_ristretto255_scalar_reduce(unsigned char *r,
     93                                             const unsigned char *s)
     94             __attribute__ ((nonnull));
     95 
     96 #ifdef __cplusplus
     97 }
     98 #endif
     99 
    100 #endif