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

md.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  $RCSfile: md.h,v $
00003  -------------------
00004  cvs         : $Id: md.h,v 1.8 2005/03/25 17:35:27 aquamaniac Exp $
00005  begin       : Thu Nov 13 2003
00006  copyright   : (C) 2003 by Martin Preuss
00007  email       : martin@libchipcard.de
00008 
00009  ***************************************************************************
00010  *                                                                         *
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU Lesser General Public            *
00013  *   License as published by the Free Software Foundation; either          *
00014  *   version 2.1 of the License, or (at your option) any later version.    *
00015  *                                                                         *
00016  *   This library is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00019  *   Lesser General Public License for more details.                       *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU Lesser General Public      *
00022  *   License along with this library; if not, write to the Free Software   *
00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
00024  *   MA  02111-1307  USA                                                   *
00025  *                                                                         *
00026  ***************************************************************************/
00027 
00028 
00029 #ifndef GWENHYWFAR_MD_H
00030 #define GWENHYWFAR_MD_H
00031 
00032 #include <gwenhywfar/gwenhywfarapi.h>
00033 #include <gwenhywfar/error.h>
00034 #include <gwenhywfar/buffer.h>
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 
00041 
00042 typedef struct GWEN_MD GWEN_MD;
00043 
00044 typedef int (*GWEN_MD_BEGIN_FN)(GWEN_MD *md);
00045 typedef int (*GWEN_MD_END_FN)(GWEN_MD *md);
00046 typedef int (*GWEN_MD_UPDATE_FN)(GWEN_MD *md,
00047                                  const char *buf,
00048                                  unsigned int l);
00049 typedef void (*GWEN_MD_FREEDATA_FN)(GWEN_MD *md);
00050 
00051 
00052 GWENHYWFAR_API
00053 GWEN_MD *GWEN_MD_Factory(const char *t);
00054 GWENHYWFAR_API
00055 void GWEN_MD_free(GWEN_MD *md);
00056 GWENHYWFAR_API
00057 unsigned char *GWEN_MD_GetDigestPtr(GWEN_MD *md);
00058 GWENHYWFAR_API
00059 unsigned int GWEN_MD_GetDigestSize(GWEN_MD *md);
00060 
00061 GWENHYWFAR_API
00062 int GWEN_MD_Begin(GWEN_MD *md);
00063 GWENHYWFAR_API
00064 int GWEN_MD_End(GWEN_MD *md);
00065 GWENHYWFAR_API
00066 int GWEN_MD_Update(GWEN_MD *md,
00067                    const char *buf,
00068                    unsigned int l);
00069 
00081 GWENHYWFAR_API
00082 int GWEN_MD_Hash(const char *algo,
00083                  const char *data,
00084                  unsigned int dsize,
00085                  char *buffer,
00086                  unsigned int *bsize);
00087 
00088 GWENHYWFAR_API
00089 int GWEN_MD_HashToBuffer(const char *typ,
00090                          const char *data,
00091                          unsigned int dsize,
00092                          GWEN_BUFFER *dstBuf);
00093 
00094 
00101 GWENHYWFAR_API
00102 GWEN_MD *GWEN_MD_new(unsigned int size);
00103 GWENHYWFAR_API
00104 void GWEN_MD_SetBeginFn(GWEN_MD *md, GWEN_MD_BEGIN_FN fn);
00105 GWENHYWFAR_API
00106 void GWEN_MD_SetEndFn(GWEN_MD *md, GWEN_MD_END_FN fn);
00107 GWENHYWFAR_API
00108 void GWEN_MD_SetUpdateFn(GWEN_MD *md, GWEN_MD_UPDATE_FN fn);
00109 GWENHYWFAR_API
00110 void GWEN_MD_SetFreeDataFn(GWEN_MD *md, GWEN_MD_FREEDATA_FN fn);
00111 GWENHYWFAR_API
00112 void GWEN_MD_SetData(GWEN_MD *md, void *data);
00113 GWENHYWFAR_API
00114 void *GWEN_MD_GetData(GWEN_MD *md);
00118 typedef struct GWEN_MD_PROVIDER GWEN_MD_PROVIDER;
00119 
00120 typedef GWEN_MD*
00121   (*GWEN_MDPROVIDER_NEWMD_FN)(GWEN_MD_PROVIDER *pr);
00122 
00123 GWENHYWFAR_API
00124 GWEN_MD_PROVIDER *GWEN_MdProvider_new();
00125 GWENHYWFAR_API
00126 void GWEN_MdProvider_free(GWEN_MD_PROVIDER *pr);
00127 
00128 GWENHYWFAR_API
00129 void GWEN_MdProvider_SetNewMdFn(GWEN_MD_PROVIDER *pr,
00130                                 GWEN_MDPROVIDER_NEWMD_FN newMdFn);
00131 GWENHYWFAR_API
00132 void GWEN_MdProvider_SetName(GWEN_MD_PROVIDER *pr,
00133                              const char *name);
00134 
00138 GWENHYWFAR_API
00139 GWEN_ERRORCODE GWEN_MD_RegisterProvider(GWEN_MD_PROVIDER *pr);
00140 GWENHYWFAR_API
00141 GWEN_ERRORCODE GWEN_MD_UnregisterProvider(GWEN_MD_PROVIDER *pr);
00142 GWENHYWFAR_API
00143 void GWEN_MD_UnregisterAllProviders();
00144 
00145 #ifdef __cplusplus
00146 }
00147 #endif
00148 
00149 
00150 
00151 #endif
00152 
00153 
00154 
00155 
00156 

Generated on Wed Oct 5 15:12:37 2005 for gwenhywfar by  doxygen 1.4.4