botan-bindings-0.0.1.0: Raw Botan bindings
Copyright(c) Leo D 2023
LicenseBSD-3-Clause
Maintainerleo@apotheca.io
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageHaskell2010

Botan.Bindings.RNG

Description

 
Synopsis

Documentation

data BotanRNGStruct Source #

Opaque RNG struct

newtype BotanRNG Source #

Botan RNG object

Constructors

MkBotanRNG 

Instances

Instances details
Storable BotanRNG Source # 
Instance details

Defined in Botan.Bindings.RNG

Eq BotanRNG Source # 
Instance details

Defined in Botan.Bindings.RNG

Ord BotanRNG Source # 
Instance details

Defined in Botan.Bindings.RNG

botan_rng_destroy :: FinalizerPtr BotanRNGStruct Source #

Frees all resources of the random number generator object

pattern BOTAN_RNG_TYPE_SYSTEM :: (Eq a, IsString a) => a Source #

pattern BOTAN_RNG_TYPE_USER :: (Eq a, IsString a) => a Source #

pattern BOTAN_RNG_TYPE_RDRAND :: (Eq a, IsString a) => a Source #

botan_rng_init Source #

Arguments

:: Ptr BotanRNG

rng

-> ConstPtr CChar

rng_type: type of the rng

-> IO CInt

0 if success, else error code

Initialize a random number generator object

rng_type has the possible values:

  • "system": system RNG
  • "user": userspace RNG
  • "user-threadsafe": userspace RNG, with internal locking
  • "rdrand": directly read RDRAND

Set rng_type to null to let the library choose some default.

type BotanRNGGetCallback ctx Source #

Arguments

 = Ptr ctx

context

-> Ptr Word8

out

-> CSize

out_len

-> IO CInt 

Callback for getting random bytes from the rng, return 0 for success

type BotanRNGAddEntropyCallback ctx Source #

Arguments

 = Ptr ctx

context

-> ConstPtr Word8

input[]

-> CSize

length

-> IO CInt 

Callback for adding entropy to the rng, return 0 for success

type BotanRNGDestroyCallback ctx Source #

Arguments

 = Ptr ctx

context

-> IO () 

Callback called when rng is destroyed

botan_rng_init_custom Source #

Arguments

:: Ptr BotanRNG

rng_out

-> ConstPtr CChar

rng_name: name of the rng

-> Ptr ctx

context: an application-specific context passed to the callback functions

-> FunPtr (BotanRNGGetCallback ctx)

get_cb

-> FunPtr (BotanRNGAddEntropyCallback ctx)

add_entropy_cb: may be NULL

-> FunPtr (BotanRNGDestroyCallback ctx)

destroy_cb: may be NULL

-> IO CInt 

Initialize a custom random number generator from a set of callback functions

botan_rng_get Source #

Arguments

:: BotanRNG

rng: rng object

-> Ptr Word8

out: output buffer of size out_len

-> CSize

out_len: number of requested bytes

-> IO CInt

0 on success, negative on failure

Get random bytes from a random number generators

botan_system_rng_get Source #

Arguments

:: Ptr Word8

out: output buffer of size out_len

-> CSize

out_len: number of requested bytes

-> IO CInt

0 on success, negative on failure

Get random bytes from system random number generator

botan_rng_reseed Source #

Arguments

:: BotanRNG

rng: rng object

-> CSize

bits: number of bits to reseed with

-> IO CInt

0 on success, a negative value on failure

Reseed a random number generator

Uses the System_RNG as a seed generator.

botan_rng_reseed_from_rng Source #

Arguments

:: BotanRNG

rng: rng object

-> BotanRNG

source_rng: the rng that will be read from

-> CSize

bits: number of bits to reseed with

-> IO CInt

0 on success, a negative value on failure

Reseed a random number generator

botan_rng_add_entropy Source #

Arguments

:: BotanRNG

rng: rng object

-> ConstPtr Word8

entropy: the data to add

-> CSize

entropy_len: length of entropy buffer

-> IO CInt

0 on success, a negative value on failure

Add some seed material to a random number generator