- Main Page
- Data Structures
- Files

# dhm.h

Go to the documentation of this file.

    00001
    00023 #ifndef POLARSSL_DHM_H
    00024 #define POLARSSL_DHM_H
    00025
    00026 #include "polarssl/bignum.h"
    00027
    00028 #define POLARSSL_ERR_DHM_BAD_INPUT_DATA                    0x0480
    00029 #define POLARSSL_ERR_DHM_READ_PARAMS_FAILED                0x0490
    00030 #define POLARSSL_ERR_DHM_MAKE_PARAMS_FAILED                0x04A0
    00031 #define POLARSSL_ERR_DHM_READ_PUBLIC_FAILED                0x04B0
    00032 #define POLARSSL_ERR_DHM_MAKE_PUBLIC_FAILED                0x04C0
    00033 #define POLARSSL_ERR_DHM_CALC_SECRET_FAILED                0x04D0
    00034
    00035 typedef struct
    00036 {
    00037     int len;
    00038     mpi P;
    00039     mpi G;
    00040     mpi X;
    00041     mpi GX;
    00042     mpi GY;
    00043     mpi K;
    00044     mpi RP;
    00045 }
    00046 dhm_context;
    00047
    00048 #ifdef __cplusplus
    00049 extern "C" {
    00050 #endif
    00051
    00061 int dhm_read_params( dhm_context *ctx,
    00062                      unsigned char **p,
    00063                      unsigned char *end );
    00064
    00081 int dhm_make_params( dhm_context *ctx, int s_size,
    00082                      unsigned char *output, int *olen,
    00083                      int (*f_rng)(void *), void *p_rng );
    00084
    00094 int dhm_read_public( dhm_context *ctx,
    00095                      unsigned char *input, int ilen );
    00096
    00109 int dhm_make_public( dhm_context *ctx, int s_size,
    00110                      unsigned char *output, int olen,
    00111                      int (*f_rng)(void *), void *p_rng );
    00112
    00122 int dhm_calc_secret( dhm_context *ctx,
    00123                      unsigned char *output, int *olen );
    00124
    00125 /*
    00126  * \brief          Free the components of a DHM key
    00127  */
    00128 void dhm_free( dhm_context *ctx );
    00129
    00135 int dhm_self_test( int verbose );
    00136
    00137 #ifdef __cplusplus
    00138 }
    00139 #endif
    00140
    00141 #endif