diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 21:41:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 21:41:43 +0000 |
commit | 92cccad89d1c12b39165d5f0ed7ccd2d44965a1a (patch) | |
tree | f59a2764cd8c50959050a428bd8fc935138df750 /tests/freebl_sha1flattensize.c | |
parent | Initial commit. (diff) | |
download | libtpms-92cccad89d1c12b39165d5f0ed7ccd2d44965a1a.tar.xz libtpms-92cccad89d1c12b39165d5f0ed7ccd2d44965a1a.zip |
Adding upstream version 0.9.2.upstream/0.9.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/freebl_sha1flattensize.c')
-rw-r--r-- | tests/freebl_sha1flattensize.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/freebl_sha1flattensize.c b/tests/freebl_sha1flattensize.c new file mode 100644 index 0000000..fcd7c78 --- /dev/null +++ b/tests/freebl_sha1flattensize.c @@ -0,0 +1,51 @@ +#include <stdint.h> +#include <stdio.h> + +#include <blapi.h> + + +#if defined (__x86_64__) || \ + defined (__amd64__) || \ + defined (__ia64__) || \ + defined (__powerpc64__) || \ + defined (__s390x__) || \ + (defined (__sparc__) && defined(__arch64__)) || \ + defined(__aarch64__) + +#define EXPECTED_LIB_FLATTENSIZE 248 + +#elif defined (__i386__) || \ + defined (__powerpc__) || \ + defined (__s390__) || \ + defined (__sparc__) || \ + defined (__arm__) + +#define EXPECTED_LIB_FLATTENSIZE 160 + +#else + +#error Undefined architecture type + +#endif + +int main(void) +{ + SHA1Context *context; + uint32_t libFlattenSize; + + context = SHA1_NewContext(); + if (!context) { + printf("Could not create SHA1 context.\n"); + return EXIT_FAILURE; + } + SHA1_Begin(context); + + libFlattenSize = SHA1_FlattenSize(context); + if (libFlattenSize != EXPECTED_LIB_FLATTENSIZE) { + printf("SHA1 flatten size is %d, expected %d\n", + libFlattenSize, + EXPECTED_LIB_FLATTENSIZE); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +} |