1 /*---------------------------------------------------------------------------*
2   Project:  NitroSDK - CRYPTO - demos
3   File:     prng.h
4 
5   Copyright 2006 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Log: prng.h,v $
14   Revision 1.1  2006/03/08 08:53:41  seiki_masashi
15   Added rc4-3 demo
16 
17   $NoKeywords: $
18  *---------------------------------------------------------------------------*/
19 
20 #ifndef PRNG_H_
21 #define PRNG_H_
22 
23 #ifdef  __cplusplus
24 extern "C" {
25 #endif
26 
27 /*===========================================================================*/
28 
29 #include    <nitro/types.h>
30 
31 /*---------------------------------------------------------------------------*
32     function definitions
33  *---------------------------------------------------------------------------*/
34 
35 /*---------------------------------------------------------------------------*
36   Name:         AddRandomSeed
37 
38   Description:  This function adds a random seed to the PRNG.
39 
40   Arguments:    random_seed - Pointer to the random seed to add
41                 len - Length of the random seed to add
42 
43   Returns:      None.
44  *---------------------------------------------------------------------------*/
45 void AddRandomSeed(u8* random_seed, u32 len);
46 
47 /*---------------------------------------------------------------------------*
48   Name:         ChurnRandomPool
49 
50   Description:  This function adds the current system status as a random seed to the PRNG.
51 
52   Arguments:    None.
53 
54   Returns:      None.
55  *---------------------------------------------------------------------------*/
56 void ChurnRandomPool(void);
57 
58 /*---------------------------------------------------------------------------*
59   Name:         GetRandomBytes
60 
61   Description:  This function gets a random number from the PRNG.
62 
63   Arguments:    Pointer to the buffer that stores the random number
64                 len - Length of the random number to get
65 
66   Returns:      None.
67  *---------------------------------------------------------------------------*/
68 void GetRandomBytes(u8* buffer, u32 len);
69 
70 
71 /*===========================================================================*/
72 
73 #ifdef  __cplusplus
74 }       /* extern "C" */
75 #endif
76 
77 #endif  /* PRNG_H_ */
78 
79 /*---------------------------------------------------------------------------*
80   End of file
81  *---------------------------------------------------------------------------*/
82