1 | #include <stdint.h>
|
---|
2 | #include <stdio.h>
|
---|
3 |
|
---|
4 | #include <blapi.h>
|
---|
5 |
|
---|
6 |
|
---|
7 | #if defined (__x86_64__) || \
|
---|
8 | defined (__amd64__) || \
|
---|
9 | defined (__ia64__) || \
|
---|
10 | defined (__powerpc64__) || \
|
---|
11 | defined (__s390x__) || \
|
---|
12 | (defined (__sparc__) && defined(__arch64__)) || \
|
---|
13 | defined(__aarch64__)
|
---|
14 |
|
---|
15 | #define EXPECTED_LIB_FLATTENSIZE 248
|
---|
16 |
|
---|
17 | #elif defined (__i386__) || \
|
---|
18 | defined (__powerpc__) || \
|
---|
19 | defined (__s390__) || \
|
---|
20 | defined (__sparc__) || \
|
---|
21 | defined (__arm__)
|
---|
22 |
|
---|
23 | #define EXPECTED_LIB_FLATTENSIZE 160
|
---|
24 |
|
---|
25 | #else
|
---|
26 |
|
---|
27 | #error Undefined architecture type
|
---|
28 |
|
---|
29 | #endif
|
---|
30 |
|
---|
31 | int main(void)
|
---|
32 | {
|
---|
33 | SHA1Context *context;
|
---|
34 | uint32_t libFlattenSize;
|
---|
35 |
|
---|
36 | context = SHA1_NewContext();
|
---|
37 | if (!context) {
|
---|
38 | printf("Could not create SHA1 context.\n");
|
---|
39 | return EXIT_FAILURE;
|
---|
40 | }
|
---|
41 | SHA1_Begin(context);
|
---|
42 |
|
---|
43 | libFlattenSize = SHA1_FlattenSize(context);
|
---|
44 | if (libFlattenSize != EXPECTED_LIB_FLATTENSIZE) {
|
---|
45 | printf("SHA1 flatten size is %d, expected %d\n",
|
---|
46 | libFlattenSize,
|
---|
47 | EXPECTED_LIB_FLATTENSIZE);
|
---|
48 | return EXIT_FAILURE;
|
---|
49 | }
|
---|
50 | return EXIT_SUCCESS;
|
---|
51 | }
|
---|