projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Redirect FIPS memory allocation to FIPS_malloc() routine, remove
[oweals/openssl.git]
/
crypto
/
sha
/
shatest.c
diff --git
a/crypto/sha/shatest.c
b/crypto/sha/shatest.c
index d492c1515bc57bc47affa717edaaae3e952b8829..27614646d1548463dc66e0d728d12c8782a3e548 100644
(file)
--- a/
crypto/sha/shatest.c
+++ b/
crypto/sha/shatest.c
@@
-60,14
+60,17
@@
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
-#ifdef OPENSSL_NO_SHA
+#include "../e_os.h"
+
+#if defined(OPENSSL_NO_SHA) || defined(OPENSSL_NO_SHA0)
int main(int argc, char *argv[])
{
int main(int argc, char *argv[])
{
- printf("No SHA support\n");
+ printf("No SHA
0
support\n");
return(0);
}
#else
#include <openssl/evp.h>
return(0);
}
#else
#include <openssl/evp.h>
+#include <openssl/sha.h>
#ifdef CHARSET_EBCDIC
#include <openssl/ebcdic.h>
#ifdef CHARSET_EBCDIC
#include <openssl/ebcdic.h>
@@
-103,7
+106,7
@@
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;
EVP_MD_CTX c;
static unsigned char buf[1000];
char *p,*r;
EVP_MD_CTX c;
@@
-114,14
+117,15
@@
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)
{
- EVP_Digest(*P,
(unsigned long)strlen((char *)*P),md,NULL,EVP_sha()
);
+ EVP_Digest(*P,
strlen(*P),md,NULL,EVP_sha(), NULL
);
p=pt(md);
p=pt(md);
- if (strcmp(p,
(char *)
*R) != 0)
+ if (strcmp(p,*R) != 0)
{
printf("error calculating SHA on '%s'\n",*P);
printf("got %s instead of %s\n",p,*R);
{
printf("error calculating SHA on '%s'\n",*P);
printf("got %s instead of %s\n",p,*R);
@@
-138,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*/
- EVP_DigestInit
(&c,EVP_sha()
);
+ EVP_DigestInit
_ex(&c,EVP_sha(), NULL
);
for (i=0; i<1000; i++)
EVP_DigestUpdate(&c,buf,1000);
for (i=0; i<1000; i++)
EVP_DigestUpdate(&c,buf,1000);
- EVP_DigestFinal(&c,md,NULL);
+ EVP_DigestFinal
_ex
(&c,md,NULL);
p=pt(md);
r=bigret;
p=pt(md);
r=bigret;
@@
-153,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
+ EVP_MD_CTX_cleanup(&c);
+ EXIT(err);
return(0);
}
return(0);
}