crypto_box.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #include "crypto_box.h"
  2. size_t
  3. crypto_box_seedbytes(void)
  4. {
  5. return crypto_box_SEEDBYTES;
  6. }
  7. size_t
  8. crypto_box_publickeybytes(void)
  9. {
  10. return crypto_box_PUBLICKEYBYTES;
  11. }
  12. size_t
  13. crypto_box_secretkeybytes(void)
  14. {
  15. return crypto_box_SECRETKEYBYTES;
  16. }
  17. size_t
  18. crypto_box_beforenmbytes(void)
  19. {
  20. return crypto_box_BEFORENMBYTES;
  21. }
  22. size_t
  23. crypto_box_noncebytes(void)
  24. {
  25. return crypto_box_NONCEBYTES;
  26. }
  27. size_t
  28. crypto_box_zerobytes(void)
  29. {
  30. return crypto_box_ZEROBYTES;
  31. }
  32. size_t
  33. crypto_box_boxzerobytes(void)
  34. {
  35. return crypto_box_BOXZEROBYTES;
  36. }
  37. size_t
  38. crypto_box_macbytes(void)
  39. {
  40. return crypto_box_MACBYTES;
  41. }
  42. size_t
  43. crypto_box_messagebytes_max(void)
  44. {
  45. return crypto_box_MESSAGEBYTES_MAX;
  46. }
  47. const char *
  48. crypto_box_primitive(void)
  49. {
  50. return crypto_box_PRIMITIVE;
  51. }
  52. int
  53. crypto_box_seed_keypair(unsigned char *pk, unsigned char *sk,
  54. const unsigned char *seed)
  55. {
  56. return crypto_box_curve25519xsalsa20poly1305_seed_keypair(pk, sk, seed);
  57. }
  58. int
  59. crypto_box_keypair(unsigned char *pk, unsigned char *sk)
  60. {
  61. return crypto_box_curve25519xsalsa20poly1305_keypair(pk, sk);
  62. }
  63. int
  64. crypto_box_beforenm(unsigned char *k, const unsigned char *pk,
  65. const unsigned char *sk)
  66. {
  67. return crypto_box_curve25519xsalsa20poly1305_beforenm(k, pk, sk);
  68. }
  69. int
  70. crypto_box_afternm(unsigned char *c, const unsigned char *m,
  71. unsigned long long mlen, const unsigned char *n,
  72. const unsigned char *k)
  73. {
  74. return crypto_box_curve25519xsalsa20poly1305_afternm(c, m, mlen, n, k);
  75. }
  76. int
  77. crypto_box_open_afternm(unsigned char *m, const unsigned char *c,
  78. unsigned long long clen, const unsigned char *n,
  79. const unsigned char *k)
  80. {
  81. return crypto_box_curve25519xsalsa20poly1305_open_afternm(m, c, clen, n, k);
  82. }
  83. int
  84. crypto_box(unsigned char *c, const unsigned char *m,
  85. unsigned long long mlen, const unsigned char *n,
  86. const unsigned char *pk, const unsigned char *sk)
  87. {
  88. return crypto_box_curve25519xsalsa20poly1305(c, m, mlen, n, pk, sk);
  89. }
  90. int
  91. crypto_box_open(unsigned char *m, const unsigned char *c,
  92. unsigned long long clen, const unsigned char *n,
  93. const unsigned char *pk, const unsigned char *sk)
  94. {
  95. return crypto_box_curve25519xsalsa20poly1305_open(m, c, clen, n, pk, sk);
  96. }