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
@@ -63,4 +63,4 @@ cc66a891768e95a2717b040c111996f14942f10f2475c33aa5f1c97476e6f8386733d6b21c16102d
63
63
  bdd3d0fafe8ba2b29d1ac0b79aa46e249cc9d3a82d0f772d690637bbdd353722356658d00436ff5dd5239ab747979329345eb8c7ed11b7331456ae87350fcf
64
64
  bd965bf31e87d70327536f2a341cebc4768eca275fa05ef98f7f1b71a0351298de006fba73fe6733ed01d75801b4a928e54231b38e38c562b2e33ea1284992fa
65
65
  2fc6e69fa26a89a5ed269092cb9b2a449a4409a7a44011eecad13d7c4b0456602d402fa5844f1a7a758136ce3d5d8d0e8b86921ffff4f692dd95bdc8e5ff0052
66
- 2fc6e69fa26a89a5ed269092cb9b2a449a4409a7a44011eecad13d7c4b0456602d402fa5844f1a7a758136ce3d5d8d0e8b86921ffff4f692dd95bdc8e5ff0052
66
+ 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
@@ -2,7 +2,8 @@
2
2
  #define TEST_NAME "generichash2"
3
3
  #include "cmptest.h"
4
4
 
5
- int main(void)
5
+ int
6
+ main(void)
6
7
  {
7
8
  #define MAXLEN 64
8
9
  crypto_generichash_state st;
@@ -10,7 +11,7 @@ int main(void)
10
11
  k[crypto_generichash_KEYBYTES_MAX];
11
12
  size_t h, i, j;
12
13
 
13
- assert(crypto_generichash_statebytes() == sizeof st);
14
+ assert(crypto_generichash_statebytes() >= sizeof st);
14
15
  for (h = 0; h < crypto_generichash_KEYBYTES_MAX; ++h)
15
16
  k[h] = h;
16
17
 
@@ -2,7 +2,8 @@
2
2
  #define TEST_NAME "generichash3"
3
3
  #include "cmptest.h"
4
4
 
5
- int main(void)
5
+ int
6
+ main(void)
6
7
  {
7
8
  #define MAXLEN 64
8
9
  crypto_generichash_blake2b_state st;
@@ -0,0 +1,26 @@
1
+ #! /bin/sh
2
+
3
+ if [ -z "$NACL_SDK_ROOT" -o -z "$PNACL_TRANSLATE" -o -z "$PNACL_FINALIZE" ]
4
+ then
5
+ echo "One or more variables need to be set:
6
+ \$NACL_SDK_ROOT=$NACL_SDK_ROOT
7
+ \$PNACL_TRANSLATE=$PNACL_TRANSLATE
8
+ \$PNACL_FINALIZE=$PNACL_FINALIZE"
9
+ exit 1
10
+ fi
11
+
12
+ if [ ! -f "$1.nexe" ]
13
+ then
14
+ $PNACL_FINALIZE "$1" -o "$1.final"
15
+ $PNACL_TRANSLATE -arch $(uname -m) "$1.final" -o "$1.nexe"
16
+ fi
17
+
18
+ command -v python >/dev/null 2>&1 || { echo >&2 "I require python but it's not installed. Aborting."; exit 1; }
19
+ SEL_LDR=$(find "$NACL_SDK_ROOT" -name sel_ldr.py | head -n 1)
20
+ if [ -z "$SEL_LDR" ]
21
+ then
22
+ echo "Couldn't find a sel_ldr.py under $NACL_SDK_ROOT"
23
+ exit 1
24
+ fi
25
+
26
+ exec python "$SEL_LDR" "$1.nexe"
@@ -105,7 +105,11 @@ static uint32_t randombytes_uniform_impl(const uint32_t upper_bound)
105
105
 
106
106
  static int impl_tests(void)
107
107
  {
108
+ #ifndef __native_client__
108
109
  randombytes_implementation impl = randombytes_sysrandom_implementation;
110
+ #else
111
+ randombytes_implementation impl = randombytes_nativeclient_implementation;
112
+ #endif
109
113
  uint32_t v = randombytes_random();
110
114
 
111
115
  impl.uniform = randombytes_uniform_impl;
@@ -2,30 +2,49 @@
2
2
  #define TEST_NAME "scalarmult"
3
3
  #include "cmptest.h"
4
4
 
5
- unsigned char alicesk[32]
5
+ const unsigned char alicesk[crypto_scalarmult_BYTES]
6
6
  = { 0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, 0x7d, 0x3c, 0x16, 0xc1,
7
7
  0x72, 0x51, 0xb2, 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb, 0xc0,
8
8
  0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5, 0x1d, 0xb9, 0x2c, 0x2a };
9
9
 
10
- unsigned char alicepk[32];
10
+ const unsigned char bobsk[crypto_scalarmult_BYTES]
11
+ = { 0x5d, 0xab, 0x08, 0x7e, 0x62, 0x4a, 0x8a, 0x4b, 0x79, 0xe1, 0x7f,
12
+ 0x8b, 0x83, 0x80, 0x0e, 0xe6, 0x6f, 0x3b, 0xb1, 0x29, 0x26, 0x18,
13
+ 0xb6, 0xfd, 0x1c, 0x2f, 0x8b, 0x27, 0xff, 0x88, 0xe0, 0xeb };
14
+
15
+ char hex[crypto_scalarmult_BYTES * 2 + 1];
11
16
 
12
17
  int main(void)
13
18
  {
14
- int i;
19
+ unsigned char *alicepk =
20
+ (unsigned char *) sodium_malloc(crypto_scalarmult_BYTES);
21
+ unsigned char *bobpk =
22
+ (unsigned char *) sodium_malloc(crypto_scalarmult_BYTES);
23
+ unsigned char *k =
24
+ (unsigned char *) sodium_malloc(crypto_scalarmult_BYTES);
25
+
26
+ assert(alicepk != NULL && bobpk != NULL && k != NULL);
15
27
 
16
28
  crypto_scalarmult_base(alicepk, alicesk);
29
+ sodium_bin2hex(hex, sizeof hex, alicepk, crypto_scalarmult_BYTES);
30
+ printf("%s\n", hex);
31
+
32
+ crypto_scalarmult_base(bobpk, bobsk);
33
+ sodium_bin2hex(hex, sizeof hex, bobpk, crypto_scalarmult_BYTES);
34
+ printf("%s\n", hex);
35
+
36
+ crypto_scalarmult(k, alicesk, bobpk);
37
+ sodium_bin2hex(hex, sizeof hex, k, crypto_scalarmult_BYTES);
38
+ printf("%s\n", hex);
39
+
40
+ crypto_scalarmult(k, bobsk, alicepk);
41
+ sodium_bin2hex(hex, sizeof hex, k, crypto_scalarmult_BYTES);
42
+ printf("%s\n", hex);
43
+
44
+ sodium_free(k);
45
+ sodium_free(bobpk);
46
+ sodium_free(alicepk);
17
47
 
18
- for (i = 0; i < 32; ++i) {
19
- if (i > 0) {
20
- printf(",");
21
- } else {
22
- printf(" ");
23
- }
24
- printf("0x%02x", (unsigned int)alicepk[i]);
25
- if (i % 8 == 7) {
26
- printf("\n");
27
- }
28
- }
29
48
  assert(crypto_scalarmult_bytes() > 0U);
30
49
  assert(crypto_scalarmult_scalarbytes() > 0U);
31
50
  assert(strcmp(crypto_scalarmult_primitive(), "curve25519") == 0);
@@ -1,4 +1,4 @@
1
- 0x85,0x20,0xf0,0x09,0x89,0x30,0xa7,0x54
2
- ,0x74,0x8b,0x7d,0xdc,0xb4,0x3e,0xf7,0x5a
3
- ,0x0d,0xbf,0x3a,0x0d,0x26,0x38,0x1a,0xf4
4
- ,0xeb,0xa4,0xa9,0x8e,0xaa,0x9b,0x4e,0x6a
1
+ 8520f0098930a754748b7ddcb43ef75a0dbf3a0d26381af4eba4a98eaa9b4e6a
2
+ de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f
3
+ 4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742
4
+ 4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742
@@ -42,6 +42,15 @@ int main(void)
42
42
  }
43
43
  printf("\n");
44
44
 
45
+ memcpy(c, m, 163);
46
+ crypto_secretbox(c, c, 163, nonce, firstkey);
47
+ for (i = 16; i < 163; ++i) {
48
+ printf(",0x%02x", (unsigned int)c[i]);
49
+ if (i % 8 == 7)
50
+ printf("\n");
51
+ }
52
+ printf("\n");
53
+
45
54
  assert(crypto_secretbox_keybytes() > 0U);
46
55
  assert(crypto_secretbox_noncebytes() > 0U);
47
56
  assert(crypto_secretbox_zerobytes() > 0U);
@@ -17,3 +17,22 @@
17
17
  ,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6
18
18
  ,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74
19
19
  ,0xe3,0x55,0xa5
20
+ ,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5
21
+ ,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9
22
+ ,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73
23
+ ,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce
24
+ ,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4
25
+ ,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a
26
+ ,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b
27
+ ,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72
28
+ ,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2
29
+ ,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38
30
+ ,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a
31
+ ,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae
32
+ ,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea
33
+ ,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda
34
+ ,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde
35
+ ,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3
36
+ ,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6
37
+ ,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74
38
+ ,0xe3,0x55,0xa5
@@ -24,12 +24,15 @@ unsigned char m[131]
24
24
  0x60, 0x90, 0x2e, 0x52, 0xf0, 0xa0, 0x89, 0xbc, 0x76, 0x89, 0x70, 0x40,
25
25
  0xe0, 0x82, 0xf9, 0x37, 0x76, 0x38, 0x48, 0x64, 0x5e, 0x07, 0x05 };
26
26
 
27
- unsigned char c[147 + crypto_secretbox_MACBYTES];
28
- unsigned char mac[crypto_secretbox_MACBYTES];
29
-
30
27
  int main(void)
31
28
  {
32
- size_t i;
29
+ unsigned char *c;
30
+ unsigned char *mac;
31
+ size_t i;
32
+
33
+ c = (unsigned char *) sodium_malloc(131 + crypto_secretbox_MACBYTES + 1);
34
+ mac = (unsigned char *) sodium_malloc(crypto_secretbox_MACBYTES);
35
+ assert(c != NULL && mac != NULL);
33
36
 
34
37
  crypto_secretbox_easy(c, m, 131, nonce, firstkey);
35
38
  for (i = 0; i < 131 + crypto_secretbox_MACBYTES; ++i) {
@@ -50,8 +53,41 @@ int main(void)
50
53
  if (i % 8 == 7)
51
54
  printf("\n");
52
55
  }
56
+ printf("\n");
57
+
58
+ /* Same test, with c and m overlapping */
59
+
60
+ memcpy(c + 1, m, 131);
61
+ crypto_secretbox_easy(c, c + 1, 131, nonce, firstkey);
62
+ for (i = 0; i < 131 + crypto_secretbox_MACBYTES; ++i) {
63
+ printf(",0x%02x", (unsigned int)c[i]);
64
+ if (i % 8 == 7)
65
+ printf("\n");
66
+ }
67
+ printf("\n");
68
+
69
+ memcpy(c, m, 131);
70
+ crypto_secretbox_easy(c + 1, c, 131, nonce, firstkey);
71
+ for (i = 0; i < 131 + crypto_secretbox_MACBYTES; ++i) {
72
+ printf(",0x%02x", (unsigned int)c[i + 1]);
73
+ if (i % 8 == 7)
74
+ printf("\n");
75
+ }
76
+ printf("\n");
77
+
78
+ memcpy(c, m, 131);
79
+ crypto_secretbox_easy(c, c, 131, nonce, firstkey);
80
+ for (i = 0; i < 131 + crypto_secretbox_MACBYTES; ++i) {
81
+ printf(",0x%02x", (unsigned int)c[i]);
82
+ if (i % 8 == 7)
83
+ printf("\n");
84
+ }
85
+ printf("\n");
53
86
 
54
87
  assert(crypto_secretbox_easy(c, m, SIZE_MAX - 1U, nonce, firstkey) == -1);
55
88
 
89
+ sodium_free(mac);
90
+ sodium_free(c);
91
+
56
92
  return 0;
57
93
  }
@@ -35,4 +35,61 @@
35
35
  ,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3
36
36
  ,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6
37
37
  ,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74
38
- ,0xe3,0x55,0xa5
38
+ ,0xe3,0x55,0xa5
39
+ ,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5
40
+ ,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9
41
+ ,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73
42
+ ,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce
43
+ ,0x48,0x33,0x2e,0xa7,0x16,0x4d,0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x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6
94
+ ,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74
95
+ ,0xe3,0x55,0xa5
@@ -9,6 +9,8 @@ int main(void)
9
9
  (void)sodium_runtime_has_neon();
10
10
  (void)sodium_runtime_has_sse2();
11
11
  (void)sodium_runtime_has_sse3();
12
+ (void)sodium_runtime_has_pclmul();
13
+ (void)sodium_runtime_has_aesni();
12
14
 
13
15
  return 0;
14
16
  }
@@ -4,13 +4,16 @@
4
4
 
5
5
  int main(void)
6
6
  {
7
- unsigned char buf1[1000];
8
- unsigned char buf2[1000];
9
- char buf3[33];
10
- unsigned char buf4[4];
11
- const char *hex;
12
- const char *hex_end;
13
- size_t bin_len;
7
+ unsigned char buf1[1000];
8
+ unsigned char buf2[1000];
9
+ char buf3[33];
10
+ unsigned char buf4[4];
11
+ unsigned char nonce[24];
12
+ char nonce_hex[49];
13
+ const char *hex;
14
+ const char *hex_end;
15
+ size_t bin_len;
16
+ int i;
14
17
 
15
18
  randombytes_buf(buf1, sizeof buf1);
16
19
  memcpy(buf2, buf1, sizeof buf2);
@@ -60,5 +63,41 @@ int main(void)
60
63
  }
61
64
  printf("dt5: %ld\n", (long) (hex_end - hex));
62
65
 
66
+ memset(nonce, 0, sizeof nonce);
67
+ sodium_increment(nonce, sizeof nonce);
68
+ printf("%s\n", sodium_bin2hex(nonce_hex, sizeof nonce_hex,
69
+ nonce, sizeof nonce));
70
+ memset(nonce, 255, sizeof nonce);
71
+ sodium_increment(nonce, sizeof nonce);
72
+ printf("%s\n", sodium_bin2hex(nonce_hex, sizeof nonce_hex,
73
+ nonce, sizeof nonce));
74
+ nonce[1] = 1U;
75
+ sodium_increment(nonce, sizeof nonce);
76
+ printf("%s\n", sodium_bin2hex(nonce_hex, sizeof nonce_hex,
77
+ nonce, sizeof nonce));
78
+ nonce[1] = 0U;
79
+ sodium_increment(nonce, sizeof nonce);
80
+ printf("%s\n", sodium_bin2hex(nonce_hex, sizeof nonce_hex,
81
+ nonce, sizeof nonce));
82
+ nonce[0] = 255U;
83
+ nonce[2] = 255U;
84
+ sodium_increment(nonce, sizeof nonce);
85
+ printf("%s\n", sodium_bin2hex(nonce_hex, sizeof nonce_hex,
86
+ nonce, sizeof nonce));
87
+ for (i = 0; i < 1000; i++) {
88
+ bin_len = (size_t) randombytes_uniform(sizeof buf1);
89
+ randombytes_buf(buf1, bin_len);
90
+ randombytes_buf(buf2, bin_len);
91
+ if (memcmp(buf1, buf2, bin_len) *
92
+ sodium_compare(buf1, buf2, bin_len) < 0) {
93
+ printf("sodium_compare() failure with length=%u\n",
94
+ (unsigned int) bin_len);
95
+ }
96
+ memcpy(buf1, buf2, bin_len);
97
+ if (sodium_compare(buf1, buf2, bin_len)) {
98
+ printf("sodium_compare() equality failure with length=%u\n",
99
+ (unsigned int) bin_len);
100
+ }
101
+ }
63
102
  return 0;
64
103
  }
@@ -11,3 +11,8 @@ dt2: 2
11
11
  dt3: 11
12
12
  dt4: 11
13
13
  dt5: 11
14
+ 010000000000000000000000000000000000000000000000
15
+ 000000000000000000000000000000000000000000000000
16
+ 010100000000000000000000000000000000000000000000
17
+ 020000000000000000000000000000000000000000000000
18
+ 0001ff000000000000000000000000000000000000000000
@@ -19,6 +19,7 @@ int main(void)
19
19
  {
20
20
  int i;
21
21
 
22
+ randombytes_buf(output, sizeof output);
22
23
  crypto_stream(output, sizeof output, nonce, firstkey);
23
24
  crypto_hash_sha256(h, output, sizeof output);
24
25
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbnacl-libsodium
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artiom Di
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-10 00:00:00.000000000 Z
11
+ date: 2015-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbnacl
@@ -92,12 +92,14 @@ files:
92
92
  - vendor/libsodium/autom4te.cache/output.2
93
93
  - vendor/libsodium/autom4te.cache/output.3
94
94
  - vendor/libsodium/autom4te.cache/output.4
95
+ - vendor/libsodium/autom4te.cache/output.5
95
96
  - vendor/libsodium/autom4te.cache/requests
96
97
  - vendor/libsodium/autom4te.cache/traces.0
97
98
  - vendor/libsodium/autom4te.cache/traces.1
98
99
  - vendor/libsodium/autom4te.cache/traces.2
99
100
  - vendor/libsodium/autom4te.cache/traces.3
100
101
  - vendor/libsodium/autom4te.cache/traces.4
102
+ - vendor/libsodium/autom4te.cache/traces.5
101
103
  - vendor/libsodium/build-aux/compile
102
104
  - vendor/libsodium/build-aux/config.guess
103
105
  - vendor/libsodium/build-aux/config.sub
@@ -108,6 +110,7 @@ files:
108
110
  - vendor/libsodium/build-aux/test-driver
109
111
  - vendor/libsodium/builds/msvc/build/buildall.bat
110
112
  - vendor/libsodium/builds/msvc/build/buildbase.bat
113
+ - vendor/libsodium/builds/msvc/properties/ARM.props
111
114
  - vendor/libsodium/builds/msvc/properties/Common.props
112
115
  - vendor/libsodium/builds/msvc/properties/DLL.props
113
116
  - vendor/libsodium/builds/msvc/properties/Debug.props
@@ -187,14 +190,27 @@ files:
187
190
  - vendor/libsodium/dist-build/Makefile.in
188
191
  - vendor/libsodium/dist-build/android-arm.sh
189
192
  - vendor/libsodium/dist-build/android-armv7-a.sh
193
+ - vendor/libsodium/dist-build/android-armv8-a.sh
190
194
  - vendor/libsodium/dist-build/android-build.sh
191
195
  - vendor/libsodium/dist-build/android-mips32.sh
196
+ - vendor/libsodium/dist-build/android-mips64.sh
197
+ - vendor/libsodium/dist-build/android-x86-64.sh
192
198
  - vendor/libsodium/dist-build/android-x86.sh
193
199
  - vendor/libsodium/dist-build/emscripten.sh
194
200
  - vendor/libsodium/dist-build/ios.sh
195
201
  - vendor/libsodium/dist-build/msys2-win32.sh
196
202
  - vendor/libsodium/dist-build/msys2-win64.sh
203
+ - vendor/libsodium/dist-build/nativeclient.sh
197
204
  - vendor/libsodium/dist-build/osx.sh
205
+ - vendor/libsodium/examples/Makefile
206
+ - vendor/libsodium/examples/auth.c
207
+ - vendor/libsodium/examples/box.c
208
+ - vendor/libsodium/examples/box_detached.c
209
+ - vendor/libsodium/examples/generichash.c
210
+ - vendor/libsodium/examples/generichash_stream.c
211
+ - vendor/libsodium/examples/shorthash.c
212
+ - vendor/libsodium/examples/sign.c
213
+ - vendor/libsodium/examples/utils.h
198
214
  - vendor/libsodium/install-sh
199
215
  - vendor/libsodium/libsodium-uninstalled.pc.in
200
216
  - vendor/libsodium/libsodium.pc.in
@@ -204,6 +220,7 @@ files:
204
220
  - vendor/libsodium/logo.png
205
221
  - vendor/libsodium/ltmain.sh
206
222
  - vendor/libsodium/m4/ax_check_compile_flag.m4
223
+ - vendor/libsodium/m4/ax_check_define.m4
207
224
  - vendor/libsodium/m4/ax_check_gnu_make.m4
208
225
  - vendor/libsodium/m4/ax_check_link_flag.m4
209
226
  - vendor/libsodium/m4/ld-output-def.m4
@@ -226,6 +243,7 @@ files:
226
243
  - vendor/libsodium/src/Makefile.in
227
244
  - vendor/libsodium/src/libsodium/Makefile.am
228
245
  - vendor/libsodium/src/libsodium/Makefile.in
246
+ - vendor/libsodium/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c
229
247
  - vendor/libsodium/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c
230
248
  - vendor/libsodium/src/libsodium/crypto_auth/crypto_auth.c
231
249
  - vendor/libsodium/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256_api.c
@@ -458,6 +476,7 @@ files:
458
476
  - vendor/libsodium/src/libsodium/include/Makefile.in
459
477
  - vendor/libsodium/src/libsodium/include/sodium.h
460
478
  - vendor/libsodium/src/libsodium/include/sodium/core.h
479
+ - vendor/libsodium/src/libsodium/include/sodium/crypto_aead_aes256gcm.h
461
480
  - vendor/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h
462
481
  - vendor/libsodium/src/libsodium/include/sodium/crypto_auth.h
463
482
  - vendor/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h
@@ -504,11 +523,13 @@ files:
504
523
  - vendor/libsodium/src/libsodium/include/sodium/crypto_verify_64.h
505
524
  - vendor/libsodium/src/libsodium/include/sodium/export.h
506
525
  - vendor/libsodium/src/libsodium/include/sodium/randombytes.h
526
+ - vendor/libsodium/src/libsodium/include/sodium/randombytes_nativeclient.h
507
527
  - vendor/libsodium/src/libsodium/include/sodium/randombytes_salsa20_random.h
508
528
  - vendor/libsodium/src/libsodium/include/sodium/randombytes_sysrandom.h
509
529
  - vendor/libsodium/src/libsodium/include/sodium/runtime.h
510
530
  - vendor/libsodium/src/libsodium/include/sodium/utils.h
511
531
  - vendor/libsodium/src/libsodium/include/sodium/version.h.in
532
+ - vendor/libsodium/src/libsodium/randombytes/nativeclient/randombytes_nativeclient.c
512
533
  - vendor/libsodium/src/libsodium/randombytes/randombytes.c
513
534
  - vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c
514
535
  - vendor/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c
@@ -521,6 +542,8 @@ files:
521
542
  - vendor/libsodium/test/Makefile.in
522
543
  - vendor/libsodium/test/default/Makefile.am
523
544
  - vendor/libsodium/test/default/Makefile.in
545
+ - vendor/libsodium/test/default/aead_aes256gcm.c
546
+ - vendor/libsodium/test/default/aead_aes256gcm.exp
524
547
  - vendor/libsodium/test/default/aead_chacha20poly1305.c
525
548
  - vendor/libsodium/test/default/aead_chacha20poly1305.exp
526
549
  - vendor/libsodium/test/default/auth.c
@@ -579,6 +602,7 @@ files:
579
602
  - vendor/libsodium/test/default/hash2.exp
580
603
  - vendor/libsodium/test/default/hash3.c
581
604
  - vendor/libsodium/test/default/hash3.exp
605
+ - vendor/libsodium/test/default/nacl-test-wrapper.sh
582
606
  - vendor/libsodium/test/default/onetimeauth.c
583
607
  - vendor/libsodium/test/default/onetimeauth.exp
584
608
  - vendor/libsodium/test/default/onetimeauth2.c
@@ -660,8 +684,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
660
684
  version: '0'
661
685
  requirements: []
662
686
  rubyforge_project:
663
- rubygems_version: 2.4.6
687
+ rubygems_version: 2.4.8
664
688
  signing_key:
665
689
  specification_version: 4
666
690
  summary: rbnacl with bundled libsodium
667
691
  test_files: []
692
+ has_rdoc: