---
name: "crypto_alloc_rng"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/crypto_alloc_rng"
---

# crypto\_alloc\_rng(9)

\- allocate RNG handle

## NAME

crypto\_alloc\_rng - - allocate RNG handle

## SYNOPSIS

**struct crypto\_rng \* crypto\_alloc\_rng(const char \*** *alg\_name***, u32** *type***, u32** *mask***);**

## ARGUMENTS

*alg\_name*

is the cra\_name / name or cra\_driver\_name / driver name of the message digest cipher

*type*

specifies the type of the cipher

*mask*

specifies the mask for the cipher

## DESCRIPTION

Allocate a cipher handle for a random number generator. The returned struct crypto\_rng is the cipher handle that is required for any subsequent API invocation for that random number generator.

For all random number generators, this call creates a new private copy of the random number generator that does not share a state with other instances. The only exception is the “krng” random number generator which is a kernel crypto API use case for the **get\_random\_bytes** function of the /dev/random driver.

## RETURN

allocated cipher handle in case of success; **IS\_ERR** is true in case of an error, **PTR\_ERR** returns the error code.

## AUTHORS

**Stephan Mueller** \<smueller@chronox.de\>

Author.

**Marek Vasut** \<marek@denx.de\>

Author.

## COPYRIGHT
