diff options
author | Richard Levitte <levitte@openssl.org> | 2016-05-20 15:18:22 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2016-05-20 16:09:48 +0200 |
commit | 06593767b21d4ebacc3e6ecc8daedd9d5c5f9f97 (patch) | |
tree | 668f8a470eaca2d92a906117edb2589f2ea4765a | |
parent | 8ff889c2a242927305d013e3bf79c7bb735793b0 (diff) | |
download | openssl-06593767b21d4ebacc3e6ecc8daedd9d5c5f9f97.tar.gz |
Clean up the VMS hacks in crypto/rand/randfile.c
Reviewed-by: Andy Polyakov <appro@openssl.org>
-rw-r--r-- | crypto/rand/randfile.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/crypto/rand/randfile.c b/crypto/rand/randfile.c index f8b911b72e..49f5405dbc 100644 --- a/crypto/rand/randfile.c +++ b/crypto/rand/randfile.c @@ -101,6 +101,9 @@ static void vms_setbuf(FILE *fp, char *buf) static __FILE_ptr32 (*const vms_fopen)(const char *, const char *, ...) = (__FILE_ptr32 (*)(const char *, const char *, ...))fopen; # define VMS_OPEN_ATTRS "shr=get,put,upd,del","ctx=bin,stm","rfm=stm","rat=none","mrs=0" + +# define fopen(fname,mode) vms_fopen((fname), (mode), VMS_OPEN_ATTRS) +# define setbuf(fp,buf) vms_setbuf((fp), (buf)) #endif #define RFILE ".rnd" @@ -142,11 +145,7 @@ int RAND_load_file(const char *file, long bytes) if (bytes == 0) return (ret); -#ifdef OPENSSL_SYS_VMS - in = vms_fopen(file, "rb", VMS_OPEN_ATTRS); -#else in = fopen(file, "rb"); -#endif if (in == NULL) goto err; #if defined(S_ISBLK) && defined(S_ISCHR) && !defined(OPENSSL_NO_POSIX_IO) @@ -157,13 +156,7 @@ int RAND_load_file(const char *file, long bytes) * because we will waste system entropy. */ bytes = (bytes == -1) ? 2048 : bytes; /* ok, is 2048 enough? */ - - /* don't do buffered reads */ -# ifdef OPENSSL_SYS_VMS - vms_setbuf(in, NULL); -# else - setbuf(in, NULL); -# endif + setbuf(in, NULL); /* don't do buffered reads */ } #endif for (;;) { @@ -248,13 +241,10 @@ int RAND_write_file(const char *file) * rand file in a concurrent use situation. */ - out = vms_fopen(file, "rb+", VMS_OPEN_ATTRS); - if (out == NULL) - out = vms_fopen(file, "wb", VMS_OPEN_ATTRS); -#else + out = fopen(file, "rb+"); +#endif if (out == NULL) out = fopen(file, "wb"); -#endif if (out == NULL) goto err; |