diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2000-02-16 23:16:01 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2000-02-16 23:16:01 +0000 |
commit | a3fe382e2d2d794c598921cd39117581a2a8941b (patch) | |
tree | 2845b270bbe0705f5844c16d23fb398af3ef3f3f /crypto/pem | |
parent | bd03b99b9bb860e062f08ec6d919c0841d951833 (diff) |
Pass phrase reorganisation.
Diffstat (limited to 'crypto/pem')
-rw-r--r-- | crypto/pem/pem.h | 3 | ||||
-rw-r--r-- | crypto/pem/pem_lib.c | 24 |
2 files changed, 7 insertions, 20 deletions
diff --git a/crypto/pem/pem.h b/crypto/pem/pem.h index 80ab491a1c..26c313b2ef 100644 --- a/crypto/pem/pem.h +++ b/crypto/pem/pem.h @@ -601,9 +601,6 @@ EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, vo int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc, char *kstr,int klen, pem_password_cb *cd, void *u); -#ifdef MS_CALLBACK -int MS_CALLBACK PEM_cb(char *buf, int len, int verify, void *key); -#endif #endif /* SSLEAY_MACROS */ diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c index 49aeb62bde..1b441d7852 100644 --- a/crypto/pem/pem_lib.c +++ b/crypto/pem/pem_lib.c @@ -85,7 +85,7 @@ static int do_pk8pkey_fp(FILE *bp, EVP_PKEY *x, int isder, char *kstr, int klen, pem_password_cb *cb, void *u); -static int def_callback(char *buf, int num, int w, void *userdata) +static int def_callback(char *buf, int num, int w, void *key) { #ifdef NO_FP_API /* We should not ever call the default callback routine from @@ -95,6 +95,12 @@ static int def_callback(char *buf, int num, int w, void *userdata) #else int i,j; const char *prompt; + if(key) { + i=strlen(key); + i=(i > num)?num:i; + memcpy(buf,key,i); + return(i); + } prompt=EVP_get_pw_prompt(); if (prompt == NULL) @@ -121,22 +127,6 @@ static int def_callback(char *buf, int num, int w, void *userdata) #endif } -/* This is a generic callback. If the user data is not NULL it is assumed - * to be a null terminated password. Otherwise the default password callback - * is called. - */ - - -int MS_CALLBACK PEM_cb(char *buf, int len, int verify, void *key) -{ - int i; - if (key == NULL) return def_callback(buf, len, verify, key); - i=strlen(key); - i=(i > len)?len:i; - memcpy(buf,key,i); - return(i); -} - void PEM_proc_type(char *buf, int type) { const char *str; |