{"schema":"libjg2-1",
"vpath":"/git/",
"avatar":"/git/avatar/",
"alang":"",
"gen_ut":1752056007,
"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":"957bd105bfe1a235ee2dbab373f07657",
"commit": {"type":"commit",
"time": 1483657228,
"time_ofs": 0,
"oid_tree": { "oid": "89bc4790992e081a014cce5b7c53b42a3c85ad72", "alias": []},
"oid":{ "oid": "71f60ef3376144885384f2b1b3f00c3d54806f38", "alias": []},
"msg": "Remove BIO_seek/BIO_tell from evp_test.c",
"sig_commit": { "git_time": { "time": 1483657228, "offset": 0 }, "name": "Dr. Stephen Henson", "email": "steve@openssl.org", "md5": "fb4026c8240f7577a612418c24e54343" },
"sig_author": { "git_time": { "time": 1483644461, "offset": 0 }, "name": "Dr. Stephen Henson", "email": "steve@openssl.org", "md5": "fb4026c8240f7577a612418c24e54343" }},
"body": "Remove BIO_seek/BIO_tell from evp_test.c\n\nBIO_seek and BIO_tell can cause problems with evp_test.c on some platforms.\nAvoid them by using a temporary memory BIO to store key PEM data.\n\nReviewed-by: Richard Levitte \u003clevitte@openssl.org\u003e\n(Merged from https://github.com/openssl/openssl/pull/2183)"
,
"diff": "diff --git a/test/evp_test.c b/test/evp_test.c\nindex b6a7c28..e5d7c91 100644\n--- a/test/evp_test.c\n+++ b/test/evp_test.c\n@@ -197,6 +197,8 @@ static int test_uint64(const char *value, uint64_t *pr)\n struct evp_test {\n /* file being read */\n BIO *in;\n+ /* temp memory BIO for reading in keys */\n+ BIO *key;\n /* List of public and private keys */\n struct key_list *private;\n struct key_list *public;\n@@ -459,11 +461,36 @@ static int check_unsupported()\n return 0;\n }\n \n+\n+static int read_key(struct evp_test *t)\n+{\n+ char tmpbuf[80];\n+ if (t-\u003ekey \u003d\u003d NULL)\n+ t-\u003ekey \u003d BIO_new(BIO_s_mem());\n+ else if (BIO_reset(t-\u003ekey) \u003c\u003d 0)\n+ return 0;\n+ if (t-\u003ekey \u003d\u003d NULL) {\n+ fprintf(stderr, \u0022Error allocating key memory BIO\u005cn\u0022);\n+ return 0;\n+ }\n+ /* Read to PEM end line and place content in memory BIO */\n+ while (BIO_gets(t-\u003ein, tmpbuf, sizeof(tmpbuf))) {\n+ t-\u003eline++;\n+ if (BIO_puts(t-\u003ekey, tmpbuf) \u003c\u003d 0) {\n+ fprintf(stderr, \u0022Error writing to key memory BIO\u005cn\u0022);\n+ return 0;\n+ }\n+ if (strncmp(tmpbuf, \u0022-----END\u0022, 8) \u003d\u003d 0)\n+ return 1;\n+ }\n+ fprintf(stderr, \u0022Can't find key end\u005cn\u0022);\n+ return 0;\n+}\n+\n static int process_test(struct evp_test *t, char *buf, int verbose)\n {\n char *keyword \u003d NULL, *value \u003d NULL;\n int rv \u003d 0, add_key \u003d 0;\n- long save_pos \u003d 0;\n struct key_list **lst \u003d NULL, *key \u003d NULL;\n EVP_PKEY *pk \u003d NULL;\n const struct evp_test_method *tmeth \u003d NULL;\n@@ -472,8 +499,9 @@ static int process_test(struct evp_test *t, char *buf, int verbose)\n if (!parse_line(\u0026keyword, \u0026value, buf))\n return 1;\n if (strcmp(keyword, \u0022PrivateKey\u0022) \u003d\u003d 0) {\n- save_pos \u003d BIO_tell(t-\u003ein);\n- pk \u003d PEM_read_bio_PrivateKey(t-\u003ein, NULL, 0, NULL);\n+ if (!read_key(t))\n+ return 0;\n+ pk \u003d PEM_read_bio_PrivateKey(t-\u003ekey, NULL, 0, NULL);\n if (pk \u003d\u003d NULL \u0026\u0026 !check_unsupported()) {\n fprintf(stderr, \u0022Error reading private key %s\u005cn\u0022, value);\n ERR_print_errors_fp(stderr);\n@@ -483,8 +511,9 @@ static int process_test(struct evp_test *t, char *buf, int verbose)\n add_key \u003d 1;\n }\n if (strcmp(keyword, \u0022PublicKey\u0022) \u003d\u003d 0) {\n- save_pos \u003d BIO_tell(t-\u003ein);\n- pk \u003d PEM_read_bio_PUBKEY(t-\u003ein, NULL, 0, NULL);\n+ if (!read_key(t))\n+ return 0;\n+ pk \u003d PEM_read_bio_PUBKEY(t-\u003ekey, NULL, 0, NULL);\n if (pk \u003d\u003d NULL \u0026\u0026 !check_unsupported()) {\n fprintf(stderr, \u0022Error reading public key %s\u005cn\u0022, value);\n ERR_print_errors_fp(stderr);\n@@ -495,7 +524,6 @@ static int process_test(struct evp_test *t, char *buf, int verbose)\n }\n /* If we have a key add to list */\n if (add_key) {\n- char tmpbuf[80];\n if (find_key(NULL, value, *lst)) {\n fprintf(stderr, \u0022Duplicate key %s\u005cn\u0022, value);\n return 0;\n@@ -507,15 +535,7 @@ static int process_test(struct evp_test *t, char *buf, int verbose)\n key-\u003ekey \u003d pk;\n key-\u003enext \u003d *lst;\n *lst \u003d key;\n- /* Rewind input, read to end and update line numbers */\n- (void)BIO_seek(t-\u003ein, save_pos);\n- while (BIO_gets(t-\u003ein,tmpbuf, sizeof(tmpbuf))) {\n- t-\u003eline++;\n- if (strncmp(tmpbuf, \u0022-----END\u0022, 8) \u003d\u003d 0)\n- return 1;\n- }\n- fprintf(stderr, \u0022Can't find key end\u005cn\u0022);\n- return 0;\n+ return 1;\n }\n \n /* See if keyword corresponds to a test start */\n@@ -639,6 +659,7 @@ int main(int argc, char **argv)\n t.ntests, t.errors, t.nskip);\n free_key_list(t.public);\n free_key_list(t.private);\n+ BIO_free(t.key);\n BIO_free(in);\n \n #ifndef OPENSSL_NO_CRYPTO_MDEBUG\n","s":{"c":1752056007,"u": 39680}}
],"g": 41142,"chitpc": 0,"ehitpc": 0,"indexed":0
,
"ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}