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
@@ -94,31 +94,35 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
94
94
  mkinstalldirs = $(install_sh) -d
95
95
  CONFIG_CLEAN_FILES =
96
96
  CONFIG_CLEAN_VPATH_FILES =
97
- am__EXEEXT_1 = auth$(EXEEXT) auth2$(EXEEXT) auth3$(EXEEXT) \
98
- auth5$(EXEEXT) auth6$(EXEEXT) auth7$(EXEEXT) box$(EXEEXT) \
99
- box2$(EXEEXT) box7$(EXEEXT) box8$(EXEEXT) box_easy$(EXEEXT) \
100
- box_easy2$(EXEEXT) core1$(EXEEXT) core2$(EXEEXT) \
101
- core3$(EXEEXT) core4$(EXEEXT) core5$(EXEEXT) core6$(EXEEXT) \
102
- generichash$(EXEEXT) generichash2$(EXEEXT) \
97
+ am__EXEEXT_1 = aead_chacha20poly1305$(EXEEXT) auth$(EXEEXT) \
98
+ auth2$(EXEEXT) auth3$(EXEEXT) auth5$(EXEEXT) auth6$(EXEEXT) \
99
+ auth7$(EXEEXT) box$(EXEEXT) box2$(EXEEXT) box7$(EXEEXT) \
100
+ box8$(EXEEXT) box_easy$(EXEEXT) box_easy2$(EXEEXT) \
101
+ box_seed$(EXEEXT) chacha20$(EXEEXT) core1$(EXEEXT) \
102
+ core2$(EXEEXT) core3$(EXEEXT) core4$(EXEEXT) core5$(EXEEXT) \
103
+ core6$(EXEEXT) generichash$(EXEEXT) generichash2$(EXEEXT) \
103
104
  generichash3$(EXEEXT) hash$(EXEEXT) hash3$(EXEEXT) \
104
105
  onetimeauth$(EXEEXT) onetimeauth2$(EXEEXT) \
105
- onetimeauth7$(EXEEXT) pwhash$(EXEEXT) randombytes$(EXEEXT) \
106
+ onetimeauth7$(EXEEXT) pwhash$(EXEEXT) \
107
+ pwhash_scrypt_ll$(EXEEXT) randombytes$(EXEEXT) \
106
108
  scalarmult$(EXEEXT) scalarmult2$(EXEEXT) scalarmult5$(EXEEXT) \
107
- scalarmult6$(EXEEXT) scalarmult7$(EXEEXT) scalarmult8$(EXEEXT) \
108
- secretbox$(EXEEXT) secretbox2$(EXEEXT) secretbox7$(EXEEXT) \
109
- secretbox8$(EXEEXT) secretbox_easy$(EXEEXT) \
110
- secretbox_easy2$(EXEEXT) shorthash$(EXEEXT) sign$(EXEEXT) \
111
- sodium_core$(EXEEXT) sodium_utils$(EXEEXT) \
112
- sodium_version$(EXEEXT) stream$(EXEEXT) stream2$(EXEEXT) \
113
- stream3$(EXEEXT) stream4$(EXEEXT) stream5$(EXEEXT) \
114
- stream6$(EXEEXT) verify1$(EXEEXT)
115
- auth_SOURCES = auth.c
116
- auth_OBJECTS = auth.$(OBJEXT)
117
- auth_DEPENDENCIES = $(TESTS_LDADD)
109
+ scalarmult6$(EXEEXT) secretbox$(EXEEXT) secretbox2$(EXEEXT) \
110
+ secretbox7$(EXEEXT) secretbox8$(EXEEXT) \
111
+ secretbox_easy$(EXEEXT) secretbox_easy2$(EXEEXT) \
112
+ shorthash$(EXEEXT) sign$(EXEEXT) sodium_core$(EXEEXT) \
113
+ sodium_utils$(EXEEXT) sodium_version$(EXEEXT) stream$(EXEEXT) \
114
+ stream2$(EXEEXT) stream3$(EXEEXT) stream4$(EXEEXT) \
115
+ stream5$(EXEEXT) stream6$(EXEEXT) verify1$(EXEEXT)
116
+ aead_chacha20poly1305_SOURCES = aead_chacha20poly1305.c
117
+ aead_chacha20poly1305_OBJECTS = aead_chacha20poly1305.$(OBJEXT)
118
+ aead_chacha20poly1305_DEPENDENCIES = $(TESTS_LDADD)
118
119
  AM_V_lt = $(am__v_lt_@AM_V@)
119
120
  am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
120
121
  am__v_lt_0 = --silent
121
122
  am__v_lt_1 =
123
+ auth_SOURCES = auth.c
124
+ auth_OBJECTS = auth.$(OBJEXT)
125
+ auth_DEPENDENCIES = $(TESTS_LDADD)
122
126
  auth2_SOURCES = auth2.c
123
127
  auth2_OBJECTS = auth2.$(OBJEXT)
124
128
  auth2_DEPENDENCIES = $(TESTS_LDADD)
@@ -152,6 +156,12 @@ box_easy_DEPENDENCIES = $(TESTS_LDADD)
152
156
  box_easy2_SOURCES = box_easy2.c
153
157
  box_easy2_OBJECTS = box_easy2.$(OBJEXT)
154
158
  box_easy2_DEPENDENCIES = $(TESTS_LDADD)
159
+ box_seed_SOURCES = box_seed.c
160
+ box_seed_OBJECTS = box_seed.$(OBJEXT)
161
+ box_seed_DEPENDENCIES = $(TESTS_LDADD)
162
+ chacha20_SOURCES = chacha20.c
163
+ chacha20_OBJECTS = chacha20.$(OBJEXT)
164
+ chacha20_DEPENDENCIES = $(TESTS_LDADD)
155
165
  core1_SOURCES = core1.c
156
166
  core1_OBJECTS = core1.$(OBJEXT)
157
167
  core1_DEPENDENCIES = $(TESTS_LDADD)
@@ -197,6 +207,9 @@ onetimeauth7_DEPENDENCIES = $(TESTS_LDADD)
197
207
  pwhash_SOURCES = pwhash.c
198
208
  pwhash_OBJECTS = pwhash.$(OBJEXT)
199
209
  pwhash_DEPENDENCIES = $(TESTS_LDADD)
210
+ pwhash_scrypt_ll_SOURCES = pwhash_scrypt_ll.c
211
+ pwhash_scrypt_ll_OBJECTS = pwhash_scrypt_ll.$(OBJEXT)
212
+ pwhash_scrypt_ll_DEPENDENCIES = $(TESTS_LDADD)
200
213
  randombytes_SOURCES = randombytes.c
201
214
  randombytes_OBJECTS = randombytes.$(OBJEXT)
202
215
  randombytes_DEPENDENCIES = $(TESTS_LDADD)
@@ -212,12 +225,6 @@ scalarmult5_DEPENDENCIES = $(TESTS_LDADD)
212
225
  scalarmult6_SOURCES = scalarmult6.c
213
226
  scalarmult6_OBJECTS = scalarmult6.$(OBJEXT)
214
227
  scalarmult6_DEPENDENCIES = $(TESTS_LDADD)
215
- scalarmult7_SOURCES = scalarmult7.c
216
- scalarmult7_OBJECTS = scalarmult7.$(OBJEXT)
217
- scalarmult7_DEPENDENCIES = $(TESTS_LDADD)
218
- scalarmult8_SOURCES = scalarmult8.c
219
- scalarmult8_OBJECTS = scalarmult8.$(OBJEXT)
220
- scalarmult8_DEPENDENCIES = $(TESTS_LDADD)
221
228
  secretbox_SOURCES = secretbox.c
222
229
  secretbox_OBJECTS = secretbox.$(OBJEXT)
223
230
  secretbox_DEPENDENCIES = $(TESTS_LDADD)
@@ -306,25 +313,27 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
306
313
  am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
307
314
  am__v_CCLD_0 = @echo " CCLD " $@;
308
315
  am__v_CCLD_1 =
309
- SOURCES = auth.c auth2.c auth3.c auth5.c auth6.c auth7.c box.c box2.c \
310
- box7.c box8.c box_easy.c box_easy2.c core1.c core2.c core3.c \
316
+ SOURCES = aead_chacha20poly1305.c auth.c auth2.c auth3.c auth5.c \
317
+ auth6.c auth7.c box.c box2.c box7.c box8.c box_easy.c \
318
+ box_easy2.c box_seed.c chacha20.c core1.c core2.c core3.c \
311
319
  core4.c core5.c core6.c generichash.c generichash2.c \
312
320
  generichash3.c hash.c hash3.c onetimeauth.c onetimeauth2.c \
313
- onetimeauth7.c pwhash.c randombytes.c scalarmult.c \
314
- scalarmult2.c scalarmult5.c scalarmult6.c scalarmult7.c \
315
- scalarmult8.c secretbox.c secretbox2.c secretbox7.c \
316
- secretbox8.c secretbox_easy.c secretbox_easy2.c shorthash.c \
317
- sign.c sodium_core.c sodium_utils.c sodium_version.c stream.c \
321
+ onetimeauth7.c pwhash.c pwhash_scrypt_ll.c randombytes.c \
322
+ scalarmult.c scalarmult2.c scalarmult5.c scalarmult6.c \
323
+ secretbox.c secretbox2.c secretbox7.c secretbox8.c \
324
+ secretbox_easy.c secretbox_easy2.c shorthash.c sign.c \
325
+ sodium_core.c sodium_utils.c sodium_version.c stream.c \
318
326
  stream2.c stream3.c stream4.c stream5.c stream6.c verify1.c
319
- DIST_SOURCES = auth.c auth2.c auth3.c auth5.c auth6.c auth7.c box.c \
320
- box2.c box7.c box8.c box_easy.c box_easy2.c core1.c core2.c \
321
- core3.c core4.c core5.c core6.c generichash.c generichash2.c \
327
+ DIST_SOURCES = aead_chacha20poly1305.c auth.c auth2.c auth3.c auth5.c \
328
+ auth6.c auth7.c box.c box2.c box7.c box8.c box_easy.c \
329
+ box_easy2.c box_seed.c chacha20.c core1.c core2.c core3.c \
330
+ core4.c core5.c core6.c generichash.c generichash2.c \
322
331
  generichash3.c hash.c hash3.c onetimeauth.c onetimeauth2.c \
323
- onetimeauth7.c pwhash.c randombytes.c scalarmult.c \
324
- scalarmult2.c scalarmult5.c scalarmult6.c scalarmult7.c \
325
- scalarmult8.c secretbox.c secretbox2.c secretbox7.c \
326
- secretbox8.c secretbox_easy.c secretbox_easy2.c shorthash.c \
327
- sign.c sodium_core.c sodium_utils.c sodium_version.c stream.c \
332
+ onetimeauth7.c pwhash.c pwhash_scrypt_ll.c randombytes.c \
333
+ scalarmult.c scalarmult2.c scalarmult5.c scalarmult6.c \
334
+ secretbox.c secretbox2.c secretbox7.c secretbox8.c \
335
+ secretbox_easy.c secretbox_easy2.c shorthash.c sign.c \
336
+ sodium_core.c sodium_utils.c sodium_version.c stream.c \
328
337
  stream2.c stream3.c stream4.c stream5.c stream6.c verify1.c
329
338
  am__can_run_installinfo = \
330
339
  case $$AM_UPDATE_INFO_DIR in \
@@ -693,6 +702,7 @@ top_srcdir = @top_srcdir@
693
702
  EXTRA_DIST = \
694
703
  cmptest.h \
695
704
  wintest.bat \
705
+ aead_chacha20poly1305.exp \
696
706
  auth.exp \
697
707
  auth2.exp \
698
708
  auth3.exp \
@@ -705,6 +715,8 @@ EXTRA_DIST = \
705
715
  box8.exp \
706
716
  box_easy.exp \
707
717
  box_easy2.exp \
718
+ box_seed.exp \
719
+ chacha20.exp \
708
720
  core1.exp \
709
721
  core2.exp \
710
722
  core3.exp \
@@ -721,12 +733,11 @@ EXTRA_DIST = \
721
733
  onetimeauth2.exp \
722
734
  onetimeauth7.exp \
723
735
  pwhash.exp \
736
+ pwhash_scrypt_ll.exp \
724
737
  scalarmult.exp \
725
738
  scalarmult2.exp \
726
739
  scalarmult5.exp \
727
740
  scalarmult6.exp \
728
- scalarmult7.exp \
729
- scalarmult8.exp \
730
741
  secretbox.exp \
731
742
  secretbox2.exp \
732
743
  secretbox7.exp \
@@ -747,6 +758,7 @@ EXTRA_DIST = \
747
758
  verify1.exp
748
759
 
749
760
  DISTCLEANFILES = \
761
+ aead_chacha20poly1305.res \
750
762
  auth.res \
751
763
  auth2.res \
752
764
  auth3.res \
@@ -759,6 +771,8 @@ DISTCLEANFILES = \
759
771
  box8.res \
760
772
  box_easy.res \
761
773
  box_easy2.res \
774
+ box_seed.res \
775
+ chacha20.res \
762
776
  core1.res \
763
777
  core2.res \
764
778
  core3.res \
@@ -775,12 +789,11 @@ DISTCLEANFILES = \
775
789
  onetimeauth2.res \
776
790
  onetimeauth7.res \
777
791
  pwhash.res \
792
+ pwhash_scrypt_ll.res \
778
793
  scalarmult.res \
779
794
  scalarmult2.res \
780
795
  scalarmult5.res \
781
796
  scalarmult6.res \
782
- scalarmult7.res \
783
- scalarmult8.res \
784
797
  secretbox.res \
785
798
  secretbox2.res \
786
799
  secretbox7.res \
@@ -809,6 +822,7 @@ AM_CPPFLAGS = \
809
822
  -I$(top_srcdir)/test/quirks
810
823
 
811
824
  TESTS_TARGETS = \
825
+ aead_chacha20poly1305 \
812
826
  auth \
813
827
  auth2 \
814
828
  auth3 \
@@ -821,6 +835,8 @@ TESTS_TARGETS = \
821
835
  box8 \
822
836
  box_easy \
823
837
  box_easy2 \
838
+ box_seed \
839
+ chacha20 \
824
840
  core1 \
825
841
  core2 \
826
842
  core3 \
@@ -836,13 +852,12 @@ TESTS_TARGETS = \
836
852
  onetimeauth2 \
837
853
  onetimeauth7 \
838
854
  pwhash \
855
+ pwhash_scrypt_ll \
839
856
  randombytes \
840
857
  scalarmult \
841
858
  scalarmult2 \
842
859
  scalarmult5 \
843
860
  scalarmult6 \
844
- scalarmult7 \
845
- scalarmult8 \
846
861
  secretbox \
847
862
  secretbox2 \
848
863
  secretbox7 \
@@ -865,6 +880,8 @@ TESTS_TARGETS = \
865
880
  TESTS_LDADD = \
866
881
  ${top_builddir}/src/libsodium/libsodium.la
867
882
 
883
+ aead_chacha20poly1305_SOURCE = cmptest.h aead_chacha20poly1305.c
884
+ aead_chacha20poly1305_LDADD = $(TESTS_LDADD)
868
885
  auth_SOURCE = cmptest.h auth.c
869
886
  auth_LDADD = $(TESTS_LDADD)
870
887
  auth2_SOURCE = cmptest.h auth2.c
@@ -889,6 +906,10 @@ box_easy_SOURCE = cmptest.h box_easy.c
889
906
  box_easy_LDADD = $(TESTS_LDADD)
890
907
  box_easy2_SOURCE = cmptest.h box_easy2.c
891
908
  box_easy2_LDADD = $(TESTS_LDADD)
909
+ box_seed_SOURCE = cmptest.h box_seed.c
910
+ box_seed_LDADD = $(TESTS_LDADD)
911
+ chacha20_SOURCE = cmptest.h chacha20.c
912
+ chacha20_LDADD = $(TESTS_LDADD)
892
913
  core1_SOURCE = cmptest.h core1.c
893
914
  core1_LDADD = $(TESTS_LDADD)
894
915
  core2_SOURCE = cmptest.h core2.c
@@ -919,6 +940,8 @@ onetimeauth7_SOURCE = cmptest.h onetimeauth7.c
919
940
  onetimeauth7_LDADD = $(TESTS_LDADD)
920
941
  pwhash_SOURCE = cmptest.h pwhash.c
921
942
  pwhash_LDADD = $(TESTS_LDADD)
943
+ pwhash_scrypt_ll_SOURCE = cmptest.h pwhash_scrypt_ll.c
944
+ pwhash_scrypt_ll_LDADD = $(TESTS_LDADD)
922
945
  randombytes_SOURCE = randombytes.c
923
946
  randombytes_LDADD = $(TESTS_LDADD)
924
947
  scalarmult_SOURCE = cmptest.h scalarmult.c
@@ -929,10 +952,6 @@ scalarmult5_SOURCE = cmptest.h scalarmult5.c
929
952
  scalarmult5_LDADD = $(TESTS_LDADD)
930
953
  scalarmult6_SOURCE = cmptest.h scalarmult6.c
931
954
  scalarmult6_LDADD = $(TESTS_LDADD)
932
- scalarmult7_SOURCE = cmptest.h scalarmult7.c
933
- scalarmult7_LDADD = $(TESTS_LDADD)
934
- scalarmult8_SOURCE = cmptest.h scalarmult8.c
935
- scalarmult8_LDADD = $(TESTS_LDADD)
936
955
  secretbox_SOURCE = cmptest.h secretbox.c
937
956
  secretbox_LDADD = $(TESTS_LDADD)
938
957
  secretbox2_SOURCE = cmptest.h secretbox2.c
@@ -1013,6 +1032,10 @@ clean-checkPROGRAMS:
1013
1032
  echo " rm -f" $$list; \
1014
1033
  rm -f $$list
1015
1034
 
1035
+ aead_chacha20poly1305$(EXEEXT): $(aead_chacha20poly1305_OBJECTS) $(aead_chacha20poly1305_DEPENDENCIES) $(EXTRA_aead_chacha20poly1305_DEPENDENCIES)
1036
+ @rm -f aead_chacha20poly1305$(EXEEXT)
1037
+ $(AM_V_CCLD)$(LINK) $(aead_chacha20poly1305_OBJECTS) $(aead_chacha20poly1305_LDADD) $(LIBS)
1038
+
1016
1039
  auth$(EXEEXT): $(auth_OBJECTS) $(auth_DEPENDENCIES) $(EXTRA_auth_DEPENDENCIES)
1017
1040
  @rm -f auth$(EXEEXT)
1018
1041
  $(AM_V_CCLD)$(LINK) $(auth_OBJECTS) $(auth_LDADD) $(LIBS)
@@ -1061,6 +1084,14 @@ box_easy2$(EXEEXT): $(box_easy2_OBJECTS) $(box_easy2_DEPENDENCIES) $(EXTRA_box_e
1061
1084
  @rm -f box_easy2$(EXEEXT)
1062
1085
  $(AM_V_CCLD)$(LINK) $(box_easy2_OBJECTS) $(box_easy2_LDADD) $(LIBS)
1063
1086
 
1087
+ box_seed$(EXEEXT): $(box_seed_OBJECTS) $(box_seed_DEPENDENCIES) $(EXTRA_box_seed_DEPENDENCIES)
1088
+ @rm -f box_seed$(EXEEXT)
1089
+ $(AM_V_CCLD)$(LINK) $(box_seed_OBJECTS) $(box_seed_LDADD) $(LIBS)
1090
+
1091
+ chacha20$(EXEEXT): $(chacha20_OBJECTS) $(chacha20_DEPENDENCIES) $(EXTRA_chacha20_DEPENDENCIES)
1092
+ @rm -f chacha20$(EXEEXT)
1093
+ $(AM_V_CCLD)$(LINK) $(chacha20_OBJECTS) $(chacha20_LDADD) $(LIBS)
1094
+
1064
1095
  core1$(EXEEXT): $(core1_OBJECTS) $(core1_DEPENDENCIES) $(EXTRA_core1_DEPENDENCIES)
1065
1096
  @rm -f core1$(EXEEXT)
1066
1097
  $(AM_V_CCLD)$(LINK) $(core1_OBJECTS) $(core1_LDADD) $(LIBS)
@@ -1121,6 +1152,10 @@ pwhash$(EXEEXT): $(pwhash_OBJECTS) $(pwhash_DEPENDENCIES) $(EXTRA_pwhash_DEPENDE
1121
1152
  @rm -f pwhash$(EXEEXT)
1122
1153
  $(AM_V_CCLD)$(LINK) $(pwhash_OBJECTS) $(pwhash_LDADD) $(LIBS)
1123
1154
 
1155
+ pwhash_scrypt_ll$(EXEEXT): $(pwhash_scrypt_ll_OBJECTS) $(pwhash_scrypt_ll_DEPENDENCIES) $(EXTRA_pwhash_scrypt_ll_DEPENDENCIES)
1156
+ @rm -f pwhash_scrypt_ll$(EXEEXT)
1157
+ $(AM_V_CCLD)$(LINK) $(pwhash_scrypt_ll_OBJECTS) $(pwhash_scrypt_ll_LDADD) $(LIBS)
1158
+
1124
1159
  randombytes$(EXEEXT): $(randombytes_OBJECTS) $(randombytes_DEPENDENCIES) $(EXTRA_randombytes_DEPENDENCIES)
1125
1160
  @rm -f randombytes$(EXEEXT)
1126
1161
  $(AM_V_CCLD)$(LINK) $(randombytes_OBJECTS) $(randombytes_LDADD) $(LIBS)
@@ -1141,14 +1176,6 @@ scalarmult6$(EXEEXT): $(scalarmult6_OBJECTS) $(scalarmult6_DEPENDENCIES) $(EXTRA
1141
1176
  @rm -f scalarmult6$(EXEEXT)
1142
1177
  $(AM_V_CCLD)$(LINK) $(scalarmult6_OBJECTS) $(scalarmult6_LDADD) $(LIBS)
1143
1178
 
1144
- scalarmult7$(EXEEXT): $(scalarmult7_OBJECTS) $(scalarmult7_DEPENDENCIES) $(EXTRA_scalarmult7_DEPENDENCIES)
1145
- @rm -f scalarmult7$(EXEEXT)
1146
- $(AM_V_CCLD)$(LINK) $(scalarmult7_OBJECTS) $(scalarmult7_LDADD) $(LIBS)
1147
-
1148
- scalarmult8$(EXEEXT): $(scalarmult8_OBJECTS) $(scalarmult8_DEPENDENCIES) $(EXTRA_scalarmult8_DEPENDENCIES)
1149
- @rm -f scalarmult8$(EXEEXT)
1150
- $(AM_V_CCLD)$(LINK) $(scalarmult8_OBJECTS) $(scalarmult8_LDADD) $(LIBS)
1151
-
1152
1179
  secretbox$(EXEEXT): $(secretbox_OBJECTS) $(secretbox_DEPENDENCIES) $(EXTRA_secretbox_DEPENDENCIES)
1153
1180
  @rm -f secretbox$(EXEEXT)
1154
1181
  $(AM_V_CCLD)$(LINK) $(secretbox_OBJECTS) $(secretbox_LDADD) $(LIBS)
@@ -1227,6 +1254,7 @@ mostlyclean-compile:
1227
1254
  distclean-compile:
1228
1255
  -rm -f *.tab.c
1229
1256
 
1257
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aead_chacha20poly1305.Po@am__quote@
1230
1258
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth.Po@am__quote@
1231
1259
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth2.Po@am__quote@
1232
1260
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth3.Po@am__quote@
@@ -1239,6 +1267,8 @@ distclean-compile:
1239
1267
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box8.Po@am__quote@
1240
1268
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_easy.Po@am__quote@
1241
1269
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_easy2.Po@am__quote@
1270
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_seed.Po@am__quote@
1271
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chacha20.Po@am__quote@
1242
1272
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/core1.Po@am__quote@
1243
1273
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/core2.Po@am__quote@
1244
1274
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/core3.Po@am__quote@
@@ -1254,13 +1284,12 @@ distclean-compile:
1254
1284
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/onetimeauth2.Po@am__quote@
1255
1285
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/onetimeauth7.Po@am__quote@
1256
1286
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pwhash.Po@am__quote@
1287
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pwhash_scrypt_ll.Po@am__quote@
1257
1288
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/randombytes.Po@am__quote@
1258
1289
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scalarmult.Po@am__quote@
1259
1290
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scalarmult2.Po@am__quote@
1260
1291
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scalarmult5.Po@am__quote@
1261
1292
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scalarmult6.Po@am__quote@
1262
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scalarmult7.Po@am__quote@
1263
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scalarmult8.Po@am__quote@
1264
1293
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/secretbox.Po@am__quote@
1265
1294
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/secretbox2.Po@am__quote@
1266
1295
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/secretbox7.Po@am__quote@
@@ -1503,6 +1532,13 @@ recheck: all $(check_PROGRAMS)
1503
1532
  am__force_recheck=am--force-recheck \
1504
1533
  TEST_LOGS="$$log_list"; \
1505
1534
  exit $$?
1535
+ aead_chacha20poly1305.log: aead_chacha20poly1305$(EXEEXT)
1536
+ @p='aead_chacha20poly1305$(EXEEXT)'; \
1537
+ b='aead_chacha20poly1305'; \
1538
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
1539
+ --log-file $$b.log --trs-file $$b.trs \
1540
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
1541
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
1506
1542
  auth.log: auth$(EXEEXT)
1507
1543
  @p='auth$(EXEEXT)'; \
1508
1544
  b='auth'; \
@@ -1587,6 +1623,20 @@ box_easy2.log: box_easy2$(EXEEXT)
1587
1623
  --log-file $$b.log --trs-file $$b.trs \
1588
1624
  $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
1589
1625
  "$$tst" $(AM_TESTS_FD_REDIRECT)
1626
+ box_seed.log: box_seed$(EXEEXT)
1627
+ @p='box_seed$(EXEEXT)'; \
1628
+ b='box_seed'; \
1629
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
1630
+ --log-file $$b.log --trs-file $$b.trs \
1631
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
1632
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
1633
+ chacha20.log: chacha20$(EXEEXT)
1634
+ @p='chacha20$(EXEEXT)'; \
1635
+ b='chacha20'; \
1636
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
1637
+ --log-file $$b.log --trs-file $$b.trs \
1638
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
1639
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
1590
1640
  core1.log: core1$(EXEEXT)
1591
1641
  @p='core1$(EXEEXT)'; \
1592
1642
  b='core1'; \
@@ -1692,6 +1742,13 @@ pwhash.log: pwhash$(EXEEXT)
1692
1742
  --log-file $$b.log --trs-file $$b.trs \
1693
1743
  $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
1694
1744
  "$$tst" $(AM_TESTS_FD_REDIRECT)
1745
+ pwhash_scrypt_ll.log: pwhash_scrypt_ll$(EXEEXT)
1746
+ @p='pwhash_scrypt_ll$(EXEEXT)'; \
1747
+ b='pwhash_scrypt_ll'; \
1748
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
1749
+ --log-file $$b.log --trs-file $$b.trs \
1750
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
1751
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
1695
1752
  randombytes.log: randombytes$(EXEEXT)
1696
1753
  @p='randombytes$(EXEEXT)'; \
1697
1754
  b='randombytes'; \
@@ -1727,20 +1784,6 @@ scalarmult6.log: scalarmult6$(EXEEXT)
1727
1784
  --log-file $$b.log --trs-file $$b.trs \
1728
1785
  $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
1729
1786
  "$$tst" $(AM_TESTS_FD_REDIRECT)
1730
- scalarmult7.log: scalarmult7$(EXEEXT)
1731
- @p='scalarmult7$(EXEEXT)'; \
1732
- b='scalarmult7'; \
1733
- $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
1734
- --log-file $$b.log --trs-file $$b.trs \
1735
- $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
1736
- "$$tst" $(AM_TESTS_FD_REDIRECT)
1737
- scalarmult8.log: scalarmult8$(EXEEXT)
1738
- @p='scalarmult8$(EXEEXT)'; \
1739
- b='scalarmult8'; \
1740
- $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
1741
- --log-file $$b.log --trs-file $$b.trs \
1742
- $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
1743
- "$$tst" $(AM_TESTS_FD_REDIRECT)
1744
1787
  secretbox.log: secretbox$(EXEEXT)
1745
1788
  @p='secretbox$(EXEEXT)'; \
1746
1789
  b='secretbox'; \
@@ -0,0 +1,97 @@
1
+ #include <stdio.h>
2
+ #include <string.h>
3
+
4
+ #define TEST_NAME "aead_chacha20poly1305"
5
+ #include "cmptest.h"
6
+
7
+ static unsigned char firstkey[crypto_aead_chacha20poly1305_KEYBYTES] = {
8
+ 0x42, 0x90, 0xbc, 0xb1, 0x54, 0x17, 0x35, 0x31,
9
+ 0xf3, 0x14, 0xaf, 0x57, 0xf3, 0xbe, 0x3b, 0x50,
10
+ 0x06, 0xda, 0x37, 0x1e, 0xce, 0x27, 0x2a, 0xfa,
11
+ 0x1b, 0x5d, 0xbd, 0xd1, 0x10, 0x0a, 0x10, 0x07
12
+ };
13
+
14
+ static unsigned char m[10U] = {
15
+ 0x86, 0xd0, 0x99, 0x74, 0x84, 0x0b, 0xde, 0xd2, 0xa5, 0xca
16
+ };
17
+
18
+ static unsigned char nonce[crypto_aead_chacha20poly1305_NPUBBYTES] = {
19
+ 0xcd, 0x7c, 0xf6, 0x7b, 0xe3, 0x9c, 0x79, 0x4a
20
+ };
21
+
22
+ static unsigned char ad[10U] = {
23
+ 0x87, 0xe2, 0x29, 0xd4, 0x50, 0x08, 0x45, 0xa0, 0x79, 0xc0
24
+ };
25
+
26
+ static unsigned char c[10U + crypto_aead_chacha20poly1305_ABYTES];
27
+
28
+ int main(void)
29
+ {
30
+ unsigned char m2[10U];
31
+ unsigned long long clen;
32
+ unsigned long long m2len;
33
+ size_t i;
34
+
35
+ crypto_aead_chacha20poly1305_encrypt(c, &clen, m, sizeof m, ad, sizeof ad,
36
+ NULL, nonce, firstkey);
37
+ if (clen != sizeof m + crypto_aead_chacha20poly1305_abytes()) {
38
+ printf("clen is not properly set\n");
39
+ }
40
+ for (i = 0U; i < sizeof c; ++i) {
41
+ printf(",0x%02x", (unsigned int) c[i]);
42
+ if (i % 8 == 7) {
43
+ printf("\n");
44
+ }
45
+ }
46
+ printf("\n");
47
+
48
+ if (crypto_aead_chacha20poly1305_decrypt(m2, &m2len, NULL, c, sizeof c,
49
+ ad, sizeof ad,
50
+ nonce, firstkey) != 0) {
51
+ printf("crypto_aead_chacha20poly1305_decrypt() failed\n");
52
+ }
53
+ if (m2len != sizeof c - crypto_aead_chacha20poly1305_abytes()) {
54
+ printf("m2len is not properly set\n");
55
+ }
56
+ if (memcmp(m, m2, sizeof m) != 0) {
57
+ printf("m != m2\n");
58
+ }
59
+
60
+ for (i = 0U; i < sizeof c; i++) {
61
+ c[i] ^= (i + 1U);
62
+ if (crypto_aead_chacha20poly1305_decrypt(m2, NULL, NULL, c, sizeof c,
63
+ ad, sizeof ad,
64
+ nonce, firstkey) == 0 ||
65
+ memcmp(m, m2, sizeof m) == 0) {
66
+ printf("message can be forged\n");
67
+ }
68
+ c[i] ^= (i + 1U);
69
+ }
70
+
71
+ crypto_aead_chacha20poly1305_encrypt(c, &clen, m, sizeof m, NULL, 0U,
72
+ NULL, nonce, firstkey);
73
+ if (clen != sizeof m + crypto_aead_chacha20poly1305_abytes()) {
74
+ printf("clen is not properly set (adlen=0)\n");
75
+ }
76
+ for (i = 0U; i < sizeof c; ++i) {
77
+ printf(",0x%02x", (unsigned int) c[i]);
78
+ if (i % 8 == 7) {
79
+ printf("\n");
80
+ }
81
+ }
82
+ printf("\n");
83
+
84
+ if (crypto_aead_chacha20poly1305_decrypt(m2, &m2len, NULL, c, sizeof c,
85
+ NULL, 0U,
86
+ nonce, firstkey) != 0) {
87
+ printf("crypto_aead_chacha20poly1305_decrypt() failed (adlen=0)\n");
88
+ }
89
+ if (m2len != sizeof c - crypto_aead_chacha20poly1305_abytes()) {
90
+ printf("m2len is not properly set (adlen=0)\n");
91
+ }
92
+ if (memcmp(m, m2, sizeof m) != 0) {
93
+ printf("m != m2 (adlen=0)\n");
94
+ }
95
+
96
+ return 0;
97
+ }