From b53a7211c79a551ab4514a0dd94bd65924ea1360 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Tue, 29 Apr 2008 05:46:42 +0000 Subject: [PATCH] Use EVP_MD_CTX_create()/EVP_MD_CTX_destroy(). git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23136 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/hcrypto/mdtest.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/hcrypto/mdtest.c b/lib/hcrypto/mdtest.c index 5287b6450..e8da78439 100644 --- a/lib/hcrypto/mdtest.c +++ b/lib/hcrypto/mdtest.c @@ -274,7 +274,7 @@ static int hash_test (struct hash_foo *hash, struct test *tests) { struct test *t; - EVP_MD_CTX ectx; + EVP_MD_CTX *ectx; unsigned int esize; void *ctx = malloc(hash->psize); unsigned char *res = malloc(hash->hsize); @@ -283,8 +283,8 @@ hash_test (struct hash_foo *hash, struct test *tests) for (t = tests; t->str; ++t) { char buf[1000]; - EVP_MD_CTX_init(&ectx); - EVP_DigestInit_ex(&ectx, hash->evp(), NULL); + ectx = EVP_MD_CTX_create(); + EVP_DigestInit_ex(ectx, hash->evp(), NULL); (*hash->init)(ctx); if(strcmp(t->str, ONE_MILLION_A) == 0) { @@ -292,11 +292,11 @@ hash_test (struct hash_foo *hash, struct test *tests) memset(buf, 'a', sizeof(buf)); for(i = 0; i < 1000; i++) { (*hash->update)(ctx, buf, sizeof(buf)); - EVP_DigestUpdate(&ectx, buf, sizeof(buf)); + EVP_DigestUpdate(ectx, buf, sizeof(buf)); } } else { (*hash->update)(ctx, (unsigned char *)t->str, strlen(t->str)); - EVP_DigestUpdate(&ectx, t->str, strlen(t->str)); + EVP_DigestUpdate(ectx, t->str, strlen(t->str)); } (*hash->final) (res, ctx); @@ -320,8 +320,8 @@ hash_test (struct hash_foo *hash, struct test *tests) return 1; } - EVP_DigestFinal_ex(&ectx, res, &esize); - EVP_MD_CTX_cleanup(&ectx); + EVP_DigestFinal_ex(ectx, res, &esize); + EVP_MD_CTX_destroy(ectx); if (hash->hsize != esize) { printf("EVP %s returned wrong hash size\n", hash->name); -- 2.11.4.GIT