yarrow.c File Reference

Yarrow PRNG. More...

#include "core/crypto.h"
#include "rng/yarrow.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   CRYPTO_TRACE_LEVEL
 

Functions

error_t yarrowInit (YarrowContext *context)
 Initialize PRNG context. More...
 
void yarrowRelease (YarrowContext *context)
 Release PRNG context. More...
 
error_t yarrowSeed (YarrowContext *context, const uint8_t *input, size_t length)
 Seed the PRNG state. More...
 
error_t yarrowAddEntropy (YarrowContext *context, uint_t source, const uint8_t *input, size_t length, size_t entropy)
 Add entropy to the PRNG state. More...
 
error_t yarrowRead (YarrowContext *context, uint8_t *output, size_t length)
 Read random data. More...
 
void yarrowGenerateBlock (YarrowContext *context, uint8_t *output)
 Generate a random block of data. More...
 
void yarrowFastReseed (YarrowContext *context)
 Reseed from the fast pool. More...
 
void yarrowSlowReseed (YarrowContext *context)
 Reseed from the slow pool. More...
 

Variables

const PrngAlgo yarrowPrngAlgo
 

Detailed Description

Yarrow PRNG.

License

Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneSSL Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
1.9.0

Definition in file yarrow.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   CRYPTO_TRACE_LEVEL

Definition at line 30 of file yarrow.c.

Function Documentation

◆ yarrowAddEntropy()

error_t yarrowAddEntropy ( YarrowContext context,
uint_t  source,
const uint8_t *  input,
size_t  length,
size_t  entropy 
)

Add entropy to the PRNG state.

Parameters
[in]contextPointer to the PRNG context
[in]sourceEntropy source identifier
[in]inputPointer to the input data
[in]lengthLength of the input data
[in]entropyActual number of bits of entropy
Returns
Error code

Definition at line 132 of file yarrow.c.

◆ yarrowFastReseed()

void yarrowFastReseed ( YarrowContext context)

Reseed from the fast pool.

Parameters
[in]contextPointer to the PRNG context

Definition at line 283 of file yarrow.c.

◆ yarrowGenerateBlock()

void yarrowGenerateBlock ( YarrowContext context,
uint8_t *  output 
)

Generate a random block of data.

Parameters
[in]contextPointer to the PRNG context
[out]outputBuffer where to store the output block

Definition at line 261 of file yarrow.c.

◆ yarrowInit()

error_t yarrowInit ( YarrowContext context)

Initialize PRNG context.

Parameters
[in]contextPointer to the PRNG context to initialize
Returns
Error code

Definition at line 59 of file yarrow.c.

◆ yarrowRead()

error_t yarrowRead ( YarrowContext context,
uint8_t *  output,
size_t  length 
)

Read random data.

Parameters
[in]contextPointer to the PRNG context
[out]outputBuffer where to store the output data
[in]lengthDesired length in bytes
Returns
Error code

Definition at line 204 of file yarrow.c.

◆ yarrowRelease()

void yarrowRelease ( YarrowContext context)

Release PRNG context.

Parameters
[in]contextPointer to the PRNG context

Definition at line 88 of file yarrow.c.

◆ yarrowSeed()

error_t yarrowSeed ( YarrowContext context,
const uint8_t *  input,
size_t  length 
)

Seed the PRNG state.

Parameters
[in]contextPointer to the PRNG context
[in]inputPointer to the input data
[in]lengthLength of the input data
Returns
Error code

Definition at line 106 of file yarrow.c.

◆ yarrowSlowReseed()

void yarrowSlowReseed ( YarrowContext context)

Reseed from the slow pool.

Parameters
[in]contextPointer to the PRNG context

Definition at line 316 of file yarrow.c.

Variable Documentation

◆ yarrowPrngAlgo

const PrngAlgo yarrowPrngAlgo
Initial value:
=
{
"Yarrow",
sizeof(YarrowContext),
}
error_t yarrowInit(YarrowContext *context)
Initialize PRNG context.
Definition: yarrow.c:59
void yarrowRelease(YarrowContext *context)
Release PRNG context.
Definition: yarrow.c:88
error_t yarrowRead(YarrowContext *context, uint8_t *output, size_t length)
Read random data.
Definition: yarrow.c:204
error_t yarrowAddEntropy(YarrowContext *context, uint_t source, const uint8_t *input, size_t length, size_t entropy)
Add entropy to the PRNG state.
Definition: yarrow.c:132
error_t yarrowSeed(YarrowContext *context, const uint8_t *input, size_t length)
Seed the PRNG state.
Definition: yarrow.c:106
error_t(* PrngAlgoSeed)(void *context, const uint8_t *input, size_t length)
Definition: crypto.h:1035
error_t(* PrngAlgoInit)(void *context)
Definition: crypto.h:1033
void(* PrngAlgoRelease)(void *context)
Definition: crypto.h:1034
Yarrow PRNG context.
Definition: yarrow.h:61
error_t(* PrngAlgoAddEntropy)(void *context, uint_t source, const uint8_t *input, size_t length, size_t entropy)
Definition: crypto.h:1036
error_t(* PrngAlgoRead)(void *context, uint8_t *output, size_t length)
Definition: crypto.h:1037

Definition at line 41 of file yarrow.c.