Copyright(c) 2011-2016 Intel Corporation All rights reserved.
Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
+ modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
int main(void)
{
+ int ret;
MD5_HASH_CTX_MGR *mgr = NULL;
MD5_HASH_CTX ctxpool[TEST_BUFS];
unsigned char *bufs[TEST_BUFS];
struct perf start, stop;
for (i = 0; i < TEST_BUFS; i++) {
- bufs[i] = (unsigned char *)calloc((size_t) TEST_LEN, 1);
+ bufs[i] = (unsigned char *)calloc((size_t)TEST_LEN, 1);
if (bufs[i] == NULL) {
printf("calloc failed test aborted\n");
return 1;
ctxpool[i].user_data = (void *)((uint64_t) i);
}
- posix_memalign((void *)&mgr, 16, sizeof(MD5_HASH_CTX_MGR));
+ ret = posix_memalign((void *)&mgr, 16, sizeof(MD5_HASH_CTX_MGR));
+ if (ret) {
+ printf("alloc error: Fail");
+ return -1;
+ }
md5_ctx_mgr_init(mgr);
// Start OpenSSL tests
for (i = 0; i < TEST_BUFS; i++) {
for (j = 0; j < MD5_DIGEST_NWORDS; j++) {
- if (ctxpool[i].job.result_digest[j] != ((uint32_t *) digest_ssl[i])[j]) {
+ if (ctxpool[i].job.result_digest[j] !=
+ to_le32(((uint32_t *) digest_ssl[i])[j])) {
fail++;
printf("Test%d, digest%d fail %08X <=> %08X\n",
i, j, ctxpool[i].job.result_digest[j],
- ((uint32_t *) digest_ssl[i])[j]);
+ to_le32(((uint32_t *) digest_ssl[i])[j]));
}
}
}