00001 /* 00002 * Copyright (c) 1998, 1999, 2000, 2001, 2002 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 _FIPS186_H 00027 #define _FIPS186_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 #include "beecrypt.h" 00039 #include "sha1.h" 00040 00041 #if (MP_WBITS == 64) 00042 # define FIPS186_STATE_SIZE 8 00043 #elif (MP_WBITS == 32) 00044 # define FIPS186_STATE_SIZE 16 00045 #else 00046 # error 00047 #endif 00048 00051 typedef struct 00052 { 00053 #ifdef _REENTRANT 00054 # if WIN32 00055 HANDLE lock; 00056 # else 00057 bc_lock_t lock; 00058 # endif 00059 #endif 00060 sha1Param param; 00061 mpw state[FIPS186_STATE_SIZE]; 00062 byte digest[20]; 00063 unsigned char digestremain; 00064 } fips186Param; 00065 00066 #ifdef __cplusplus 00067 extern "C" { 00068 #endif 00069 00070 extern BEECRYPTAPI const randomGenerator fips186prng; 00071 00072 BEECRYPTAPI 00073 int fips186Setup (fips186Param*); 00074 BEECRYPTAPI 00075 int fips186Seed (fips186Param*, const byte*, size_t); 00076 BEECRYPTAPI 00077 int fips186Next (fips186Param*, byte*, size_t); 00078 BEECRYPTAPI 00079 int fips186Cleanup(fips186Param*); 00080 00081 #ifdef __cplusplus 00082 } 00083 #endif 00084 00085 #endif