Mercurial > dropbear
comparison testprof/store_test.c @ 191:1c15b283127b libtomcrypt-orig
Import of libtomcrypt 1.02 with manual path rename rearrangement etc
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 06 May 2005 13:23:02 +0000 |
parents | |
children | 39d5d58461d6 |
comparison
equal
deleted
inserted
replaced
143:5d99163f7e32 | 191:1c15b283127b |
---|---|
1 #include <tomcrypt_test.h> | |
2 | |
3 /* Test store/load macros with offsets */ | |
4 int store_test(void) | |
5 { | |
6 unsigned char buf[24]; | |
7 int y; | |
8 ulong32 L, L1; | |
9 ulong64 LL, LL1; | |
10 | |
11 L = 0x12345678UL; | |
12 for (y = 0; y < 4; y++) { | |
13 STORE32L(L, buf + y); | |
14 LOAD32L(L1, buf + y); | |
15 if (L1 != L) { | |
16 fprintf(stderr, "\n32L failed at offset %d\n", y); | |
17 return 1; | |
18 } | |
19 STORE32H(L, buf + y); | |
20 LOAD32H(L1, buf + y); | |
21 if (L1 != L) { | |
22 fprintf(stderr, "\n32H failed at offset %d\n", y); | |
23 return 1; | |
24 } | |
25 } | |
26 | |
27 LL = CONST64 (0x01020304050607); | |
28 for (y = 0; y < 8; y++) { | |
29 STORE64L(LL, buf + y); | |
30 LOAD64L(LL1, buf + y); | |
31 if (LL1 != LL) { | |
32 fprintf(stderr, "\n64L failed at offset %d\n", y); | |
33 return 1; | |
34 } | |
35 STORE64H(LL, buf + y); | |
36 LOAD64H(LL1, buf + y); | |
37 if (LL1 != LL) { | |
38 fprintf(stderr, "\n64H failed at offset %d\n", y); | |
39 return 1; | |
40 } | |
41 } | |
42 | |
43 return 0; | |
44 } |