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

# beecrypt/fips186.h

Go to the documentation of this file.

    00001
    00007 /*
    00008  * Copyright (c) 1998, 1999, 2000, 2001 Virtual Unlimited B.V.
    00009  *
    00010  * Author: Bob Deblier <bob@virtualunlimited.com>
    00011  *
    00012  * This library is free software; you can redistribute it and/or
    00013  * modify it under the terms of the GNU Lesser General Public
    00014  * License as published by the Free Software Foundation; either
    00015  * version 2.1 of the License, or (at your option) any later version.
    00016  *
    00017  * This library is distributed in the hope that it will be useful,
    00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00020  * Lesser General Public License for more details.
    00021  *
    00022  * You should have received a copy of the GNU Lesser General Public
    00023  * License along with this library; if not, write to the Free Software
    00024  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00025  *
    00026  */
    00027
    00028 #ifndef _FIPS186_H
    00029 #define _FIPS186_H
    00030
    00031 #include "beecrypt.h"
    00032
    00033 #ifdef _REENTRANT
    00034 # if WIN32
    00035 #  include <windows.h>
    00036 #  include <winbase.h>
    00037 # else
    00038 #  if HAVE_THREAD_H && HAVE_SYNCH_H
    00039 #   include <synch.h>
    00040 #  elif HAVE_PTHREAD_H
    00041 #   include <pthread.h>
    00042 #  else
    00043 #   error need locking mechanism
    00044 #  endif
    00045 # endif
    00046 #endif
    00047
    00048 #include "sha1.h"
    00049
    00050 #define FIPS186_STATE_SIZE      16
    00051
    00054 typedef struct
    00055 {
    00056         #ifdef _REENTRANT
    00057         # if WIN32
    00058         HANDLE                  lock;
    00059         # else
    00060         #  if HAVE_THREAD_H && HAVE_SYNCH_H
    00061         mutex_t                 lock;
    00062         #  elif HAVE_PTHREAD_H
    00063         pthread_mutex_t lock;
    00064         #  else
    00065         #   error need locking mechanism
    00066         #  endif
    00067         # endif
    00068         #endif
    00069         sha1Param       param;
    00070         uint32          state[FIPS186_STATE_SIZE];
    00071         int                     digestsize;
    00072 } fips186Param;
    00073
    00074 #ifdef __cplusplus
    00075 extern "C" {
    00076 #endif
    00077
    00080 /*@observer@*/ /*@checked@*/
    00081 extern BEECRYPTAPI const randomGenerator fips186prng;
    00082
    00085 /*@-exportlocal@*/
    00086 BEECRYPTAPI
    00087 int fips186Setup  (fips186Param* fp)
    00088         /*@modifies fp */;
    00089 /*@=exportlocal@*/
    00090
    00093 /*@-exportlocal@*/
    00094 BEECRYPTAPI
    00095 int fips186Seed   (fips186Param* fp, const uint32* data, int size)
    00096         /*@modifies fp */;
    00097 /*@=exportlocal@*/
    00098
    00101 /*@-exportlocal@*/
    00102 BEECRYPTAPI
    00103 int fips186Next   (fips186Param* fp, uint32* data, int size)
    00104         /*@modifies fp, data */;
    00105 /*@=exportlocal@*/
    00106
    00109 /*@-exportlocal@*/
    00110 BEECRYPTAPI
    00111 int fips186Cleanup(fips186Param* fp)
    00112         /*@modifies fp */;
    00113 /*@=exportlocal@*/
    00114
    00115 #ifdef __cplusplus
    00116 }
    00117 #endif
    00118
    00119 #endif