Camellia block cipher. More...
#include "config.h"
#include <string.h>
#include <inttypes.h>
Go to the source code of this file.
Data Structures | |
struct | camellia_context |
CAMELLIA context structure. More... | |
Defines | |
#define | CAMELLIA_ENCRYPT 1 |
#define | CAMELLIA_DECRYPT 0 |
#define | POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH -0x0024 |
Invalid key length. | |
#define | POLARSSL_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026 |
Invalid data input length. | |
Functions | |
int | camellia_setkey_enc (camellia_context *ctx, const unsigned char *key, unsigned int keysize) |
CAMELLIA key schedule (encryption). | |
int | camellia_setkey_dec (camellia_context *ctx, const unsigned char *key, unsigned int keysize) |
CAMELLIA key schedule (decryption). | |
int | camellia_crypt_ecb (camellia_context *ctx, int mode, const unsigned char input[16], unsigned char output[16]) |
CAMELLIA-ECB block encryption/decryption. | |
int | camellia_self_test (int verbose) |
Checkup routine. |
Camellia block cipher.
Copyright (C) 2006-2013, Brainspark B.V.
This file is part of PolarSSL (http://www.polarssl.org) Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
All rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Definition in file camellia.h.
#define CAMELLIA_DECRYPT 0 |
Definition at line 42 of file camellia.h.
Referenced by camellia_crypt_cbc(), camellia_crypt_cfb128(), camellia_self_test(), test_suite_camellia_decrypt_cbc(), test_suite_camellia_decrypt_cfb128(), and test_suite_camellia_decrypt_ecb().
#define CAMELLIA_ENCRYPT 1 |
Definition at line 41 of file camellia.h.
Referenced by camellia_crypt_cfb128(), camellia_crypt_ctr(), test_suite_camellia_encrypt_cbc(), test_suite_camellia_encrypt_cfb128(), and test_suite_camellia_encrypt_ecb().
#define POLARSSL_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026 |
Invalid data input length.
Definition at line 45 of file camellia.h.
Referenced by camellia_crypt_cbc(), polarssl_strerror(), and verify_int().
#define POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH -0x0024 |
Invalid key length.
Definition at line 44 of file camellia.h.
Referenced by camellia_setkey_dec(), camellia_setkey_enc(), polarssl_strerror(), and verify_int().
int camellia_crypt_ecb | ( | camellia_context * | ctx, | |
int | mode, | |||
const unsigned char | input[16], | |||
unsigned char | output[16] | |||
) |
CAMELLIA-ECB block encryption/decryption.
ctx | CAMELLIA context | |
mode | CAMELLIA_ENCRYPT or CAMELLIA_DECRYPT | |
input | 16-byte input block | |
output | 16-byte output block |
Definition at line 467 of file camellia.c.
References camellia_feistel(), FL, FLInv, GET_UINT32_BE, camellia_context::nr, PUT_UINT32_BE, and camellia_context::rk.
Referenced by camellia_crypt_cbc(), camellia_crypt_cfb128(), camellia_crypt_ctr(), camellia_crypt_ecb_wrap(), camellia_self_test(), test_suite_camellia_decrypt_ecb(), and test_suite_camellia_encrypt_ecb().
int camellia_self_test | ( | int | verbose | ) |
Checkup routine.
Definition at line 867 of file camellia.c.
References camellia_crypt_cbc(), camellia_crypt_ctr(), camellia_crypt_ecb(), CAMELLIA_DECRYPT, camellia_setkey_dec(), camellia_setkey_enc(), camellia_test_cbc_cipher, camellia_test_cbc_iv, camellia_test_cbc_key, camellia_test_cbc_plain, camellia_test_ctr_ct, camellia_test_ctr_key, camellia_test_ctr_len, camellia_test_ctr_nonce_counter, camellia_test_ctr_pt, camellia_test_ecb_cipher, camellia_test_ecb_key, camellia_test_ecb_plain, CAMELLIA_TESTS_CBC, CAMELLIA_TESTS_ECB, iv, and key.
Referenced by test_suite_camellia_selftest().
int camellia_setkey_dec | ( | camellia_context * | ctx, | |
const unsigned char * | key, | |||
unsigned int | keysize | |||
) |
CAMELLIA key schedule (decryption).
ctx | CAMELLIA context to be initialized | |
key | decryption key | |
keysize | must be 128, 192 or 256 |
Definition at line 416 of file camellia.c.
References camellia_setkey_enc(), camellia_context::nr, POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH, and camellia_context::rk.
Referenced by camellia_self_test(), camellia_setkey_dec_wrap(), test_suite_camellia_decrypt_cbc(), and test_suite_camellia_decrypt_ecb().
int camellia_setkey_enc | ( | camellia_context * | ctx, | |
const unsigned char * | key, | |||
unsigned int | keysize | |||
) |
CAMELLIA key schedule (encryption).
ctx | CAMELLIA context to be initialized | |
key | encryption key | |
keysize | must be 128, 192 or 256 |
Definition at line 312 of file camellia.c.
References camellia_feistel(), GET_UINT32_BE, camellia_context::nr, POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH, camellia_context::rk, SHIFT_AND_PLACE, SIGMA_CHARS, and transposes.
Referenced by camellia_self_test(), camellia_setkey_dec(), camellia_setkey_enc_wrap(), test_suite_camellia_decrypt_cfb128(), test_suite_camellia_encrypt_cbc(), test_suite_camellia_encrypt_cfb128(), and test_suite_camellia_encrypt_ecb().