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

Go to the documentation of this file.
00001 /* SVN FILE INFO
00002  * $Revision: 174 $ : Last Committed Revision
00003  * $Date: 2008-06-24 10:50:29 -0700 (Tue, 24 Jun 2008) $ : Last Committed Date */
00007 #ifndef _DHM_H
00008 #define _DHM_H
00009 
00010 #ifdef __cplusplus
00011 extern "C" {
00012 #endif
00013 
00014 #include "bignum.h"
00015 
00016 #define ERR_DHM_BAD_INPUT_DATA                  0x0380
00017 #define ERR_DHM_READ_PARAMS_FAILED              0x0390
00018 #define ERR_DHM_MAKE_PARAMS_FAILED              0x03A0
00019 #define ERR_DHM_READ_PUBLIC_FAILED              0x03B0
00020 #define ERR_DHM_MAKE_PUBLIC_FAILED              0x03C0
00021 #define ERR_DHM_CALC_SECRET_FAILED              0x03D0
00022 
00023 typedef struct
00024 {
00025     int len;    
00026     mpi P;      
00027     mpi G;      
00028     mpi X;      
00029     mpi GX;     
00030     mpi GY;     
00031     mpi K;      
00032     mpi RP;     
00033 }
00034 dhm_context;
00035 
00045 int dhm_read_params( dhm_context *ctx,
00046                      unsigned char **p,
00047                      unsigned char *end );
00048 
00064 int dhm_make_params( dhm_context *ctx,
00065                      int (*rng_f)(void *), void *rng_d,
00066                      unsigned char *output, int *olen );
00067 
00077 int dhm_read_public( dhm_context *ctx,
00078                      unsigned char *input, int ilen );
00079 
00091 int dhm_make_public( dhm_context *ctx,
00092                      unsigned char *output, int olen,
00093                      int (*rng_f)(void *), void *rng_d );
00094 
00104 int dhm_calc_secret( dhm_context *ctx,
00105                      unsigned char *output, int *olen );
00106 
00107 /*
00108  * \brief          Free the components of a DHM key
00109  */
00110 void dhm_free( dhm_context *ctx );
00111 
00117 int dhm_self_test( int verbose );
00118 
00119 #ifdef __cplusplus
00120 }
00121 #endif
00122 
00123 #endif

Generated on Tue Jul 1 15:29:58 2008 for Mobile-C by  doxygen 1.5.4