Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

mtprng.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1998, 1999, 2000, 2003 Virtual Unlimited B.V.
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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

Generated on Wed Mar 24 13:56:53 2004 for BeeCrypt by doxygen 1.3.6