RAND_DRBG_SET_CALLBACKS - Online Linux Manual PageSection : 3
Updated : 2021-03-26
Source : 1.1.1k
Note : OpenSSL

NAMERAND_DRBG_set_callbacks, RAND_DRBG_get_entropy_fn, RAND_DRBG_cleanup_entropy_fn, RAND_DRBG_get_nonce_fn, RAND_DRBG_cleanup_nonce_fn ​− set callbacks for reseeding

SYNOPSIS​ #include <openssl/rand_drbg.h> ​ ​ ​ int RAND_DRBG_set_callbacks(RAND_DRBG *drbg, ​ RAND_DRBG_get_entropy_fn get_entropy, ​ RAND_DRBG_cleanup_entropy_fn cleanup_entropy, ​ RAND_DRBG_get_nonce_fn get_nonce, ​ RAND_DRBG_cleanup_nonce_fn cleanup_nonce);

Callback Functions​ typedef size_t (*RAND_DRBG_get_entropy_fn)( ​ RAND_DRBG *drbg, ​ unsigned char **pout, ​ int entropy, ​ size_t min_len, size_t max_len, ​ int prediction_resistance); ​ ​ typedef void (*RAND_DRBG_cleanup_entropy_fn)( ​ RAND_DRBG *drbg, ​ unsigned char *out, size_t outlen); ​ ​ typedef size_t (*RAND_DRBG_get_nonce_fn)( ​ RAND_DRBG *drbg, ​ unsigned char **pout, ​ int entropy, ​ size_t min_len, size_t max_len); ​ ​ typedef void (*RAND_DRBG_cleanup_nonce_fn)( ​ RAND_DRBG *drbg, ​ unsigned char *out, size_t outlen);

DESCRIPTIONRAND_DRBG_set_callbacks() sets the callbacks for obtaining fresh entropy and the nonce when reseeding the given drbg. The callback functions are implemented and provided by the caller. Their parameter lists need to match the function prototypes above. Setting the callbacks is allowed only if the DRBG has not been initialized yet. Otherwise, the operation will fail. To change the settings for one of the three shared DRBGs it is necessary to call ​RAND_DRBG_uninstantiate() first. The get_entropy() callback is called by the drbg when it requests fresh random input. It is expected that the callback allocates and fills a random buffer of size ​min_len <= size <= max_len (in bytes) which contains at least entropy bits of randomness. The prediction_resistance flag indicates whether the reseeding was triggered by a prediction resistance request. The buffer's address is to be returned in *pout and the number of collected randomness bytes as return value. If the callback fails to acquire at least entropy bits of randomness, it must indicate an error by returning a buffer length of 0. If prediction_resistance was requested and the random source of the DRBG does not satisfy the conditions requested by [NIST SP 800−90C], then it must also indicate an error by returning a buffer length of 0. See NOTES section for more details. The cleanup_entropy() callback is called from the drbg to clear and free the buffer allocated previously by get_entropy(). The values out and outlen are the random buffer's address and length, as returned by the get_entropy() callback. The get_nonce() and cleanup_nonce() callbacks are used to obtain a nonce and free it again. A nonce is only required for instantiation (not for reseeding) and only in the case where the DRBG uses a derivation function. The callbacks are analogous to get_entropy() and cleanup_entropy(), except for the missing prediction_resistance flag. If the derivation function is disabled, then no nonce is used for instantiation, and the get_nonce() and cleanup_nonce() callbacks can be omitted by setting them to NULL.

RETURN VALUESRAND_DRBG_set_callbacks() return 1 on success, and 0 on failure

NOTESIt is important that cleanup_entropy() and cleanup_nonce() clear the buffer contents safely before freeing it, in order not to leave sensitive information about the DRBG's state in memory. A request for prediction resistance can only be satisfied by pulling fresh entropy from one of the approved entropy sources listed in section 5.5.2 of [NIST SP 800−90C]. Since the default implementation of the get_entropy callback does not have access to such an approved entropy source, a request for prediction resistance will always fail. In other words, prediction resistance is currently not supported yet by the DRBG. The derivation function is disabled during initialization by calling the ​RAND_DRBG_set() function with the RAND_DRBG_FLAG_CTR_NO_DF flag. For more information on the derivation function and when it can be omitted, see [NIST SP 800−90A Rev. 1]. Roughly speaking it can be omitted if the random source has full entropy, i.e., contains 8 bits of entropy per byte. Even if a nonce is required, the get_nonce() and cleanup_nonce() callbacks can be omitted by setting them to NULL. In this case the DRBG will automatically request an extra amount of entropy (using the get_entropy() and cleanup_entropy() callbacks) which it will utilize for the nonce, following the recommendations of [NIST SP 800−90A Rev. 1], section 8.6.7.

SEE ALSORAND_DRBG_new(3), ​RAND_DRBG_reseed(3), ​RAND_DRBG(7)

HISTORYThe RAND_DRBG functions were added in OpenSSL 1.1.1.

COPYRIGHTCopyright 2017−2020 The OpenSSL Project Authors. All Rights Reserved. Licensed under the OpenSSL license (the License). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
0
Johanes Gumabo
Data Size   :   15,759 byte
man-RAND_DRBG_set_callbacks.3sslBuild   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   3 / 173,919
Visitor ID   :     :  
Visitor IP   :   3.142.55.138   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.

ERROR : Need New Coding :         (parse_manual_page_|249|R___AND_DRBG_cleanup_entropy_fn.3ssl|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\| )         (htmlprn|149|R___AND_DRBG_cleanup_entropy_fn.3ssl|36/37|.el══─{─══. ds --  —  |.el══─{─══. ds -- \|\(em\| )         (parse_manual_page_|249|R___AND_DRBG_cleanup_entropy_fn.3ssl|43|br══─}─══|'br══─}─══ )         (htmlprn|149|R___AND_DRBG_cleanup_entropy_fn.3ssl|43|'br══─}─══ |'br══─}─══ )