/home/dko/projects/mobilec/trunk/src/security/xyssl-0.7/include/xyssl/dhm.h

Go to the documentation of this file.
00001 
00004 #ifndef _DHM_H
00005 #define _DHM_H
00006 
00007 #ifdef __cplusplus
00008 extern "C" {
00009 #endif
00010 
00011 #include "bignum.h"
00012 
00013 #define ERR_DHM_BAD_INPUT_DATA                  0x0380
00014 #define ERR_DHM_READ_PARAMS_FAILED              0x0390
00015 #define ERR_DHM_MAKE_PARAMS_FAILED              0x03A0
00016 #define ERR_DHM_READ_PUBLIC_FAILED              0x03B0
00017 #define ERR_DHM_MAKE_PUBLIC_FAILED              0x03C0
00018 #define ERR_DHM_CALC_SECRET_FAILED              0x03D0
00019 
00020 typedef struct
00021 {
00022     int len;    
00023     mpi P;      
00024     mpi G;      
00025     mpi X;      
00026     mpi GX;     
00027     mpi GY;     
00028     mpi K;      
00029     mpi RP;     
00030 }
00031 dhm_context;
00032 
00042 int dhm_read_params( dhm_context *ctx,
00043                      unsigned char **p,
00044                      unsigned char *end );
00045 
00061 int dhm_make_params( dhm_context *ctx,
00062                      int (*rng_f)(void *), void *rng_d,
00063                      unsigned char *output, int *olen );
00064 
00074 int dhm_read_public( dhm_context *ctx,
00075                      unsigned char *input, int ilen );
00076 
00088 int dhm_make_public( dhm_context *ctx,
00089                      unsigned char *output, int olen,
00090                      int (*rng_f)(void *), void *rng_d );
00091 
00101 int dhm_calc_secret( dhm_context *ctx,
00102                      unsigned char *output, int *olen );
00103 
00104 /*
00105  * \brief          Free the components of a DHM key
00106  */
00107 void dhm_free( dhm_context *ctx );
00108 
00114 int dhm_self_test( int verbose );
00115 
00116 #ifdef __cplusplus
00117 }
00118 #endif
00119 
00120 #endif

Generated on Fri May 16 14:49:55 2008 for Mobile-C by  doxygen 1.5.4