diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2017-05-02 16:41:35 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2017-05-02 16:41:35 (GMT) |
commit | 3d328008deedc58cd7a11c79063cefa7d662d4fc (patch) | |
tree | cb41a048885ce7b493f406360cf5f6edf689c468 /openssl/bugs/sgiccbug.c | |
parent | 0a2b8b8e0bc2e91a9f10659b30e2e4f5b79ce692 (diff) | |
download | blt-3d328008deedc58cd7a11c79063cefa7d662d4fc.zip blt-3d328008deedc58cd7a11c79063cefa7d662d4fc.tar.gz blt-3d328008deedc58cd7a11c79063cefa7d662d4fc.tar.bz2 |
inital commit
Diffstat (limited to 'openssl/bugs/sgiccbug.c')
-rw-r--r-- | openssl/bugs/sgiccbug.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/openssl/bugs/sgiccbug.c b/openssl/bugs/sgiccbug.c new file mode 100644 index 0000000..6b1b3d4 --- /dev/null +++ b/openssl/bugs/sgiccbug.c @@ -0,0 +1,60 @@ +/* NOCW */ +/* sgibug.c */ +/* bug found by Eric Young (eay@mincom.oz.au) May 95 */ + +#include <stdio.h> + +/* + * This compiler bug it present on IRIX 5.3, 5.1 and 4.0.5 (these are the + * only versions of IRIX I have access to. defining FIXBUG removes the bug. + * (bug is still present in IRIX 6.3 according to Gage + * <agage@forgetmenot.Mines.EDU> + */ + +/*- + * Compare the output from + * cc sgiccbug.c; ./a.out + * and + * cc -O sgiccbug.c; ./a.out + */ + +static unsigned long a[4] = + { 0x01234567, 0x89ABCDEF, 0xFEDCBA98, 0x76543210 }; +static unsigned long b[4] = + { 0x89ABCDEF, 0xFEDCBA98, 0x76543210, 0x01234567 }; +static unsigned long c[4] = + { 0x77777778, 0x8ACF1357, 0x88888888, 0x7530ECA9 }; + +main() +{ + unsigned long r[4]; + sub(r, a, b); + fprintf(stderr, "input a= %08X %08X %08X %08X\n", a[3], a[2], a[1], a[0]); + fprintf(stderr, "input b= %08X %08X %08X %08X\n", b[3], b[2], b[1], b[0]); + fprintf(stderr, "output = %08X %08X %08X %08X\n", r[3], r[2], r[1], r[0]); + fprintf(stderr, "correct= %08X %08X %08X %08X\n", c[3], c[2], c[1], c[0]); +} + +int sub(r, a, b) +unsigned long *r, *a, *b; +{ + register unsigned long t1, t2, *ap, *bp, *rp; + int i, carry; +#ifdef FIXBUG + unsigned long dummy; +#endif + + ap = a; + bp = b; + rp = r; + carry = 0; + for (i = 0; i < 4; i++) { + t1 = *(ap++); + t2 = *(bp++); + t1 = (t1 - t2); +#ifdef FIXBUG + dummy = t1; +#endif + *(rp++) = t1 & 0xffffffff; + } +} |