00001 /* 00002 * Copyright (c) 1998, 1999, 2000, 2001, 2002 X-Way Rights BV 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/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 #ifdef __cplusplus 00052 struct BEECRYPTAPI fips186Param 00053 #else 00054 struct _fips186Param 00055 #endif 00056 { 00057 #ifdef _REENTRANT 00058 bc_mutex_t lock; 00059 #endif 00060 sha1Param param; 00061 mpw state[FIPS186_STATE_SIZE]; 00062 byte digest[20]; 00063 unsigned char digestremain; 00064 }; 00065 00066 #ifndef __cplusplus 00067 typedef struct _fips186Param fips186Param; 00068 #endif 00069 00070 #ifdef __cplusplus 00071 extern "C" { 00072 #endif 00073 00074 extern BEECRYPTAPI const randomGenerator fips186prng; 00075 00076 BEECRYPTAPI 00077 int fips186Setup (fips186Param*); 00078 BEECRYPTAPI 00079 int fips186Seed (fips186Param*, const byte*, size_t); 00080 BEECRYPTAPI 00081 int fips186Next (fips186Param*, byte*, size_t); 00082 BEECRYPTAPI 00083 int fips186Cleanup(fips186Param*); 00084 00085 #ifdef __cplusplus 00086 } 00087 #endif 00088 00089 #endif