Warmcat homepage andy@warmcat.com
libwebsockets
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1747287511, "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":"7a8dfcf18838953e3fbec77c0b095404", "commit": {"type":"commit", "time": 1534675445, "time_ofs": 120, "oid_tree": { "oid": "b13928ba107439b462acf57b75be530f6bde114c", "alias": []}, "oid":{ "oid": "630ce41e836a756423c7d834fa2b4a0f8efec871", "alias": []}, "msg": "rand_unix.c: don't discard entropy bytes from syscall_random()", "sig_commit": { "git_time": { "time": 1534675445, "offset": 120 }, "name": "Dr. Matthias St. Pierre", "email": "Matthias.St.Pierre@ncp-e.com", "md5": "7d700d548b38974b2492f8ff219793b3" }, "sig_author": { "git_time": { "time": 1534446347, "offset": 120 }, "name": "Dr. Matthias St. Pierre", "email": "Matthias.St.Pierre@ncp-e.com", "md5": "7d700d548b38974b2492f8ff219793b3" }}, "body": "rand_unix.c: don't discard entropy bytes from syscall_random()\n\nFixes #6978\n\nDon't discard partial reads from syscall_random() and retry instead.\n\nReviewed-by: Andy Polyakov \u003cappro@openssl.org\u003e\nReviewed-by: Paul Dale \u003cpaul.dale@oracle.com\u003e\nReviewed-by: Tim Hudson \u003ctjh@openssl.org\u003e\n(Merged from https://github.com/openssl/openssl/pull/6990)\n" , "diff": "diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c\nindex 74cc9e1..e63d778 100644\n--- a/crypto/rand/rand_unix.c\n+++ b/crypto/rand/rand_unix.c\n@@ -458,17 +458,25 @@ size_t rand_pool_acquire_entropy(RAND_POOL *pool)\n unsigned char *buffer;\n \n # ifdef OPENSSL_RAND_SEED_GETRANDOM\n- bytes_needed \u003d rand_pool_bytes_needed(pool, 1 /*entropy_factor*/);\n- buffer \u003d rand_pool_add_begin(pool, bytes_needed);\n- if (buffer !\u003d NULL) {\n- size_t bytes \u003d 0;\n-\n- if (syscall_random(buffer, bytes_needed) \u003d\u003d (int)bytes_needed)\n- bytes \u003d bytes_needed;\n+ {\n+ ssize_t bytes;\n+ /* Maximum allowed number of consecutive unsuccessful attempts */\n+ int attempts \u003d 3;\n \n- rand_pool_add_end(pool, bytes, 8 * bytes);\n- entropy_available \u003d rand_pool_entropy_available(pool);\n+ bytes_needed \u003d rand_pool_bytes_needed(pool, 1 /*entropy_factor*/);\n+ while (bytes_needed !\u003d 0 \u0026\u0026 attempts-- \u003e 0) {\n+ buffer \u003d rand_pool_add_begin(pool, bytes_needed);\n+ bytes \u003d syscall_random(buffer, bytes_needed);\n+ if (bytes \u003e 0) {\n+ rand_pool_add_end(pool, bytes, 8 * bytes);\n+ bytes_needed -\u003d bytes;\n+ attempts \u003d 3; /* reset counter after successful attempt */\n+ } else if (bytes \u003c 0 \u0026\u0026 errno !\u003d EINTR) {\n+ break;\n+ }\n+ }\n }\n+ entropy_available \u003d rand_pool_entropy_available(pool);\n if (entropy_available \u003e 0)\n return entropy_available;\n # endif\n","s":{"c":1747287511,"u": 62089}} ],"g": 63459,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}