crypto_core_ristretto255.h 3.2 KB

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