diff options
author | Mat <mberchtold@gmail.com> | 2016-05-10 15:51:28 +0200 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2016-05-31 17:39:00 -0400 |
commit | af9895cb8c00cb383c0417bda1163001946681bd (patch) | |
tree | 4035e3e295849a36699085f3147c5d4cf0809f22 | |
parent | b01e1644d7f7a0d750340540385e93db7d180fd6 (diff) |
Updates from review
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
-rw-r--r-- | crypto/pem/pem_lib.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c index 0f281629a0..90893f1954 100644 --- a/crypto/pem/pem_lib.c +++ b/crypto/pem/pem_lib.c @@ -30,21 +30,23 @@ int pem_check_suffix(const char *pem_str, const char *suffix); int PEM_def_callback(char *buf, int num, int w, void *key) { +#if defined(OPENSSL_NO_STDIO) || defined(OPENSSL_NO_UI) + int i; +#else int i, j; const char *prompt; +#endif + if (key) { i = strlen(key); i = (i > num) ? num : i; memcpy(buf, key, i); - return (i); + return i; } #if defined(OPENSSL_NO_STDIO) || defined(OPENSSL_NO_UI) - /* - * We should not ever call the default callback routine from windows. - */ PEMerr(PEM_F_PEM_DEF_CALLBACK, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); - return (-1); + return -1; #else prompt = EVP_get_pw_prompt(); if (prompt == NULL) @@ -61,7 +63,7 @@ int PEM_def_callback(char *buf, int num, int w, void *key) if (i != 0) { PEMerr(PEM_F_PEM_DEF_CALLBACK, PEM_R_PROBLEMS_GETTING_PASSWORD); memset(buf, 0, (unsigned int)num); - return (-1); + return -1; } j = strlen(buf); if (min_len && j < min_len) { @@ -71,7 +73,7 @@ int PEM_def_callback(char *buf, int num, int w, void *key) } else break; } - return (j); + return j; #endif } |