Latest update.
This commit is contained in:
@@ -7,6 +7,12 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* HMAC low level APIs are deprecated for public use, but still ok for internal
|
||||
* use.
|
||||
*/
|
||||
#include "internal/deprecated.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <openssl/crypto.h>
|
||||
|
||||
@@ -304,6 +304,34 @@ void rand_drbg_cleanup_nonce(RAND_DRBG *drbg,
|
||||
OPENSSL_clear_free(out, outlen);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the |drbg|'s callback data pointer for the entropy and nonce callbacks
|
||||
*
|
||||
* The ownership of the context data remains with the caller,
|
||||
* i.e., it is the caller's responsibility to keep it available as long
|
||||
* as it is need by the callbacks and free it after use.
|
||||
*
|
||||
* Setting the callback data is allowed only if the drbg has not been
|
||||
* initialized yet. Otherwise, the operation will fail.
|
||||
*
|
||||
* Returns 1 on success, 0 on failure.
|
||||
*/
|
||||
int RAND_DRBG_set_callback_data(RAND_DRBG *drbg, void *data)
|
||||
{
|
||||
if (drbg->state != DRBG_UNINITIALISED
|
||||
|| drbg->parent != NULL)
|
||||
return 0;
|
||||
|
||||
drbg->callback_data = data;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Retrieve the callback data pointer */
|
||||
void *RAND_DRBG_get_callback_data(RAND_DRBG *drbg)
|
||||
{
|
||||
return drbg->callback_data;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set/initialize |drbg| to be of type |type|, with optional |flags|.
|
||||
*
|
||||
|
||||
@@ -697,7 +697,7 @@ int rand_pool_add(RAND_POOL *pool,
|
||||
* is returned without producing an error message.
|
||||
*
|
||||
* After updating the buffer, rand_pool_add_end() needs to be called
|
||||
* to finish the udpate operation (see next comment).
|
||||
* to finish the update operation (see next comment).
|
||||
*/
|
||||
unsigned char *rand_pool_add_begin(RAND_POOL *pool, size_t len)
|
||||
{
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
* Typically, the DRBGs will set a minimum larger than this so optimal
|
||||
* allocation ought to take place (for full quality seed material).
|
||||
*
|
||||
* The normal value has been chosed by noticing that the rand_drbg_get_nonce
|
||||
* The normal value has been chosen by noticing that the rand_drbg_get_nonce
|
||||
* function is usually the largest of the built in allocation (twenty four
|
||||
* bytes and then appending another sixteen bytes). This means the buffer ends
|
||||
* with 40 bytes. The value of forty eight is comfortably above this which
|
||||
@@ -328,6 +328,8 @@ struct rand_drbg_st {
|
||||
RAND_DRBG_cleanup_entropy_fn cleanup_entropy;
|
||||
RAND_DRBG_get_nonce_fn get_nonce;
|
||||
RAND_DRBG_cleanup_nonce_fn cleanup_nonce;
|
||||
|
||||
void *callback_data;
|
||||
};
|
||||
|
||||
/* The global RAND method, and the global buffer and DRBG instance. */
|
||||
|
||||
Reference in New Issue
Block a user