aboutsummaryrefslogtreecommitdiffstats
path: root/src/block/cast
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/cast
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/cast')
-rw-r--r--src/block/cast/cast128.cpp52
-rw-r--r--src/block/cast/cast128.h16
-rw-r--r--src/block/cast/cast256.cpp46
-rw-r--r--src/block/cast/cast256.h16
-rw-r--r--src/block/cast/cast_tab.cpp10
5 files changed, 75 insertions, 65 deletions
diff --git a/src/block/cast/cast128.cpp b/src/block/cast/cast128.cpp
index 6a6b46efd..fdb9428a6 100644
--- a/src/block/cast/cast128.cpp
+++ b/src/block/cast/cast128.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* CAST-128 Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* CAST-128
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/cast128.h>
#include <botan/loadstor.h>
@@ -11,9 +13,9 @@ namespace Botan {
namespace {
-/*************************************************
-* CAST-128 Round Type 1 *
-*************************************************/
+/*
+* CAST-128 Round Type 1
+*/
inline void R1(u32bit& L, u32bit R, u32bit MK, u32bit RK)
{
u32bit T = rotate_left(MK + R, RK);
@@ -21,9 +23,9 @@ inline void R1(u32bit& L, u32bit R, u32bit MK, u32bit RK)
CAST_SBOX3[get_byte(2, T)] + CAST_SBOX4[get_byte(3, T)];
}
-/*************************************************
-* CAST-128 Round Type 2 *
-*************************************************/
+/*
+* CAST-128 Round Type 2
+*/
inline void R2(u32bit& L, u32bit R, u32bit MK, u32bit RK)
{
u32bit T = rotate_left(MK ^ R, RK);
@@ -31,9 +33,9 @@ inline void R2(u32bit& L, u32bit R, u32bit MK, u32bit RK)
CAST_SBOX3[get_byte(2, T)]) ^ CAST_SBOX4[get_byte(3, T)];
}
-/*************************************************
-* CAST-128 Round Type 3 *
-*************************************************/
+/*
+* CAST-128 Round Type 3
+*/
inline void R3(u32bit& L, u32bit R, u32bit MK, u32bit RK)
{
u32bit T = rotate_left(MK - R, RK);
@@ -43,9 +45,9 @@ inline void R3(u32bit& L, u32bit R, u32bit MK, u32bit RK)
}
-/*************************************************
-* CAST-128 Encryption *
-*************************************************/
+/*
+* CAST-128 Encryption
+*/
void CAST_128::enc(const byte in[], byte out[]) const
{
u32bit L = load_be<u32bit>(in, 0);
@@ -71,9 +73,9 @@ void CAST_128::enc(const byte in[], byte out[]) const
store_be(out, R, L);
}
-/*************************************************
-* CAST-128 Decryption *
-*************************************************/
+/*
+* CAST-128 Decryption
+*/
void CAST_128::dec(const byte in[], byte out[]) const
{
u32bit L = load_be<u32bit>(in, 0);
@@ -99,9 +101,9 @@ void CAST_128::dec(const byte in[], byte out[]) const
store_be(out, R, L);
}
-/*************************************************
-* CAST-128 Key Schedule *
-*************************************************/
+/*
+* CAST-128 Key Schedule
+*/
void CAST_128::key_schedule(const byte key[], u32bit length)
{
clear();
@@ -116,9 +118,9 @@ void CAST_128::key_schedule(const byte key[], u32bit length)
RK[j] %= 32;
}
-/*************************************************
-* S-Box Based Key Expansion *
-*************************************************/
+/*
+* S-Box Based Key Expansion
+*/
void CAST_128::key_schedule(u32bit K[16], u32bit X[4])
{
class ByteReader
diff --git a/src/block/cast/cast128.h b/src/block/cast/cast128.h
index 2004de51a..680481482 100644
--- a/src/block/cast/cast128.h
+++ b/src/block/cast/cast128.h
@@ -1,7 +1,9 @@
-/*************************************************
-* CAST-128 Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* CAST-128
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_CAST128_H__
#define BOTAN_CAST128_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* CAST-128 *
-*************************************************/
+/*
+* CAST-128
+*/
class BOTAN_DLL CAST_128 : public BlockCipher
{
public:
diff --git a/src/block/cast/cast256.cpp b/src/block/cast/cast256.cpp
index b8004851b..993bab46c 100644
--- a/src/block/cast/cast256.cpp
+++ b/src/block/cast/cast256.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* CAST-256 Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* CAST-256
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/cast256.h>
#include <botan/loadstor.h>
@@ -11,9 +13,9 @@ namespace Botan {
namespace {
-/*************************************************
-* CAST-256 Round Type 1 *
-*************************************************/
+/*
+* CAST-256 Round Type 1
+*/
void round1(u32bit& out, u32bit in, u32bit mask, u32bit rot)
{
u32bit temp = rotate_left(mask + in, rot);
@@ -21,9 +23,9 @@ void round1(u32bit& out, u32bit in, u32bit mask, u32bit rot)
CAST_SBOX3[get_byte(2, temp)] + CAST_SBOX4[get_byte(3, temp)];
}
-/*************************************************
-* CAST-256 Round Type 2 *
-*************************************************/
+/*
+* CAST-256 Round Type 2
+*/
void round2(u32bit& out, u32bit in, u32bit mask, u32bit rot)
{
u32bit temp = rotate_left(mask ^ in, rot);
@@ -31,9 +33,9 @@ void round2(u32bit& out, u32bit in, u32bit mask, u32bit rot)
CAST_SBOX3[get_byte(2, temp)]) ^ CAST_SBOX4[get_byte(3, temp)];
}
-/*************************************************
-* CAST-256 Round Type 3 *
-*************************************************/
+/*
+* CAST-256 Round Type 3
+*/
void round3(u32bit& out, u32bit in, u32bit mask, u32bit rot)
{
u32bit temp = rotate_left(mask - in, rot);
@@ -43,9 +45,9 @@ void round3(u32bit& out, u32bit in, u32bit mask, u32bit rot)
}
-/*************************************************
-* CAST-256 Encryption *
-*************************************************/
+/*
+* CAST-256 Encryption
+*/
void CAST_256::enc(const byte in[], byte out[]) const
{
u32bit A = load_be<u32bit>(in, 0);
@@ -81,9 +83,9 @@ void CAST_256::enc(const byte in[], byte out[]) const
store_be(out, A, B, C, D);
}
-/*************************************************
-* CAST-256 Decryption *
-*************************************************/
+/*
+* CAST-256 Decryption
+*/
void CAST_256::dec(const byte in[], byte out[]) const
{
u32bit A = load_be<u32bit>(in, 0);
@@ -119,9 +121,9 @@ void CAST_256::dec(const byte in[], byte out[]) const
store_be(out, A, B, C, D);
}
-/*************************************************
-* CAST-256 Key Schedule *
-*************************************************/
+/*
+* CAST-256 Key Schedule
+*/
void CAST_256::key_schedule(const byte key[], u32bit length)
{
SecureBuffer<u32bit, 8> TMP;
diff --git a/src/block/cast/cast256.h b/src/block/cast/cast256.h
index e80208ad4..cd48edd5e 100644
--- a/src/block/cast/cast256.h
+++ b/src/block/cast/cast256.h
@@ -1,7 +1,9 @@
-/*************************************************
-* CAST-256 Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* CAST-256
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_CAST256_H__
#define BOTAN_CAST256_H__
@@ -10,9 +12,9 @@
namespace Botan {
-/*************************************************
-* CAST-256 *
-*************************************************/
+/*
+* CAST-256
+*/
class BOTAN_DLL CAST_256 : public BlockCipher
{
public:
diff --git a/src/block/cast/cast_tab.cpp b/src/block/cast/cast_tab.cpp
index 3edab713f..61c843713 100644
--- a/src/block/cast/cast_tab.cpp
+++ b/src/block/cast/cast_tab.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* S-Box Tables for CAST-128 and CAST-256 *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* S-Box Tables for CAST-128 and CAST-256
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/cast128.h>
#include <botan/cast256.h>