aboutsummaryrefslogtreecommitdiffstats
path: root/src/modes/mode_pad
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/modes/mode_pad
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/modes/mode_pad')
-rw-r--r--src/modes/mode_pad/mode_pad.cpp70
-rw-r--r--src/modes/mode_pad/mode_pad.h4
2 files changed, 39 insertions, 35 deletions
diff --git a/src/modes/mode_pad/mode_pad.cpp b/src/modes/mode_pad/mode_pad.cpp
index 3944837cc..b8badd7a7 100644
--- a/src/modes/mode_pad/mode_pad.cpp
+++ b/src/modes/mode_pad/mode_pad.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* CBC Padding Methods Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* CBC Padding Methods
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/mode_pad.h>
#include <botan/exceptn.h>
@@ -9,26 +11,26 @@
namespace Botan {
-/*************************************************
-* Default amount of padding *
-*************************************************/
+/*
+* Default amount of padding
+*/
u32bit BlockCipherModePaddingMethod::pad_bytes(u32bit bs, u32bit pos) const
{
return (bs - pos);
}
-/*************************************************
-* Pad with PKCS #7 Method *
-*************************************************/
+/*
+* Pad with PKCS #7 Method
+*/
void PKCS7_Padding::pad(byte block[], u32bit size, u32bit position) const
{
for(u32bit j = 0; j != size; ++j)
block[j] = (size-position);
}
-/*************************************************
-* Unpad with PKCS #7 Method *
-*************************************************/
+/*
+* Unpad with PKCS #7 Method
+*/
u32bit PKCS7_Padding::unpad(const byte block[], u32bit size) const
{
u32bit position = block[size-1];
@@ -40,9 +42,9 @@ u32bit PKCS7_Padding::unpad(const byte block[], u32bit size) const
return (size-position);
}
-/*************************************************
-* Query if the size is valid for this method *
-*************************************************/
+/*
+* Query if the size is valid for this method
+*/
bool PKCS7_Padding::valid_blocksize(u32bit size) const
{
if(size > 0 && size < 256)
@@ -51,9 +53,9 @@ bool PKCS7_Padding::valid_blocksize(u32bit size) const
return false;
}
-/*************************************************
-* Pad with ANSI X9.23 Method *
-*************************************************/
+/*
+* Pad with ANSI X9.23 Method
+*/
void ANSI_X923_Padding::pad(byte block[], u32bit size, u32bit position) const
{
for(u32bit j = 0; j != size-position; ++j)
@@ -61,9 +63,9 @@ void ANSI_X923_Padding::pad(byte block[], u32bit size, u32bit position) const
block[size-position-1] = (size-position);
}
-/*************************************************
-* Unpad with ANSI X9.23 Method *
-*************************************************/
+/*
+* Unpad with ANSI X9.23 Method
+*/
u32bit ANSI_X923_Padding::unpad(const byte block[], u32bit size) const
{
u32bit position = block[size-1];
@@ -75,9 +77,9 @@ u32bit ANSI_X923_Padding::unpad(const byte block[], u32bit size) const
return (size-position);
}
-/*************************************************
-* Query if the size is valid for this method *
-*************************************************/
+/*
+* Query if the size is valid for this method
+*/
bool ANSI_X923_Padding::valid_blocksize(u32bit size) const
{
if(size > 0 && size < 256)
@@ -86,9 +88,9 @@ bool ANSI_X923_Padding::valid_blocksize(u32bit size) const
return false;
}
-/*************************************************
-* Pad with One and Zeros Method *
-*************************************************/
+/*
+* Pad with One and Zeros Method
+*/
void OneAndZeros_Padding::pad(byte block[], u32bit size, u32bit) const
{
block[0] = 0x80;
@@ -96,9 +98,9 @@ void OneAndZeros_Padding::pad(byte block[], u32bit size, u32bit) const
block[j] = 0x00;
}
-/*************************************************
-* Unpad with One and Zeros Method *
-*************************************************/
+/*
+* Unpad with One and Zeros Method
+*/
u32bit OneAndZeros_Padding::unpad(const byte block[], u32bit size) const
{
while(size)
@@ -114,9 +116,9 @@ u32bit OneAndZeros_Padding::unpad(const byte block[], u32bit size) const
return (size-1);
}
-/*************************************************
-* Query if the size is valid for this method *
-*************************************************/
+/*
+* Query if the size is valid for this method
+*/
bool OneAndZeros_Padding::valid_blocksize(u32bit size) const
{
if(size) return true;
diff --git a/src/modes/mode_pad/mode_pad.h b/src/modes/mode_pad/mode_pad.h
index 5c31a4f1e..a486d3c1f 100644
--- a/src/modes/mode_pad/mode_pad.h
+++ b/src/modes/mode_pad/mode_pad.h
@@ -1,6 +1,8 @@
/**
-* CBC Padding Methods Header File
+* CBC Padding Methods
* (C) 1999-2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
*/
#ifndef BOTAN_CBC_PADDING_H__