rbnacl-libsodium 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rbnacl/libsodium/version.rb +1 -1
  3. data/vendor/libsodium/ChangeLog +7 -0
  4. data/vendor/libsodium/autom4te.cache/output.1 +11 -11
  5. data/vendor/libsodium/autom4te.cache/output.5 +11 -11
  6. data/vendor/libsodium/autom4te.cache/requests +919 -919
  7. data/vendor/libsodium/autom4te.cache/traces.1 +1 -1
  8. data/vendor/libsodium/builds/msvc/version.h +1 -1
  9. data/vendor/libsodium/configure +11 -11
  10. data/vendor/libsodium/configure.ac +2 -2
  11. data/vendor/libsodium/dist-build/emscripten.sh +3 -3
  12. data/vendor/libsodium/msvc-scripts/process.bat +1 -1
  13. data/vendor/libsodium/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c +2 -2
  14. data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2.h +12 -3
  15. data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_cswap_curve25519_ref10.c +1 -1
  16. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_cmov.c +1 -1
  17. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_frombytes.c +10 -10
  18. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_mul.c +12 -12
  19. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sq.c +12 -12
  20. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/fe_sq2.c +12 -12
  21. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc_muladd.c +70 -70
  22. data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sc_reduce.c +47 -47
  23. data/vendor/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h +12 -2
  24. data/vendor/libsodium/src/libsodium/include/sodium/export.h +5 -1
  25. data/vendor/libsodium/src/libsodium/randombytes/randombytes.c +3 -3
  26. data/vendor/libsodium/test/default/generichash.c +4 -4
  27. metadata +2 -2
@@ -7,7 +7,7 @@ m4trace:aclocal.m4:1214: -1- m4_include([m4/ltoptions.m4])
7
7
  m4trace:aclocal.m4:1215: -1- m4_include([m4/ltsugar.m4])
8
8
  m4trace:aclocal.m4:1216: -1- m4_include([m4/ltversion.m4])
9
9
  m4trace:aclocal.m4:1217: -1- m4_include([m4/lt~obsolete.m4])
10
- m4trace:configure.ac:5: -1- AC_INIT([libsodium], [1.0.4], [https://github.com/jedisct1/libsodium/issues], [libsodium], [https://github.com/jedisct1/libsodium])
10
+ m4trace:configure.ac:5: -1- AC_INIT([libsodium], [1.0.5], [https://github.com/jedisct1/libsodium/issues], [libsodium], [https://github.com/jedisct1/libsodium])
11
11
  m4trace:configure.ac:5: -1- m4_pattern_forbid([^_?A[CHUM]_])
12
12
  m4trace:configure.ac:5: -1- m4_pattern_forbid([_AC_])
13
13
  m4trace:configure.ac:5: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS'])
@@ -4,7 +4,7 @@
4
4
 
5
5
  #include "export.h"
6
6
 
7
- #define SODIUM_VERSION_STRING "1.0.4"
7
+ #define SODIUM_VERSION_STRING "1.0.5"
8
8
 
9
9
  #define SODIUM_LIBRARY_VERSION_MAJOR 7
10
10
  #define SODIUM_LIBRARY_VERSION_MINOR 6
@@ -1,6 +1,6 @@
1
1
  #! /bin/sh
2
2
  # Guess values for system-dependent variables and create Makefiles.
3
- # Generated by GNU Autoconf 2.69 for libsodium 1.0.4.
3
+ # Generated by GNU Autoconf 2.69 for libsodium 1.0.5.
4
4
  #
5
5
  # Report bugs to <https://github.com/jedisct1/libsodium/issues>.
6
6
  #
@@ -590,8 +590,8 @@ MAKEFLAGS=
590
590
  # Identity of this package.
591
591
  PACKAGE_NAME='libsodium'
592
592
  PACKAGE_TARNAME='libsodium'
593
- PACKAGE_VERSION='1.0.4'
594
- PACKAGE_STRING='libsodium 1.0.4'
593
+ PACKAGE_VERSION='1.0.5'
594
+ PACKAGE_STRING='libsodium 1.0.5'
595
595
  PACKAGE_BUGREPORT='https://github.com/jedisct1/libsodium/issues'
596
596
  PACKAGE_URL='https://github.com/jedisct1/libsodium'
597
597
 
@@ -1368,7 +1368,7 @@ if test "$ac_init_help" = "long"; then
1368
1368
  # Omit some internal or obsolete options to make the list less imposing.
1369
1369
  # This message is too long to be a string in the A/UX 3.1 sh.
1370
1370
  cat <<_ACEOF
1371
- \`configure' configures libsodium 1.0.4 to adapt to many kinds of systems.
1371
+ \`configure' configures libsodium 1.0.5 to adapt to many kinds of systems.
1372
1372
 
1373
1373
  Usage: $0 [OPTION]... [VAR=VALUE]...
1374
1374
 
@@ -1438,7 +1438,7 @@ fi
1438
1438
 
1439
1439
  if test -n "$ac_init_help"; then
1440
1440
  case $ac_init_help in
1441
- short | recursive ) echo "Configuration of libsodium 1.0.4:";;
1441
+ short | recursive ) echo "Configuration of libsodium 1.0.5:";;
1442
1442
  esac
1443
1443
  cat <<\_ACEOF
1444
1444
 
@@ -1571,7 +1571,7 @@ fi
1571
1571
  test -n "$ac_init_help" && exit $ac_status
1572
1572
  if $ac_init_version; then
1573
1573
  cat <<\_ACEOF
1574
- libsodium configure 1.0.4
1574
+ libsodium configure 1.0.5
1575
1575
  generated by GNU Autoconf 2.69
1576
1576
 
1577
1577
  Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1940,7 +1940,7 @@ cat >config.log <<_ACEOF
1940
1940
  This file contains any messages produced by compilers while
1941
1941
  running configure, to aid debugging if configure makes a mistake.
1942
1942
 
1943
- It was created by libsodium $as_me 1.0.4, which was
1943
+ It was created by libsodium $as_me 1.0.5, which was
1944
1944
  generated by GNU Autoconf 2.69. Invocation command line was
1945
1945
 
1946
1946
  $ $0 $@
@@ -2876,7 +2876,7 @@ fi
2876
2876
 
2877
2877
  # Define the identity of the package.
2878
2878
  PACKAGE='libsodium'
2879
- VERSION='1.0.4'
2879
+ VERSION='1.0.5'
2880
2880
 
2881
2881
 
2882
2882
  cat >>confdefs.h <<_ACEOF
@@ -15596,7 +15596,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
15596
15596
  # error mode(TI) is a gcc extension
15597
15597
  #endif
15598
15598
  #if defined(__clang__) && !defined(__x86_64__)
15599
- # error clang doesn't properly compile smult_curve25519_donna_c64.c
15599
+ # error clang does not properly compile smult_curve25519_donna_c64.c
15600
15600
  #endif
15601
15601
  #ifndef NATIVE_LITTLE_ENDIAN
15602
15602
  # error donna_c64 currently requires a little endian CPU
@@ -16769,7 +16769,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
16769
16769
  # report actual input values of CONFIG_FILES etc. instead of their
16770
16770
  # values after options handling.
16771
16771
  ac_log="
16772
- This file was extended by libsodium $as_me 1.0.4, which was
16772
+ This file was extended by libsodium $as_me 1.0.5, which was
16773
16773
  generated by GNU Autoconf 2.69. Invocation command line was
16774
16774
 
16775
16775
  CONFIG_FILES = $CONFIG_FILES
@@ -16827,7 +16827,7 @@ _ACEOF
16827
16827
  cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
16828
16828
  ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
16829
16829
  ac_cs_version="\\
16830
- libsodium config.status 1.0.4
16830
+ libsodium config.status 1.0.5
16831
16831
  configured by $0, generated by GNU Autoconf 2.69,
16832
16832
  with options \\"\$ac_cs_config\\"
16833
16833
 
@@ -1,5 +1,5 @@
1
1
  AC_PREREQ([2.65])
2
- AC_INIT([libsodium],[1.0.4],
2
+ AC_INIT([libsodium],[1.0.5],
3
3
  [https://github.com/jedisct1/libsodium/issues],
4
4
  [libsodium],
5
5
  [https://github.com/jedisct1/libsodium])
@@ -414,7 +414,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
414
414
  # error mode(TI) is a gcc extension
415
415
  #endif
416
416
  #if defined(__clang__) && !defined(__x86_64__)
417
- # error clang doesn't properly compile smult_curve25519_donna_c64.c
417
+ # error clang does not properly compile smult_curve25519_donna_c64.c
418
418
  #endif
419
419
  #ifndef NATIVE_LITTLE_ENDIAN
420
420
  # error donna_c64 currently requires a little endian CPU
@@ -2,7 +2,7 @@
2
2
 
3
3
  export MAKE_FLAGS='-j4'
4
4
  export PREFIX="$(pwd)/libsodium-js"
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"]'
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_memzero","_sodium_version_string"]'
6
6
  export TOTAL_MEMORY=33554432
7
7
  export JS_EXPORTS_FLAGS="-s EXPORTED_FUNCTIONS=${EXPORTED_FUNCTIONS}"
8
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"
@@ -17,7 +17,7 @@ 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
20
- for candidate in iojs node nodejs; do
20
+ for candidate in node nodejs; do
21
21
  case $($candidate --version 2>&1) in #(
22
22
  v*)
23
23
  NODE=$candidate
@@ -27,7 +27,7 @@ if test "x$NODE" = x; then
27
27
  fi
28
28
 
29
29
  if test "x$NODE" = x; then
30
- echo 'io.js / node.js not found - test suite skipped.' >&2
30
+ echo 'node.js not found - test suite skipped.' >&2
31
31
  exit 1
32
32
  fi
33
33
 
@@ -1,4 +1,4 @@
1
- cscript msvc-scripts/rep.vbs //Nologo s/@VERSION@/1.0.4/ < src\libsodium\include\sodium\version.h.in > tmp
1
+ cscript msvc-scripts/rep.vbs //Nologo s/@VERSION@/1.0.5/ < src\libsodium\include\sodium\version.h.in > tmp
2
2
  cscript msvc-scripts/rep.vbs //Nologo s/@SODIUM_LIBRARY_VERSION_MAJOR@/7/ < tmp > tmp2
3
3
  cscript msvc-scripts/rep.vbs //Nologo s/@SODIUM_LIBRARY_VERSION_MINOR@/6/ < tmp2 > src\libsodium\include\sodium\version.h
4
4
  del tmp tmp2
@@ -507,7 +507,6 @@ crypto_aead_aes256gcm_encrypt_afternm(unsigned char *c, unsigned long long *clen
507
507
  const unsigned char *npub,
508
508
  const crypto_aead_aes256gcm_state *ctx_)
509
509
  {
510
- unsigned char H[16];
511
510
  const __m128i rev = _mm_set_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
512
511
  const context *ctx = (const context *) ctx_;
513
512
  const __m128i *rkeys = ctx->rkeys;
@@ -515,6 +514,7 @@ crypto_aead_aes256gcm_encrypt_afternm(unsigned char *c, unsigned long long *clen
515
514
  unsigned long long i, j;
516
515
  unsigned long long adlen_rnd64 = adlen & ~63ULL;
517
516
  unsigned long long mlen_rnd128 = mlen & ~127ULL;
517
+ CRYPTO_ALIGN(16) unsigned char H[16];
518
518
  CRYPTO_ALIGN(16) unsigned char n2[16];
519
519
  CRYPTO_ALIGN(16) unsigned char T[16];
520
520
  CRYPTO_ALIGN(16) unsigned char accum[16];
@@ -623,7 +623,6 @@ crypto_aead_aes256gcm_decrypt_afternm(unsigned char *m, unsigned long long *mlen
623
623
  const unsigned char *npub,
624
624
  const crypto_aead_aes256gcm_state *ctx_)
625
625
  {
626
- unsigned char H[16];
627
626
  const __m128i rev = _mm_set_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
628
627
  const context *ctx = (const context *) ctx_;
629
628
  const __m128i *rkeys = ctx->rkeys;
@@ -632,6 +631,7 @@ crypto_aead_aes256gcm_decrypt_afternm(unsigned char *m, unsigned long long *mlen
632
631
  unsigned long long adlen_rnd64 = adlen & ~63ULL;
633
632
  unsigned long long mlen;
634
633
  unsigned long long mlen_rnd128;
634
+ CRYPTO_ALIGN(16) unsigned char H[16];
635
635
  CRYPTO_ALIGN(16) unsigned char n2[16];
636
636
  CRYPTO_ALIGN(16) unsigned char T[16];
637
637
  CRYPTO_ALIGN(16) unsigned char accum[16];
@@ -57,7 +57,12 @@ extern "C" {
57
57
  BLAKE2B_PERSONALBYTES = 16
58
58
  };
59
59
 
60
- #pragma pack(push, 1)
60
+ #ifdef __SUNPRO_C
61
+ # pragma pack(1)
62
+ #else
63
+ # pragma pack(push, 1)
64
+ #endif
65
+
61
66
  typedef struct blake2s_param_
62
67
  {
63
68
  uint8_t digest_length; // 1
@@ -127,7 +132,12 @@ typedef crypto_generichash_blake2b_state blake2b_state;
127
132
  uint8_t buf[4 * BLAKE2B_BLOCKBYTES];
128
133
  size_t buflen;
129
134
  } blake2bp_state;
130
- #pragma pack(pop)
135
+
136
+ #ifdef __SUNPRO_C
137
+ # pragma pack()
138
+ #else
139
+ # pragma pack(pop)
140
+ #endif
131
141
 
132
142
  // Streaming API
133
143
  int blake2s_init( blake2s_state *S, const uint8_t outlen );
@@ -174,4 +184,3 @@ typedef crypto_generichash_blake2b_state blake2b_state;
174
184
  #endif
175
185
 
176
186
  #endif
177
-
@@ -41,7 +41,7 @@ void fe_cswap(fe f,fe g,unsigned int b)
41
41
  crypto_int32 x7 = f7 ^ g7;
42
42
  crypto_int32 x8 = f8 ^ g8;
43
43
  crypto_int32 x9 = f9 ^ g9;
44
- b = -b;
44
+ b = (unsigned int) (- (int) b);
45
45
  x0 &= b;
46
46
  x1 &= b;
47
47
  x2 &= b;
@@ -39,7 +39,7 @@ void fe_cmov(fe f,const fe g,unsigned int b)
39
39
  crypto_int32 x7 = f7 ^ g7;
40
40
  crypto_int32 x8 = f8 ^ g8;
41
41
  crypto_int32 x9 = f9 ^ g9;
42
- b = -b;
42
+ b = (unsigned int) (- (int) b);
43
43
  x0 &= b;
44
44
  x1 &= b;
45
45
  x2 &= b;
@@ -48,17 +48,17 @@ void fe_frombytes(fe h,const unsigned char *s)
48
48
  crypto_int64 carry8;
49
49
  crypto_int64 carry9;
50
50
 
51
- carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
52
- carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
53
- carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
54
- carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
55
- carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
51
+ carry9 = (h9 + (crypto_int64) (1L << 24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
52
+ carry1 = (h1 + (crypto_int64) (1L << 24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
53
+ carry3 = (h3 + (crypto_int64) (1L << 24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
54
+ carry5 = (h5 + (crypto_int64) (1L << 24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
55
+ carry7 = (h7 + (crypto_int64) (1L << 24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
56
56
 
57
- carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
58
- carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
59
- carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
60
- carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
61
- carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
57
+ carry0 = (h0 + (crypto_int64) (1L << 25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
58
+ carry2 = (h2 + (crypto_int64) (1L << 25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
59
+ carry4 = (h4 + (crypto_int64) (1L << 25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
60
+ carry6 = (h6 + (crypto_int64) (1L << 25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
61
+ carry8 = (h8 + (crypto_int64) (1L << 25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
62
62
 
63
63
  h[0] = (crypto_int32) h0;
64
64
  h[1] = (crypto_int32) h1;
@@ -197,46 +197,46 @@ void fe_mul(fe h,const fe f,const fe g)
197
197
  i.e. |h1| <= 1.7*2^59; narrower ranges for h3, h5, h7, h9
198
198
  */
199
199
 
200
- carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
201
- carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
200
+ carry0 = (h0 + (crypto_int64) (1L << 25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
201
+ carry4 = (h4 + (crypto_int64) (1L << 25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
202
202
  /* |h0| <= 2^25 */
203
203
  /* |h4| <= 2^25 */
204
204
  /* |h1| <= 1.71*2^59 */
205
205
  /* |h5| <= 1.71*2^59 */
206
206
 
207
- carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
208
- carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
207
+ carry1 = (h1 + (crypto_int64) (1L << 24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
208
+ carry5 = (h5 + (crypto_int64) (1L << 24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
209
209
  /* |h1| <= 2^24; from now on fits into int32 */
210
210
  /* |h5| <= 2^24; from now on fits into int32 */
211
211
  /* |h2| <= 1.41*2^60 */
212
212
  /* |h6| <= 1.41*2^60 */
213
213
 
214
- carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
215
- carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
214
+ carry2 = (h2 + (crypto_int64) (1L << 25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
215
+ carry6 = (h6 + (crypto_int64) (1L << 25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
216
216
  /* |h2| <= 2^25; from now on fits into int32 unchanged */
217
217
  /* |h6| <= 2^25; from now on fits into int32 unchanged */
218
218
  /* |h3| <= 1.71*2^59 */
219
219
  /* |h7| <= 1.71*2^59 */
220
220
 
221
- carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
222
- carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
221
+ carry3 = (h3 + (crypto_int64) (1L << 24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
222
+ carry7 = (h7 + (crypto_int64) (1L << 24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
223
223
  /* |h3| <= 2^24; from now on fits into int32 unchanged */
224
224
  /* |h7| <= 2^24; from now on fits into int32 unchanged */
225
225
  /* |h4| <= 1.72*2^34 */
226
226
  /* |h8| <= 1.41*2^60 */
227
227
 
228
- carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
229
- carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
228
+ carry4 = (h4 + (crypto_int64) (1L << 25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
229
+ carry8 = (h8 + (crypto_int64) (1L << 25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
230
230
  /* |h4| <= 2^25; from now on fits into int32 unchanged */
231
231
  /* |h8| <= 2^25; from now on fits into int32 unchanged */
232
232
  /* |h5| <= 1.01*2^24 */
233
233
  /* |h9| <= 1.71*2^59 */
234
234
 
235
- carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
235
+ carry9 = (h9 + (crypto_int64) (1L << 24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
236
236
  /* |h9| <= 2^24; from now on fits into int32 unchanged */
237
237
  /* |h0| <= 1.1*2^39 */
238
238
 
239
- carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
239
+ carry0 = (h0 + (crypto_int64) (1L << 25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
240
240
  /* |h0| <= 2^25; from now on fits into int32 unchanged */
241
241
  /* |h1| <= 1.01*2^24 */
242
242
 
@@ -117,24 +117,24 @@ void fe_sq(fe h,const fe f)
117
117
  crypto_int64 carry8;
118
118
  crypto_int64 carry9;
119
119
 
120
- carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
121
- carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
120
+ carry0 = (h0 + (crypto_int64) (1L << 25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
121
+ carry4 = (h4 + (crypto_int64) (1L << 25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
122
122
 
123
- carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
124
- carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
123
+ carry1 = (h1 + (crypto_int64) (1L << 24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
124
+ carry5 = (h5 + (crypto_int64) (1L << 24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
125
125
 
126
- carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
127
- carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
126
+ carry2 = (h2 + (crypto_int64) (1L << 25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
127
+ carry6 = (h6 + (crypto_int64) (1L << 25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
128
128
 
129
- carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
130
- carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
129
+ carry3 = (h3 + (crypto_int64) (1L << 24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
130
+ carry7 = (h7 + (crypto_int64) (1L << 24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
131
131
 
132
- carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
133
- carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
132
+ carry4 = (h4 + (crypto_int64) (1L << 25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
133
+ carry8 = (h8 + (crypto_int64) (1L << 25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
134
134
 
135
- carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
135
+ carry9 = (h9 + (crypto_int64) (1L << 24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
136
136
 
137
- carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
137
+ carry0 = (h0 + (crypto_int64) (1L << 25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
138
138
 
139
139
  h[0] = (crypto_int32) h0;
140
140
  h[1] = (crypto_int32) h1;
@@ -128,24 +128,24 @@ void fe_sq2(fe h,const fe f)
128
128
  h8 += h8;
129
129
  h9 += h9;
130
130
 
131
- carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
132
- carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
131
+ carry0 = (h0 + (crypto_int64) (1L << 25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
132
+ carry4 = (h4 + (crypto_int64) (1L << 25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
133
133
 
134
- carry1 = (h1 + (crypto_int64) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
135
- carry5 = (h5 + (crypto_int64) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
134
+ carry1 = (h1 + (crypto_int64) (1L << 24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
135
+ carry5 = (h5 + (crypto_int64) (1L << 24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
136
136
 
137
- carry2 = (h2 + (crypto_int64) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
138
- carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
137
+ carry2 = (h2 + (crypto_int64) (1L << 25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
138
+ carry6 = (h6 + (crypto_int64) (1L << 25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
139
139
 
140
- carry3 = (h3 + (crypto_int64) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
141
- carry7 = (h7 + (crypto_int64) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
140
+ carry3 = (h3 + (crypto_int64) (1L << 24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
141
+ carry7 = (h7 + (crypto_int64) (1L << 24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
142
142
 
143
- carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
144
- carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
143
+ carry4 = (h4 + (crypto_int64) (1L << 25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
144
+ carry8 = (h8 + (crypto_int64) (1L << 25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
145
145
 
146
- carry9 = (h9 + (crypto_int64) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
146
+ carry9 = (h9 + (crypto_int64) (1L << 24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
147
147
 
148
- carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
148
+ carry0 = (h0 + (crypto_int64) (1L << 25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
149
149
 
150
150
  h[0] = (crypto_int32) h0;
151
151
  h[1] = (crypto_int32) h1;
@@ -144,30 +144,30 @@ void sc_muladd(unsigned char *s,const unsigned char *a,const unsigned char *b,co
144
144
  s22 = a11*b11;
145
145
  s23 = 0;
146
146
 
147
- carry0 = (s0 + (1<<20)) >> 21; s1 += carry0; s0 -= carry0 << 21;
148
- carry2 = (s2 + (1<<20)) >> 21; s3 += carry2; s2 -= carry2 << 21;
149
- carry4 = (s4 + (1<<20)) >> 21; s5 += carry4; s4 -= carry4 << 21;
150
- carry6 = (s6 + (1<<20)) >> 21; s7 += carry6; s6 -= carry6 << 21;
151
- carry8 = (s8 + (1<<20)) >> 21; s9 += carry8; s8 -= carry8 << 21;
152
- carry10 = (s10 + (1<<20)) >> 21; s11 += carry10; s10 -= carry10 << 21;
153
- carry12 = (s12 + (1<<20)) >> 21; s13 += carry12; s12 -= carry12 << 21;
154
- carry14 = (s14 + (1<<20)) >> 21; s15 += carry14; s14 -= carry14 << 21;
155
- carry16 = (s16 + (1<<20)) >> 21; s17 += carry16; s16 -= carry16 << 21;
156
- carry18 = (s18 + (1<<20)) >> 21; s19 += carry18; s18 -= carry18 << 21;
157
- carry20 = (s20 + (1<<20)) >> 21; s21 += carry20; s20 -= carry20 << 21;
158
- carry22 = (s22 + (1<<20)) >> 21; s23 += carry22; s22 -= carry22 << 21;
159
-
160
- carry1 = (s1 + (1<<20)) >> 21; s2 += carry1; s1 -= carry1 << 21;
161
- carry3 = (s3 + (1<<20)) >> 21; s4 += carry3; s3 -= carry3 << 21;
162
- carry5 = (s5 + (1<<20)) >> 21; s6 += carry5; s5 -= carry5 << 21;
163
- carry7 = (s7 + (1<<20)) >> 21; s8 += carry7; s7 -= carry7 << 21;
164
- carry9 = (s9 + (1<<20)) >> 21; s10 += carry9; s9 -= carry9 << 21;
165
- carry11 = (s11 + (1<<20)) >> 21; s12 += carry11; s11 -= carry11 << 21;
166
- carry13 = (s13 + (1<<20)) >> 21; s14 += carry13; s13 -= carry13 << 21;
167
- carry15 = (s15 + (1<<20)) >> 21; s16 += carry15; s15 -= carry15 << 21;
168
- carry17 = (s17 + (1<<20)) >> 21; s18 += carry17; s17 -= carry17 << 21;
169
- carry19 = (s19 + (1<<20)) >> 21; s20 += carry19; s19 -= carry19 << 21;
170
- carry21 = (s21 + (1<<20)) >> 21; s22 += carry21; s21 -= carry21 << 21;
147
+ carry0 = (s0 + (1L << 20)) >> 21; s1 += carry0; s0 -= carry0 * (1L << 21);
148
+ carry2 = (s2 + (1L << 20)) >> 21; s3 += carry2; s2 -= carry2 * (1L << 21);
149
+ carry4 = (s4 + (1L << 20)) >> 21; s5 += carry4; s4 -= carry4 * (1L << 21);
150
+ carry6 = (s6 + (1L << 20)) >> 21; s7 += carry6; s6 -= carry6 * (1L << 21);
151
+ carry8 = (s8 + (1L << 20)) >> 21; s9 += carry8; s8 -= carry8 * (1L << 21);
152
+ carry10 = (s10 + (1L << 20)) >> 21; s11 += carry10; s10 -= carry10 * (1L << 21);
153
+ carry12 = (s12 + (1L << 20)) >> 21; s13 += carry12; s12 -= carry12 * (1L << 21);
154
+ carry14 = (s14 + (1L << 20)) >> 21; s15 += carry14; s14 -= carry14 * (1L << 21);
155
+ carry16 = (s16 + (1L << 20)) >> 21; s17 += carry16; s16 -= carry16 * (1L << 21);
156
+ carry18 = (s18 + (1L << 20)) >> 21; s19 += carry18; s18 -= carry18 * (1L << 21);
157
+ carry20 = (s20 + (1L << 20)) >> 21; s21 += carry20; s20 -= carry20 * (1L << 21);
158
+ carry22 = (s22 + (1L << 20)) >> 21; s23 += carry22; s22 -= carry22 * (1L << 21);
159
+
160
+ carry1 = (s1 + (1L << 20)) >> 21; s2 += carry1; s1 -= carry1 * (1L << 21);
161
+ carry3 = (s3 + (1L << 20)) >> 21; s4 += carry3; s3 -= carry3 * (1L << 21);
162
+ carry5 = (s5 + (1L << 20)) >> 21; s6 += carry5; s5 -= carry5 * (1L << 21);
163
+ carry7 = (s7 + (1L << 20)) >> 21; s8 += carry7; s7 -= carry7 * (1L << 21);
164
+ carry9 = (s9 + (1L << 20)) >> 21; s10 += carry9; s9 -= carry9 * (1L << 21);
165
+ carry11 = (s11 + (1L << 20)) >> 21; s12 += carry11; s11 -= carry11 * (1L << 21);
166
+ carry13 = (s13 + (1L << 20)) >> 21; s14 += carry13; s13 -= carry13 * (1L << 21);
167
+ carry15 = (s15 + (1L << 20)) >> 21; s16 += carry15; s15 -= carry15 * (1L << 21);
168
+ carry17 = (s17 + (1L << 20)) >> 21; s18 += carry17; s17 -= carry17 * (1L << 21);
169
+ carry19 = (s19 + (1L << 20)) >> 21; s20 += carry19; s19 -= carry19 * (1L << 21);
170
+ carry21 = (s21 + (1L << 20)) >> 21; s22 += carry21; s21 -= carry21 * (1L << 21);
171
171
 
172
172
  s11 += s23 * 666643;
173
173
  s12 += s23 * 470296;
@@ -217,18 +217,18 @@ void sc_muladd(unsigned char *s,const unsigned char *a,const unsigned char *b,co
217
217
  s11 -= s18 * 683901;
218
218
 
219
219
 
220
- carry6 = (s6 + (1<<20)) >> 21; s7 += carry6; s6 -= carry6 << 21;
221
- carry8 = (s8 + (1<<20)) >> 21; s9 += carry8; s8 -= carry8 << 21;
222
- carry10 = (s10 + (1<<20)) >> 21; s11 += carry10; s10 -= carry10 << 21;
223
- carry12 = (s12 + (1<<20)) >> 21; s13 += carry12; s12 -= carry12 << 21;
224
- carry14 = (s14 + (1<<20)) >> 21; s15 += carry14; s14 -= carry14 << 21;
225
- carry16 = (s16 + (1<<20)) >> 21; s17 += carry16; s16 -= carry16 << 21;
220
+ carry6 = (s6 + (1L << 20)) >> 21; s7 += carry6; s6 -= carry6 * (1L << 21);
221
+ carry8 = (s8 + (1L << 20)) >> 21; s9 += carry8; s8 -= carry8 * (1L << 21);
222
+ carry10 = (s10 + (1L << 20)) >> 21; s11 += carry10; s10 -= carry10 * (1L << 21);
223
+ carry12 = (s12 + (1L << 20)) >> 21; s13 += carry12; s12 -= carry12 * (1L << 21);
224
+ carry14 = (s14 + (1L << 20)) >> 21; s15 += carry14; s14 -= carry14 * (1L << 21);
225
+ carry16 = (s16 + (1L << 20)) >> 21; s17 += carry16; s16 -= carry16 * (1L << 21);
226
226
 
227
- carry7 = (s7 + (1<<20)) >> 21; s8 += carry7; s7 -= carry7 << 21;
228
- carry9 = (s9 + (1<<20)) >> 21; s10 += carry9; s9 -= carry9 << 21;
229
- carry11 = (s11 + (1<<20)) >> 21; s12 += carry11; s11 -= carry11 << 21;
230
- carry13 = (s13 + (1<<20)) >> 21; s14 += carry13; s13 -= carry13 << 21;
231
- carry15 = (s15 + (1<<20)) >> 21; s16 += carry15; s15 -= carry15 << 21;
227
+ carry7 = (s7 + (1L << 20)) >> 21; s8 += carry7; s7 -= carry7 * (1L << 21);
228
+ carry9 = (s9 + (1L << 20)) >> 21; s10 += carry9; s9 -= carry9 * (1L << 21);
229
+ carry11 = (s11 + (1L << 20)) >> 21; s12 += carry11; s11 -= carry11 * (1L << 21);
230
+ carry13 = (s13 + (1L << 20)) >> 21; s14 += carry13; s13 -= carry13 * (1L << 21);
231
+ carry15 = (s15 + (1L << 20)) >> 21; s16 += carry15; s15 -= carry15 * (1L << 21);
232
232
 
233
233
  s5 += s17 * 666643;
234
234
  s6 += s17 * 470296;
@@ -278,19 +278,19 @@ void sc_muladd(unsigned char *s,const unsigned char *a,const unsigned char *b,co
278
278
  s5 -= s12 * 683901;
279
279
  s12 = 0;
280
280
 
281
- carry0 = (s0 + (1<<20)) >> 21; s1 += carry0; s0 -= carry0 << 21;
282
- carry2 = (s2 + (1<<20)) >> 21; s3 += carry2; s2 -= carry2 << 21;
283
- carry4 = (s4 + (1<<20)) >> 21; s5 += carry4; s4 -= carry4 << 21;
284
- carry6 = (s6 + (1<<20)) >> 21; s7 += carry6; s6 -= carry6 << 21;
285
- carry8 = (s8 + (1<<20)) >> 21; s9 += carry8; s8 -= carry8 << 21;
286
- carry10 = (s10 + (1<<20)) >> 21; s11 += carry10; s10 -= carry10 << 21;
281
+ carry0 = (s0 + (1L << 20)) >> 21; s1 += carry0; s0 -= carry0 * (1L << 21);
282
+ carry2 = (s2 + (1L << 20)) >> 21; s3 += carry2; s2 -= carry2 * (1L << 21);
283
+ carry4 = (s4 + (1L << 20)) >> 21; s5 += carry4; s4 -= carry4 * (1L << 21);
284
+ carry6 = (s6 + (1L << 20)) >> 21; s7 += carry6; s6 -= carry6 * (1L << 21);
285
+ carry8 = (s8 + (1L << 20)) >> 21; s9 += carry8; s8 -= carry8 * (1L << 21);
286
+ carry10 = (s10 + (1L << 20)) >> 21; s11 += carry10; s10 -= carry10 * (1L << 21);
287
287
 
288
- carry1 = (s1 + (1<<20)) >> 21; s2 += carry1; s1 -= carry1 << 21;
289
- carry3 = (s3 + (1<<20)) >> 21; s4 += carry3; s3 -= carry3 << 21;
290
- carry5 = (s5 + (1<<20)) >> 21; s6 += carry5; s5 -= carry5 << 21;
291
- carry7 = (s7 + (1<<20)) >> 21; s8 += carry7; s7 -= carry7 << 21;
292
- carry9 = (s9 + (1<<20)) >> 21; s10 += carry9; s9 -= carry9 << 21;
293
- carry11 = (s11 + (1<<20)) >> 21; s12 += carry11; s11 -= carry11 << 21;
288
+ carry1 = (s1 + (1L << 20)) >> 21; s2 += carry1; s1 -= carry1 * (1L << 21);
289
+ carry3 = (s3 + (1L << 20)) >> 21; s4 += carry3; s3 -= carry3 * (1L << 21);
290
+ carry5 = (s5 + (1L << 20)) >> 21; s6 += carry5; s5 -= carry5 * (1L << 21);
291
+ carry7 = (s7 + (1L << 20)) >> 21; s8 += carry7; s7 -= carry7 * (1L << 21);
292
+ carry9 = (s9 + (1L << 20)) >> 21; s10 += carry9; s9 -= carry9 * (1L << 21);
293
+ carry11 = (s11 + (1L << 20)) >> 21; s12 += carry11; s11 -= carry11 * (1L << 21);
294
294
 
295
295
  s0 += s12 * 666643;
296
296
  s1 += s12 * 470296;
@@ -300,18 +300,18 @@ void sc_muladd(unsigned char *s,const unsigned char *a,const unsigned char *b,co
300
300
  s5 -= s12 * 683901;
301
301
  s12 = 0;
302
302
 
303
- carry0 = s0 >> 21; s1 += carry0; s0 -= carry0 << 21;
304
- carry1 = s1 >> 21; s2 += carry1; s1 -= carry1 << 21;
305
- carry2 = s2 >> 21; s3 += carry2; s2 -= carry2 << 21;
306
- carry3 = s3 >> 21; s4 += carry3; s3 -= carry3 << 21;
307
- carry4 = s4 >> 21; s5 += carry4; s4 -= carry4 << 21;
308
- carry5 = s5 >> 21; s6 += carry5; s5 -= carry5 << 21;
309
- carry6 = s6 >> 21; s7 += carry6; s6 -= carry6 << 21;
310
- carry7 = s7 >> 21; s8 += carry7; s7 -= carry7 << 21;
311
- carry8 = s8 >> 21; s9 += carry8; s8 -= carry8 << 21;
312
- carry9 = s9 >> 21; s10 += carry9; s9 -= carry9 << 21;
313
- carry10 = s10 >> 21; s11 += carry10; s10 -= carry10 << 21;
314
- carry11 = s11 >> 21; s12 += carry11; s11 -= carry11 << 21;
303
+ carry0 = s0 >> 21; s1 += carry0; s0 -= carry0 * (1L << 21);
304
+ carry1 = s1 >> 21; s2 += carry1; s1 -= carry1 * (1L << 21);
305
+ carry2 = s2 >> 21; s3 += carry2; s2 -= carry2 * (1L << 21);
306
+ carry3 = s3 >> 21; s4 += carry3; s3 -= carry3 * (1L << 21);
307
+ carry4 = s4 >> 21; s5 += carry4; s4 -= carry4 * (1L << 21);
308
+ carry5 = s5 >> 21; s6 += carry5; s5 -= carry5 * (1L << 21);
309
+ carry6 = s6 >> 21; s7 += carry6; s6 -= carry6 * (1L << 21);
310
+ carry7 = s7 >> 21; s8 += carry7; s7 -= carry7 * (1L << 21);
311
+ carry8 = s8 >> 21; s9 += carry8; s8 -= carry8 * (1L << 21);
312
+ carry9 = s9 >> 21; s10 += carry9; s9 -= carry9 * (1L << 21);
313
+ carry10 = s10 >> 21; s11 += carry10; s10 -= carry10 * (1L << 21);
314
+ carry11 = s11 >> 21; s12 += carry11; s11 -= carry11 * (1L << 21);
315
315
 
316
316
  s0 += s12 * 666643;
317
317
  s1 += s12 * 470296;
@@ -321,17 +321,17 @@ void sc_muladd(unsigned char *s,const unsigned char *a,const unsigned char *b,co
321
321
  s5 -= s12 * 683901;
322
322
 
323
323
 
324
- carry0 = s0 >> 21; s1 += carry0; s0 -= carry0 << 21;
325
- carry1 = s1 >> 21; s2 += carry1; s1 -= carry1 << 21;
326
- carry2 = s2 >> 21; s3 += carry2; s2 -= carry2 << 21;
327
- carry3 = s3 >> 21; s4 += carry3; s3 -= carry3 << 21;
328
- carry4 = s4 >> 21; s5 += carry4; s4 -= carry4 << 21;
329
- carry5 = s5 >> 21; s6 += carry5; s5 -= carry5 << 21;
330
- carry6 = s6 >> 21; s7 += carry6; s6 -= carry6 << 21;
331
- carry7 = s7 >> 21; s8 += carry7; s7 -= carry7 << 21;
332
- carry8 = s8 >> 21; s9 += carry8; s8 -= carry8 << 21;
333
- carry9 = s9 >> 21; s10 += carry9; s9 -= carry9 << 21;
334
- carry10 = s10 >> 21; s11 += carry10; s10 -= carry10 << 21;
324
+ carry0 = s0 >> 21; s1 += carry0; s0 -= carry0 * (1L << 21);
325
+ carry1 = s1 >> 21; s2 += carry1; s1 -= carry1 * (1L << 21);
326
+ carry2 = s2 >> 21; s3 += carry2; s2 -= carry2 * (1L << 21);
327
+ carry3 = s3 >> 21; s4 += carry3; s3 -= carry3 * (1L << 21);
328
+ carry4 = s4 >> 21; s5 += carry4; s4 -= carry4 * (1L << 21);
329
+ carry5 = s5 >> 21; s6 += carry5; s5 -= carry5 * (1L << 21);
330
+ carry6 = s6 >> 21; s7 += carry6; s6 -= carry6 * (1L << 21);
331
+ carry7 = s7 >> 21; s8 += carry7; s7 -= carry7 * (1L << 21);
332
+ carry8 = s8 >> 21; s9 += carry8; s8 -= carry8 * (1L << 21);
333
+ carry9 = s9 >> 21; s10 += carry9; s9 -= carry9 * (1L << 21);
334
+ carry10 = s10 >> 21; s11 += carry10; s10 -= carry10 * (1L << 21);
335
335
 
336
336
  s[0] = s0 >> 0;
337
337
  s[1] = s0 >> 8;