Proper support for OpenBSD-i386 shared build, including assember modules!
[openssl.git] / crypto / rc4 / rc4.c
index a1a66acf0c37ee91544d15bc8e168e0188253939..c900b260554a394107031c708951a02d6d203d92 100644 (file)
@@ -59,7 +59,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "rc4.h"
+#include <openssl/rc4.h>
+#include <openssl/evp.h>
 
 char *usage[]={
 "usage: rc4 args\n",
 
 char *usage[]={
 "usage: rc4 args\n",
@@ -113,7 +114,7 @@ int main(int argc, char *argv[])
                {
 bad:
                for (pp=usage; (*pp != NULL); pp++)
                {
 bad:
                for (pp=usage; (*pp != NULL); pp++)
-                       fprintf(stderr,*pp);
+                       fprintf(stderr,"%s",*pp);
                exit(1);
                }
 
                exit(1);
                }
 
@@ -141,7 +142,7 @@ bad:
                        }
                }
                
                        }
                }
                
-#ifdef MSDOS
+#ifdef OPENSSL_SYS_MSDOS
        /* This should set the file to binary mode. */
        {
 #include <fcntl.h>
        /* This should set the file to binary mode. */
        {
 #include <fcntl.h>
@@ -155,15 +156,15 @@ bad:
                i=EVP_read_pw_string(buf,BUFSIZ,"Enter RC4 password:",0);
                if (i != 0)
                        {
                i=EVP_read_pw_string(buf,BUFSIZ,"Enter RC4 password:",0);
                if (i != 0)
                        {
-                       memset(buf,0,BUFSIZ);
+                       OPENSSL_cleanse(buf,BUFSIZ);
                        fprintf(stderr,"bad password read\n");
                        exit(1);
                        }
                keystr=buf;
                }
 
                        fprintf(stderr,"bad password read\n");
                        exit(1);
                        }
                keystr=buf;
                }
 
-       MD5((unsigned char *)keystr,(unsigned long)strlen(keystr),md);
-       memset(keystr,0,strlen(keystr));
+       EVP_Digest((unsigned char *)keystr,strlen(keystr),md,NULL,EVP_md5(),NULL);
+       OPENSSL_cleanse(keystr,strlen(keystr));
        RC4_set_key(&key,MD5_DIGEST_LENGTH,md);
        
        for(;;)
        RC4_set_key(&key,MD5_DIGEST_LENGTH,md);
        
        for(;;)