diff options
author | Dr. Stephen Henson <steve@openssl.org> | 1999-12-24 23:53:57 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 1999-12-24 23:53:57 +0000 |
commit | 36217a942488852b616974e168a6ff0fecfb02fa (patch) | |
tree | 416a573e7d641b0209f7479c93070cc5365de039 /crypto/pem/pem_lib.c | |
parent | 12aefe78f0aec57159e396b5fd8f71644a76b631 (diff) | |
download | openssl-36217a942488852b616974e168a6ff0fecfb02fa.tar.gz |
Allow passwords to be included on command line for a few
more utilities.
Diffstat (limited to 'crypto/pem/pem_lib.c')
-rw-r--r-- | crypto/pem/pem_lib.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c index 2bafb5e735..bb2597b921 100644 --- a/crypto/pem/pem_lib.c +++ b/crypto/pem/pem_lib.c @@ -121,6 +121,22 @@ 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; |