提交 af9895cb 编写于 作者: M Mat 提交者: Rich Salz

Updates from review

Reviewed-by: NMatt Caswell <matt@openssl.org>
Reviewed-by: NRich Salz <rsalz@openssl.org>
上级 b01e1644
...@@ -30,21 +30,23 @@ int pem_check_suffix(const char *pem_str, const char *suffix); ...@@ -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) 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; int i, j;
const char *prompt; const char *prompt;
#endif
if (key) { if (key) {
i = strlen(key); i = strlen(key);
i = (i > num) ? num : i; i = (i > num) ? num : i;
memcpy(buf, key, i); memcpy(buf, key, i);
return (i); return i;
} }
#if defined(OPENSSL_NO_STDIO) || defined(OPENSSL_NO_UI) #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); PEMerr(PEM_F_PEM_DEF_CALLBACK, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return (-1); return -1;
#else #else
prompt = EVP_get_pw_prompt(); prompt = EVP_get_pw_prompt();
if (prompt == NULL) if (prompt == NULL)
...@@ -61,7 +63,7 @@ int PEM_def_callback(char *buf, int num, int w, void *key) ...@@ -61,7 +63,7 @@ int PEM_def_callback(char *buf, int num, int w, void *key)
if (i != 0) { if (i != 0) {
PEMerr(PEM_F_PEM_DEF_CALLBACK, PEM_R_PROBLEMS_GETTING_PASSWORD); PEMerr(PEM_F_PEM_DEF_CALLBACK, PEM_R_PROBLEMS_GETTING_PASSWORD);
memset(buf, 0, (unsigned int)num); memset(buf, 0, (unsigned int)num);
return (-1); return -1;
} }
j = strlen(buf); j = strlen(buf);
if (min_len && j < min_len) { if (min_len && j < min_len) {
...@@ -71,7 +73,7 @@ int PEM_def_callback(char *buf, int num, int w, void *key) ...@@ -71,7 +73,7 @@ int PEM_def_callback(char *buf, int num, int w, void *key)
} else } else
break; break;
} }
return (j); return j;
#endif #endif
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册