]> git.cryptolib.org Git - avr-crypto-lib.git/blobdiff - camellia.c
adjustments made for host usage (but still not "endian-safe")
[avr-crypto-lib.git] / camellia.c
index e0e21597d4433c6bb4e22682f7bf60f2c5e5c702..a561d4ee2f637e851207dc687d21477581fcb370 100644 (file)
@@ -49,7 +49,7 @@ uint64_t PROGMEM camellia_sigma[6]={ / * 64 byte table * /
        0xB05688C2B3E6C1FDLL
 };     
 */
-uint32_t PROGMEM camellia_sigma[12]={ /* 64 byte table */
+uint32_t PROGMEM camellia_sigma[12]={ /* 48 byte table */
          0x3BCC908BL, 0xA09E667FL,
          0x4CAA73B2L, 0xB67AE858L,
          0xE94F82BEL, 0xC6EF372FL,
@@ -82,7 +82,7 @@ void camellia128_ctx_dump(camellia128_ctx_t *s){
 /*****************************************************************************/
 /* extern prog_uint64_t camellia_sigma[6]; */
 
-void camellia128_init(camellia128_ctx_t* s, uint8_t* key){
+void camellia128_init(uint8_t* key, camellia128_ctx_t* s){
        uint8_t i;
        s->kll = 0; /* ((uint64_t*)key)[0]; */
        
@@ -130,18 +130,19 @@ void camellia128_keyop_inv(camellia128_ctx_t* s, int8_t q);
 #define KEY_ROL17              0x08
 #define KEY_ROL15              0x00
 
-void camellia_6rounds(camellia128_ctx_t* s, uint64_t* bl, uint64_t* br, uint8_t roundop, uint8_t keychoice);
+void camellia_6rounds(camellia128_ctx_t* s, uint64_t* bl, uint64_t* br, 
+                      uint8_t roundop, uint8_t keychoice);
 /*****************************************************************************/
 
 
-void camellia128_enc(camellia128_ctx_t* s, void* block){
+void camellia128_enc(void* block, camellia128_ctx_t* s){
 
        #define BL (((uint64_t*)block)[0])
        #define BR (((uint64_t*)block)[1])
        /* endian adjustment */
         /*BL*/
-        /*     1 2 3 4 5 6 7 8
-         *             8 7 6 5 4 3 2 1
+        /* 1 2 3 4 5 6 7 8
+         *     8 7 6 5 4 3 2 1
          */
         
        uint64_t temp64;
@@ -188,7 +189,7 @@ void camellia128_enc(camellia128_ctx_t* s, void* block){
 
 /*****************************************************************************/
 
-void camellia128_dec(camellia128_ctx_t* s, void* block){
+void camellia128_dec(void* block, camellia128_ctx_t* s){
 
        #define BL (((uint64_t*)block)[1])
        #define BR (((uint64_t*)block)[0])