avutil/camellia: cosmetic fixes

Signed-off-by: Giorgio Vazzana <mywing81@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Giorgio Vazzana 2015-01-02 17:05:30 +01:00 committed by Michael Niedermayer
parent fbb792f90f
commit a3ab87427c
1 changed files with 80 additions and 83 deletions

View File

@ -44,8 +44,7 @@ typedef struct AVCAMELLIA {
int key_bits;
} AVCAMELLIA;
static const uint8_t SBOX1[256] =
{
static const uint8_t SBOX1[256] = {
112, 130, 44, 236, 179, 39, 192, 229, 228, 133, 87, 53, 234, 12, 174, 65,
35, 239, 107, 147, 69, 25, 165, 33, 237, 14, 79, 78, 29, 101, 146, 189,
134, 184, 175, 143, 124, 235, 31, 206, 62, 48, 220, 95, 94, 197, 11, 26,
@ -64,8 +63,7 @@ static const uint8_t SBOX1[256] =
64, 40, 211, 123, 187, 201, 67, 193, 21, 227, 173, 244, 119, 199, 128, 158
};
static const uint8_t SBOX2[256] =
{
static const uint8_t SBOX2[256] = {
224, 5, 88, 217, 103, 78, 129, 203, 201, 11, 174, 106, 213, 24, 93, 130,
70, 223, 214, 39, 138, 50, 75, 66, 219, 28, 158, 156, 58, 202, 37, 123,
13, 113, 95, 31, 248, 215, 62, 157, 124, 96, 185, 190, 188, 139, 22, 52,
@ -84,8 +82,7 @@ static const uint8_t SBOX2[256] =
128, 80, 167, 246, 119, 147, 134, 131, 42, 199, 91, 233, 238, 143, 1, 61
};
static const uint8_t SBOX3[256] =
{
static const uint8_t SBOX3[256] = {
56, 65, 22, 118, 217, 147, 96, 242, 114, 194, 171, 154, 117, 6, 87, 160,
145, 247, 181, 201, 162, 140, 210, 144, 246, 7, 167, 39, 142, 178, 73, 222,
67, 92, 215, 199, 62, 245, 143, 103, 31, 24, 110, 175, 47, 226, 133, 13,
@ -104,8 +101,7 @@ static const uint8_t SBOX3[256] =
32, 20, 233, 189, 221, 228, 161, 224, 138, 241, 214, 122, 187, 227, 64, 79
};
static const uint8_t SBOX4[256] =
{
static const uint8_t SBOX4[256] = {
112, 44, 179, 192, 228, 87, 234, 174, 35, 107, 69, 165, 237, 79, 29, 146,
134, 175, 124, 31, 62, 220, 94, 11, 166, 57, 213, 93, 217, 90, 81, 108,
139, 154, 251, 176, 116, 43, 240, 132, 223, 203, 52, 118, 109, 169, 209, 4,
@ -129,7 +125,7 @@ const int av_camellia_size = sizeof(AVCAMELLIA);
static void LR128(uint64_t d[2], const uint64_t K[2], int x)
{
int i = 0;
if (x >=64 && x < 128) {
if (64 <= x && x < 128) {
i = 1;
x -= 64;
}
@ -141,6 +137,7 @@ static void LR128(uint64_t d[2], const uint64_t K[2], int x)
d[0] = (K[i] << x | K[!i] >> (64 - x));
d[1] = (K[!i] << x | K[i] >> (64 - x));
}
static uint64_t F(uint64_t F_IN, uint64_t KE)
{
uint32_t Zl, Zr;
@ -404,7 +401,7 @@ void av_camellia_crypt(AVCAMELLIA* cs, uint8_t* dst, const uint8_t* src, int cou
#include<stdlib.h>
#include"log.h"
int main(int argc, char** argv)
int main(int argc, char *argv[])
{
const uint8_t Key[3][32] = {
{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},