00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00026 #ifndef _MTPRNG_H
00027 #define _MTPRNG_H
00028
00029 #include "beecrypt/beecrypt.h"
00030
00031 #ifdef _REENTRANT
00032 # if WIN32
00033 # include <windows.h>
00034 # include <winbase.h>
00035 # endif
00036 #endif
00037
00038 #define N 624
00039 #define M 397
00040 #define K 0x9908B0DFU
00041
00042
00043
00044 #ifdef __cplusplus
00045 struct BEECRYPTAPI mtprngParam
00046 #else
00047 struct _mtprngParam
00048 #endif
00049 {
00050 #ifdef _REENTRANT
00051 bc_mutex_t lock;
00052 #endif
00053 uint32_t state[N+1];
00054 uint32_t left;
00055 uint32_t* nextw;
00056 };
00057
00058 #ifndef __cplusplus
00059 typedef struct _mtprngParam mtprngParam;
00060 #endif
00061
00062 #ifdef __cplusplus
00063 extern "C" {
00064 #endif
00065
00066
00067
00068 extern BEECRYPTAPI const randomGenerator mtprng;
00069
00070
00071
00072 BEECRYPTAPI
00073 int mtprngSetup (mtprngParam* mp);
00074
00075
00076
00077 BEECRYPTAPI
00078 int mtprngSeed (mtprngParam* mp, const byte* data, size_t size);
00079
00080
00081
00082 BEECRYPTAPI
00083 int mtprngNext (mtprngParam* mp, byte* data, size_t size);
00084
00085
00086
00087 BEECRYPTAPI
00088 int mtprngCleanup(mtprngParam* mp);
00089
00090 #ifdef __cplusplus
00091 }
00092 #endif
00093
00094 #endif