X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fevp%2Fevp_key.c;h=26cdcdf19539e83e7cf59967f7e60fd41f25b5db;hp=0aa1dbb65a78db96441fe4e62c28495e4e329765;hb=854e076df8cbd79a407c7a282ccd0f7fd15ee481;hpb=eda1f21f1af8b6f77327e7b37573af9c1ba73726 diff --git a/crypto/evp/evp_key.c b/crypto/evp/evp_key.c index 0aa1dbb65a..26cdcdf195 100644 --- a/crypto/evp/evp_key.c +++ b/crypto/evp/evp_key.c @@ -1,5 +1,5 @@ /* crypto/evp/evp_key.c */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written @@ -58,15 +58,14 @@ #include #include "cryptlib.h" -#include "x509.h" -#include "objects.h" -#include "evp.h" +#include +#include +#include /* 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'; @@ -74,7 +73,7 @@ char *prompt; strncpy(prompt_string,prompt,79); } -char *EVP_get_pw_prompt() +char *EVP_get_pw_prompt(void) { if (prompt_string[0] == '\0') return(NULL); @@ -82,26 +81,23 @@ char *EVP_get_pw_prompt() return(prompt_string); } -int EVP_read_pw_string(buf,len,prompt,verify) -char *buf; -int len; -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 OPENSSL_NO_DES 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) -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, const EVP_MD *md, + const unsigned char *salt, const 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]; @@ -120,7 +116,7 @@ unsigned char *iv; EVP_DigestUpdate(&c,&(md_buf[0]),mds); EVP_DigestUpdate(&c,data,datal); if (salt != NULL) - EVP_DigestUpdate(&c,salt,8); + EVP_DigestUpdate(&c,salt,PKCS5_SALT_LEN); EVP_DigestFinal(&c,&(md_buf[0]),&mds); for (i=1; i<(unsigned int)count; i++) @@ -158,6 +154,6 @@ unsigned char *iv; } memset(&c,0,sizeof(c)); memset(&(md_buf[0]),0,EVP_MAX_MD_SIZE); - return(nkey); + return(type->key_len); }