rbnacl-libsodium 0.5.0.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +4 -0
  3. data/lib/rbnacl/libsodium/version.rb +1 -1
  4. data/vendor/libsodium/AUTHORS +62 -81
  5. data/vendor/libsodium/ChangeLog +31 -1
  6. data/vendor/libsodium/README.markdown +15 -364
  7. data/vendor/libsodium/THANKS +6 -0
  8. data/vendor/libsodium/autom4te.cache/output.0 +67 -36
  9. data/vendor/libsodium/autom4te.cache/output.1 +67 -36
  10. data/vendor/libsodium/autom4te.cache/output.2 +67 -36
  11. data/vendor/libsodium/autom4te.cache/traces.0 +52 -51
  12. data/vendor/libsodium/autom4te.cache/traces.1 +137 -133
  13. data/vendor/libsodium/autom4te.cache/traces.2 +52 -51
  14. data/vendor/libsodium/builds/msvc/version.h +2 -2
  15. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj +365 -345
  16. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters +1114 -1037
  17. data/vendor/libsodium/builds/msvc/vs2010/test/test.props +8 -2
  18. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj +364 -344
  19. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters +1113 -1036
  20. data/vendor/libsodium/builds/msvc/vs2012/test/test.props +8 -2
  21. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj +365 -345
  22. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters +1114 -1037
  23. data/vendor/libsodium/builds/msvc/vs2013/test/test.props +8 -2
  24. data/vendor/libsodium/configure +66 -35
  25. data/vendor/libsodium/configure.ac +25 -14
  26. data/vendor/libsodium/dist-build/ios.sh +1 -1
  27. data/vendor/libsodium/dist-build/msys2-win64.sh +1 -1
  28. data/vendor/libsodium/libsodium.vcxproj +29 -14
  29. data/vendor/libsodium/libsodium.vcxproj.filters +77 -28
  30. data/vendor/libsodium/msvc-scripts/process.bat +3 -3
  31. data/vendor/libsodium/packaging/nuget/package.config +1 -1
  32. data/vendor/libsodium/packaging/nuget/package.gsl +6 -1
  33. data/vendor/libsodium/packaging/nuget/package.nuspec +1 -1
  34. data/vendor/libsodium/src/libsodium/Makefile.am +31 -13
  35. data/vendor/libsodium/src/libsodium/Makefile.in +406 -155
  36. data/vendor/libsodium/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c +146 -0
  37. data/vendor/libsodium/src/libsodium/crypto_box/crypto_box.c +13 -0
  38. data/vendor/libsodium/src/libsodium/crypto_box/crypto_box_easy.c +39 -73
  39. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c +5 -0
  40. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/api.h +2 -0
  41. data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c +15 -0
  42. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c +6 -5
  43. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2s-ref.c +6 -5
  44. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/crypto_onetimeauth.c +25 -0
  45. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c +76 -47
  46. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.h +30 -7
  47. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h +3 -16
  48. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h +3 -10
  49. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/verify_poly1305_donna.c +11 -6
  50. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c +23 -1
  51. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_try.c +1 -1
  52. data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256 → scryptsalsa208sha256}/crypto_scrypt-common.c +7 -7
  53. data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256 → scryptsalsa208sha256}/crypto_scrypt.h +6 -20
  54. data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256/nosse/pwhash_scryptxsalsa208sha256_nosse.c → scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c} +0 -0
  55. data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256 → scryptsalsa208sha256}/pbkdf2-sha256.c +1 -11
  56. data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256 → scryptsalsa208sha256}/pbkdf2-sha256.h +0 -0
  57. data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256/pwhash_scryptxsalsa208sha256.c → scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c} +50 -25
  58. data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256 → scryptsalsa208sha256}/scrypt_platform.c +4 -0
  59. data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256_sse.c → scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c} +0 -0
  60. data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256 → scryptsalsa208sha256}/sysendian.h +0 -0
  61. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/smult_curve25519_donna_c64.c +1 -1
  62. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/{ref → ref10}/api.h +0 -3
  63. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/base_curve25519_ref10.c +14 -0
  64. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe.h +44 -0
  65. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_0_curve25519_ref10.c +23 -0
  66. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_1_curve25519_ref10.c +23 -0
  67. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_add_curve25519_ref10.c +61 -0
  68. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_copy_curve25519_ref10.c +33 -0
  69. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_cswap_curve25519_ref10.c +77 -0
  70. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_frombytes_curve25519_ref10.c +73 -0
  71. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_invert_curve25519_ref10.c +18 -0
  72. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_mul121666_curve25519_ref10.c +74 -0
  73. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_mul_curve25519_ref10.c +257 -0
  74. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_sq_curve25519_ref10.c +153 -0
  75. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_sub_curve25519_ref10.c +61 -0
  76. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_tobytes_curve25519_ref10.c +123 -0
  77. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/montgomery.h +140 -0
  78. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/pow225521.h +160 -0
  79. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/scalarmult_curve25519_ref10.c +54 -0
  80. data/vendor/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c +92 -61
  81. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_scalarmult_base.c +3 -3
  82. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow22523.h +2 -2
  83. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow225521.h +2 -2
  84. data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sc25519_edwards25519sha512batch.c +8 -4
  85. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/consts_aes128ctr.c +3 -3
  86. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128.h +6 -3
  87. data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128_aes128ctr.c +23 -23
  88. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/api.h +12 -0
  89. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.c +275 -0
  90. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/stream_chacha20_api.c +36 -0
  91. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.S +11 -10
  92. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c +8 -3
  93. data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20_api.c +8 -0
  94. data/vendor/libsodium/src/libsodium/include/Makefile.am +3 -2
  95. data/vendor/libsodium/src/libsodium/include/Makefile.in +3 -2
  96. data/vendor/libsodium/src/libsodium/include/sodium.h +3 -1
  97. data/vendor/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h +55 -0
  98. data/vendor/libsodium/src/libsodium/include/sodium/crypto_box.h +21 -0
  99. data/vendor/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h +11 -1
  100. data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash.h +7 -0
  101. data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h +7 -0
  102. data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h +7 -0
  103. data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h +15 -0
  104. data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h +25 -0
  105. data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h +80 -0
  106. data/vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h +2 -2
  107. data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox.h +14 -0
  108. data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h +11 -0
  109. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_aes256estream.h +11 -6
  110. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h +49 -0
  111. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h +6 -0
  112. data/vendor/libsodium/src/libsodium/include/sodium/randombytes.h +7 -7
  113. data/vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +10 -14
  114. data/vendor/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +10 -13
  115. data/vendor/libsodium/src/libsodium/sodium/compat.c +55 -4
  116. data/vendor/libsodium/src/libsodium/sodium/utils.c +18 -0
  117. data/vendor/libsodium/test/default/Makefile.am +24 -12
  118. data/vendor/libsodium/test/default/Makefile.in +116 -73
  119. data/vendor/libsodium/test/default/aead_chacha20poly1305.c +97 -0
  120. data/vendor/libsodium/test/default/aead_chacha20poly1305.exp +8 -0
  121. data/vendor/libsodium/test/default/box_easy.c +1 -1
  122. data/vendor/libsodium/test/default/box_seed.c +28 -0
  123. data/vendor/libsodium/test/default/box_seed.exp +8 -0
  124. data/vendor/libsodium/test/default/chacha20.c +45 -0
  125. data/vendor/libsodium/test/default/chacha20.exp +5 -0
  126. data/vendor/libsodium/test/default/pwhash.c +83 -15
  127. data/vendor/libsodium/test/default/pwhash.exp +10 -1
  128. data/vendor/libsodium/test/default/pwhash_scrypt_ll.c +67 -0
  129. data/vendor/libsodium/test/default/pwhash_scrypt_ll.exp +15 -0
  130. data/vendor/libsodium/test/default/secretbox_easy.c +13 -1
  131. data/vendor/libsodium/test/default/secretbox_easy.exp +19 -0
  132. data/vendor/libsodium/test/default/secretbox_easy2.c +5 -0
  133. data/vendor/libsodium/test/default/secretbox_easy2.exp +1 -0
  134. data/vendor/libsodium/test/default/sign.c +7 -3
  135. metadata +44 -21
  136. data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/api.h +0 -8
  137. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref/base_curve25519_ref.c +0 -20
  138. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref/smult_curve25519_ref.c +0 -268
  139. data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305_donna.h +0 -37
  140. data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptxsalsa208sha256.h +0 -48
  141. data/vendor/libsodium/test/default/scalarmult7.c +0 -32
  142. data/vendor/libsodium/test/default/scalarmult7.exp +0 -1
  143. data/vendor/libsodium/test/default/scalarmult8.c +0 -32
  144. data/vendor/libsodium/test/default/scalarmult8.exp +0 -1
@@ -3,6 +3,7 @@
3
3
  #define __SODIUM_H__
4
4
 
5
5
  #include <sodium/core.h>
6
+ #include <sodium/crypto_aead_chacha20poly1305.h>
6
7
  #include <sodium/crypto_auth.h>
7
8
  #include <sodium/crypto_auth_hmacsha256.h>
8
9
  #include <sodium/crypto_auth_hmacsha512.h>
@@ -20,7 +21,7 @@
20
21
  #include <sodium/crypto_hash_sha512.h>
21
22
  #include <sodium/crypto_onetimeauth.h>
22
23
  #include <sodium/crypto_onetimeauth_poly1305.h>
23
- #include <sodium/crypto_pwhash_scryptxsalsa208sha256.h>
24
+ #include <sodium/crypto_pwhash_scryptsalsa208sha256.h>
24
25
  #include <sodium/crypto_scalarmult.h>
25
26
  #include <sodium/crypto_scalarmult_curve25519.h>
26
27
  #include <sodium/crypto_secretbox.h>
@@ -32,6 +33,7 @@
32
33
  #include <sodium/crypto_stream.h>
33
34
  #include <sodium/crypto_stream_aes128ctr.h>
34
35
  #include <sodium/crypto_stream_aes256estream.h>
36
+ #include <sodium/crypto_stream_chacha20.h>
35
37
  #include <sodium/crypto_stream_salsa20.h>
36
38
  #include <sodium/crypto_stream_salsa2012.h>
37
39
  #include <sodium/crypto_stream_salsa208.h>
@@ -0,0 +1,55 @@
1
+ #ifndef crypto_aead_chacha20poly1305_H
2
+ #define crypto_aead_chacha20poly1305_H
3
+
4
+ #include <stddef.h>
5
+ #include "export.h"
6
+
7
+ #ifdef __cplusplus
8
+ # if __GNUC__
9
+ # pragma GCC diagnostic ignored "-Wlong-long"
10
+ # endif
11
+ extern "C" {
12
+ #endif
13
+
14
+ #define crypto_aead_chacha20poly1305_KEYBYTES 32U
15
+ SODIUM_EXPORT
16
+ size_t crypto_aead_chacha20poly1305_keybytes(void);
17
+
18
+ #define crypto_aead_chacha20poly1305_NSECBYTES 0U
19
+ SODIUM_EXPORT
20
+ size_t crypto_aead_chacha20poly1305_nsecbytes(void);
21
+
22
+ #define crypto_aead_chacha20poly1305_NPUBBYTES 8U
23
+ SODIUM_EXPORT
24
+ size_t crypto_aead_chacha20poly1305_npubbytes(void);
25
+
26
+ #define crypto_aead_chacha20poly1305_ABYTES 16U
27
+ SODIUM_EXPORT
28
+ size_t crypto_aead_chacha20poly1305_abytes(void);
29
+
30
+ SODIUM_EXPORT
31
+ int crypto_aead_chacha20poly1305_encrypt(unsigned char *c,
32
+ unsigned long long *clen,
33
+ const unsigned char *m,
34
+ unsigned long long mlen,
35
+ const unsigned char *ad,
36
+ unsigned long long adlen,
37
+ const unsigned char *nsec,
38
+ const unsigned char *npub,
39
+ const unsigned char *k);
40
+
41
+ SODIUM_EXPORT
42
+ int crypto_aead_chacha20poly1305_decrypt(unsigned char *m,
43
+ unsigned long long *mlen,
44
+ unsigned char *nsec,
45
+ const unsigned char *c,
46
+ unsigned long long clen,
47
+ const unsigned char *ad,
48
+ unsigned long long adlen,
49
+ const unsigned char *npub,
50
+ const unsigned char *k);
51
+ #ifdef __cplusplus
52
+ }
53
+ #endif
54
+
55
+ #endif
@@ -20,6 +20,10 @@
20
20
  extern "C" {
21
21
  #endif
22
22
 
23
+ #define crypto_box_SEEDBYTES crypto_box_curve25519xsalsa20poly1305_SEEDBYTES
24
+ SODIUM_EXPORT
25
+ size_t crypto_box_seedbytes(void);
26
+
23
27
  #define crypto_box_PUBLICKEYBYTES crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES
24
28
  SODIUM_EXPORT
25
29
  size_t crypto_box_publickeybytes(void);
@@ -52,6 +56,10 @@ size_t crypto_box_macbytes(void);
52
56
  SODIUM_EXPORT
53
57
  const char *crypto_box_primitive(void);
54
58
 
59
+ SODIUM_EXPORT
60
+ int crypto_box_seed_keypair(unsigned char *pk, unsigned char *sk,
61
+ const unsigned char *seed);
62
+
55
63
  SODIUM_EXPORT
56
64
  int crypto_box_keypair(unsigned char *pk, unsigned char *sk);
57
65
 
@@ -89,6 +97,19 @@ int crypto_box_open_easy(unsigned char *m, const unsigned char *c,
89
97
  unsigned long long clen, const unsigned char *n,
90
98
  const unsigned char *pk, const unsigned char *sk);
91
99
 
100
+ SODIUM_EXPORT
101
+ int crypto_box_detached(unsigned char *c, unsigned char *mac,
102
+ const unsigned char *m, unsigned long long mlen,
103
+ const unsigned char *n, const unsigned char *pk,
104
+ const unsigned char *sk);
105
+
106
+ SODIUM_EXPORT
107
+ int crypto_box_open_detached(unsigned char *m, const unsigned char *c,
108
+ const unsigned char *mac,
109
+ unsigned long long clen,
110
+ const unsigned char *n,
111
+ const unsigned char *pk,
112
+ const unsigned char *sk);
92
113
  #ifdef __cplusplus
93
114
  }
94
115
  #endif
@@ -11,6 +11,10 @@
11
11
  extern "C" {
12
12
  #endif
13
13
 
14
+ #define crypto_box_curve25519xsalsa20poly1305_SEEDBYTES 32U
15
+ SODIUM_EXPORT
16
+ size_t crypto_box_curve25519xsalsa20poly1305_seedbytes(void);
17
+
14
18
  #define crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES 32U
15
19
  SODIUM_EXPORT
16
20
  size_t crypto_box_curve25519xsalsa20poly1305_publickeybytes(void);
@@ -58,7 +62,13 @@ int crypto_box_curve25519xsalsa20poly1305_open(unsigned char *m,
58
62
  const unsigned char *sk);
59
63
 
60
64
  SODIUM_EXPORT
61
- int crypto_box_curve25519xsalsa20poly1305_keypair(unsigned char *pk, unsigned char *sk);
65
+ int crypto_box_curve25519xsalsa20poly1305_seed_keypair(unsigned char *pk,
66
+ unsigned char *sk,
67
+ const unsigned char *seed);
68
+
69
+ SODIUM_EXPORT
70
+ int crypto_box_curve25519xsalsa20poly1305_keypair(unsigned char *pk,
71
+ unsigned char *sk);
62
72
 
63
73
  SODIUM_EXPORT
64
74
  int crypto_box_curve25519xsalsa20poly1305_beforenm(unsigned char *k,
@@ -1,6 +1,13 @@
1
1
  #ifndef crypto_hash_H
2
2
  #define crypto_hash_H
3
3
 
4
+ /*
5
+ * WARNING: Unless you absolutely need to use SHA512 for interoperatibility,
6
+ * purposes, you might want to consider crypto_generichash() instead.
7
+ * Unlike SHA512, crypto_generichash() is not vulnerable to length
8
+ * extension attacks.
9
+ */
10
+
4
11
  #include <stddef.h>
5
12
 
6
13
  #include "crypto_hash_sha512.h"
@@ -1,6 +1,13 @@
1
1
  #ifndef crypto_hash_sha256_H
2
2
  #define crypto_hash_sha256_H
3
3
 
4
+ /*
5
+ * WARNING: Unless you absolutely need to use SHA256 for interoperatibility,
6
+ * purposes, you might want to consider crypto_generichash() instead.
7
+ * Unlike SHA256, crypto_generichash() is not vulnerable to length
8
+ * extension attacks.
9
+ */
10
+
4
11
  #include <stddef.h>
5
12
  #include <stdint.h>
6
13
  #include <stdlib.h>
@@ -1,6 +1,13 @@
1
1
  #ifndef crypto_hash_sha512_H
2
2
  #define crypto_hash_sha512_H
3
3
 
4
+ /*
5
+ * WARNING: Unless you absolutely need to use SHA512 for interoperatibility,
6
+ * purposes, you might want to consider crypto_generichash() instead.
7
+ * Unlike SHA512, crypto_generichash() is not vulnerable to length
8
+ * extension attacks.
9
+ */
10
+
4
11
  #include <stddef.h>
5
12
  #include <stdint.h>
6
13
  #include <stdlib.h>
@@ -13,6 +13,8 @@
13
13
  extern "C" {
14
14
  #endif
15
15
 
16
+ typedef crypto_onetimeauth_poly1305_state crypto_onetimeauth_state;
17
+
16
18
  #define crypto_onetimeauth_BYTES crypto_onetimeauth_poly1305_BYTES
17
19
  SODIUM_EXPORT
18
20
  size_t crypto_onetimeauth_bytes(void);
@@ -33,6 +35,19 @@ SODIUM_EXPORT
33
35
  int crypto_onetimeauth_verify(const unsigned char *h, const unsigned char *in,
34
36
  unsigned long long inlen, const unsigned char *k);
35
37
 
38
+ SODIUM_EXPORT
39
+ int crypto_onetimeauth_init(crypto_onetimeauth_state *state,
40
+ const unsigned char *key);
41
+
42
+ SODIUM_EXPORT
43
+ int crypto_onetimeauth_update(crypto_onetimeauth_state *state,
44
+ const unsigned char *in,
45
+ unsigned long long inlen);
46
+
47
+ SODIUM_EXPORT
48
+ int crypto_onetimeauth_final(crypto_onetimeauth_state *state,
49
+ unsigned char *out);
50
+
36
51
  #ifdef __cplusplus
37
52
  }
38
53
  #endif
@@ -16,6 +16,11 @@ extern "C" {
16
16
  #include <stdint.h>
17
17
  #include <stdio.h>
18
18
 
19
+ typedef struct crypto_onetimeauth_poly1305_state {
20
+ unsigned long long aligner;
21
+ unsigned char opaque[136];
22
+ } crypto_onetimeauth_poly1305_state;
23
+
19
24
  typedef struct crypto_onetimeauth_poly1305_implementation {
20
25
  const char *(*implementation_name)(void);
21
26
  int (*onetimeauth)(unsigned char *out,
@@ -26,6 +31,13 @@ typedef struct crypto_onetimeauth_poly1305_implementation {
26
31
  const unsigned char *in,
27
32
  unsigned long long inlen,
28
33
  const unsigned char *k);
34
+ int (*onetimeauth_init)(crypto_onetimeauth_poly1305_state *state,
35
+ const unsigned char *key);
36
+ int (*onetimeauth_update)(crypto_onetimeauth_poly1305_state *state,
37
+ const unsigned char *in,
38
+ unsigned long long inlen);
39
+ int (*onetimeauth_final)(crypto_onetimeauth_poly1305_state *state,
40
+ unsigned char *out);
29
41
  } crypto_onetimeauth_poly1305_implementation;
30
42
 
31
43
  #define crypto_onetimeauth_poly1305_BYTES 16U
@@ -58,6 +70,19 @@ int crypto_onetimeauth_poly1305_verify(const unsigned char *h,
58
70
  unsigned long long inlen,
59
71
  const unsigned char *k);
60
72
 
73
+ SODIUM_EXPORT
74
+ int crypto_onetimeauth_poly1305_init(crypto_onetimeauth_poly1305_state *state,
75
+ const unsigned char *key);
76
+
77
+ SODIUM_EXPORT
78
+ int crypto_onetimeauth_poly1305_update(crypto_onetimeauth_poly1305_state *state,
79
+ const unsigned char *in,
80
+ unsigned long long inlen);
81
+
82
+ SODIUM_EXPORT
83
+ int crypto_onetimeauth_poly1305_final(crypto_onetimeauth_poly1305_state *state,
84
+ unsigned char *out);
85
+
61
86
  #ifdef __cplusplus
62
87
  }
63
88
  #endif
@@ -0,0 +1,80 @@
1
+ #ifndef crypto_pwhash_scryptsalsa208sha256_H
2
+ #define crypto_pwhash_scryptsalsa208sha256_H
3
+
4
+ #include <stddef.h>
5
+
6
+ #include "export.h"
7
+
8
+ #ifdef __cplusplus
9
+ # if __GNUC__
10
+ # pragma GCC diagnostic ignored "-Wlong-long"
11
+ # endif
12
+ extern "C" {
13
+ #endif
14
+
15
+ #define crypto_pwhash_scryptsalsa208sha256_SALTBYTES 32U
16
+ SODIUM_EXPORT
17
+ size_t crypto_pwhash_scryptsalsa208sha256_saltbytes(void);
18
+
19
+ #define crypto_pwhash_scryptsalsa208sha256_STRBYTES 102U
20
+ SODIUM_EXPORT
21
+ size_t crypto_pwhash_scryptsalsa208sha256_strbytes(void);
22
+
23
+ #define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE 524288ULL
24
+ SODIUM_EXPORT
25
+ size_t crypto_pwhash_scryptsalsa208sha256_opslimit_interactive(void);
26
+
27
+ #define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE 16777216ULL
28
+ SODIUM_EXPORT
29
+ size_t crypto_pwhash_scryptsalsa208sha256_memlimit_interactive(void);
30
+
31
+ #define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE 33554432ULL
32
+ SODIUM_EXPORT
33
+ size_t crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive(void);
34
+
35
+ #define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE 1073741824ULL
36
+ SODIUM_EXPORT
37
+ size_t crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive(void);
38
+
39
+ SODIUM_EXPORT
40
+ int crypto_pwhash_scryptsalsa208sha256(unsigned char * const out,
41
+ unsigned long long outlen,
42
+ const char * const passwd,
43
+ unsigned long long passwdlen,
44
+ const unsigned char * const salt,
45
+ unsigned long long opslimit,
46
+ size_t memlimit);
47
+
48
+ SODIUM_EXPORT
49
+ int crypto_pwhash_scryptsalsa208sha256_str(char out[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
50
+ const char * const passwd,
51
+ unsigned long long passwdlen,
52
+ unsigned long long opslimit,
53
+ size_t memlimit);
54
+
55
+ SODIUM_EXPORT
56
+ int crypto_pwhash_scryptsalsa208sha256_str_verify(const char str[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
57
+ const char * const passwd,
58
+ unsigned long long passwdlen);
59
+
60
+ SODIUM_EXPORT
61
+ int crypto_pwhash_scryptsalsa208sha256_ll(const uint8_t * passwd, size_t passwdlen,
62
+ const uint8_t * salt, size_t saltlen,
63
+ uint64_t N, uint32_t r, uint32_t p,
64
+ uint8_t * buf, size_t buflen);
65
+
66
+ #ifdef __cplusplus
67
+ }
68
+ #endif
69
+
70
+ /* Backward compatibility with version 0.5.0 */
71
+
72
+ #define crypto_pwhash_scryptxsalsa208sha256_SALTBYTES crypto_pwhash_scryptsalsa208sha256_SALTBYTES
73
+ #define crypto_pwhash_scryptxsalsa208sha256_saltbytes crypto_pwhash_scryptsalsa208sha256_saltbytes
74
+ #define crypto_pwhash_scryptxsalsa208sha256_STRBYTES crypto_pwhash_scryptsalsa208sha256_STRBYTES
75
+ #define crypto_pwhash_scryptxsalsa208sha256_strbytes crypto_pwhash_scryptsalsa208sha256_strbytes
76
+ #define crypto_pwhash_scryptxsalsa208sha256 crypto_pwhash_scryptsalsa208sha256
77
+ #define crypto_pwhash_scryptxsalsa208sha256_str crypto_pwhash_scryptsalsa208sha256_str
78
+ #define crypto_pwhash_scryptxsalsa208sha256_str_verify crypto_pwhash_scryptsalsa208sha256_str_verify
79
+
80
+ #endif
@@ -9,11 +9,11 @@
9
9
  extern "C" {
10
10
  #endif
11
11
 
12
- #define crypto_scalarmult_curve25519_BYTES 32
12
+ #define crypto_scalarmult_curve25519_BYTES 32U
13
13
  SODIUM_EXPORT
14
14
  size_t crypto_scalarmult_curve25519_bytes(void);
15
15
 
16
- #define crypto_scalarmult_curve25519_SCALARBYTES 32
16
+ #define crypto_scalarmult_curve25519_SCALARBYTES 32U
17
17
  SODIUM_EXPORT
18
18
  size_t crypto_scalarmult_curve25519_scalarbytes(void);
19
19
 
@@ -57,6 +57,20 @@ int crypto_secretbox_open_easy(unsigned char *m, const unsigned char *c,
57
57
  unsigned long long clen, const unsigned char *n,
58
58
  const unsigned char *k);
59
59
 
60
+ SODIUM_EXPORT
61
+ int crypto_secretbox_detached(unsigned char *c, unsigned char *mac,
62
+ const unsigned char *m,
63
+ unsigned long long mlen,
64
+ const unsigned char *n,
65
+ const unsigned char *k);
66
+
67
+ SODIUM_EXPORT
68
+ int crypto_secretbox_open_detached(unsigned char *m,
69
+ const unsigned char *c,
70
+ const unsigned char *mac,
71
+ unsigned long long clen,
72
+ const unsigned char *n,
73
+ const unsigned char *k);
60
74
  #ifdef __cplusplus
61
75
  }
62
76
  #endif
@@ -1,6 +1,17 @@
1
1
  #ifndef crypto_sign_edwards25519sha512batch_H
2
2
  #define crypto_sign_edwards25519sha512batch_H
3
3
 
4
+ /*
5
+ * WARNING: This construction was a prototype, which should not be used
6
+ * any more in new projects.
7
+ *
8
+ * crypto_sign_edwards25519sha512batch is provided for applications
9
+ * initially built with NaCl, but as recommended by the author of this
10
+ * construction, new applications should use ed25519 instead.
11
+ *
12
+ * In Sodium, you should use the high-level crypto_sign_*() functions instead.
13
+ */
14
+
4
15
  #include <stddef.h>
5
16
  #include "export.h"
6
17
 
@@ -2,12 +2,17 @@
2
2
  #define crypto_stream_aes256estream_H
3
3
 
4
4
  /*
5
- * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
6
- * While it provides some protection against eavesdropping, it does NOT
7
- * provide any security against active attacks.
8
- * Furthermore, this implementation was not part of NaCl.
9
- * Unless you know what you're doing, what you are looking for is probably
10
- * the crypto_box functions.
5
+ * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
6
+ * While it provides some protection against eavesdropping, it does NOT
7
+ * provide any security against active attacks.
8
+ * Furthermore, this implementation was not part of NaCl.
9
+ *
10
+ * If you are looking for a stream cipher, you might consider
11
+ * crypto_stream_aes128ctr, crypto_stream_chacha20 or crypto_stream_(x)salsa20
12
+ * which are timing-attack resistant.
13
+ *
14
+ * But unless you know what you're doing, what you are looking for is probably
15
+ * the crypto_box or crypto_secretbox functions.
11
16
  */
12
17
 
13
18
  #include <stddef.h>
@@ -0,0 +1,49 @@
1
+ #ifndef crypto_stream_chacha20_H
2
+ #define crypto_stream_chacha20_H
3
+
4
+ /*
5
+ * WARNING: This is just a stream cipher. It is NOT authenticated encryption.
6
+ * While it provides some protection against eavesdropping, it does NOT
7
+ * provide any security against active attacks.
8
+ * Unless you know what you're doing, what you are looking for is probably
9
+ * the crypto_box functions.
10
+ */
11
+
12
+ #include <stddef.h>
13
+ #include <stdint.h>
14
+ #include "export.h"
15
+
16
+ #ifdef __cplusplus
17
+ # if __GNUC__
18
+ # pragma GCC diagnostic ignored "-Wlong-long"
19
+ # endif
20
+ extern "C" {
21
+ #endif
22
+
23
+ #define crypto_stream_chacha20_KEYBYTES 32U
24
+ SODIUM_EXPORT
25
+ size_t crypto_stream_chacha20_keybytes(void);
26
+
27
+ #define crypto_stream_chacha20_NONCEBYTES 8U
28
+ SODIUM_EXPORT
29
+ size_t crypto_stream_chacha20_noncebytes(void);
30
+
31
+ SODIUM_EXPORT
32
+ int crypto_stream_chacha20(unsigned char *c, unsigned long long clen,
33
+ const unsigned char *n, const unsigned char *k);
34
+
35
+ SODIUM_EXPORT
36
+ int crypto_stream_chacha20_xor(unsigned char *c, const unsigned char *m,
37
+ unsigned long long mlen, const unsigned char *n,
38
+ const unsigned char *k);
39
+
40
+ SODIUM_EXPORT
41
+ int crypto_stream_chacha20_xor_ic(unsigned char *c, const unsigned char *m,
42
+ unsigned long long mlen,
43
+ const unsigned char *n, uint64_t ic,
44
+ const unsigned char *k);
45
+ #ifdef __cplusplus
46
+ }
47
+ #endif
48
+
49
+ #endif