mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-11 10:56:17 +08:00
remove old api
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <gmssl/hex.h>
|
||||
#include <gmssl/sha2.h>
|
||||
|
||||
@@ -100,19 +101,17 @@ int main(int argc, char **argv)
|
||||
{
|
||||
int err = 0;
|
||||
SHA224_CTX ctx;
|
||||
unsigned char dgst[SHA224_DIGEST_SIZE];
|
||||
unsigned char *dgstbuf = NULL;
|
||||
uint8_t dgst[SHA224_DIGEST_SIZE];
|
||||
uint8_t dgstbuf[SHA224_DIGEST_SIZE];
|
||||
size_t dgstlen;
|
||||
size_t i, j;
|
||||
|
||||
for (i = 0; i < 7; i++) {
|
||||
|
||||
if (!(dgstbuf = OPENSSL_hexstr2buf(tests[i].dgsthex, NULL))) {
|
||||
goto end;
|
||||
}
|
||||
hex_to_bytes(tests[i].dgsthex, strlen(tests[i].dgsthex), dgstbuf, &dgstlen);
|
||||
|
||||
sha224_init(&ctx);
|
||||
for (j = 0; j < tests[i].count; j++) {
|
||||
sha224_update(&ctx, (unsigned char *)tests[i].data, tests[i].length);
|
||||
sha224_update(&ctx, (uint8_t *)tests[i].data, tests[i].length);
|
||||
}
|
||||
sha224_finish(&ctx, dgst);
|
||||
|
||||
@@ -127,12 +126,7 @@ int main(int argc, char **argv)
|
||||
} else {
|
||||
printf("sha224 test %lu ok\n", i+1);
|
||||
}
|
||||
|
||||
free(dgstbuf);
|
||||
dgstbuf = NULL;
|
||||
}
|
||||
|
||||
end:
|
||||
if (dgstbuf) free(dgstbuf);
|
||||
return err;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user