Ejemplo n.º 1
0
/**
 * Initialize Droplet global data.
 *
 * Initializes global data used by the library.  Must be called once
 * and only once before any other Droplet library functions.  The next
 * step after calling `dpl_init()` is probably `dpl_ctx_new()`.
 *
 * @retval DPL_SUCCESS this function cannot currently fail
 */
dpl_status_t
dpl_init()
{
  SSL_library_init();
  SSL_load_error_strings();

  dpl_base64_init();

  return DPL_SUCCESS;
}
Ejemplo n.º 2
0
/**
 * Initialize Droplet global data.
 *
 * Initializes global data used by the library.  Must be called once
 * and only once before any other Droplet library functions.  The next
 * step after calling `dpl_init()` is probably `dpl_ctx_new()`.
 *
 * @retval DPL_SUCCESS this function cannot currently fail
 */
dpl_status_t
dpl_init()
{
  SSL_library_init();
  SSL_load_error_strings();
  ERR_load_crypto_strings();

  /* RAND_seed(randbuf, strlen(randbuf)); */
  int ret = RAND_status();
  if (0 == ret) {
    DPL_LOG(NULL, DPL_WARNING, "PRNG not properly seeded, seeding it...");
    RAND_poll();
    ret = RAND_status();
    DPL_LOG(NULL, DPL_INFO, "PRNG state after seeding: %d", ret);
  } else if (1 == ret) {
    DPL_LOG(NULL, DPL_INFO, "PRNG has been seeded with enough data");
  }

  dpl_base64_init();

  return DPL_SUCCESS;
}