[ruby-core:63795] [ruby-trunk - Bug #10053] [Open] OpenSSL: incorrect return value check of EGD functions

0 views
Skip to first unread message

cre...@mail.ru

unread,
Jul 17, 2014, 5:01:59 AM7/17/14
to ruby...@ruby-lang.org
Issue #10053 has been reported by cremno phobia.

----------------------------------------
Bug #10053: OpenSSL: incorrect return value check of EGD functions
https://bugs.ruby-lang.org/issues/10053

* Author: cremno phobia
* Status: Open
* Priority: Normal
* Assignee: openssl
* Category: ext/openssl
* Target version: current: 2.2.0
* ruby -v: all
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
https://www.openssl.org/docs/crypto/RAND_egd.html#RETURN_VALUE

~~~diff
diff --git a/ext/openssl/ossl_rand.c b/ext/openssl/ossl_rand.c
index 270a4b7..a9188bc 100644
--- a/ext/openssl/ossl_rand.c
+++ b/ext/openssl/ossl_rand.c
@@ -135,7 +135,7 @@ ossl_rand_egd(VALUE self, VALUE filename)
{
SafeStringValue(filename);

- if(!RAND_egd(RSTRING_PTR(filename))) {
+ if (RAND_egd(RSTRING_PTR(filename)) == -1) {
ossl_raise(eRandomError, NULL);
}
return Qtrue;
@@ -153,7 +153,7 @@ ossl_rand_egd_bytes(VALUE self, VALUE filename, VALUE len)

SafeStringValue(filename);

- if (!RAND_egd_bytes(RSTRING_PTR(filename), n)) {
+ if (RAND_egd_bytes(RSTRING_PTR(filename), n) == -1) {
ossl_raise(eRandomError, NULL);
}
return Qtrue;
~~~


Maybe an error message (e.g. `"EGD connection failed or not enough data returned to fully seed the PRNG"`) should also be added.



--
https://bugs.ruby-lang.org/

wtne...@gmail.com

unread,
Jul 18, 2014, 7:36:14 PM7/18/14
to ruby...@ruby-lang.org
Issue #10053 has been updated by William T. Nelson.


The Entropy Gathering Daemon was last updated twelve years ago.

Ruby should deprecate the use of egd functions and provide configuration options to use LibreSSL in place of OpenSSL, just like how the Editline Library can be used in place of GNU Readline.

----------------------------------------
Bug #10053: OpenSSL: incorrect return value check of EGD functions
https://bugs.ruby-lang.org/issues/10053#change-47875

shibata...@gmail.com

unread,
Aug 6, 2014, 12:10:46 AM8/6/14
to ruby...@ruby-lang.org
Issue #10053 has been updated by Hiroshi SHIBATA.

Status changed from Open to Assigned
Assignee changed from openssl to Martin Bosslet

----------------------------------------
Bug #10053: OpenSSL: incorrect return value check of EGD functions
https://bugs.ruby-lang.org/issues/10053#change-48217

* Author: cremno phobia
* Status: Assigned
* Priority: Normal
* Assignee: Martin Bosslet

e...@zzak.io

unread,
Feb 12, 2015, 9:30:51 PM2/12/15
to ruby...@ruby-lang.org
Issue #10053 has been updated by Zachary Scott.


The first part sounds OK, I support deprecate of egd functions. The second part needs actionable tickets, and patches welcome.

----------------------------------------
Bug #10053: OpenSSL: incorrect return value check of EGD functions
https://bugs.ruby-lang.org/issues/10053#change-51481

* Author: cremno phobia
* Status: Assigned
* Priority: Normal
* Assignee: Martin Bosslet

e...@zzak.io

unread,
Feb 12, 2015, 9:57:40 PM2/12/15
to ruby...@ruby-lang.org
Issue #10053 has been updated by Zachary Scott.

Assignee changed from Martin Bosslet to openssl

----------------------------------------
Bug #10053: OpenSSL: incorrect return value check of EGD functions
https://bugs.ruby-lang.org/issues/10053#change-51484

* Author: cremno phobia
* Status: Assigned
* Priority: Normal
* Assignee: openssl
Reply all
Reply to author
Forward
0 new messages