rbnacl-libsodium 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) 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 +3 -0
  5. data/vendor/libsodium/ChangeLog +21 -0
  6. data/vendor/libsodium/Makefile.in +9 -0
  7. data/vendor/libsodium/THANKS +3 -0
  8. data/vendor/libsodium/aclocal.m4 +1 -0
  9. data/vendor/libsodium/autom4te.cache/output.1 +919 -85
  10. data/vendor/libsodium/autom4te.cache/output.5 +18351 -0
  11. data/vendor/libsodium/autom4te.cache/requests +960 -725
  12. data/vendor/libsodium/autom4te.cache/traces.1 +289 -247
  13. data/vendor/libsodium/autom4te.cache/traces.5 +3032 -0
  14. data/vendor/libsodium/build-aux/ltmain.sh +70 -11
  15. data/vendor/libsodium/builds/msvc/properties/ARM.props +20 -0
  16. data/vendor/libsodium/builds/msvc/properties/ReleaseDEXE.props +1 -1
  17. data/vendor/libsodium/builds/msvc/version.h +2 -2
  18. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj +3 -1
  19. data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters +13 -1
  20. data/vendor/libsodium/builds/msvc/vs2010/test/test.vcxproj +244 -241
  21. data/vendor/libsodium/builds/msvc/vs2010/test/test.vcxproj.filters +192 -189
  22. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj +2 -0
  23. data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters +13 -1
  24. data/vendor/libsodium/builds/msvc/vs2012/test/test.vcxproj +244 -241
  25. data/vendor/libsodium/builds/msvc/vs2012/test/test.vcxproj.filters +192 -189
  26. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj +3 -1
  27. data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters +13 -1
  28. data/vendor/libsodium/builds/msvc/vs2013/test/test.vcxproj +244 -241
  29. data/vendor/libsodium/builds/msvc/vs2013/test/test.vcxproj.filters +192 -189
  30. data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.vcxproj +3 -1
  31. data/vendor/libsodium/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters +13 -1
  32. data/vendor/libsodium/builds/msvc/vs2015/test/test.vcxproj +244 -241
  33. data/vendor/libsodium/builds/msvc/vs2015/test/test.vcxproj.filters +192 -189
  34. data/vendor/libsodium/configure +918 -84
  35. data/vendor/libsodium/configure.ac +89 -15
  36. data/vendor/libsodium/dist-build/Makefile.am +6 -2
  37. data/vendor/libsodium/dist-build/Makefile.in +15 -2
  38. data/vendor/libsodium/dist-build/android-armv8-a.sh +4 -0
  39. data/vendor/libsodium/dist-build/android-build.sh +9 -9
  40. data/vendor/libsodium/dist-build/android-mips64.sh +4 -0
  41. data/vendor/libsodium/dist-build/android-x86-64.sh +4 -0
  42. data/vendor/libsodium/dist-build/emscripten.sh +3 -3
  43. data/vendor/libsodium/dist-build/ios.sh +5 -5
  44. data/vendor/libsodium/dist-build/nativeclient.sh +28 -0
  45. data/vendor/libsodium/examples/Makefile +21 -0
  46. data/vendor/libsodium/examples/auth.c +68 -0
  47. data/vendor/libsodium/examples/box.c +133 -0
  48. data/vendor/libsodium/examples/box_detached.c +132 -0
  49. data/vendor/libsodium/examples/generichash.c +80 -0
  50. data/vendor/libsodium/examples/generichash_stream.c +58 -0
  51. data/vendor/libsodium/examples/shorthash.c +58 -0
  52. data/vendor/libsodium/examples/sign.c +78 -0
  53. data/vendor/libsodium/examples/utils.h +106 -0
  54. data/vendor/libsodium/libsodium-uninstalled.pc.in +1 -1
  55. data/vendor/libsodium/libsodium.vcxproj +2 -0
  56. data/vendor/libsodium/libsodium.vcxproj.filters +6 -0
  57. data/vendor/libsodium/m4/ax_check_compile_flag.m4 +2 -2
  58. data/vendor/libsodium/m4/ax_check_define.m4 +92 -0
  59. data/vendor/libsodium/m4/ax_check_link_flag.m4 +3 -2
  60. data/vendor/libsodium/m4/libtool.m4 +111 -60
  61. data/vendor/libsodium/m4/ltoptions.m4 +1 -1
  62. data/vendor/libsodium/m4/ltsugar.m4 +1 -1
  63. data/vendor/libsodium/m4/ltversion.m4 +6 -6
  64. data/vendor/libsodium/m4/lt~obsolete.m4 +1 -1
  65. data/vendor/libsodium/msvc-scripts/Makefile.in +9 -0
  66. data/vendor/libsodium/msvc-scripts/process.bat +2 -2
  67. data/vendor/libsodium/src/Makefile.in +9 -0
  68. data/vendor/libsodium/src/libsodium/Makefile.am +27 -3
  69. data/vendor/libsodium/src/libsodium/Makefile.in +170 -63
  70. data/vendor/libsodium/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c +852 -0
  71. data/vendor/libsodium/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c +137 -17
  72. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/cp/hmac_hmacsha256.c +1 -0
  73. data/vendor/libsodium/src/libsodium/crypto_auth/hmacsha512/cp/hmac_hmacsha512.c +1 -0
  74. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c +10 -6
  75. data/vendor/libsodium/src/libsodium/crypto_generichash/crypto_generichash.c +1 -1
  76. data/vendor/libsodium/src/libsodium/crypto_hash/sha256/cp/hash_sha256.c +29 -23
  77. data/vendor/libsodium/src/libsodium/crypto_hash/sha512/cp/hash_sha512.c +9 -10
  78. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c +4 -2
  79. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h +1 -0
  80. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c +4 -0
  81. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c +3 -0
  82. data/vendor/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c +2 -1
  83. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_frombytes_curve25519_ref10.c +10 -10
  84. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/api.h +10 -0
  85. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.c +51 -0
  86. data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/stream_chacha20_api.c +29 -0
  87. data/vendor/libsodium/src/libsodium/include/Makefile.am +6 -0
  88. data/vendor/libsodium/src/libsodium/include/Makefile.in +67 -40
  89. data/vendor/libsodium/src/libsodium/include/sodium.h +4 -0
  90. data/vendor/libsodium/src/libsodium/include/sodium/crypto_aead_aes256gcm.h +88 -0
  91. data/vendor/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h +28 -2
  92. data/vendor/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h +0 -6
  93. data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h +1 -1
  94. data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h +23 -0
  95. data/vendor/libsodium/src/libsodium/include/sodium/export.h +8 -0
  96. data/vendor/libsodium/src/libsodium/include/sodium/randombytes_nativeclient.h +37 -0
  97. data/vendor/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h +3 -2
  98. data/vendor/libsodium/src/libsodium/include/sodium/runtime.h +6 -0
  99. data/vendor/libsodium/src/libsodium/include/sodium/utils.h +15 -1
  100. data/vendor/libsodium/src/libsodium/randombytes/nativeclient/randombytes_nativeclient.c +49 -0
  101. data/vendor/libsodium/src/libsodium/randombytes/randombytes.c +11 -1
  102. data/vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +71 -45
  103. data/vendor/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +12 -2
  104. data/vendor/libsodium/src/libsodium/sodium/runtime.c +26 -3
  105. data/vendor/libsodium/src/libsodium/sodium/utils.c +86 -13
  106. data/vendor/libsodium/test/Makefile.in +9 -0
  107. data/vendor/libsodium/test/default/Makefile.am +130 -0
  108. data/vendor/libsodium/test/default/Makefile.in +197 -50
  109. data/vendor/libsodium/test/default/aead_aes256gcm.c +3197 -0
  110. data/vendor/libsodium/test/default/aead_aes256gcm.exp +1 -0
  111. data/vendor/libsodium/test/default/aead_chacha20poly1305.c +150 -17
  112. data/vendor/libsodium/test/default/aead_chacha20poly1305.exp +51 -0
  113. data/vendor/libsodium/test/default/chacha20.c +80 -5
  114. data/vendor/libsodium/test/default/chacha20.exp +11 -0
  115. data/vendor/libsodium/test/default/generichash.c +1332 -1
  116. data/vendor/libsodium/test/default/generichash.exp +1 -1
  117. data/vendor/libsodium/test/default/generichash2.c +3 -2
  118. data/vendor/libsodium/test/default/generichash3.c +2 -1
  119. data/vendor/libsodium/test/default/nacl-test-wrapper.sh +26 -0
  120. data/vendor/libsodium/test/default/randombytes.c +4 -0
  121. data/vendor/libsodium/test/default/scalarmult.c +33 -14
  122. data/vendor/libsodium/test/default/scalarmult.exp +4 -4
  123. data/vendor/libsodium/test/default/secretbox.c +9 -0
  124. data/vendor/libsodium/test/default/secretbox.exp +19 -0
  125. data/vendor/libsodium/test/default/secretbox_easy.c +40 -4
  126. data/vendor/libsodium/test/default/secretbox_easy.exp +58 -1
  127. data/vendor/libsodium/test/default/sodium_core.c +2 -0
  128. data/vendor/libsodium/test/default/sodium_utils.c +46 -7
  129. data/vendor/libsodium/test/default/sodium_utils.exp +5 -0
  130. data/vendor/libsodium/test/default/stream.c +1 -0
  131. metadata +28 -3
@@ -1,5 +1,5 @@
1
1
  AC_PREREQ([2.65])
2
- AC_INIT([libsodium],[1.0.3],
2
+ AC_INIT([libsodium],[1.0.4],
3
3
  [https://github.com/jedisct1/libsodium/issues],
4
4
  [libsodium],
5
5
  [https://github.com/jedisct1/libsodium])
@@ -17,9 +17,9 @@ ISODATE=`date +%Y-%m-%d`
17
17
  AC_SUBST(ISODATE)
18
18
 
19
19
  SODIUM_LIBRARY_VERSION_MAJOR=7
20
- SODIUM_LIBRARY_VERSION_MINOR=5
20
+ SODIUM_LIBRARY_VERSION_MINOR=6
21
21
  DLL_VERSION=6
22
- SODIUM_LIBRARY_VERSION=15:0:2
22
+ SODIUM_LIBRARY_VERSION=16:0:3
23
23
  # | | |
24
24
  # +------+ | +---+
25
25
  # | | |
@@ -143,8 +143,12 @@ AC_PROG_CC_C99
143
143
  AM_PROG_AS
144
144
  AC_USE_SYSTEM_EXTENSIONS
145
145
 
146
- AX_CHECK_COMPILE_FLAG([-D_FORTIFY_SOURCE=2],
147
- [CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"])
146
+ AC_CHECK_DEFINE([__native_client__], [NATIVECLIENT="yes"], [])
147
+
148
+ AC_CHECK_DEFINE([_FORTIFY_SOURCE], [], [
149
+ AX_CHECK_COMPILE_FLAG([-D_FORTIFY_SOURCE=2],
150
+ [CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"])
151
+ ])
148
152
 
149
153
  AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],
150
154
  [CFLAGS="$CFLAGS -fvisibility=hidden"])
@@ -177,7 +181,7 @@ LIBTOOL_EXTRA_FLAGS="$LIBTOOL_EXTRA_FLAGS -version-info $SODIUM_LIBRARY_VERSION"
177
181
  AC_ARG_ENABLE(soname-versions,
178
182
  [AC_HELP_STRING([--enable-soname-versions], [enable soname versions (must be disabled for Android) (default: enabled)])],
179
183
  [
180
- AS_IF([test "x$enableval" = "xno"], [
184
+ AS_IF([test "x$enableval" = "xno"], [
181
185
  LIBTOOL_EXTRA_FLAGS="$LIBTOOL_OLD_FLAGS -avoid-version"
182
186
  ])
183
187
  ]
@@ -259,23 +263,36 @@ dnl Checks for headers
259
263
  AS_IF([test "x$EMSCRIPTEN" = "x"],[
260
264
 
261
265
  AC_MSG_CHECKING(for MMX instructions set)
266
+ oldcflags="$CFLAGS"
267
+ AX_CHECK_COMPILE_FLAG([-mmmx], [CFLAGS="$CFLAGS -mmmx"])
262
268
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
263
269
  #pragma GCC target("mmx")
264
270
  #include <mmintrin.h>
265
271
  ]], [[ __m64 x = _mm_setzero_si64(); ]])],
266
272
  [AC_MSG_RESULT(yes)
267
- AC_DEFINE([HAVE_MMINTRIN_H], [1], [mmx is available])],
273
+ AC_DEFINE([HAVE_MMINTRIN_H], [1], [mmx is available])
274
+ AX_CHECK_COMPILE_FLAG([-mmmx], [CFLAGS_MMX="-mmmx"])],
268
275
  [AC_MSG_RESULT(no)])
276
+ CFLAGS="$oldcflags"
269
277
 
270
278
  AC_MSG_CHECKING(for SSE2 instructions set)
279
+ oldcflags="$CFLAGS"
280
+ AX_CHECK_COMPILE_FLAG([-msse2], [CFLAGS="$CFLAGS -msse2"])
271
281
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
272
282
  #pragma GCC target("sse2")
283
+ #ifndef __SSE2__
284
+ # define __SSE2__
285
+ #endif
273
286
  #include <emmintrin.h>
274
287
  ]], [[ __m128d x = _mm_setzero_pd(); ]])],
275
288
  [AC_MSG_RESULT(yes)
276
- AC_DEFINE([HAVE_EMMINTRIN_H], [1], [sse2 is available])],
289
+ AC_DEFINE([HAVE_EMMINTRIN_H], [1], [sse2 is available])
290
+ AX_CHECK_COMPILE_FLAG([-msse2], [CFLAGS_SSE2="-msse2"])],
277
291
  [AC_MSG_RESULT(no)])
292
+ CFLAGS="$oldcflags"
278
293
 
294
+ oldcflags="$CFLAGS"
295
+ AX_CHECK_COMPILE_FLAG([-msse3], [CFLAGS="$CFLAGS -msse3"])
279
296
  AC_MSG_CHECKING(for SSE3 instructions set)
280
297
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
281
298
  #pragma GCC target("sse3")
@@ -283,19 +300,65 @@ AS_IF([test "x$EMSCRIPTEN" = "x"],[
283
300
  ]], [[ __m128 x = _mm_addsub_ps(_mm_cvtpd_ps(_mm_setzero_pd()),
284
301
  _mm_cvtpd_ps(_mm_setzero_pd())); ]])],
285
302
  [AC_MSG_RESULT(yes)
286
- AC_DEFINE([HAVE_PMMINTRIN_H], [1], [sse3 is available])],
303
+ AC_DEFINE([HAVE_PMMINTRIN_H], [1], [sse3 is available])
304
+ AX_CHECK_COMPILE_FLAG([-msse3], [CFLAGS_SSE3="-msse3"])],
287
305
  [AC_MSG_RESULT(no)])
306
+ CFLAGS="$oldcflags"
288
307
 
308
+ oldcflags="$CFLAGS"
309
+ AX_CHECK_COMPILE_FLAG([-mssse3], [CFLAGS="$CFLAGS -mssse3"])
289
310
  AC_MSG_CHECKING(for SSSE3 instructions set)
290
311
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
291
312
  #pragma GCC target("ssse3")
292
313
  #include <tmmintrin.h>
293
314
  ]], [[ __m64 x = _mm_abs_pi32(_m_from_int(0)); ]])],
294
315
  [AC_MSG_RESULT(yes)
295
- AC_DEFINE([HAVE_TMMINTRIN_H], [1], [ssse3 is available])],
316
+ AC_DEFINE([HAVE_TMMINTRIN_H], [1], [ssse3 is available])
317
+ AX_CHECK_COMPILE_FLAG([-mssse3], [CFLAGS_SSSE3="-mssse3"])],
296
318
  [AC_MSG_RESULT(no)])
319
+ CFLAGS="$oldcflags"
320
+
321
+ oldcflags="$CFLAGS"
322
+ AX_CHECK_COMPILE_FLAG([-msse4.1], [CFLAGS="$CFLAGS -msse4.1"])
323
+ AC_MSG_CHECKING(for SSE4.1 instructions set)
324
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
325
+ #pragma GCC target("sse4.1")
326
+ #include <smmintrin.h>
327
+ ]], [[ __m128i x = _mm_minpos_epu16(_mm_setzero_si128()); ]])],
328
+ [AC_MSG_RESULT(yes)
329
+ AC_DEFINE([HAVE_SMMINTRIN_H], [1], [sse4.1 is available])
330
+ AX_CHECK_COMPILE_FLAG([-msse4.1], [CFLAGS_SSE4_1="-msse4.1"])],
331
+ [AC_MSG_RESULT(no)])
332
+ CFLAGS="$oldcflags"
333
+
334
+ oldcflags="$CFLAGS"
335
+ AX_CHECK_COMPILE_FLAG([-maes], [CFLAGS="$CFLAGS -maes"])
336
+ AX_CHECK_COMPILE_FLAG([-mpclmul], [CFLAGS="$CFLAGS -mpclmul"])
337
+ AC_MSG_CHECKING(for AESNI instructions set and PCLMULQDQ)
338
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
339
+ #pragma GCC target("aes")
340
+ #pragma GCC target("pclmul")
341
+ #include <wmmintrin.h>
342
+ ]], [[ __m128i x = _mm_aesimc_si128(_mm_setzero_si128());
343
+ __m128i y = _mm_clmulepi64_si128(_mm_setzero_si128(), _mm_setzero_si128(), 0);]])],
344
+ [AC_MSG_RESULT(yes)
345
+ AC_DEFINE([HAVE_WMMINTRIN_H], [1], [aesni is available])
346
+ AX_CHECK_COMPILE_FLAG([-maes], [CFLAGS_AESNI="-maes"])
347
+ AX_CHECK_COMPILE_FLAG([-mpclmul], [CFLAGS_PCLMUL="-mpclmul"])
348
+ ],
349
+ [AC_MSG_RESULT(no)])
350
+ CFLAGS="$oldcflags"
351
+
297
352
  ])
298
353
 
354
+ AC_SUBST(CFLAGS_MMX)
355
+ AC_SUBST(CFLAGS_SSE2)
356
+ AC_SUBST(CFLAGS_SSE3)
357
+ AC_SUBST(CFLAGS_SSSE3)
358
+ AC_SUBST(CFLAGS_SSE4_1)
359
+ AC_SUBST(CFLAGS_AESNI)
360
+ AC_SUBST(CFLAGS_PCLMUL)
361
+
299
362
  AC_CHECK_HEADERS([sys/mman.h])
300
363
 
301
364
  dnl Checks for typedefs, structures, and compiler characteristics.
@@ -402,13 +465,22 @@ void f(void *x) { __dummy(x); }
402
465
  AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], [weak symbols are supported])],
403
466
  [AC_MSG_RESULT(no)])
404
467
 
468
+ AC_MSG_CHECKING(if data alignment is required)
469
+ aligned_access_required=yes
405
470
  AS_CASE([$host_cpu],
406
471
  [i*86 | x86_64 | powerpc* | s390*],
407
- [AC_MSG_NOTICE([data alignment is not required on this target])],
408
- [*],
409
- [AC_MSG_NOTICE([data alignment is required on this target])
410
- AC_DEFINE([CPU_ALIGNED_ACCESS_REQUIRED], [1], [data alignment is required])]
472
+ [aligned_access_required=no],
473
+ [arm*],
474
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
475
+ #ifndef __ARM_FEATURE_UNALIGNED
476
+ # error data alignment is required
477
+ #endif
478
+ ]], [[]])], [aligned_access_required=no], [])]
411
479
  )
480
+ AS_IF([test "x$aligned_access_required" = "xyes"],
481
+ [AC_MSG_RESULT(yes)
482
+ AC_DEFINE([CPU_ALIGNED_ACCESS_REQUIRED], [1], [data alignment is required])],
483
+ [AC_MSG_RESULT(no)])
412
484
 
413
485
  dnl Checks for functions and headers
414
486
 
@@ -416,7 +488,7 @@ AS_IF([test "x$EMSCRIPTEN" = "x"],[
416
488
  AC_CHECK_FUNCS([arc4random arc4random_buf])
417
489
  AC_CHECK_FUNCS([mmap mlock madvise mprotect explicit_bzero])
418
490
  ])
419
- AC_CHECK_FUNCS([posix_memalign])
491
+ AC_CHECK_FUNCS([posix_memalign getpid])
420
492
 
421
493
  AC_SUBST([LIBTOOL_EXTRA_FLAGS])
422
494
 
@@ -428,6 +500,8 @@ AS_IF([test "x$EMSCRIPTEN" != "x"],[
428
500
  AC_SUBST(TEST_LDFLAGS)
429
501
  AM_CONDITIONAL([EMSCRIPTEN], [test "x$EMSCRIPTEN" != "x"])
430
502
 
503
+ AM_CONDITIONAL([NATIVECLIENT], [test "x$NATIVECLIENT" != "x"])
504
+
431
505
  dnl Libtool.
432
506
 
433
507
  LT_INIT([dlopen])
@@ -3,9 +3,13 @@ EXTRA_DIST = \
3
3
  android-build.sh \
4
4
  android-arm.sh \
5
5
  android-armv7-a.sh \
6
- android-x86.sh \
6
+ android-armv8-a.sh \
7
7
  android-mips32.sh \
8
+ android-mips64.sh \
9
+ android-x86.sh \
10
+ android-x86-64.sh \
8
11
  emscripten.sh \
9
12
  ios.sh \
10
13
  msys2-win32.sh \
11
- msys2-win64.sh
14
+ msys2-win64.sh \
15
+ nativeclient.sh
@@ -90,6 +90,7 @@ host_triplet = @host@
90
90
  subdir = dist-build
91
91
  ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
92
92
  am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \
93
+ $(top_srcdir)/m4/ax_check_define.m4 \
93
94
  $(top_srcdir)/m4/ax_check_link_flag.m4 \
94
95
  $(top_srcdir)/m4/ld-output-def.m4 $(top_srcdir)/m4/libtool.m4 \
95
96
  $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -138,6 +139,13 @@ CCASDEPMODE = @CCASDEPMODE@
138
139
  CCASFLAGS = @CCASFLAGS@
139
140
  CCDEPMODE = @CCDEPMODE@
140
141
  CFLAGS = @CFLAGS@
142
+ CFLAGS_AESNI = @CFLAGS_AESNI@
143
+ CFLAGS_MMX = @CFLAGS_MMX@
144
+ CFLAGS_PCLMUL = @CFLAGS_PCLMUL@
145
+ CFLAGS_SSE2 = @CFLAGS_SSE2@
146
+ CFLAGS_SSE3 = @CFLAGS_SSE3@
147
+ CFLAGS_SSE4_1 = @CFLAGS_SSE4_1@
148
+ CFLAGS_SSSE3 = @CFLAGS_SSSE3@
141
149
  CPP = @CPP@
142
150
  CPPFLAGS = @CPPFLAGS@
143
151
  CWFLAGS = @CWFLAGS@
@@ -174,6 +182,7 @@ LIBTOOL_EXTRA_FLAGS = @LIBTOOL_EXTRA_FLAGS@
174
182
  LIPO = @LIPO@
175
183
  LN_S = @LN_S@
176
184
  LTLIBOBJS = @LTLIBOBJS@
185
+ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
177
186
  MAINT = @MAINT@
178
187
  MAKEINFO = @MAKEINFO@
179
188
  MANIFEST_TOOL = @MANIFEST_TOOL@
@@ -259,12 +268,16 @@ EXTRA_DIST = \
259
268
  android-build.sh \
260
269
  android-arm.sh \
261
270
  android-armv7-a.sh \
262
- android-x86.sh \
271
+ android-armv8-a.sh \
263
272
  android-mips32.sh \
273
+ android-mips64.sh \
274
+ android-x86.sh \
275
+ android-x86-64.sh \
264
276
  emscripten.sh \
265
277
  ios.sh \
266
278
  msys2-win32.sh \
267
- msys2-win64.sh
279
+ msys2-win64.sh \
280
+ nativeclient.sh
268
281
 
269
282
  all: all-am
270
283
 
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ export TARGET_ARCH=armv8-a
3
+ export CFLAGS="-Os -march=${TARGET_ARCH}"
4
+ ARCH=arm64 HOST_COMPILER=aarch64-linux-android "$(dirname "$0")/android-build.sh"
@@ -24,14 +24,14 @@ export PATH="${PATH}:${TOOLCHAIN_DIR}/bin"
24
24
 
25
25
  rm -rf "${TOOLCHAIN_DIR}" "${PREFIX}"
26
26
 
27
- bash $MAKE_TOOLCHAIN --platform="${NDK_PLATFORM:-android-21}" \
28
- --arch="$ARCH" \
29
- --install-dir="$TOOLCHAIN_DIR" && \
30
- ./configure --host="${HOST_COMPILER}" \
31
- --with-sysroot="${TOOLCHAIN_DIR}/sysroot" \
32
- --prefix="${PREFIX}" \
33
- --enable-minimal \
34
- --disable-soname-versions && \
27
+ bash $MAKE_TOOLCHAIN --platform="${NDK_PLATFORM:-android-16}" \
28
+ --arch="$ARCH" --install-dir="$TOOLCHAIN_DIR" && \
29
+ ./configure \
30
+ --disable-soname-versions \
31
+ --enable-minimal \
32
+ --host="${HOST_COMPILER}" \
33
+ --prefix="${PREFIX}" \
34
+ --with-sysroot="${TOOLCHAIN_DIR}/sysroot" && \
35
35
  make clean && \
36
36
  make -j3 install && \
37
- echo "libsodium has been installed into $PREFIX"
37
+ echo "libsodium has been installed into ${PREFIX}"
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ export TARGET_ARCH=mips64r6
3
+ export CFLAGS="-Os -march=${TARGET_ARCH}"
4
+ ARCH=mips64 HOST_COMPILER=mips64el-linux-android "$(dirname "$0")/android-build.sh"
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ export TARGET_ARCH=x86-64
3
+ export CFLAGS="-Os -march=${TARGET_ARCH}"
4
+ ARCH=x86_64 HOST_COMPILER=x86_64-linux-android "$(dirname "$0")/android-build.sh"
@@ -2,10 +2,10 @@
2
2
 
3
3
  export MAKE_FLAGS='-j4'
4
4
  export PREFIX="$(pwd)/libsodium-js"
5
- export EXPORTED_FUNCTIONS='["_crypto_aead_chacha20poly1305_abytes","_crypto_aead_chacha20poly1305_decrypt","_crypto_aead_chacha20poly1305_encrypt","_crypto_aead_chacha20poly1305_keybytes","_crypto_aead_chacha20poly1305_npubbytes","_crypto_aead_chacha20poly1305_nsecbytes","_crypto_auth","_crypto_auth_bytes","_crypto_auth_keybytes","_crypto_auth_verify","_crypto_box_beforenm","_crypto_box_beforenmbytes","_crypto_box_detached","_crypto_box_detached_afternm","_crypto_box_easy","_crypto_box_easy_afternm","_crypto_box_keypair","_crypto_box_macbytes","_crypto_box_noncebytes","_crypto_box_open_detached","_crypto_box_open_detached_afternm","_crypto_box_open_easy","_crypto_box_open_easy_afternm","_crypto_box_publickeybytes","_crypto_box_seal","_crypto_box_seal_open","_crypto_box_sealbytes","_crypto_box_secretkeybytes","_crypto_box_seed_keypair","_crypto_box_seedbytes","_crypto_generichash","_crypto_generichash_bytes","_crypto_generichash_bytes_max","_crypto_generichash_bytes_min","_crypto_generichash_final","_crypto_generichash_init","_crypto_generichash_keybytes","_crypto_generichash_keybytes_max","_crypto_generichash_keybytes_min","_crypto_generichash_statebytes","_crypto_generichash_update","_crypto_hash","_crypto_hash_bytes","_crypto_pwhash_scryptsalsa208sha256","_crypto_pwhash_scryptsalsa208sha256_ll","_crypto_pwhash_scryptsalsa208sha256_memlimit_interactive","_crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive","_crypto_pwhash_scryptsalsa208sha256_opslimit_interactive","_crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive","_crypto_pwhash_scryptsalsa208sha256_saltbytes","_crypto_pwhash_scryptsalsa208sha256_str","_crypto_pwhash_scryptsalsa208sha256_str_verify","_crypto_pwhash_scryptsalsa208sha256_strbytes","_crypto_pwhash_scryptsalsa208sha256_strprefix","_crypto_scalarmult","_crypto_scalarmult_base","_crypto_scalarmult_bytes","_crypto_scalarmult_scalarbytes","_crypto_secretbox_detached","_crypto_secretbox_easy","_crypto_secretbox_keybytes","_crypto_secretbox_macbytes","_crypto_secretbox_noncebytes","_crypto_secretbox_open_detached","_crypto_secretbox_open_easy","_crypto_shorthash","_crypto_shorthash_bytes","_crypto_shorthash_keybytes","_crypto_sign","_crypto_sign_bytes","_crypto_sign_detached","_crypto_sign_ed25519_pk_to_curve25519","_crypto_sign_ed25519_sk_to_curve25519","_crypto_sign_keypair","_crypto_sign_open","_crypto_sign_publickeybytes","_crypto_sign_secretkeybytes","_crypto_sign_seed_keypair","_crypto_sign_seedbytes","_crypto_sign_verify_detached","_randombytes_buf","_randombytes_close","_randombytes_random","_randombytes_set_implementation","_randombytes_stir","_randombytes_uniform","_sodium_bin2hex","_sodium_hex2bin","_sodium_init","_sodium_library_version_major","_sodium_library_version_minor","_sodium_memcmp","_sodium_memzero","_sodium_version_string"]'
5
+ export EXPORTED_FUNCTIONS='["_crypto_auth","_crypto_auth_bytes","_crypto_auth_keybytes","_crypto_auth_verify","_crypto_box_beforenm","_crypto_box_beforenmbytes","_crypto_box_detached","_crypto_box_detached_afternm","_crypto_box_easy","_crypto_box_easy_afternm","_crypto_box_keypair","_crypto_box_macbytes","_crypto_box_noncebytes","_crypto_box_open_detached","_crypto_box_open_detached_afternm","_crypto_box_open_easy","_crypto_box_open_easy_afternm","_crypto_box_publickeybytes","_crypto_box_seal","_crypto_box_seal_open","_crypto_box_sealbytes","_crypto_box_secretkeybytes","_crypto_box_seed_keypair","_crypto_box_seedbytes","_crypto_generichash","_crypto_generichash_bytes","_crypto_generichash_bytes_max","_crypto_generichash_bytes_min","_crypto_generichash_final","_crypto_generichash_init","_crypto_generichash_keybytes","_crypto_generichash_keybytes_max","_crypto_generichash_keybytes_min","_crypto_generichash_statebytes","_crypto_generichash_update","_crypto_hash","_crypto_hash_bytes","_crypto_onetimeauth","_crypto_onetimeauth_bytes","_crypto_onetimeauth_final","_crypto_onetimeauth_init","_crypto_onetimeauth_keybytes","_crypto_onetimeauth_statebytes","_crypto_onetimeauth_update","_crypto_onetimeauth_verify","_crypto_pwhash_scryptsalsa208sha256","_crypto_pwhash_scryptsalsa208sha256_ll","_crypto_pwhash_scryptsalsa208sha256_memlimit_interactive","_crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive","_crypto_pwhash_scryptsalsa208sha256_opslimit_interactive","_crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive","_crypto_pwhash_scryptsalsa208sha256_saltbytes","_crypto_pwhash_scryptsalsa208sha256_str","_crypto_pwhash_scryptsalsa208sha256_str_verify","_crypto_pwhash_scryptsalsa208sha256_strbytes","_crypto_pwhash_scryptsalsa208sha256_strprefix","_crypto_scalarmult","_crypto_scalarmult_base","_crypto_scalarmult_bytes","_crypto_scalarmult_scalarbytes","_crypto_secretbox_detached","_crypto_secretbox_easy","_crypto_secretbox_keybytes","_crypto_secretbox_macbytes","_crypto_secretbox_noncebytes","_crypto_secretbox_open_detached","_crypto_secretbox_open_easy","_crypto_shorthash","_crypto_shorthash_bytes","_crypto_shorthash_keybytes","_crypto_sign","_crypto_sign_bytes","_crypto_sign_detached","_crypto_sign_ed25519_pk_to_curve25519","_crypto_sign_ed25519_sk_to_curve25519","_crypto_sign_keypair","_crypto_sign_open","_crypto_sign_publickeybytes","_crypto_sign_secretkeybytes","_crypto_sign_seed_keypair","_crypto_sign_seedbytes","_crypto_sign_verify_detached","_randombytes_buf","_randombytes_close","_randombytes_random","_randombytes_set_implementation","_randombytes_stir","_randombytes_uniform","_sodium_bin2hex","_sodium_hex2bin","_sodium_init","_sodium_library_version_major","_sodium_library_version_minor","_sodium_memcmp","_sodium_memzero","_sodium_version_string"]'
6
6
  export TOTAL_MEMORY=33554432
7
7
  export JS_EXPORTS_FLAGS="-s EXPORTED_FUNCTIONS=${EXPORTED_FUNCTIONS}"
8
- export LDFLAGS="-s TOTAL_MEMORY=${TOTAL_MEMORY} -s RESERVED_FUNCTION_POINTERS=8 -s NO_BROWSER=1"
8
+ export LDFLAGS="-s TOTAL_MEMORY=${TOTAL_MEMORY} -s RESERVED_FUNCTION_POINTERS=8 -s NO_BROWSER=1 -s NO_DYNAMIC_EXECUTION=1 -s RUNNING_JS_OPTS=1"
9
9
 
10
10
  rm -f test/js.done
11
11
 
@@ -13,7 +13,7 @@ emconfigure ./configure --enable-minimal --disable-shared --prefix="$PREFIX" \
13
13
  CFLAGS="-O3" && \
14
14
  emmake make clean && \
15
15
  emmake make $MAKE_FLAGS install V=1 && \
16
- emcc -O3 --closure 1 --llvm-lto 1 --memory-init-file 0 $LDFLAGS $JS_EXPORTS_FLAGS \
16
+ emcc -O3 --llvm-lto 1 --memory-init-file 0 $LDFLAGS $JS_EXPORTS_FLAGS \
17
17
  "${PREFIX}/lib/libsodium.a" -o "${PREFIX}/lib/libsodium.js" || exit 1
18
18
 
19
19
  if test "x$NODE" = x; then
@@ -55,8 +55,8 @@ export PATH="${BASEDIR}/usr/bin:$BASEDIR/usr/sbin:$PATH"
55
55
  export SDK="${BASEDIR}/SDKs/iPhoneOS.sdk"
56
56
 
57
57
  ## 32-bit iOS
58
- export CFLAGS="-Oz -mthumb -arch armv7 -arch armv7s -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
59
- export LDFLAGS="-mthumb -arch armv7 -arch armv7s -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
58
+ export CFLAGS="-Oz -mthumb -arch armv7 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
59
+ export LDFLAGS="-mthumb -arch armv7 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
60
60
 
61
61
  make distclean > /dev/null
62
62
 
@@ -82,19 +82,19 @@ make -j3 install || exit 1
82
82
 
83
83
  # Create universal binary and include folder
84
84
  rm -fr -- "$PREFIX/include" "$PREFIX/libsodium.a" 2> /dev/null
85
- mkdir -p -- "$PREFIX"
85
+ mkdir -p -- "$PREFIX/lib"
86
86
  lipo -create \
87
87
  "$SIMULATOR32_PREFIX/lib/libsodium.a" \
88
88
  "$SIMULATOR64_PREFIX/lib/libsodium.a" \
89
89
  "$IOS32_PREFIX/lib/libsodium.a" \
90
90
  "$IOS64_PREFIX/lib/libsodium.a" \
91
- -output "$PREFIX/libsodium.a"
91
+ -output "$PREFIX/lib/libsodium.a"
92
92
  mv -f -- "$IOS32_PREFIX/include" "$PREFIX/"
93
93
 
94
94
  echo
95
95
  echo "libsodium has been installed into $PREFIX"
96
96
  echo
97
- file -- "$PREFIX/libsodium.a"
97
+ file -- "$PREFIX/lib/libsodium.a"
98
98
 
99
99
  # Cleanup
100
100
  rm -rf -- "$PREFIX/tmp"
@@ -0,0 +1,28 @@
1
+ #! /bin/sh
2
+
3
+ export NACL_SDK_ROOT=${NACL_SDK_ROOT-"/opt/nacl_sdk/pepper_45"}
4
+ export NACL_TOOLCHAIN=${NACL_TOOLCHAIN-"${NACL_SDK_ROOT}/toolchain/mac_pnacl"}
5
+ export NACL_BIN=${NACL_BIN-"${NACL_TOOLCHAIN}/bin"}
6
+ export PREFIX="$(pwd)/libsodium-nativeclient"
7
+ export PATH="${NACL_BIN}:$PATH"
8
+ export AR=${AR-"pnacl-ar"}
9
+ export AS=${AS-"pnacl-as"}
10
+ export CC=${CC-"pnacl-clang"}
11
+ export LD=${LD-"pnacl-ld"}
12
+ export NM=${NM-"pnacl-nm"}
13
+ export RANLIB=${RANLIB-"pnacl-ranlib"}
14
+ export PNACL_FINALIZE=${PNACL_FINALIZE-"pnacl-finalize"}
15
+ export PNACL_TRANSLATE=${PNACL_TRANSLATE-"pnacl-translate"}
16
+
17
+ mkdir -p $PREFIX || exit 1
18
+
19
+ make distclean > /dev/null
20
+
21
+ ./configure --enable-minimal \
22
+ --host=nacl \
23
+ --prefix="$PREFIX" || exit 1
24
+
25
+ make -j3 check && make -j3 install || exit 1
26
+
27
+ # Cleanup
28
+ make distclean > /dev/null
@@ -0,0 +1,21 @@
1
+
2
+ TARGETS = \
3
+ auth \
4
+ box \
5
+ box_detached \
6
+ generichash \
7
+ generichash_stream \
8
+ shorthash \
9
+ sign
10
+
11
+ SODIUM_CFLAGS != pkg-config --cflags libsodium
12
+ SODIUM_LIBS != pkg-config --libs libsodium
13
+ CFLAGS += $(SODIUM_CFLAGS)
14
+ LDFLAGS += $(SODIUM_LIBS)
15
+
16
+ all: $(TARGETS)
17
+
18
+ clean:
19
+ rm -f $(TARGETS)
20
+
21
+ distclean: clean
@@ -0,0 +1,68 @@
1
+ /*
2
+ * GraxRabble
3
+ * example programs for libsodium.
4
+ */
5
+
6
+ #include <sodium.h> /* library header */
7
+
8
+ #include "utils.h" /* utility functions shared by examples */
9
+
10
+ /*
11
+ * This operation computes an authentication tag for a message and a
12
+ * secret key, and provides a way to verify that a given tag is valid
13
+ * for a given message and a key.
14
+ *
15
+ * The function computing the tag deterministic: the same (message,
16
+ * key) tuple will always produce the same output.
17
+ *
18
+ * However, even if the message is public, knowing the key is
19
+ * required in order to be able to compute a valid tag. Therefore,
20
+ * the key should remain confidential. The tag, however, can be
21
+ * public.
22
+ *
23
+ * A typical use case is:
24
+ *
25
+ * - A prepares a message, add an authentication tag, sends it to B
26
+ * - A doesn't store the message
27
+ * - Later on, B sends the message and the authentication tag to A
28
+ * - A uses the authentication tag to verify that it created this message.
29
+ *
30
+ * This operation does not encrypt the message. It only computes and
31
+ * verifies an authentication tag.
32
+ */
33
+ static int
34
+ auth(void)
35
+ {
36
+ unsigned char key[crypto_auth_KEYBYTES];
37
+ unsigned char mac[crypto_auth_BYTES];
38
+ unsigned char message[MAX_INPUT_LEN];
39
+ size_t message_len;
40
+ int ret;
41
+
42
+ puts("Example: crypto_auth\n");
43
+
44
+ prompt_input("a key", (char*)key, sizeof key, 0);
45
+ message_len = prompt_input("a message", (char*)message, sizeof message, 1);
46
+
47
+ printf("Generating %s authentication...\n", crypto_auth_primitive());
48
+ crypto_auth(mac, message, message_len, key);
49
+
50
+ printf("Authentication tag: ");
51
+ print_hex(mac, sizeof mac);
52
+
53
+ puts("Verifying authentication tag...");
54
+ ret = crypto_auth_verify(mac, message, message_len, key);
55
+ print_verification(ret);
56
+
57
+ sodium_memzero(key, sizeof key); /* wipe sensitive data */
58
+
59
+ return ret;
60
+ }
61
+
62
+ int
63
+ main(void)
64
+ {
65
+ init();
66
+
67
+ return auth() != 0;
68
+ }