aboutsummaryrefslogtreecommitdiffstats
path: root/src/block/des
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-03-30 18:27:18 +0000
committerlloyd <[email protected]>2009-03-30 18:27:18 +0000
commit96d6eb6f29c55e16a37cf11899547886f735b065 (patch)
tree9f13901e9b44c98d58b2589c9b09c6a7443eb7cd /src/block/des
parent3cc3dd72c5f87b76852a55c1f2d1821dba967d8c (diff)
Thomas Moschny passed along a request from the Fedora packagers which came
up during the Fedora submission review, that each source file include some text about the license. One handy Perl script later and each file now has the line Distributed under the terms of the Botan license after the copyright notices. While I was in there modifying every file anyway, I also stripped out the remainder of the block comments (lots of astericks before and after the text); this is stylistic thing I picked up when I was first learning C++ but in retrospect it is not a good style as the structure makes it harder to modify comments (with the result that comments become fewer, shorter and are less likely to be updated, which are not good things).
Diffstat (limited to 'src/block/des')
-rw-r--r--src/block/des/des.cpp64
-rw-r--r--src/block/des/des.h28
-rw-r--r--src/block/des/des_tab.cpp10
-rw-r--r--src/block/des/desx.cpp28
-rw-r--r--src/block/des/desx.h16
5 files changed, 78 insertions, 68 deletions
diff --git a/src/block/des/des.cpp b/src/block/des/des.cpp
index f6453cff0..37520e0fc 100644
--- a/src/block/des/des.cpp
+++ b/src/block/des/des.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* DES Source File *
-* (C) 1999-2008 Jack Lloyd *
-*************************************************/
+/*
+* DES
+* (C) 1999-2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/des.h>
#include <botan/loadstor.h>
@@ -10,9 +12,9 @@ namespace Botan {
namespace {
-/*************************************************
-* DES Key Schedule *
-*************************************************/
+/*
+* DES Key Schedule
+*/
void des_key_schedule(u32bit round_key[32], const byte key[8])
{
static const byte ROT[16] = { 1, 1, 2, 2, 2, 2, 2, 2,
@@ -76,9 +78,9 @@ void des_key_schedule(u32bit round_key[32], const byte key[8])
}
}
-/*************************************************
-* DES Encryption *
-*************************************************/
+/*
+* DES Encryption
+*/
void des_encrypt(u32bit& L, u32bit& R,
const u32bit round_key[32])
{
@@ -104,9 +106,9 @@ void des_encrypt(u32bit& L, u32bit& R,
}
}
-/*************************************************
-* DES Decryption *
-*************************************************/
+/*
+* DES Decryption
+*/
void des_decrypt(u32bit& L, u32bit& R,
const u32bit round_key[32])
{
@@ -134,9 +136,9 @@ void des_decrypt(u32bit& L, u32bit& R,
}
-/*************************************************
-* DES Encryption *
-*************************************************/
+/*
+* DES Encryption
+*/
void DES::enc(const byte in[], byte out[]) const
{
u64bit T = (DES_IPTAB1[in[0]] ) | (DES_IPTAB1[in[1]] << 1) |
@@ -159,9 +161,9 @@ void DES::enc(const byte in[], byte out[]) const
store_be(T, out);
}
-/*************************************************
-* DES Decryption *
-*************************************************/
+/*
+* DES Decryption
+*/
void DES::dec(const byte in[], byte out[]) const
{
u64bit T = (DES_IPTAB1[in[0]] ) | (DES_IPTAB1[in[1]] << 1) |
@@ -184,17 +186,17 @@ void DES::dec(const byte in[], byte out[]) const
store_be(T, out);
}
-/*************************************************
-* DES Key Schedule *
-*************************************************/
+/*
+* DES Key Schedule
+*/
void DES::key_schedule(const byte key[], u32bit)
{
des_key_schedule(round_key.begin(), key);
}
-/*************************************************
-* TripleDES Encryption *
-*************************************************/
+/*
+* TripleDES Encryption
+*/
void TripleDES::enc(const byte in[], byte out[]) const
{
u64bit T = (DES_IPTAB1[in[0]] ) | (DES_IPTAB1[in[1]] << 1) |
@@ -219,9 +221,9 @@ void TripleDES::enc(const byte in[], byte out[]) const
store_be(T, out);
}
-/*************************************************
-* TripleDES Decryption *
-*************************************************/
+/*
+* TripleDES Decryption
+*/
void TripleDES::dec(const byte in[], byte out[]) const
{
u64bit T = (DES_IPTAB1[in[0]] ) | (DES_IPTAB1[in[1]] << 1) |
@@ -246,9 +248,9 @@ void TripleDES::dec(const byte in[], byte out[]) const
store_be(T, out);
}
-/*************************************************
-* TripleDES Key Schedule *
-*************************************************/
+/*
+* TripleDES Key Schedule
+*/
void TripleDES::key_schedule(const byte key[], u32bit length)
{
des_key_schedule(&round_key[0], key);
diff --git a/src/block/des/des.h b/src/block/des/des.h
index f3a0d56eb..6fa59de5e 100644
--- a/src/block/des/des.h
+++ b/src/block/des/des.h
@@ -1,7 +1,9 @@
-/*************************************************
-* DES Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* DES
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_DES_H__
#define BOTAN_DES_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* DES *
-*************************************************/
+/*
+* DES
+*/
class BOTAN_DLL DES : public BlockCipher
{
public:
@@ -28,9 +30,9 @@ class BOTAN_DLL DES : public BlockCipher
SecureBuffer<u32bit, 32> round_key;
};
-/*************************************************
-* Triple DES *
-*************************************************/
+/*
+* Triple DES
+*/
class BOTAN_DLL TripleDES : public BlockCipher
{
public:
@@ -46,9 +48,9 @@ class BOTAN_DLL TripleDES : public BlockCipher
SecureBuffer<u32bit, 96> round_key;
};
-/*************************************************
-* DES Tables *
-*************************************************/
+/*
+* DES Tables
+*/
extern const u32bit DES_SPBOX1[256];
extern const u32bit DES_SPBOX2[256];
extern const u32bit DES_SPBOX3[256];
diff --git a/src/block/des/des_tab.cpp b/src/block/des/des_tab.cpp
index aa3b7cd45..b46ca3063 100644
--- a/src/block/des/des_tab.cpp
+++ b/src/block/des/des_tab.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* Substitution/Permutation Tables for DES *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* Substitution/Permutation Tables for DES
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/des.h>
diff --git a/src/block/des/desx.cpp b/src/block/des/desx.cpp
index 41c3bcd8d..e557901d3 100644
--- a/src/block/des/desx.cpp
+++ b/src/block/des/desx.cpp
@@ -1,16 +1,18 @@
-/*************************************************
-* DES Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* DES
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/desx.h>
#include <botan/xor_buf.h>
namespace Botan {
-/*************************************************
-* DESX Encryption *
-*************************************************/
+/*
+* DESX Encryption
+*/
void DESX::enc(const byte in[], byte out[]) const
{
xor_buf(out, in, K1.begin(), BLOCK_SIZE);
@@ -18,9 +20,9 @@ void DESX::enc(const byte in[], byte out[]) const
xor_buf(out, K2.begin(), BLOCK_SIZE);
}
-/*************************************************
-* DESX Decryption *
-*************************************************/
+/*
+* DESX Decryption
+*/
void DESX::dec(const byte in[], byte out[]) const
{
xor_buf(out, in, K2.begin(), BLOCK_SIZE);
@@ -28,9 +30,9 @@ void DESX::dec(const byte in[], byte out[]) const
xor_buf(out, K1.begin(), BLOCK_SIZE);
}
-/*************************************************
-* DESX Key Schedule *
-*************************************************/
+/*
+* DESX Key Schedule
+*/
void DESX::key_schedule(const byte key[], u32bit)
{
K1.copy(key, 8);
diff --git a/src/block/des/desx.h b/src/block/des/desx.h
index 1fa68fcde..49ecc2421 100644
--- a/src/block/des/desx.h
+++ b/src/block/des/desx.h
@@ -1,7 +1,9 @@
-/*************************************************
-* DESX Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* DESX
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_DESX_H__
#define BOTAN_DESX_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* DESX *
-*************************************************/
+/*
+* DESX
+*/
class BOTAN_DLL DESX : public BlockCipher
{
public: