---
name: "RAND_DRBG_set_ex_data"
section: "3ssl"
platform: "linux"
package: "libssl-doc"
version: "1.1.1w-0+deb11u1"
release: "Debian 11 (Bullseye)"
platforms: ["linux"]
url: "https://new.carta.tech/RAND_DRBG_set_ex_data"
---

# RAND\_DRBG\_set\_ex\_data(3ssl)

store and retrieve extra data from the DRBG instance

## NAME

RAND\_DRBG\_set\_ex\_data, RAND\_DRBG\_get\_ex\_data, RAND\_DRBG\_get\_ex\_new\_index - store and retrieve extra data from the DRBG instance

## SYNOPSIS

```
 #include <openssl/rand_drbg.h>
 int RAND_DRBG_set_ex_data(RAND_DRBG *drbg, int idx, void *data);
 void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx);
 int RAND_DRBG_get_ex_new_index(long argl, void *argp,
                                CRYPTO_EX_new *new_func,
                                CRYPTO_EX_dup *dup_func,
                                CRYPTO_EX_free *free_func);
```

## DESCRIPTION

**RAND\_DRBG\_set\_ex\_data()** enables an application to store arbitrary application specific data **data** in a RAND\_DRBG instance **drbg**. The index **idx** should be a value previously returned from a call to **RAND\_DRBG\_get\_ex\_new\_index()**.

**RAND\_DRBG\_get\_ex\_data()** retrieves application specific data previously stored in an RAND\_DRBG instance **drbg**. The **idx** value should be the same as that used when originally storing the data.

For more detailed information see **CRYPTO\_get\_ex\_data**(3) and **CRYPTO\_set\_ex\_data**(3) which implement these functions and **CRYPTO\_get\_ex\_new\_index**(3) for generating a unique index.

## RETURN VALUES

**RAND\_DRBG\_set\_ex\_data()** returns 1 for success or 0 for failure.

**RAND\_DRBG\_get\_ex\_data()** returns the previously stored value or NULL on failure. NULL may also be a valid value.

## NOTES

RAND\_DRBG\_get\_ex\_new\_index(...) is implemented as a macro and equivalent to CRYPTO\_get\_ex\_new\_index(CRYPTO\_EX\_INDEX\_DRBG,...).

## SEE ALSO

**CRYPTO\_get\_ex\_data**(3), **CRYPTO\_set\_ex\_data**(3), **CRYPTO\_get\_ex\_new\_index**(3), **RAND\_DRBG**(7)

## COPYRIGHT

Copyright 2017-2018 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\>.
