camellia.h

Go to the documentation of this file.
00001 
00023 #ifndef MBEDTLS_CAMELLIA_H
00024 #define MBEDTLS_CAMELLIA_H
00025 
00026 #if !defined(MBEDTLS_CONFIG_FILE)
00027 #include "config.h"
00028 #else
00029 #include MBEDTLS_CONFIG_FILE
00030 #endif
00031 
00032 #include <stddef.h>
00033 #include <stdint.h>
00034 
00035 #define MBEDTLS_CAMELLIA_ENCRYPT     1
00036 #define MBEDTLS_CAMELLIA_DECRYPT     0
00037 
00038 #define MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH           -0x0024  
00039 #define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH         -0x0026  
00041 #if !defined(MBEDTLS_CAMELLIA_ALT)
00042 // Regular implementation
00043 //
00044 
00045 #ifdef __cplusplus
00046 extern "C" {
00047 #endif
00048 
00052 typedef struct
00053 {
00054     int nr;                     
00055     uint32_t rk[68];            
00056 }
00057 mbedtls_camellia_context;
00058 
00064 void mbedtls_camellia_init( mbedtls_camellia_context *ctx );
00065 
00071 void mbedtls_camellia_free( mbedtls_camellia_context *ctx );
00072 
00082 int mbedtls_camellia_setkey_enc( mbedtls_camellia_context *ctx, const unsigned char *key,
00083                          unsigned int keybits );
00084 
00094 int mbedtls_camellia_setkey_dec( mbedtls_camellia_context *ctx, const unsigned char *key,
00095                          unsigned int keybits );
00096 
00107 int mbedtls_camellia_crypt_ecb( mbedtls_camellia_context *ctx,
00108                     int mode,
00109                     const unsigned char input[16],
00110                     unsigned char output[16] );
00111 
00112 #if defined(MBEDTLS_CIPHER_MODE_CBC)
00113 
00136 int mbedtls_camellia_crypt_cbc( mbedtls_camellia_context *ctx,
00137                     int mode,
00138                     size_t length,
00139                     unsigned char iv[16],
00140                     const unsigned char *input,
00141                     unsigned char *output );
00142 #endif /* MBEDTLS_CIPHER_MODE_CBC */
00143 
00144 #if defined(MBEDTLS_CIPHER_MODE_CFB)
00145 
00171 int mbedtls_camellia_crypt_cfb128( mbedtls_camellia_context *ctx,
00172                        int mode,
00173                        size_t length,
00174                        size_t *iv_off,
00175                        unsigned char iv[16],
00176                        const unsigned char *input,
00177                        unsigned char *output );
00178 #endif /* MBEDTLS_CIPHER_MODE_CFB */
00179 
00180 #if defined(MBEDTLS_CIPHER_MODE_CTR)
00181 
00203 int mbedtls_camellia_crypt_ctr( mbedtls_camellia_context *ctx,
00204                        size_t length,
00205                        size_t *nc_off,
00206                        unsigned char nonce_counter[16],
00207                        unsigned char stream_block[16],
00208                        const unsigned char *input,
00209                        unsigned char *output );
00210 #endif /* MBEDTLS_CIPHER_MODE_CTR */
00211 
00212 #ifdef __cplusplus
00213 }
00214 #endif
00215 
00216 #else  /* MBEDTLS_CAMELLIA_ALT */
00217 #include "camellia_alt.h"
00218 #endif /* MBEDTLS_CAMELLIA_ALT */
00219 
00220 #ifdef __cplusplus
00221 extern "C" {
00222 #endif
00223 
00229 int mbedtls_camellia_self_test( int verbose );
00230 
00231 #ifdef __cplusplus
00232 }
00233 #endif
00234 
00235 #endif /* camellia.h */

Generated on 11 Mar 2017 for mbed TLS v2.4.2 by  doxygen 1.4.7