make no-des and no-rc2 work.
[openssl.git] / crypto / evp / evp_key.c
index b766f73ec16eb43b3cba77d2660bb27ed7d3f2b9..667c21cca8d365f9c594347f985a3ef806c54edb 100644 (file)
 
 #include <stdio.h>
 #include "cryptlib.h"
 
 #include <stdio.h>
 #include "cryptlib.h"
-#include "x509.h"
-#include "objects.h"
-#include "evp.h"
+#include <openssl/x509.h>
+#include <openssl/objects.h>
+#include <openssl/evp.h>
 
 /* should be init to zeros. */
 static char prompt_string[80];
 
 
 /* should be init to zeros. */
 static char prompt_string[80];
 
-void EVP_set_pw_prompt(prompt)
-char *prompt;
+void EVP_set_pw_prompt(char *prompt)
        {
        if (prompt == NULL)
                prompt_string[0]='\0';
        {
        if (prompt == NULL)
                prompt_string[0]='\0';
@@ -74,7 +73,7 @@ char *prompt;
                strncpy(prompt_string,prompt,79);
        }
 
                strncpy(prompt_string,prompt,79);
        }
 
-char *EVP_get_pw_prompt()
+char *EVP_get_pw_prompt(void)
        {
        if (prompt_string[0] == '\0')
                return(NULL);
        {
        if (prompt_string[0] == '\0')
                return(NULL);
@@ -82,30 +81,23 @@ char *EVP_get_pw_prompt()
                return(prompt_string);
        }
 
                return(prompt_string);
        }
 
-#ifdef NO_DES
-int des_read_pw_string(char *buf,int len,char *prompt,int verify);
-#endif
-
-int EVP_read_pw_string(buf,len,prompt,verify)
-char *buf;
-int len;
-const char *prompt;
-int verify;
+/* For historical reasons, the standard function for reading passwords is
+ * in the DES library -- if someone ever wants to disable DES,
+ * this function will fail */
+int EVP_read_pw_string(char *buf, int len, const char *prompt, int verify)
        {
        {
+#ifndef NO_DES
        if ((prompt == NULL) && (prompt_string[0] != '\0'))
                prompt=prompt_string;
        return(des_read_pw_string(buf,len,prompt,verify));
        if ((prompt == NULL) && (prompt_string[0] != '\0'))
                prompt=prompt_string;
        return(des_read_pw_string(buf,len,prompt,verify));
+#else
+       return -1;
+#endif
        }
 
        }
 
-int EVP_BytesToKey(type,md,salt,data,datal,count,key,iv)
-const EVP_CIPHER *type;
-EVP_MD *md;
-unsigned char *salt;
-unsigned char *data;
-int datal;
-int count;
-unsigned char *key;
-unsigned char *iv;
+int EVP_BytesToKey(const EVP_CIPHER *type, EVP_MD *md, unsigned char *salt,
+            unsigned char *data, int datal, int count, unsigned char *key,
+            unsigned char *iv)
        {
        EVP_MD_CTX c;
        unsigned char md_buf[EVP_MAX_MD_SIZE];
        {
        EVP_MD_CTX c;
        unsigned char md_buf[EVP_MAX_MD_SIZE];