From 9d01b22113829c89fb59915fd5789b1f902ba5a0 Mon Sep 17 00:00:00 2001 From: reyk <> Date: Wed, 16 Apr 2014 13:57:14 +0000 Subject: Some software expects RAND_status() to return 1 for success, so always return 1 in the arc4random backend because there is no possible error condition. Unbreaks lynx, git and friends. ok miod@ dcoppa@ --- src/lib/libcrypto/rand/rc4_rand.c | 12 ++++++++++-- src/lib/libssl/src/crypto/rand/rc4_rand.c | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/rand/rc4_rand.c b/src/lib/libcrypto/rand/rc4_rand.c index ebfb241d53..47405b0d9a 100644 --- a/src/lib/libcrypto/rand/rc4_rand.c +++ b/src/lib/libcrypto/rand/rc4_rand.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rc4_rand.c,v 1.1 2014/04/15 16:52:50 miod Exp $ */ +/* $OpenBSD: rc4_rand.c,v 1.2 2014/04/16 13:57:14 reyk Exp $ */ /* * Copyright (c) 2014 Miodrag Vallat. @@ -29,16 +29,24 @@ arc4_rand_bytes(unsigned char *buf, int num) return 1; } +static int +arc4_rand_status(void) +{ + /* no possible error condition */ + return 1; +} + static RAND_METHOD rand_arc4_meth = { .seed = NULL, /* no external seed allowed */ .bytes = arc4_rand_bytes, .cleanup = NULL, /* no cleanup necessary */ .add = NULL, /* no external feed allowed */ .pseudorand = arc4_rand_bytes, - .status = NULL /* no possible error condition */ + .status = arc4_rand_status }; RAND_METHOD *RAND_SSLeay(void) { return &rand_arc4_meth; } + diff --git a/src/lib/libssl/src/crypto/rand/rc4_rand.c b/src/lib/libssl/src/crypto/rand/rc4_rand.c index ebfb241d53..47405b0d9a 100644 --- a/src/lib/libssl/src/crypto/rand/rc4_rand.c +++ b/src/lib/libssl/src/crypto/rand/rc4_rand.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rc4_rand.c,v 1.1 2014/04/15 16:52:50 miod Exp $ */ +/* $OpenBSD: rc4_rand.c,v 1.2 2014/04/16 13:57:14 reyk Exp $ */ /* * Copyright (c) 2014 Miodrag Vallat. @@ -29,16 +29,24 @@ arc4_rand_bytes(unsigned char *buf, int num) return 1; } +static int +arc4_rand_status(void) +{ + /* no possible error condition */ + return 1; +} + static RAND_METHOD rand_arc4_meth = { .seed = NULL, /* no external seed allowed */ .bytes = arc4_rand_bytes, .cleanup = NULL, /* no cleanup necessary */ .add = NULL, /* no external feed allowed */ .pseudorand = arc4_rand_bytes, - .status = NULL /* no possible error condition */ + .status = arc4_rand_status }; RAND_METHOD *RAND_SSLeay(void) { return &rand_arc4_meth; } + -- cgit v1.2.3-55-g6feb