version 1.2, 2014/08/28 14:23:52 |
version 1.3, 2014/10/22 13:54:03 |
|
|
#include <openssl/bn.h> |
#include <openssl/bn.h> |
#include <openssl/err.h> |
#include <openssl/err.h> |
#include <openssl/pem.h> |
#include <openssl/pem.h> |
#include <openssl/rand.h> |
|
#include <openssl/ts.h> |
#include <openssl/ts.h> |
|
|
/* Length of the nonce of the request in bits (must be a multiple of 8). */ |
/* Length of the nonce of the request in bits (must be a multiple of 8). */ |
|
|
/* Generating random byte sequence. */ |
/* Generating random byte sequence. */ |
if (len > (int) sizeof(buf)) |
if (len > (int) sizeof(buf)) |
goto err; |
goto err; |
if (RAND_bytes(buf, len) <= 0) |
arc4random_buf(buf, len); |
goto err; |
|
|
|
/* Find the first non-zero byte and creating ASN1_INTEGER object. */ |
/* Find the first non-zero byte and creating ASN1_INTEGER object. */ |
for (i = 0; i < len && !buf[i]; ++i) |
for (i = 0; i < len && !buf[i]; ++i) |