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/pem_lib.c | |
parent | bd03b99b9bb860e062f08ec6d919c0841d951833 (diff) | |
download | openssl-a3fe382e2d2d794c598921cd39117581a2a8941b.tar.gz |
Pass phrase reorganisation.
Diffstat (limited to 'crypto/pem/pem_lib.c')
-rw-r--r-- | crypto/pem/pem_lib.c | 24 |
1 files changed, 7 insertions, 17 deletions
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; |