00001
00027 #ifndef POLARSSL_CAMELLIA_H
00028 #define POLARSSL_CAMELLIA_H
00029
00030 #include "config.h"
00031
00032 #include <string.h>
00033
00034 #if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
00035 #include <basetsd.h>
00036 typedef UINT32 uint32_t;
00037 #else
00038 #include <inttypes.h>
00039 #endif
00040
00041 #define CAMELLIA_ENCRYPT 1
00042 #define CAMELLIA_DECRYPT 0
00043
00044 #define POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH -0x0024
00045 #define POLARSSL_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026
00047 #if !defined(POLARSSL_CAMELLIA_ALT)
00048
00049
00050
00051 #ifdef __cplusplus
00052 extern "C" {
00053 #endif
00054
00058 typedef struct
00059 {
00060 int nr;
00061 uint32_t rk[68];
00062 }
00063 camellia_context;
00064
00074 int camellia_setkey_enc( camellia_context *ctx, const unsigned char *key, unsigned int keysize );
00075
00085 int camellia_setkey_dec( camellia_context *ctx, const unsigned char *key, unsigned int keysize );
00086
00097 int camellia_crypt_ecb( camellia_context *ctx,
00098 int mode,
00099 const unsigned char input[16],
00100 unsigned char output[16] );
00101
00102 #if defined(POLARSSL_CIPHER_MODE_CBC)
00103
00117 int camellia_crypt_cbc( camellia_context *ctx,
00118 int mode,
00119 size_t length,
00120 unsigned char iv[16],
00121 const unsigned char *input,
00122 unsigned char *output );
00123 #endif
00124
00125 #if defined(POLARSSL_CIPHER_MODE_CFB)
00126
00143 int camellia_crypt_cfb128( camellia_context *ctx,
00144 int mode,
00145 size_t length,
00146 size_t *iv_off,
00147 unsigned char iv[16],
00148 const unsigned char *input,
00149 unsigned char *output );
00150 #endif
00151
00152 #if defined(POLARSSL_CIPHER_MODE_CTR)
00153
00175 int camellia_crypt_ctr( camellia_context *ctx,
00176 size_t length,
00177 size_t *nc_off,
00178 unsigned char nonce_counter[16],
00179 unsigned char stream_block[16],
00180 const unsigned char *input,
00181 unsigned char *output );
00182 #endif
00183
00184 #ifdef __cplusplus
00185 }
00186 #endif
00187
00188 #else
00189 #include "camellia_alt.h"
00190 #endif
00191
00192 #ifdef __cplusplus
00193 extern "C" {
00194 #endif
00195
00201 int camellia_self_test( int verbose );
00202
00203 #ifdef __cplusplus
00204 }
00205 #endif
00206
00207 #endif