summaryrefslogtreecommitdiffstats
path: root/crypto/sha/sha1test.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2001-06-19 22:30:40 +0000
committerDr. Stephen Henson <steve@openssl.org>2001-06-19 22:30:40 +0000
commit323f289c480b0a8eb15ed3be2befbcc0f86e8904 (patch)
treea8f18dde28ce3c77b7bff50c2b45a44c556dfed4 /crypto/sha/sha1test.c
parenta45e4a5537e009761652db0d9aa1ef28b1ce8937 (diff)
Change all calls to low level digest routines in the library and
applications to use EVP. Add missing calls to HMAC_cleanup() and don't assume HMAC_CTX can be copied using memcpy(). Note: this is almost identical to the patch submitted to openssl-dev by Verdon Walker <VWalker@novell.com> except some redundant EVP_add_digest_()/EVP_cleanup() calls were removed and some changes made to avoid compiler warnings.
Diffstat (limited to 'crypto/sha/sha1test.c')
-rw-r--r--crypto/sha/sha1test.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/crypto/sha/sha1test.c b/crypto/sha/sha1test.c
index 3b09039cc8..a915981b5b 100644
--- a/crypto/sha/sha1test.c
+++ b/crypto/sha/sha1test.c
@@ -67,7 +67,7 @@ int main(int argc, char *argv[])
return(0);
}
#else
-#include <openssl/sha.h>
+#include <openssl/evp.h>
#ifdef CHARSET_EBCDIC
#include <openssl/ebcdic.h>
@@ -106,7 +106,7 @@ int main(int argc, char *argv[])
unsigned char **P,**R;
static unsigned char buf[1000];
char *p,*r;
- SHA_CTX c;
+ EVP_MD_CTX c;
unsigned char md[SHA_DIGEST_LENGTH];
#ifdef CHARSET_EBCDIC
@@ -119,7 +119,8 @@ int main(int argc, char *argv[])
i=1;
while (*P != NULL)
{
- p=pt(SHA1(*P,(unsigned long)strlen((char *)*P),NULL));
+ EVP_Digest(*P,(unsigned long)strlen((char *)*P),md,NULL,EVP_sha1());
+ p=pt(md);
if (strcmp(p,(char *)*R) != 0)
{
printf("error calculating SHA1 on '%s'\n",*P);
@@ -137,10 +138,10 @@ int main(int argc, char *argv[])
#ifdef CHARSET_EBCDIC
ebcdic2ascii(buf, buf, 1000);
#endif /*CHARSET_EBCDIC*/
- SHA1_Init(&c);
+ EVP_DigestInit(&c,EVP_sha1());
for (i=0; i<1000; i++)
- SHA1_Update(&c,buf,1000);
- SHA1_Final(md,&c);
+ EVP_DigestUpdate(&c,buf,1000);
+ EVP_DigestFinal(&c,md,NULL);
p=pt(md);
r=bigret;