summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorreyk <>2014-04-16 13:57:14 +0000
committerreyk <>2014-04-16 13:57:14 +0000
commit9d01b22113829c89fb59915fd5789b1f902ba5a0 (patch)
treeee4dd1ea5c6787694f4ccfebb6509861f2181c25 /src
parentfe3d1685b68e44ed30e549a3cc305ba88b3e6d93 (diff)
downloadopenbsd-9d01b22113829c89fb59915fd5789b1f902ba5a0.tar.gz
openbsd-9d01b22113829c89fb59915fd5789b1f902ba5a0.tar.bz2
openbsd-9d01b22113829c89fb59915fd5789b1f902ba5a0.zip
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@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/rand/rc4_rand.c12
-rw-r--r--src/lib/libssl/src/crypto/rand/rc4_rand.c12
2 files changed, 20 insertions, 4 deletions
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 @@
1/* $OpenBSD: rc4_rand.c,v 1.1 2014/04/15 16:52:50 miod Exp $ */ 1/* $OpenBSD: rc4_rand.c,v 1.2 2014/04/16 13:57:14 reyk Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2014 Miodrag Vallat. 4 * Copyright (c) 2014 Miodrag Vallat.
@@ -29,16 +29,24 @@ arc4_rand_bytes(unsigned char *buf, int num)
29 return 1; 29 return 1;
30} 30}
31 31
32static int
33arc4_rand_status(void)
34{
35 /* no possible error condition */
36 return 1;
37}
38
32static RAND_METHOD rand_arc4_meth = { 39static RAND_METHOD rand_arc4_meth = {
33 .seed = NULL, /* no external seed allowed */ 40 .seed = NULL, /* no external seed allowed */
34 .bytes = arc4_rand_bytes, 41 .bytes = arc4_rand_bytes,
35 .cleanup = NULL, /* no cleanup necessary */ 42 .cleanup = NULL, /* no cleanup necessary */
36 .add = NULL, /* no external feed allowed */ 43 .add = NULL, /* no external feed allowed */
37 .pseudorand = arc4_rand_bytes, 44 .pseudorand = arc4_rand_bytes,
38 .status = NULL /* no possible error condition */ 45 .status = arc4_rand_status
39}; 46};
40 47
41RAND_METHOD *RAND_SSLeay(void) 48RAND_METHOD *RAND_SSLeay(void)
42{ 49{
43 return &rand_arc4_meth; 50 return &rand_arc4_meth;
44} 51}
52
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 @@
1/* $OpenBSD: rc4_rand.c,v 1.1 2014/04/15 16:52:50 miod Exp $ */ 1/* $OpenBSD: rc4_rand.c,v 1.2 2014/04/16 13:57:14 reyk Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2014 Miodrag Vallat. 4 * Copyright (c) 2014 Miodrag Vallat.
@@ -29,16 +29,24 @@ arc4_rand_bytes(unsigned char *buf, int num)
29 return 1; 29 return 1;
30} 30}
31 31
32static int
33arc4_rand_status(void)
34{
35 /* no possible error condition */
36 return 1;
37}
38
32static RAND_METHOD rand_arc4_meth = { 39static RAND_METHOD rand_arc4_meth = {
33 .seed = NULL, /* no external seed allowed */ 40 .seed = NULL, /* no external seed allowed */
34 .bytes = arc4_rand_bytes, 41 .bytes = arc4_rand_bytes,
35 .cleanup = NULL, /* no cleanup necessary */ 42 .cleanup = NULL, /* no cleanup necessary */
36 .add = NULL, /* no external feed allowed */ 43 .add = NULL, /* no external feed allowed */
37 .pseudorand = arc4_rand_bytes, 44 .pseudorand = arc4_rand_bytes,
38 .status = NULL /* no possible error condition */ 45 .status = arc4_rand_status
39}; 46};
40 47
41RAND_METHOD *RAND_SSLeay(void) 48RAND_METHOD *RAND_SSLeay(void)
42{ 49{
43 return &rand_arc4_meth; 50 return &rand_arc4_meth;
44} 51}
52