diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2018-01-14 21:40:40 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2018-01-14 21:40:40 +0100 |
commit | b625a9423cd74481a77f816adae37db2515f4307 (patch) | |
tree | 33211524a3963934f3fc4de133785c6ea6aa5e3b /lib/lanplus/lanplus_crypt_impl.c | |
parent | a065a7a25209c92425480fa90f9c5545e3fe0350 (diff) | |
parent | f875d640b628e5e88fd63f9b51121c90c0c1122b (diff) |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'lib/lanplus/lanplus_crypt_impl.c')
-rw-r--r-- | lib/lanplus/lanplus_crypt_impl.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/lanplus/lanplus_crypt_impl.c b/lib/lanplus/lanplus_crypt_impl.c index 1daf230..389a436 100644 --- a/lib/lanplus/lanplus_crypt_impl.c +++ b/lib/lanplus/lanplus_crypt_impl.c @@ -41,7 +41,27 @@ #include <openssl/err.h> #include <assert.h> - +#ifdef WIN32 +/* win_rand_filename + Custom RAND_file_name routine to use better path than C:\ + Use: %USERPROFILE%, %HOME%, %HOMEPATH%, + USERPROFILE=C:\Users\acress + HOMEDRIVE=C: + HOMEPATH=\Users\acress + */ +char *win_rand_filename(char *buffer, int bufsz) +{ + char *root = "C:\\"; + char *envpath = NULL; + + envpath = getenv("USERPROFILE"); + if ((envpath == NULL) || (envpath[0] == '\0')) { + envpath = root; + } + snprintf(buffer,bufsz,"%s\\.rnd",envpath); + return(buffer); +} +#endif /* * lanplus_seed_prng @@ -60,7 +80,8 @@ int lanplus_seed_prng(uint32_t bytes) char buffer[200]; static FILE *fp = NULL; size_t i; - randfile = RAND_file_name(buffer, sizeof buffer); /* usu C:\.rnd */ + // randfile = RAND_file_name(buffer, sizeof buffer); /* usu C:\.rnd */ + randfile = win_rand_filename(buffer, sizeof buffer); if ((randfile != NULL) && (fp == NULL)) { fp = fopen(randfile,"r"); /*check the randfile*/ if (fp == NULL) { /*does not exist, create it*/ |