]> git.cryptolib.org Git - avr-crypto-lib.git/blobdiff - des.c
some changings to make API more consistent
[avr-crypto-lib.git] / des.c
diff --git a/des.c b/des.c
index 0a47906afcb0fbce6d32e2fcaf4ed31ea768b3fe..33e6a76be96a707f5d1d50c0cbb1b239410d6e3b 100644 (file)
--- a/des.c
+++ b/des.c
@@ -1,10 +1,29 @@
+/* des.c */
+/*
+    This file is part of the Crypto-avr-lib/microcrypt-lib.
+    Copyright (C) 2008  Daniel Otte (daniel.otte@rub.de)
+
+    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 3 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, see <http://www.gnu.org/licenses/>.
+*/
 /**
- * \file       des.c
- * \author     Daniel Otte 
- * \date       2007-06-16
- * \brief      DES and EDE-DES implementation
+ * \file        des.c
+ * \author      Daniel Otte
+ * \email       daniel.otte@rub.de
+ * \date        2007-06-16
+ * \brief       DES and EDE-DES implementation
  * \par License        
- * GPL
+ * GPLv3 or later
  * 
  */
 #include "config.h"
@@ -283,7 +302,7 @@ uint32_t des_f(uint32_t r, uint8_t* kr){
 
 /******************************************************************************/
 
-void des_encrypt(uint8_t* out, uint8_t* in, uint8_t* key){
+void des_enc(uint8_t* out, uint8_t* in, uint8_t* key){
 #define R *((uint32_t*)&(data[4]))
 #define L *((uint32_t*)&(data[0]))
 
@@ -316,7 +335,7 @@ void des_encrypt(uint8_t* out, uint8_t* in, uint8_t* key){
 
 /******************************************************************************/
 
-void des_decrypt(uint8_t* out, uint8_t* in, uint8_t* key){
+void des_dec(uint8_t* out, uint8_t* in, uint8_t* key){
 #define R *((uint32_t*)&(data[4]))
 #define L *((uint32_t*)&(data[0]))
 
@@ -352,18 +371,18 @@ void des_decrypt(uint8_t* out, uint8_t* in, uint8_t* key){
 
 /******************************************************************************/
 
-void tdes_encrypt(uint8_t* out, uint8_t* in, uint8_t* key){
-       des_encrypt(out,  in, key + 0);
-       des_decrypt(out, out, key + 8);
-       des_encrypt(out, out, key +16);
+void tdes_enc(uint8_t* out, uint8_t* in, uint8_t* key){
+       des_enc(out,  in, key + 0);
+       des_dec(out, out, key + 8);
+       des_enc(out, out, key +16);
 }
 
 /******************************************************************************/
 
-void tdes_decrypt(uint8_t* out, uint8_t* in, uint8_t* key){
-       des_decrypt(out,  in, key + 0);
-       des_encrypt(out, out, key + 8);
-       des_decrypt(out, out, key +16);
+void tdes_dec(uint8_t* out, uint8_t* in, uint8_t* key){
+       des_dec(out,  in, key + 0);
+       des_enc(out, out, key + 8);
+       des_dec(out, out, key +16);
 }
 
 /******************************************************************************/