- Main Page
- Data Structures
- Files

# des.h

Go to the documentation of this file.

    00001
    00023 #ifndef POLARSSL_DES_H
    00024 #define POLARSSL_DES_H
    00025
    00026 #define DES_ENCRYPT     1
    00027 #define DES_DECRYPT     0
    00028
    00032 typedef struct
    00033 {
    00034     int mode;
    00035     unsigned long sk[32];
    00036 }
    00037 des_context;
    00038
    00042 typedef struct
    00043 {
    00044     int mode;
    00045     unsigned long sk[96];
    00046 }
    00047 des3_context;
    00048
    00049 #ifdef __cplusplus
    00050 extern "C" {
    00051 #endif
    00052
    00059 void des_setkey_enc( des_context *ctx, unsigned char key[8] );
    00060
    00067 void des_setkey_dec( des_context *ctx, unsigned char key[8] );
    00068
    00075 void des3_set2key_enc( des3_context *ctx, unsigned char key[16] );
    00076
    00083 void des3_set2key_dec( des3_context *ctx, unsigned char key[16] );
    00084
    00091 void des3_set3key_enc( des3_context *ctx, unsigned char key[24] );
    00092
    00099 void des3_set3key_dec( des3_context *ctx, unsigned char key[24] );
    00100
    00108 void des_crypt_ecb( des_context *ctx,
    00109                     unsigned char input[8],
    00110                     unsigned char output[8] );
    00111
    00122 void des_crypt_cbc( des_context *ctx,
    00123                     int mode,
    00124                     int length,
    00125                     unsigned char iv[8],
    00126                     unsigned char *input,
    00127                     unsigned char *output );
    00128
    00136 void des3_crypt_ecb( des3_context *ctx,
    00137                      unsigned char input[8],
    00138                      unsigned char output[8] );
    00139
    00150 void des3_crypt_cbc( des3_context *ctx,
    00151                      int mode,
    00152                      int length,
    00153                      unsigned char iv[8],
    00154                      unsigned char *input,
    00155                      unsigned char *output );
    00156
    00157 /*
    00158  * \brief          Checkup routine
    00159  *
    00160  * \return         0 if successful, or 1 if the test failed
    00161  */
    00162 int des_self_test( int verbose );
    00163
    00164 #ifdef __cplusplus
    00165 }
    00166 #endif
    00167
    00168 #endif /* des.h */