)]}' { "commit": "15c1488b6177b269a311814b63e670df534549e3", "tree": "061387453b292031244b5b1a77b03e2bb546bd16", "parents": [ "cfa9de85a3f1b5c09fe0087fb94b3b5f7210ba69" ], "author": { "name": "David Benjamin", "email": "davidben@google.com", "time": "Mon Mar 14 14:25:46 2016 -0400" }, "committer": { "name": "David Benjamin", "email": "davidben@google.com", "time": "Mon Mar 14 19:05:05 2016 +0000" }, "message": "Clear the error queue on entry to core SSL operations.\n\nOpenSSL historically made some poor API decisions. Rather than returning a\nstatus enum in SSL_read, etc., these functions must be paired with\nSSL_get_error which determines the cause of the last error\u0027s failure. This\nrequires SSL_read communicate with SSL_get_error with some stateful flag,\nrwstate.\n\nFurther, probably as workarounds for bugs elsewhere, SSL_get_error does not\ntrust rwstate. Among other quirks, if the error queue is non-empty,\nSSL_get_error overrides rwstate and returns a value based on that. This\nrequires that SSL_read, etc., be called with an empty error queue. (Or we hit\none of the spurious ERR_clear_error calls in the handshake state machine,\nlikely added as further self-workarounds.)\n\nSince requiring callers consistently clear the error queue everywhere is\nunreasonable (crbug.com/567501), clear ERR_clear_error *once* at the entry\npoint. Until/unless[*] we make SSL_get_error sane, this is the most reasonable\nway to get to the point that clearing the error queue on error is optional.\n\nWith those in place, the calls in the handshake state machine are no longer\nneeded. (I suspect all the ERR_clear_system_error calls can also go, but I\u0027ll\ninvestigate and think about that separately.)\n\n[*] I\u0027m not even sure it\u0027s possible anymore, thanks to the possibility of\nBIO_write pushing to the error queue.\n\nBUG\u003d567501,593963\n\nChange-Id: I564ace199e5a4a74b2554ad3335e99cd17120741\nReviewed-on: https://boringssl-review.googlesource.com/7455\nReviewed-by: Steven Valdez \u003csvaldez@google.com\u003e\nReviewed-by: David Benjamin \u003cdavidben@google.com\u003e\n", "tree_diff": [ { "type": "modify", "old_id": "7b311d6219418214e316fc9f5e4cae5a6ceab41f", "old_mode": 33188, "old_path": "ssl/d1_clnt.c", "new_id": "7fd61b7916b4667e8e1440840b470b8edbf8b671", "new_mode": 33188, "new_path": "ssl/d1_clnt.c" }, { "type": "modify", "old_id": "81079f4859b94c306b36960b2d9bfacb62399529", "old_mode": 33188, "old_path": "ssl/d1_lib.c", "new_id": "60057a89e8c31d936fa3119c1724c39959702bc9", "new_mode": 33188, "new_path": "ssl/d1_lib.c" }, { "type": "modify", "old_id": "5c9624a3cb3892a860bdba89e1932f172cdd8b98", "old_mode": 33188, "old_path": "ssl/d1_srvr.c", "new_id": "38b55571aeb4a06c31c82165f6fe20f6da968fd3", "new_mode": 33188, "new_path": "ssl/d1_srvr.c" }, { "type": "modify", "old_id": "1cabde08c4faa5a63cd8126c0c37878decb40fdb", "old_mode": 33188, "old_path": "ssl/s3_clnt.c", "new_id": "869e5acc4b9f03206e4ea1c731e3ddee2d37ccc1", "new_mode": 33188, "new_path": "ssl/s3_clnt.c" }, { "type": "modify", "old_id": "9ed0e2ea6119f667b830ac819bf14eb12f89efd9", "old_mode": 33188, "old_path": "ssl/s3_srvr.c", "new_id": "cfaddc9bd26c7fd50e26e2ec49b4e6d907602b72", "new_mode": 33188, "new_path": "ssl/s3_srvr.c" }, { "type": "modify", "old_id": "c1e6a004989c01052df7d365343e89efe6790a2d", "old_mode": 33188, "old_path": "ssl/ssl_lib.c", "new_id": "d9cea9981a310f4340accfc860c515ae372509b1", "new_mode": 33188, "new_path": "ssl/ssl_lib.c" } ] }