summaryrefslogtreecommitdiff
path: root/src/regress/lib/libcrypto/sha1/sha1test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/regress/lib/libcrypto/sha1/sha1test.c')
-rw-r--r--src/regress/lib/libcrypto/sha1/sha1test.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/regress/lib/libcrypto/sha1/sha1test.c b/src/regress/lib/libcrypto/sha1/sha1test.c
index 7f28ba676f..537454851b 100644
--- a/src/regress/lib/libcrypto/sha1/sha1test.c
+++ b/src/regress/lib/libcrypto/sha1/sha1test.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha1test.c,v 1.3 2018/07/17 17:06:50 tb Exp $ */ 1/* $OpenBSD: sha1test.c,v 1.4 2021/11/18 15:23:24 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -83,10 +83,13 @@ int main(int argc, char *argv[])
83 char **P,**R; 83 char **P,**R;
84 static unsigned char buf[1000]; 84 static unsigned char buf[1000];
85 char *p,*r; 85 char *p,*r;
86 EVP_MD_CTX c; 86 EVP_MD_CTX *c;
87 unsigned char md[SHA_DIGEST_LENGTH]; 87 unsigned char md[SHA_DIGEST_LENGTH];
88 88
89 EVP_MD_CTX_init(&c); 89 if ((c = EVP_MD_CTX_new()) == NULL) {
90 printf("EVP_MD_CTX_new() failed\n");
91 return 1;
92 }
90 P=test; 93 P=test;
91 R=ret; 94 R=ret;
92 i=1; 95 i=1;
@@ -108,10 +111,10 @@ int main(int argc, char *argv[])
108 } 111 }
109 112
110 memset(buf,'a',1000); 113 memset(buf,'a',1000);
111 EVP_DigestInit_ex(&c,EVP_sha1(), NULL); 114 EVP_DigestInit_ex(c,EVP_sha1(), NULL);
112 for (i=0; i<1000; i++) 115 for (i=0; i<1000; i++)
113 EVP_DigestUpdate(&c,buf,1000); 116 EVP_DigestUpdate(c,buf,1000);
114 EVP_DigestFinal_ex(&c,md,NULL); 117 EVP_DigestFinal_ex(c,md,NULL);
115 p=pt(md); 118 p=pt(md);
116 119
117 r=bigret; 120 r=bigret;
@@ -124,7 +127,7 @@ int main(int argc, char *argv[])
124 else 127 else
125 printf("test 3 ok\n"); 128 printf("test 3 ok\n");
126 129
127 EVP_MD_CTX_cleanup(&c); 130 EVP_MD_CTX_free(c);
128 exit(err); 131 exit(err);
129 } 132 }
130 133