{"schema":"libjg2-1",
"vpath":"/git/",
"avatar":"/git/avatar/",
"alang":"",
"gen_ut":1752654445,
"reponame":"openssl",
"desc":"OpenSSL",
"owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://warmcat.com/repo/openssl",
"f":3,
"items": [
{"schema":"libjg2-1",
"cid":"d21ba674f6d709b7f7630ea945e97be7",
"commit": {"type":"commit",
"time": 1524731984,
"time_ofs": 120,
"oid_tree": { "oid": "eec065cc29c5b53bdfd005d7d9c5c70b36a9c8e0", "alias": []},
"oid":{ "oid": "d6d94d339756332bbabe2a1032ac511ae31b3fdc", "alias": []},
"msg": "PEM_def_callback(): use same parameter names as for pem_password_cb",
"sig_commit": { "git_time": { "time": 1524731984, "offset": 120 }, "name": "Richard Levitte", "email": "levitte@openssl.org", "md5": "b737120f0642a6a5c30c6291e6170c77" },
"sig_author": { "git_time": { "time": 1524689620, "offset": 120 }, "name": "Richard Levitte", "email": "levitte@openssl.org", "md5": "b737120f0642a6a5c30c6291e6170c77" }},
"body": "PEM_def_callback(): use same parameter names as for pem_password_cb\n\nAdd a bit more commentary to explain what's going on.\n\nReviewed-by: Matt Caswell \u003cmatt@openssl.org\u003e\n(Merged from https://github.com/openssl/openssl/pull/6080)\n"
,
"diff": "diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c\nindex 3be12d6..5000f26 100644\n--- a/crypto/pem/pem_lib.c\n+++ b/crypto/pem/pem_lib.c\n@@ -28,15 +28,16 @@ static int load_iv(char **fromp, unsigned char *to, int num);\n static int check_pem(const char *nm, const char *name);\n int pem_check_suffix(const char *pem_str, const char *suffix);\n \n-int PEM_def_callback(char *buf, int num, int w, void *key)\n+int PEM_def_callback(char *buf, int num, int rwflag, void *userdata)\n {\n int i, min_len;\n const char *prompt;\n \n- if (key) {\n- i \u003d strlen(key);\n+ /* We assume that the user passes a default password as userdata */\n+ if (userdata) {\n+ i \u003d strlen(userdata);\n i \u003d (i \u003e num) ? num : i;\n- memcpy(buf, key, i);\n+ memcpy(buf, userdata, i);\n return i;\n }\n \n@@ -45,12 +46,15 @@ int PEM_def_callback(char *buf, int num, int w, void *key)\n prompt \u003d \u0022Enter PEM pass phrase:\u0022;\n \n /*\n- * We assume that w \u003d\u003d 0 means decryption,\n- * while w \u003d\u003d 1 means encryption\n+ * rwflag \u003d\u003d 0 means decryption\n+ * rwflag \u003d\u003d 1 means encryption\n+ *\n+ * We assume that for encryption, we want a minimum length, while for\n+ * decryption, we cannot know any minimum length, so we assume zero.\n */\n- min_len \u003d w ? MIN_LENGTH : 0;\n+ min_len \u003d rwflag ? MIN_LENGTH : 0;\n \n- i \u003d EVP_read_pw_string_min(buf, min_len, num, prompt, w);\n+ i \u003d EVP_read_pw_string_min(buf, min_len, num, prompt, rwflag);\n if (i !\u003d 0) {\n PEMerr(PEM_F_PEM_DEF_CALLBACK, PEM_R_PROBLEMS_GETTING_PASSWORD);\n memset(buf, 0, (unsigned int)num);\ndiff --git a/include/openssl/pem.h b/include/openssl/pem.h\nindex 165544c..2ef5b5d 100644\n--- a/include/openssl/pem.h\n+++ b/include/openssl/pem.h\n@@ -280,7 +280,8 @@ int PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt);\n int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,\n unsigned int *siglen, EVP_PKEY *pkey);\n \n-int PEM_def_callback(char *buf, int num, int w, void *key);\n+/* The default pem_password_cb that's used internally */\n+int PEM_def_callback(char *buf, int num, int rwflag, void *userdata);\n void PEM_proc_type(char *buf, int type);\n void PEM_dek_info(char *buf, const char *type, int len, char *str);\n \n","s":{"c":1752654445,"u": 39840}}
],"g": 41250,"chitpc": 0,"ehitpc": 0,"indexed":0
,
"ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}