summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rand/randfile.c
diff options
context:
space:
mode:
authorbeck <>2001-06-22 00:03:44 +0000
committerbeck <>2001-06-22 00:03:44 +0000
commit38b6ff9e5294811c57541ad47940f8f8f41dc114 (patch)
tree402699541cee3cf3f2943b0384dbda7de534de70 /src/lib/libcrypto/rand/randfile.c
parentafae624d63e4e717c5bae8c7842a4712309f728f (diff)
downloadopenbsd-38b6ff9e5294811c57541ad47940f8f8f41dc114.tar.gz
openbsd-38b6ff9e5294811c57541ad47940f8f8f41dc114.tar.bz2
openbsd-38b6ff9e5294811c57541ad47940f8f8f41dc114.zip
openssl-engine-0.9.6a merge
Diffstat (limited to 'src/lib/libcrypto/rand/randfile.c')
-rw-r--r--src/lib/libcrypto/rand/randfile.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/libcrypto/rand/randfile.c b/src/lib/libcrypto/rand/randfile.c
index 663a36cb70..f4376cf8cc 100644
--- a/src/lib/libcrypto/rand/randfile.c
+++ b/src/lib/libcrypto/rand/randfile.c
@@ -73,7 +73,7 @@
73# include <sys/stat.h> 73# include <sys/stat.h>
74#endif 74#endif
75 75
76#include <openssl/e_os.h> 76#include "openssl/e_os.h"
77#include <openssl/crypto.h> 77#include <openssl/crypto.h>
78#include <openssl/rand.h> 78#include <openssl/rand.h>
79 79
@@ -83,6 +83,9 @@
83 83
84/* #define RFILE ".rnd" - defined in ../../e_os.h */ 84/* #define RFILE ".rnd" - defined in ../../e_os.h */
85 85
86/* Note that these functions are intended for seed files only.
87 * Entropy devices and EGD sockets are handled in rand_unix.c */
88
86int RAND_load_file(const char *file, long bytes) 89int RAND_load_file(const char *file, long bytes)
87 { 90 {
88 /* If bytes >= 0, read up to 'bytes' bytes. 91 /* If bytes >= 0, read up to 'bytes' bytes.
@@ -213,7 +216,7 @@ err:
213 return (rand_err ? -1 : ret); 216 return (rand_err ? -1 : ret);
214 } 217 }
215 218
216const char *RAND_file_name(char *buf, int size) 219const char *RAND_file_name(char *buf, size_t size)
217 { 220 {
218 char *s = NULL; 221 char *s = NULL;
219 char *ret=NULL; 222 char *ret=NULL;
@@ -239,6 +242,8 @@ const char *RAND_file_name(char *buf, int size)
239 strlcat(buf,RFILE,size); 242 strlcat(buf,RFILE,size);
240 ret=buf; 243 ret=buf;
241 } 244 }
245 else
246 buf[0] = '\0'; /* no file name */
242 } 247 }
243 248
244#ifdef DEVRANDOM 249#ifdef DEVRANDOM
@@ -257,3 +262,4 @@ const char *RAND_file_name(char *buf, int size)
257#endif 262#endif
258 return(ret); 263 return(ret);
259 } 264 }
265