rbnacl-libsodium 0.5.0.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/lib/rbnacl/libsodium/version.rb +1 -1
- data/vendor/libsodium/AUTHORS +62 -81
- data/vendor/libsodium/ChangeLog +31 -1
- data/vendor/libsodium/README.markdown +15 -364
- data/vendor/libsodium/THANKS +6 -0
- data/vendor/libsodium/autom4te.cache/output.0 +67 -36
- data/vendor/libsodium/autom4te.cache/output.1 +67 -36
- data/vendor/libsodium/autom4te.cache/output.2 +67 -36
- data/vendor/libsodium/autom4te.cache/traces.0 +52 -51
- data/vendor/libsodium/autom4te.cache/traces.1 +137 -133
- data/vendor/libsodium/autom4te.cache/traces.2 +52 -51
- data/vendor/libsodium/builds/msvc/version.h +2 -2
- data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj +365 -345
- data/vendor/libsodium/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters +1114 -1037
- data/vendor/libsodium/builds/msvc/vs2010/test/test.props +8 -2
- data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj +364 -344
- data/vendor/libsodium/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters +1113 -1036
- data/vendor/libsodium/builds/msvc/vs2012/test/test.props +8 -2
- data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj +365 -345
- data/vendor/libsodium/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters +1114 -1037
- data/vendor/libsodium/builds/msvc/vs2013/test/test.props +8 -2
- data/vendor/libsodium/configure +66 -35
- data/vendor/libsodium/configure.ac +25 -14
- data/vendor/libsodium/dist-build/ios.sh +1 -1
- data/vendor/libsodium/dist-build/msys2-win64.sh +1 -1
- data/vendor/libsodium/libsodium.vcxproj +29 -14
- data/vendor/libsodium/libsodium.vcxproj.filters +77 -28
- data/vendor/libsodium/msvc-scripts/process.bat +3 -3
- data/vendor/libsodium/packaging/nuget/package.config +1 -1
- data/vendor/libsodium/packaging/nuget/package.gsl +6 -1
- data/vendor/libsodium/packaging/nuget/package.nuspec +1 -1
- data/vendor/libsodium/src/libsodium/Makefile.am +31 -13
- data/vendor/libsodium/src/libsodium/Makefile.in +406 -155
- data/vendor/libsodium/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c +146 -0
- data/vendor/libsodium/src/libsodium/crypto_box/crypto_box.c +13 -0
- data/vendor/libsodium/src/libsodium/crypto_box/crypto_box_easy.c +39 -73
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c +5 -0
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/api.h +2 -0
- data/vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c +15 -0
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c +6 -5
- data/vendor/libsodium/src/libsodium/crypto_generichash/blake2/ref/blake2s-ref.c +6 -5
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/crypto_onetimeauth.c +25 -0
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/auth_poly1305_donna.c +76 -47
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.h +30 -7
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h +3 -16
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h +3 -10
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/verify_poly1305_donna.c +11 -6
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c +23 -1
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305_try.c +1 -1
- data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256 → scryptsalsa208sha256}/crypto_scrypt-common.c +7 -7
- data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256 → scryptsalsa208sha256}/crypto_scrypt.h +6 -20
- data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256/nosse/pwhash_scryptxsalsa208sha256_nosse.c → scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c} +0 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256 → scryptsalsa208sha256}/pbkdf2-sha256.c +1 -11
- data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256 → scryptsalsa208sha256}/pbkdf2-sha256.h +0 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256/pwhash_scryptxsalsa208sha256.c → scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c} +50 -25
- data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256 → scryptsalsa208sha256}/scrypt_platform.c +4 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256/sse/pwhash_scryptxsalsa208sha256_sse.c → scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c} +0 -0
- data/vendor/libsodium/src/libsodium/crypto_pwhash/{scryptxsalsa208sha256 → scryptsalsa208sha256}/sysendian.h +0 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/donna_c64/smult_curve25519_donna_c64.c +1 -1
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/{ref → ref10}/api.h +0 -3
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/base_curve25519_ref10.c +14 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe.h +44 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_0_curve25519_ref10.c +23 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_1_curve25519_ref10.c +23 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_add_curve25519_ref10.c +61 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_copy_curve25519_ref10.c +33 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_cswap_curve25519_ref10.c +77 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_frombytes_curve25519_ref10.c +73 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_invert_curve25519_ref10.c +18 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_mul121666_curve25519_ref10.c +74 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_mul_curve25519_ref10.c +257 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_sq_curve25519_ref10.c +153 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_sub_curve25519_ref10.c +61 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_tobytes_curve25519_ref10.c +123 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/montgomery.h +140 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/pow225521.h +160 -0
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/scalarmult_curve25519_ref10.c +54 -0
- data/vendor/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c +92 -61
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_scalarmult_base.c +3 -3
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow22523.h +2 -2
- data/vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/pow225521.h +2 -2
- data/vendor/libsodium/src/libsodium/crypto_sign/edwards25519sha512batch/ref/sc25519_edwards25519sha512batch.c +8 -4
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/consts_aes128ctr.c +3 -3
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128.h +6 -3
- data/vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/int128_aes128ctr.c +23 -23
- data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/api.h +12 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/ref/stream_chacha20_ref.c +275 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/chacha20/stream_chacha20_api.c +36 -0
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.S +11 -10
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c +8 -3
- data/vendor/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20_api.c +8 -0
- data/vendor/libsodium/src/libsodium/include/Makefile.am +3 -2
- data/vendor/libsodium/src/libsodium/include/Makefile.in +3 -2
- data/vendor/libsodium/src/libsodium/include/sodium.h +3 -1
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h +55 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_box.h +21 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h +11 -1
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash.h +7 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h +7 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h +7 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth.h +15 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h +25 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h +80 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h +2 -2
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_secretbox.h +14 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h +11 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_aes256estream.h +11 -6
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_chacha20.h +49 -0
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_stream_salsa20.h +6 -0
- data/vendor/libsodium/src/libsodium/include/sodium/randombytes.h +7 -7
- data/vendor/libsodium/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +10 -14
- data/vendor/libsodium/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +10 -13
- data/vendor/libsodium/src/libsodium/sodium/compat.c +55 -4
- data/vendor/libsodium/src/libsodium/sodium/utils.c +18 -0
- data/vendor/libsodium/test/default/Makefile.am +24 -12
- data/vendor/libsodium/test/default/Makefile.in +116 -73
- data/vendor/libsodium/test/default/aead_chacha20poly1305.c +97 -0
- data/vendor/libsodium/test/default/aead_chacha20poly1305.exp +8 -0
- data/vendor/libsodium/test/default/box_easy.c +1 -1
- data/vendor/libsodium/test/default/box_seed.c +28 -0
- data/vendor/libsodium/test/default/box_seed.exp +8 -0
- data/vendor/libsodium/test/default/chacha20.c +45 -0
- data/vendor/libsodium/test/default/chacha20.exp +5 -0
- data/vendor/libsodium/test/default/pwhash.c +83 -15
- data/vendor/libsodium/test/default/pwhash.exp +10 -1
- data/vendor/libsodium/test/default/pwhash_scrypt_ll.c +67 -0
- data/vendor/libsodium/test/default/pwhash_scrypt_ll.exp +15 -0
- data/vendor/libsodium/test/default/secretbox_easy.c +13 -1
- data/vendor/libsodium/test/default/secretbox_easy.exp +19 -0
- data/vendor/libsodium/test/default/secretbox_easy2.c +5 -0
- data/vendor/libsodium/test/default/secretbox_easy2.exp +1 -0
- data/vendor/libsodium/test/default/sign.c +7 -3
- metadata +44 -21
- data/vendor/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/api.h +0 -8
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref/base_curve25519_ref.c +0 -20
- data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref/smult_curve25519_ref.c +0 -268
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_onetimeauth_poly1305_donna.h +0 -37
- data/vendor/libsodium/src/libsodium/include/sodium/crypto_pwhash_scryptxsalsa208sha256.h +0 -48
- data/vendor/libsodium/test/default/scalarmult7.c +0 -32
- data/vendor/libsodium/test/default/scalarmult7.exp +0 -1
- data/vendor/libsodium/test/default/scalarmult8.c +0 -32
- data/vendor/libsodium/test/default/scalarmult8.exp +0 -1
data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_sub_curve25519_ref10.c
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
#include "fe.h"
|
2
|
+
|
3
|
+
#ifndef HAVE_TI_MODE
|
4
|
+
|
5
|
+
/*
|
6
|
+
h = f - g
|
7
|
+
Can overlap h with f or g.
|
8
|
+
|
9
|
+
Preconditions:
|
10
|
+
|f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
|
11
|
+
|g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
|
12
|
+
|
13
|
+
Postconditions:
|
14
|
+
|h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
|
15
|
+
*/
|
16
|
+
|
17
|
+
void fe_sub(fe h,fe f,fe g)
|
18
|
+
{
|
19
|
+
crypto_int32 f0 = f[0];
|
20
|
+
crypto_int32 f1 = f[1];
|
21
|
+
crypto_int32 f2 = f[2];
|
22
|
+
crypto_int32 f3 = f[3];
|
23
|
+
crypto_int32 f4 = f[4];
|
24
|
+
crypto_int32 f5 = f[5];
|
25
|
+
crypto_int32 f6 = f[6];
|
26
|
+
crypto_int32 f7 = f[7];
|
27
|
+
crypto_int32 f8 = f[8];
|
28
|
+
crypto_int32 f9 = f[9];
|
29
|
+
crypto_int32 g0 = g[0];
|
30
|
+
crypto_int32 g1 = g[1];
|
31
|
+
crypto_int32 g2 = g[2];
|
32
|
+
crypto_int32 g3 = g[3];
|
33
|
+
crypto_int32 g4 = g[4];
|
34
|
+
crypto_int32 g5 = g[5];
|
35
|
+
crypto_int32 g6 = g[6];
|
36
|
+
crypto_int32 g7 = g[7];
|
37
|
+
crypto_int32 g8 = g[8];
|
38
|
+
crypto_int32 g9 = g[9];
|
39
|
+
crypto_int32 h0 = f0 - g0;
|
40
|
+
crypto_int32 h1 = f1 - g1;
|
41
|
+
crypto_int32 h2 = f2 - g2;
|
42
|
+
crypto_int32 h3 = f3 - g3;
|
43
|
+
crypto_int32 h4 = f4 - g4;
|
44
|
+
crypto_int32 h5 = f5 - g5;
|
45
|
+
crypto_int32 h6 = f6 - g6;
|
46
|
+
crypto_int32 h7 = f7 - g7;
|
47
|
+
crypto_int32 h8 = f8 - g8;
|
48
|
+
crypto_int32 h9 = f9 - g9;
|
49
|
+
h[0] = h0;
|
50
|
+
h[1] = h1;
|
51
|
+
h[2] = h2;
|
52
|
+
h[3] = h3;
|
53
|
+
h[4] = h4;
|
54
|
+
h[5] = h5;
|
55
|
+
h[6] = h6;
|
56
|
+
h[7] = h7;
|
57
|
+
h[8] = h8;
|
58
|
+
h[9] = h9;
|
59
|
+
}
|
60
|
+
|
61
|
+
#endif
|
data/vendor/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_tobytes_curve25519_ref10.c
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
#include "fe.h"
|
2
|
+
|
3
|
+
#ifndef HAVE_TI_MODE
|
4
|
+
|
5
|
+
/*
|
6
|
+
Preconditions:
|
7
|
+
|h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
|
8
|
+
|
9
|
+
Write p=2^255-19; q=floor(h/p).
|
10
|
+
Basic claim: q = floor(2^(-255)(h + 19 2^(-25)h9 + 2^(-1))).
|
11
|
+
|
12
|
+
Proof:
|
13
|
+
Have |h|<=p so |q|<=1 so |19^2 2^(-255) q|<1/4.
|
14
|
+
Also have |h-2^230 h9|<2^230 so |19 2^(-255)(h-2^230 h9)|<1/4.
|
15
|
+
|
16
|
+
Write y=2^(-1)-19^2 2^(-255)q-19 2^(-255)(h-2^230 h9).
|
17
|
+
Then 0<y<1.
|
18
|
+
|
19
|
+
Write r=h-pq.
|
20
|
+
Have 0<=r<=p-1=2^255-20.
|
21
|
+
Thus 0<=r+19(2^-255)r<r+19(2^-255)2^255<=2^255-1.
|
22
|
+
|
23
|
+
Write x=r+19(2^-255)r+y.
|
24
|
+
Then 0<x<2^255 so floor(2^(-255)x) = 0 so floor(q+2^(-255)x) = q.
|
25
|
+
|
26
|
+
Have q+2^(-255)x = 2^(-255)(h + 19 2^(-25) h9 + 2^(-1))
|
27
|
+
so floor(2^(-255)(h + 19 2^(-25) h9 + 2^(-1))) = q.
|
28
|
+
*/
|
29
|
+
|
30
|
+
void fe_tobytes(unsigned char *s,fe h)
|
31
|
+
{
|
32
|
+
crypto_int32 h0 = h[0];
|
33
|
+
crypto_int32 h1 = h[1];
|
34
|
+
crypto_int32 h2 = h[2];
|
35
|
+
crypto_int32 h3 = h[3];
|
36
|
+
crypto_int32 h4 = h[4];
|
37
|
+
crypto_int32 h5 = h[5];
|
38
|
+
crypto_int32 h6 = h[6];
|
39
|
+
crypto_int32 h7 = h[7];
|
40
|
+
crypto_int32 h8 = h[8];
|
41
|
+
crypto_int32 h9 = h[9];
|
42
|
+
crypto_int32 q;
|
43
|
+
crypto_int32 carry0;
|
44
|
+
crypto_int32 carry1;
|
45
|
+
crypto_int32 carry2;
|
46
|
+
crypto_int32 carry3;
|
47
|
+
crypto_int32 carry4;
|
48
|
+
crypto_int32 carry5;
|
49
|
+
crypto_int32 carry6;
|
50
|
+
crypto_int32 carry7;
|
51
|
+
crypto_int32 carry8;
|
52
|
+
crypto_int32 carry9;
|
53
|
+
|
54
|
+
q = (19 * h9 + (((crypto_int32) 1) << 24)) >> 25;
|
55
|
+
q = (h0 + q) >> 26;
|
56
|
+
q = (h1 + q) >> 25;
|
57
|
+
q = (h2 + q) >> 26;
|
58
|
+
q = (h3 + q) >> 25;
|
59
|
+
q = (h4 + q) >> 26;
|
60
|
+
q = (h5 + q) >> 25;
|
61
|
+
q = (h6 + q) >> 26;
|
62
|
+
q = (h7 + q) >> 25;
|
63
|
+
q = (h8 + q) >> 26;
|
64
|
+
q = (h9 + q) >> 25;
|
65
|
+
|
66
|
+
/* Goal: Output h-(2^255-19)q, which is between 0 and 2^255-20. */
|
67
|
+
h0 += 19 * q;
|
68
|
+
/* Goal: Output h-2^255 q, which is between 0 and 2^255-20. */
|
69
|
+
|
70
|
+
carry0 = h0 >> 26; h1 += carry0; h0 -= carry0 << 26;
|
71
|
+
carry1 = h1 >> 25; h2 += carry1; h1 -= carry1 << 25;
|
72
|
+
carry2 = h2 >> 26; h3 += carry2; h2 -= carry2 << 26;
|
73
|
+
carry3 = h3 >> 25; h4 += carry3; h3 -= carry3 << 25;
|
74
|
+
carry4 = h4 >> 26; h5 += carry4; h4 -= carry4 << 26;
|
75
|
+
carry5 = h5 >> 25; h6 += carry5; h5 -= carry5 << 25;
|
76
|
+
carry6 = h6 >> 26; h7 += carry6; h6 -= carry6 << 26;
|
77
|
+
carry7 = h7 >> 25; h8 += carry7; h7 -= carry7 << 25;
|
78
|
+
carry8 = h8 >> 26; h9 += carry8; h8 -= carry8 << 26;
|
79
|
+
carry9 = h9 >> 25; h9 -= carry9 << 25;
|
80
|
+
/* h10 = carry9 */
|
81
|
+
|
82
|
+
/*
|
83
|
+
Goal: Output h0+...+2^255 h10-2^255 q, which is between 0 and 2^255-20.
|
84
|
+
Have h0+...+2^230 h9 between 0 and 2^255-1;
|
85
|
+
evidently 2^255 h10-2^255 q = 0.
|
86
|
+
Goal: Output h0+...+2^230 h9.
|
87
|
+
*/
|
88
|
+
|
89
|
+
s[0] = h0 >> 0;
|
90
|
+
s[1] = h0 >> 8;
|
91
|
+
s[2] = h0 >> 16;
|
92
|
+
s[3] = (h0 >> 24) | (h1 << 2);
|
93
|
+
s[4] = h1 >> 6;
|
94
|
+
s[5] = h1 >> 14;
|
95
|
+
s[6] = (h1 >> 22) | (h2 << 3);
|
96
|
+
s[7] = h2 >> 5;
|
97
|
+
s[8] = h2 >> 13;
|
98
|
+
s[9] = (h2 >> 21) | (h3 << 5);
|
99
|
+
s[10] = h3 >> 3;
|
100
|
+
s[11] = h3 >> 11;
|
101
|
+
s[12] = (h3 >> 19) | (h4 << 6);
|
102
|
+
s[13] = h4 >> 2;
|
103
|
+
s[14] = h4 >> 10;
|
104
|
+
s[15] = h4 >> 18;
|
105
|
+
s[16] = h5 >> 0;
|
106
|
+
s[17] = h5 >> 8;
|
107
|
+
s[18] = h5 >> 16;
|
108
|
+
s[19] = (h5 >> 24) | (h6 << 1);
|
109
|
+
s[20] = h6 >> 7;
|
110
|
+
s[21] = h6 >> 15;
|
111
|
+
s[22] = (h6 >> 23) | (h7 << 3);
|
112
|
+
s[23] = h7 >> 5;
|
113
|
+
s[24] = h7 >> 13;
|
114
|
+
s[25] = (h7 >> 21) | (h8 << 4);
|
115
|
+
s[26] = h8 >> 4;
|
116
|
+
s[27] = h8 >> 12;
|
117
|
+
s[28] = (h8 >> 20) | (h9 << 6);
|
118
|
+
s[29] = h9 >> 2;
|
119
|
+
s[30] = h9 >> 10;
|
120
|
+
s[31] = h9 >> 18;
|
121
|
+
}
|
122
|
+
|
123
|
+
#endif
|
@@ -0,0 +1,140 @@
|
|
1
|
+
|
2
|
+
/* qhasm: fe X2 */
|
3
|
+
|
4
|
+
/* qhasm: fe Z2 */
|
5
|
+
|
6
|
+
/* qhasm: fe X3 */
|
7
|
+
|
8
|
+
/* qhasm: fe Z3 */
|
9
|
+
|
10
|
+
/* qhasm: fe X4 */
|
11
|
+
|
12
|
+
/* qhasm: fe Z4 */
|
13
|
+
|
14
|
+
/* qhasm: fe X5 */
|
15
|
+
|
16
|
+
/* qhasm: fe Z5 */
|
17
|
+
|
18
|
+
/* qhasm: fe A */
|
19
|
+
|
20
|
+
/* qhasm: fe B */
|
21
|
+
|
22
|
+
/* qhasm: fe C */
|
23
|
+
|
24
|
+
/* qhasm: fe D */
|
25
|
+
|
26
|
+
/* qhasm: fe E */
|
27
|
+
|
28
|
+
/* qhasm: fe AA */
|
29
|
+
|
30
|
+
/* qhasm: fe BB */
|
31
|
+
|
32
|
+
/* qhasm: fe DA */
|
33
|
+
|
34
|
+
/* qhasm: fe CB */
|
35
|
+
|
36
|
+
/* qhasm: fe t0 */
|
37
|
+
|
38
|
+
/* qhasm: fe t1 */
|
39
|
+
|
40
|
+
/* qhasm: fe t2 */
|
41
|
+
|
42
|
+
/* qhasm: fe t3 */
|
43
|
+
|
44
|
+
/* qhasm: fe t4 */
|
45
|
+
|
46
|
+
/* qhasm: enter ladder */
|
47
|
+
|
48
|
+
/* qhasm: D = X3-Z3 */
|
49
|
+
/* asm 1: fe_sub(>D=fe#5,<X3=fe#3,<Z3=fe#4); */
|
50
|
+
/* asm 2: fe_sub(>D=tmp0,<X3=x3,<Z3=z3); */
|
51
|
+
fe_sub(tmp0,x3,z3);
|
52
|
+
|
53
|
+
/* qhasm: B = X2-Z2 */
|
54
|
+
/* asm 1: fe_sub(>B=fe#6,<X2=fe#1,<Z2=fe#2); */
|
55
|
+
/* asm 2: fe_sub(>B=tmp1,<X2=x2,<Z2=z2); */
|
56
|
+
fe_sub(tmp1,x2,z2);
|
57
|
+
|
58
|
+
/* qhasm: A = X2+Z2 */
|
59
|
+
/* asm 1: fe_add(>A=fe#1,<X2=fe#1,<Z2=fe#2); */
|
60
|
+
/* asm 2: fe_add(>A=x2,<X2=x2,<Z2=z2); */
|
61
|
+
fe_add(x2,x2,z2);
|
62
|
+
|
63
|
+
/* qhasm: C = X3+Z3 */
|
64
|
+
/* asm 1: fe_add(>C=fe#2,<X3=fe#3,<Z3=fe#4); */
|
65
|
+
/* asm 2: fe_add(>C=z2,<X3=x3,<Z3=z3); */
|
66
|
+
fe_add(z2,x3,z3);
|
67
|
+
|
68
|
+
/* qhasm: DA = D*A */
|
69
|
+
/* asm 1: fe_mul(>DA=fe#4,<D=fe#5,<A=fe#1); */
|
70
|
+
/* asm 2: fe_mul(>DA=z3,<D=tmp0,<A=x2); */
|
71
|
+
fe_mul(z3,tmp0,x2);
|
72
|
+
|
73
|
+
/* qhasm: CB = C*B */
|
74
|
+
/* asm 1: fe_mul(>CB=fe#2,<C=fe#2,<B=fe#6); */
|
75
|
+
/* asm 2: fe_mul(>CB=z2,<C=z2,<B=tmp1); */
|
76
|
+
fe_mul(z2,z2,tmp1);
|
77
|
+
|
78
|
+
/* qhasm: BB = B^2 */
|
79
|
+
/* asm 1: fe_sq(>BB=fe#5,<B=fe#6); */
|
80
|
+
/* asm 2: fe_sq(>BB=tmp0,<B=tmp1); */
|
81
|
+
fe_sq(tmp0,tmp1);
|
82
|
+
|
83
|
+
/* qhasm: AA = A^2 */
|
84
|
+
/* asm 1: fe_sq(>AA=fe#6,<A=fe#1); */
|
85
|
+
/* asm 2: fe_sq(>AA=tmp1,<A=x2); */
|
86
|
+
fe_sq(tmp1,x2);
|
87
|
+
|
88
|
+
/* qhasm: t0 = DA+CB */
|
89
|
+
/* asm 1: fe_add(>t0=fe#3,<DA=fe#4,<CB=fe#2); */
|
90
|
+
/* asm 2: fe_add(>t0=x3,<DA=z3,<CB=z2); */
|
91
|
+
fe_add(x3,z3,z2);
|
92
|
+
|
93
|
+
/* qhasm: assign x3 to t0 */
|
94
|
+
|
95
|
+
/* qhasm: t1 = DA-CB */
|
96
|
+
/* asm 1: fe_sub(>t1=fe#2,<DA=fe#4,<CB=fe#2); */
|
97
|
+
/* asm 2: fe_sub(>t1=z2,<DA=z3,<CB=z2); */
|
98
|
+
fe_sub(z2,z3,z2);
|
99
|
+
|
100
|
+
/* qhasm: X4 = AA*BB */
|
101
|
+
/* asm 1: fe_mul(>X4=fe#1,<AA=fe#6,<BB=fe#5); */
|
102
|
+
/* asm 2: fe_mul(>X4=x2,<AA=tmp1,<BB=tmp0); */
|
103
|
+
fe_mul(x2,tmp1,tmp0);
|
104
|
+
|
105
|
+
/* qhasm: E = AA-BB */
|
106
|
+
/* asm 1: fe_sub(>E=fe#6,<AA=fe#6,<BB=fe#5); */
|
107
|
+
/* asm 2: fe_sub(>E=tmp1,<AA=tmp1,<BB=tmp0); */
|
108
|
+
fe_sub(tmp1,tmp1,tmp0);
|
109
|
+
|
110
|
+
/* qhasm: t2 = t1^2 */
|
111
|
+
/* asm 1: fe_sq(>t2=fe#2,<t1=fe#2); */
|
112
|
+
/* asm 2: fe_sq(>t2=z2,<t1=z2); */
|
113
|
+
fe_sq(z2,z2);
|
114
|
+
|
115
|
+
/* qhasm: t3 = a24*E */
|
116
|
+
/* asm 1: fe_mul121666(>t3=fe#4,<E=fe#6); */
|
117
|
+
/* asm 2: fe_mul121666(>t3=z3,<E=tmp1); */
|
118
|
+
fe_mul121666(z3,tmp1);
|
119
|
+
|
120
|
+
/* qhasm: X5 = t0^2 */
|
121
|
+
/* asm 1: fe_sq(>X5=fe#3,<t0=fe#3); */
|
122
|
+
/* asm 2: fe_sq(>X5=x3,<t0=x3); */
|
123
|
+
fe_sq(x3,x3);
|
124
|
+
|
125
|
+
/* qhasm: t4 = BB+t3 */
|
126
|
+
/* asm 1: fe_add(>t4=fe#5,<BB=fe#5,<t3=fe#4); */
|
127
|
+
/* asm 2: fe_add(>t4=tmp0,<BB=tmp0,<t3=z3); */
|
128
|
+
fe_add(tmp0,tmp0,z3);
|
129
|
+
|
130
|
+
/* qhasm: Z5 = X1*t2 */
|
131
|
+
/* asm 1: fe_mul(>Z5=fe#4,x1,<t2=fe#2); */
|
132
|
+
/* asm 2: fe_mul(>Z5=z3,x1,<t2=z2); */
|
133
|
+
fe_mul(z3,x1,z2);
|
134
|
+
|
135
|
+
/* qhasm: Z4 = E*t4 */
|
136
|
+
/* asm 1: fe_mul(>Z4=fe#2,<E=fe#6,<t4=fe#5); */
|
137
|
+
/* asm 2: fe_mul(>Z4=z2,<E=tmp1,<t4=tmp0); */
|
138
|
+
fe_mul(z2,tmp1,tmp0);
|
139
|
+
|
140
|
+
/* qhasm: return */
|
@@ -0,0 +1,160 @@
|
|
1
|
+
|
2
|
+
/* qhasm: fe z1 */
|
3
|
+
|
4
|
+
/* qhasm: fe z2 */
|
5
|
+
|
6
|
+
/* qhasm: fe z8 */
|
7
|
+
|
8
|
+
/* qhasm: fe z9 */
|
9
|
+
|
10
|
+
/* qhasm: fe z11 */
|
11
|
+
|
12
|
+
/* qhasm: fe z22 */
|
13
|
+
|
14
|
+
/* qhasm: fe z_5_0 */
|
15
|
+
|
16
|
+
/* qhasm: fe z_10_5 */
|
17
|
+
|
18
|
+
/* qhasm: fe z_10_0 */
|
19
|
+
|
20
|
+
/* qhasm: fe z_20_10 */
|
21
|
+
|
22
|
+
/* qhasm: fe z_20_0 */
|
23
|
+
|
24
|
+
/* qhasm: fe z_40_20 */
|
25
|
+
|
26
|
+
/* qhasm: fe z_40_0 */
|
27
|
+
|
28
|
+
/* qhasm: fe z_50_10 */
|
29
|
+
|
30
|
+
/* qhasm: fe z_50_0 */
|
31
|
+
|
32
|
+
/* qhasm: fe z_100_50 */
|
33
|
+
|
34
|
+
/* qhasm: fe z_100_0 */
|
35
|
+
|
36
|
+
/* qhasm: fe z_200_100 */
|
37
|
+
|
38
|
+
/* qhasm: fe z_200_0 */
|
39
|
+
|
40
|
+
/* qhasm: fe z_250_50 */
|
41
|
+
|
42
|
+
/* qhasm: fe z_250_0 */
|
43
|
+
|
44
|
+
/* qhasm: fe z_255_5 */
|
45
|
+
|
46
|
+
/* qhasm: fe z_255_21 */
|
47
|
+
|
48
|
+
/* qhasm: enter pow225521 */
|
49
|
+
|
50
|
+
/* qhasm: z2 = z1^2^1 */
|
51
|
+
/* asm 1: fe_sq(>z2=fe#1,<z1=fe#11); for (i = 1;i < 1;++i) fe_sq(>z2=fe#1,>z2=fe#1); */
|
52
|
+
/* asm 2: fe_sq(>z2=t0,<z1=z); for (i = 1;i < 1;++i) fe_sq(>z2=t0,>z2=t0); */
|
53
|
+
fe_sq(t0,z); for (i = 1;i < 1;++i) fe_sq(t0,t0);
|
54
|
+
|
55
|
+
/* qhasm: z8 = z2^2^2 */
|
56
|
+
/* asm 1: fe_sq(>z8=fe#2,<z2=fe#1); for (i = 1;i < 2;++i) fe_sq(>z8=fe#2,>z8=fe#2); */
|
57
|
+
/* asm 2: fe_sq(>z8=t1,<z2=t0); for (i = 1;i < 2;++i) fe_sq(>z8=t1,>z8=t1); */
|
58
|
+
fe_sq(t1,t0); for (i = 1;i < 2;++i) fe_sq(t1,t1);
|
59
|
+
|
60
|
+
/* qhasm: z9 = z1*z8 */
|
61
|
+
/* asm 1: fe_mul(>z9=fe#2,<z1=fe#11,<z8=fe#2); */
|
62
|
+
/* asm 2: fe_mul(>z9=t1,<z1=z,<z8=t1); */
|
63
|
+
fe_mul(t1,z,t1);
|
64
|
+
|
65
|
+
/* qhasm: z11 = z2*z9 */
|
66
|
+
/* asm 1: fe_mul(>z11=fe#1,<z2=fe#1,<z9=fe#2); */
|
67
|
+
/* asm 2: fe_mul(>z11=t0,<z2=t0,<z9=t1); */
|
68
|
+
fe_mul(t0,t0,t1);
|
69
|
+
|
70
|
+
/* qhasm: z22 = z11^2^1 */
|
71
|
+
/* asm 1: fe_sq(>z22=fe#3,<z11=fe#1); for (i = 1;i < 1;++i) fe_sq(>z22=fe#3,>z22=fe#3); */
|
72
|
+
/* asm 2: fe_sq(>z22=t2,<z11=t0); for (i = 1;i < 1;++i) fe_sq(>z22=t2,>z22=t2); */
|
73
|
+
fe_sq(t2,t0); for (i = 1;i < 1;++i) fe_sq(t2,t2);
|
74
|
+
|
75
|
+
/* qhasm: z_5_0 = z9*z22 */
|
76
|
+
/* asm 1: fe_mul(>z_5_0=fe#2,<z9=fe#2,<z22=fe#3); */
|
77
|
+
/* asm 2: fe_mul(>z_5_0=t1,<z9=t1,<z22=t2); */
|
78
|
+
fe_mul(t1,t1,t2);
|
79
|
+
|
80
|
+
/* qhasm: z_10_5 = z_5_0^2^5 */
|
81
|
+
/* asm 1: fe_sq(>z_10_5=fe#3,<z_5_0=fe#2); for (i = 1;i < 5;++i) fe_sq(>z_10_5=fe#3,>z_10_5=fe#3); */
|
82
|
+
/* asm 2: fe_sq(>z_10_5=t2,<z_5_0=t1); for (i = 1;i < 5;++i) fe_sq(>z_10_5=t2,>z_10_5=t2); */
|
83
|
+
fe_sq(t2,t1); for (i = 1;i < 5;++i) fe_sq(t2,t2);
|
84
|
+
|
85
|
+
/* qhasm: z_10_0 = z_10_5*z_5_0 */
|
86
|
+
/* asm 1: fe_mul(>z_10_0=fe#2,<z_10_5=fe#3,<z_5_0=fe#2); */
|
87
|
+
/* asm 2: fe_mul(>z_10_0=t1,<z_10_5=t2,<z_5_0=t1); */
|
88
|
+
fe_mul(t1,t2,t1);
|
89
|
+
|
90
|
+
/* qhasm: z_20_10 = z_10_0^2^10 */
|
91
|
+
/* asm 1: fe_sq(>z_20_10=fe#3,<z_10_0=fe#2); for (i = 1;i < 10;++i) fe_sq(>z_20_10=fe#3,>z_20_10=fe#3); */
|
92
|
+
/* asm 2: fe_sq(>z_20_10=t2,<z_10_0=t1); for (i = 1;i < 10;++i) fe_sq(>z_20_10=t2,>z_20_10=t2); */
|
93
|
+
fe_sq(t2,t1); for (i = 1;i < 10;++i) fe_sq(t2,t2);
|
94
|
+
|
95
|
+
/* qhasm: z_20_0 = z_20_10*z_10_0 */
|
96
|
+
/* asm 1: fe_mul(>z_20_0=fe#3,<z_20_10=fe#3,<z_10_0=fe#2); */
|
97
|
+
/* asm 2: fe_mul(>z_20_0=t2,<z_20_10=t2,<z_10_0=t1); */
|
98
|
+
fe_mul(t2,t2,t1);
|
99
|
+
|
100
|
+
/* qhasm: z_40_20 = z_20_0^2^20 */
|
101
|
+
/* asm 1: fe_sq(>z_40_20=fe#4,<z_20_0=fe#3); for (i = 1;i < 20;++i) fe_sq(>z_40_20=fe#4,>z_40_20=fe#4); */
|
102
|
+
/* asm 2: fe_sq(>z_40_20=t3,<z_20_0=t2); for (i = 1;i < 20;++i) fe_sq(>z_40_20=t3,>z_40_20=t3); */
|
103
|
+
fe_sq(t3,t2); for (i = 1;i < 20;++i) fe_sq(t3,t3);
|
104
|
+
|
105
|
+
/* qhasm: z_40_0 = z_40_20*z_20_0 */
|
106
|
+
/* asm 1: fe_mul(>z_40_0=fe#3,<z_40_20=fe#4,<z_20_0=fe#3); */
|
107
|
+
/* asm 2: fe_mul(>z_40_0=t2,<z_40_20=t3,<z_20_0=t2); */
|
108
|
+
fe_mul(t2,t3,t2);
|
109
|
+
|
110
|
+
/* qhasm: z_50_10 = z_40_0^2^10 */
|
111
|
+
/* asm 1: fe_sq(>z_50_10=fe#3,<z_40_0=fe#3); for (i = 1;i < 10;++i) fe_sq(>z_50_10=fe#3,>z_50_10=fe#3); */
|
112
|
+
/* asm 2: fe_sq(>z_50_10=t2,<z_40_0=t2); for (i = 1;i < 10;++i) fe_sq(>z_50_10=t2,>z_50_10=t2); */
|
113
|
+
fe_sq(t2,t2); for (i = 1;i < 10;++i) fe_sq(t2,t2);
|
114
|
+
|
115
|
+
/* qhasm: z_50_0 = z_50_10*z_10_0 */
|
116
|
+
/* asm 1: fe_mul(>z_50_0=fe#2,<z_50_10=fe#3,<z_10_0=fe#2); */
|
117
|
+
/* asm 2: fe_mul(>z_50_0=t1,<z_50_10=t2,<z_10_0=t1); */
|
118
|
+
fe_mul(t1,t2,t1);
|
119
|
+
|
120
|
+
/* qhasm: z_100_50 = z_50_0^2^50 */
|
121
|
+
/* asm 1: fe_sq(>z_100_50=fe#3,<z_50_0=fe#2); for (i = 1;i < 50;++i) fe_sq(>z_100_50=fe#3,>z_100_50=fe#3); */
|
122
|
+
/* asm 2: fe_sq(>z_100_50=t2,<z_50_0=t1); for (i = 1;i < 50;++i) fe_sq(>z_100_50=t2,>z_100_50=t2); */
|
123
|
+
fe_sq(t2,t1); for (i = 1;i < 50;++i) fe_sq(t2,t2);
|
124
|
+
|
125
|
+
/* qhasm: z_100_0 = z_100_50*z_50_0 */
|
126
|
+
/* asm 1: fe_mul(>z_100_0=fe#3,<z_100_50=fe#3,<z_50_0=fe#2); */
|
127
|
+
/* asm 2: fe_mul(>z_100_0=t2,<z_100_50=t2,<z_50_0=t1); */
|
128
|
+
fe_mul(t2,t2,t1);
|
129
|
+
|
130
|
+
/* qhasm: z_200_100 = z_100_0^2^100 */
|
131
|
+
/* asm 1: fe_sq(>z_200_100=fe#4,<z_100_0=fe#3); for (i = 1;i < 100;++i) fe_sq(>z_200_100=fe#4,>z_200_100=fe#4); */
|
132
|
+
/* asm 2: fe_sq(>z_200_100=t3,<z_100_0=t2); for (i = 1;i < 100;++i) fe_sq(>z_200_100=t3,>z_200_100=t3); */
|
133
|
+
fe_sq(t3,t2); for (i = 1;i < 100;++i) fe_sq(t3,t3);
|
134
|
+
|
135
|
+
/* qhasm: z_200_0 = z_200_100*z_100_0 */
|
136
|
+
/* asm 1: fe_mul(>z_200_0=fe#3,<z_200_100=fe#4,<z_100_0=fe#3); */
|
137
|
+
/* asm 2: fe_mul(>z_200_0=t2,<z_200_100=t3,<z_100_0=t2); */
|
138
|
+
fe_mul(t2,t3,t2);
|
139
|
+
|
140
|
+
/* qhasm: z_250_50 = z_200_0^2^50 */
|
141
|
+
/* asm 1: fe_sq(>z_250_50=fe#3,<z_200_0=fe#3); for (i = 1;i < 50;++i) fe_sq(>z_250_50=fe#3,>z_250_50=fe#3); */
|
142
|
+
/* asm 2: fe_sq(>z_250_50=t2,<z_200_0=t2); for (i = 1;i < 50;++i) fe_sq(>z_250_50=t2,>z_250_50=t2); */
|
143
|
+
fe_sq(t2,t2); for (i = 1;i < 50;++i) fe_sq(t2,t2);
|
144
|
+
|
145
|
+
/* qhasm: z_250_0 = z_250_50*z_50_0 */
|
146
|
+
/* asm 1: fe_mul(>z_250_0=fe#2,<z_250_50=fe#3,<z_50_0=fe#2); */
|
147
|
+
/* asm 2: fe_mul(>z_250_0=t1,<z_250_50=t2,<z_50_0=t1); */
|
148
|
+
fe_mul(t1,t2,t1);
|
149
|
+
|
150
|
+
/* qhasm: z_255_5 = z_250_0^2^5 */
|
151
|
+
/* asm 1: fe_sq(>z_255_5=fe#2,<z_250_0=fe#2); for (i = 1;i < 5;++i) fe_sq(>z_255_5=fe#2,>z_255_5=fe#2); */
|
152
|
+
/* asm 2: fe_sq(>z_255_5=t1,<z_250_0=t1); for (i = 1;i < 5;++i) fe_sq(>z_255_5=t1,>z_255_5=t1); */
|
153
|
+
fe_sq(t1,t1); for (i = 1;i < 5;++i) fe_sq(t1,t1);
|
154
|
+
|
155
|
+
/* qhasm: z_255_21 = z_255_5*z11 */
|
156
|
+
/* asm 1: fe_mul(>z_255_21=fe#12,<z_255_5=fe#2,<z11=fe#1); */
|
157
|
+
/* asm 2: fe_mul(>z_255_21=out,<z_255_5=t1,<z11=t0); */
|
158
|
+
fe_mul(out,t1,t0);
|
159
|
+
|
160
|
+
/* qhasm: return */
|