/* present80.c */
/*
This file is part of the AVR-Crypto-Lib.
- Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
+ Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
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
* present80.c
* a implementation of the PRESENT block-cipher
* author: Daniel Otte
- * email: daniel.otte@rub.de
+ * email: bg@nerilex.org
* license: GPLv3
*
* */
#include "present80.h"
static
-void key_update(uint8_t* buffer, uint8_t round){
+void key_update(uint8_t *buffer, uint8_t round){
uint8_t j;
union __attribute__((packed)){
uint8_t v8[2];
}
static
-void key_update_inv(uint8_t* buffer, uint8_t round){
+void key_update_inv(uint8_t *buffer, uint8_t round){
uint8_t j;
union __attribute__((packed)){
uint8_t v8[2];
}while(j--);
}
-void present80_init(const uint8_t* key, uint8_t keysize_b, present80_ctx_t* ctx){
+void present80_init(const uint8_t *key, uint8_t keysize_b, present80_ctx_t *ctx){
uint8_t i;
memcpy(ctx->fwd_key, key, 10);
memcpy(ctx->rev_key, key, 10);
}
}
-void present80_enc(void* buffer, present80_ctx_t* ctx){
+void present80_enc(void *buffer, present80_ctx_t *ctx){
present_generic_enc(buffer, (uint8_t*)ctx, 10, key_update);
}
-void present80_dec(void* buffer, present80_ctx_t* ctx){
+void present80_dec(void *buffer, present80_ctx_t *ctx){
present_generic_dec(buffer, (uint8_t*)ctx, 10, key_update_inv);
}
/*
-void present80_enc(void* buffer, present80_ctx_t* ctx){
+void present80_enc(void *buffer, present80_ctx_t *ctx){
uint8_t i,j,tmp[8], k[10];
memcpy(k, ctx->fwd_key, 10);
memxor(buffer, k, 8);
}
}
-void present80_dec(void* buffer, present80_ctx_t* ctx){
+void present80_dec(void *buffer, present80_ctx_t *ctx){
uint8_t j,tmp[8], k[10];
uint8_t i;
memcpy(k, ctx->rev_key, 10);