version 1.4, 2014/10/13 02:46:14 |
version 1.5, 2014/10/22 13:54:03 |
|
|
|
|
#include <openssl/bio.h> |
#include <openssl/bio.h> |
#include <openssl/err.h> |
#include <openssl/err.h> |
#include <openssl/rand.h> |
|
|
|
struct { |
struct { |
int base64; |
int base64; |
|
|
chunk = num; |
chunk = num; |
if (chunk > (int) sizeof(buf)) |
if (chunk > (int) sizeof(buf)) |
chunk = sizeof(buf); |
chunk = sizeof(buf); |
r = RAND_bytes(buf, chunk); |
arc4random_buf(buf, chunk); |
if (r <= 0) |
|
goto err; |
|
if (rand_config.hex) { |
if (rand_config.hex) { |
for (i = 0; i < chunk; i++) |
for (i = 0; i < chunk; i++) |
BIO_printf(out, "%02x", buf[i]); |
BIO_printf(out, "%02x", buf[i]); |