remove old api

This commit is contained in:
Zhi Guan
2021-07-31 22:07:25 +08:00
parent f7b4533cdd
commit 2ecba70472
30 changed files with 1025 additions and 953 deletions

View File

@@ -50,9 +50,11 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <gmssl/md5.h>
#include <gmssl/hex.h>
static char *teststr[] = {
"",
"a",
@@ -77,17 +79,14 @@ int main(int argc, char **argv)
{
int err = 0;
char *p;
unsigned char *dgstbuf = NULL;
uint8_t dgst[16];
uint8_t dgstbuf[16];
size_t dgstbuflen;
unsigned char dgst[16];
size_t i;
for (i = 0; i < sizeof(teststr)/sizeof(teststr[0]); i++) {
if (!(dgstbuf = OPENSSL_hexstr2buf(dgsthex[i], &dgstbuflen))) {
goto end;
}
md5_digest((unsigned char *)teststr[i], strlen(teststr[i]), dgst);
hex_to_bytes(dgsthex[i], strlen(dgsthex[i]), dgstbuf, &dgstbuflen);
md5_digest((uint8_t *)teststr[i], strlen(teststr[i]), dgst);
if (memcmp(dgstbuf, dgst, sizeof(dgst)) != 0) {
int n;
@@ -102,12 +101,7 @@ int main(int argc, char **argv)
} else {
printf("md5 test %lu ok\n", i+1);
}
free(dgstbuf);
dgstbuf = NULL;
}
end:
if (dgstbuf) free(dgstbuf);
return err;
}