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.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 typedef struct
00045 {
00046 #ifdef _REENTRANT
00047 # if WIN32
00048 HANDLE lock;
00049 # else
00050 bc_lock_t lock;
00051 # endif
00052 #endif
00053 uint32_t state[N+1];
00054 uint32_t left;
00055 uint32_t* nextw;
00056 } mtprngParam;
00057
00058 #ifdef __cplusplus
00059 extern "C" {
00060 #endif
00061
00062
00063
00064 extern BEECRYPTAPI const randomGenerator mtprng;
00065
00066
00067
00068 BEECRYPTAPI
00069 int mtprngSetup (mtprngParam* mp);
00070
00071
00072
00073 BEECRYPTAPI
00074 int mtprngSeed (mtprngParam* mp, const byte* data, size_t size);
00075
00076
00077
00078 BEECRYPTAPI
00079 int mtprngNext (mtprngParam* mp, byte* data, size_t size);
00080
00081
00082
00083 BEECRYPTAPI
00084 int mtprngCleanup(mtprngParam* mp);
00085
00086 #ifdef __cplusplus
00087 }
00088 #endif
00089
00090 #endif