aboutsummaryrefslogtreecommitdiffstats
path: root/src/stream/salsa20/salsa20.cpp
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/stream/salsa20/salsa20.cpp
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/stream/salsa20/salsa20.cpp')
-rw-r--r--src/stream/salsa20/salsa20.cpp52
1 files changed, 27 insertions, 25 deletions
diff --git a/src/stream/salsa20/salsa20.cpp b/src/stream/salsa20/salsa20.cpp
index e6a190fc3..75137798c 100644
--- a/src/stream/salsa20/salsa20.cpp
+++ b/src/stream/salsa20/salsa20.cpp
@@ -1,7 +1,9 @@
-/*************************************************
-* Salsa20 Source File *
-* (C) 1999-2008 Jack Lloyd *
-*************************************************/
+/*
+* Salsa20
+* (C) 1999-2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/salsa20.h>
#include <botan/mem_ops.h>
@@ -13,9 +15,9 @@ namespace Botan {
namespace {
-/*************************************************
-* Generate Salsa20 cipher stream *
-*************************************************/
+/*
+* Generate Salsa20 cipher stream
+*/
void salsa20(byte output[64], const u32bit input[16])
{
u32bit x00 = input[0];
@@ -92,9 +94,9 @@ void salsa20(byte output[64], const u32bit input[16])
}
-/*************************************************
-* Combine cipher stream with message *
-*************************************************/
+/*
+* Combine cipher stream with message
+*/
void Salsa20::cipher(const byte in[], byte out[], u32bit length)
{
while(length >= buffer.size() - position)
@@ -117,9 +119,9 @@ void Salsa20::cipher(const byte in[], byte out[], u32bit length)
position += length;
}
-/*************************************************
-* Salsa20 Key Schedule *
-*************************************************/
+/*
+* Salsa20 Key Schedule
+*/
void Salsa20::key_schedule(const byte key[], u32bit length)
{
static const u32bit TAU[] =
@@ -165,9 +167,9 @@ void Salsa20::key_schedule(const byte key[], u32bit length)
resync(ZERO, sizeof(ZERO));
}
-/*************************************************
-* Return the name of this type *
-*************************************************/
+/*
+* Return the name of this type
+*/
void Salsa20::resync(const byte iv[], u32bit length)
{
if(length != IV_LENGTH)
@@ -186,17 +188,17 @@ void Salsa20::resync(const byte iv[], u32bit length)
position = 0;
}
-/*************************************************
-* Return the name of this type *
-*************************************************/
+/*
+* Return the name of this type
+*/
std::string Salsa20::name() const
{
return "Salsa20";
}
-/*************************************************
-* Clear memory of sensitive data *
-*************************************************/
+/*
+* Clear memory of sensitive data
+*/
void Salsa20::clear() throw()
{
state.clear();
@@ -204,9 +206,9 @@ void Salsa20::clear() throw()
position = 0;
}
-/*************************************************
-* Salsa20 Constructor *
-*************************************************/
+/*
+* Salsa20 Constructor
+*/
Salsa20::Salsa20() : StreamCipher(16, 32, 16, 8)
{
clear();