diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-09-26 09:07:44 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-09-26 09:07:44 -0400 |
commit | 27bd1ef100a81235e9d2763c4cf24699251a8008 (patch) | |
tree | 9a96e898c44019c11e41937aed52e2b3d20d27be /src/ext | |
parent | 7c52a0555aee23f171870c5d41ce3c0f593c2e57 (diff) | |
download | tor-27bd1ef100a81235e9d2763c4cf24699251a8008.tar.gz tor-27bd1ef100a81235e9d2763c4cf24699251a8008.zip |
Comment-out dead code in ed25519/ref10
There are some loops of the form
for (i=1;i<1;++i) ...
And of course, if the loop index is initialized to 1, it will never
be less than 1, and the loop body will never be executed. This
upsets coverity.
Patch fixes CID 1221543 and 1221542
Diffstat (limited to 'src/ext')
-rw-r--r-- | src/ext/ed25519/ref10/pow22523.h | 5 | ||||
-rw-r--r-- | src/ext/ed25519/ref10/pow225521.h | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/ext/ed25519/ref10/pow22523.h b/src/ext/ed25519/ref10/pow22523.h index 60ffe0d34c..9204ff838f 100644 --- a/src/ext/ed25519/ref10/pow22523.h +++ b/src/ext/ed25519/ref10/pow22523.h @@ -1,3 +1,4 @@ +/* Modified by Tor: pointless loops removed to appease analysis tools */ /* qhasm: fe z1 */ @@ -50,7 +51,7 @@ /* qhasm: z2 = z1^2^1 */ /* asm 1: fe_sq(>z2=fe#1,<z1=fe#11); for (i = 1;i < 1;++i) fe_sq(>z2=fe#1,>z2=fe#1); */ /* asm 2: fe_sq(>z2=t0,<z1=z); for (i = 1;i < 1;++i) fe_sq(>z2=t0,>z2=t0); */ -fe_sq(t0,z); for (i = 1;i < 1;++i) fe_sq(t0,t0); +fe_sq(t0,z); /* DEADCODE This loop has no effect: for (i = 1;i < 1;++i) fe_sq(t0,t0); */ /* qhasm: z8 = z2^2^2 */ /* asm 1: fe_sq(>z8=fe#2,<z2=fe#1); for (i = 1;i < 2;++i) fe_sq(>z8=fe#2,>z8=fe#2); */ @@ -70,7 +71,7 @@ fe_mul(t0,t0,t1); /* qhasm: z22 = z11^2^1 */ /* asm 1: fe_sq(>z22=fe#1,<z11=fe#1); for (i = 1;i < 1;++i) fe_sq(>z22=fe#1,>z22=fe#1); */ /* asm 2: fe_sq(>z22=t0,<z11=t0); for (i = 1;i < 1;++i) fe_sq(>z22=t0,>z22=t0); */ -fe_sq(t0,t0); for (i = 1;i < 1;++i) fe_sq(t0,t0); +fe_sq(t0,t0); /* DEADCODE This loop has no effect: for (i = 1;i < 1;++i) fe_sq(t0,t0); */ /* qhasm: z_5_0 = z9*z22 */ /* asm 1: fe_mul(>z_5_0=fe#1,<z9=fe#2,<z22=fe#1); */ diff --git a/src/ext/ed25519/ref10/pow225521.h b/src/ext/ed25519/ref10/pow225521.h index 109df779a2..fe2af94c03 100644 --- a/src/ext/ed25519/ref10/pow225521.h +++ b/src/ext/ed25519/ref10/pow225521.h @@ -1,3 +1,4 @@ +/* Modified by Tor: pointless loops removed to appease analysis tools */ /* qhasm: fe z1 */ @@ -50,7 +51,7 @@ /* qhasm: z2 = z1^2^1 */ /* asm 1: fe_sq(>z2=fe#1,<z1=fe#11); for (i = 1;i < 1;++i) fe_sq(>z2=fe#1,>z2=fe#1); */ /* asm 2: fe_sq(>z2=t0,<z1=z); for (i = 1;i < 1;++i) fe_sq(>z2=t0,>z2=t0); */ -fe_sq(t0,z); for (i = 1;i < 1;++i) fe_sq(t0,t0); +fe_sq(t0,z); /* DEADCODE This loop has no effect: for (i = 1;i < 1;++i) fe_sq(t0,t0); */ /* qhasm: z8 = z2^2^2 */ /* asm 1: fe_sq(>z8=fe#2,<z2=fe#1); for (i = 1;i < 2;++i) fe_sq(>z8=fe#2,>z8=fe#2); */ @@ -70,7 +71,7 @@ fe_mul(t0,t0,t1); /* qhasm: z22 = z11^2^1 */ /* asm 1: fe_sq(>z22=fe#3,<z11=fe#1); for (i = 1;i < 1;++i) fe_sq(>z22=fe#3,>z22=fe#3); */ /* asm 2: fe_sq(>z22=t2,<z11=t0); for (i = 1;i < 1;++i) fe_sq(>z22=t2,>z22=t2); */ -fe_sq(t2,t0); for (i = 1;i < 1;++i) fe_sq(t2,t2); +fe_sq(t2,t0); /* DEADCODE This loop has no effect for (i = 1;i < 1;++i) fe_sq(t2,t2); */ /* qhasm: z_5_0 = z9*z22 */ /* asm 1: fe_mul(>z_5_0=fe#2,<z9=fe#2,<z22=fe#3); */ |