projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix Win32 build.
[oweals/openssl.git]
/
crypto
/
sha
/
sha1test.c
diff --git
a/crypto/sha/sha1test.c
b/crypto/sha/sha1test.c
index 688d06c63747a41025482394ee280213495cd0d6..6feb3964c7577f6083532d098fff25b45f213962 100644
(file)
--- a/
crypto/sha/sha1test.c
+++ b/
crypto/sha/sha1test.c
@@
-60,13
+60,16
@@
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
-#ifdef NO_SHA
+#include "../e_os.h"
+
+#ifdef OPENSSL_NO_SHA
int main(int argc, char *argv[])
{
printf("No SHA support\n");
return(0);
}
#else
int main(int argc, char *argv[])
{
printf("No SHA support\n");
return(0);
}
#else
+#include <openssl/evp.h>
#include <openssl/sha.h>
#ifdef CHARSET_EBCDIC
#include <openssl/sha.h>
#ifdef CHARSET_EBCDIC
@@
-103,10
+106,10
@@
static char *pt(unsigned char *md);
int main(int argc, char *argv[])
{
int i,err=0;
int main(int argc, char *argv[])
{
int i,err=0;
-
unsigned
char **P,**R;
+ char **P,**R;
static unsigned char buf[1000];
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
unsigned char md[SHA_DIGEST_LENGTH];
#ifdef CHARSET_EBCDIC
@@
-114,12
+117,14
@@
int main(int argc, char *argv[])
ebcdic2ascii(test[1], test[1], strlen(test[1]));
#endif
ebcdic2ascii(test[1], test[1], strlen(test[1]));
#endif
- P=(unsigned char **)test;
- R=(unsigned char **)ret;
+ EVP_MD_CTX_init(&c);
+ P=test;
+ R=ret;
i=1;
while (*P != NULL)
{
i=1;
while (*P != NULL)
{
- p=pt(SHA1(*P,(unsigned long)strlen((char *)*P),NULL));
+ EVP_Digest(*P,strlen((char *)*P),md,NULL,EVP_sha1(), NULL);
+ p=pt(md);
if (strcmp(p,(char *)*R) != 0)
{
printf("error calculating SHA1 on '%s'\n",*P);
if (strcmp(p,(char *)*R) != 0)
{
printf("error calculating SHA1 on '%s'\n",*P);
@@
-137,10
+142,10
@@
int main(int argc, char *argv[])
#ifdef CHARSET_EBCDIC
ebcdic2ascii(buf, buf, 1000);
#endif /*CHARSET_EBCDIC*/
#ifdef CHARSET_EBCDIC
ebcdic2ascii(buf, buf, 1000);
#endif /*CHARSET_EBCDIC*/
-
SHA1_Init(&c
);
+
EVP_DigestInit_ex(&c,EVP_sha1(), NULL
);
for (i=0; i<1000; i++)
for (i=0; i<1000; i++)
-
SHA1_
Update(&c,buf,1000);
-
SHA1_Final(md,&c
);
+
EVP_Digest
Update(&c,buf,1000);
+
EVP_DigestFinal_ex(&c,md,NULL
);
p=pt(md);
r=bigret;
p=pt(md);
r=bigret;
@@
-152,7
+157,12
@@
int main(int argc, char *argv[])
}
else
printf("test 3 ok\n");
}
else
printf("test 3 ok\n");
- exit(err);
+
+#ifdef OPENSSL_SYS_NETWARE
+ if (err) printf("ERROR: %d\n", err);
+#endif
+ EXIT(err);
+ EVP_MD_CTX_cleanup(&c);
return(0);
}
return(0);
}