aboutsummaryrefslogtreecommitdiffstats
path: root/src/constructs
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-06-16 01:21:33 +0000
committerlloyd <[email protected]>2010-06-16 01:21:33 +0000
commita87419f1304aa63b0b4e17f750f5dd2097cb8bf4 (patch)
treeae6c8b89d432394877e657b27b5b55fe8ef0cb4f /src/constructs
parentecb574d32f4382326e94ad19e9d5baecc84a3c29 (diff)
Remove some of the more extraneous namespaces
Diffstat (limited to 'src/constructs')
-rw-r--r--src/constructs/aont/package.cpp18
-rw-r--r--src/constructs/aont/package.h18
-rw-r--r--src/constructs/cryptobox/cryptobox.cpp16
-rw-r--r--src/constructs/cryptobox/cryptobox.h14
4 files changed, 25 insertions, 41 deletions
diff --git a/src/constructs/aont/package.cpp b/src/constructs/aont/package.cpp
index 5d1e674ca..e10087060 100644
--- a/src/constructs/aont/package.cpp
+++ b/src/constructs/aont/package.cpp
@@ -14,12 +14,10 @@
namespace Botan {
-namespace AllOrNothingTransform {
-
-void package(RandomNumberGenerator& rng,
- BlockCipher* cipher,
- const byte input[], u32bit input_len,
- byte output[])
+void aont_package(RandomNumberGenerator& rng,
+ BlockCipher* cipher,
+ const byte input[], u32bit input_len,
+ byte output[])
{
if(!cipher->valid_keylength(cipher->BLOCK_SIZE))
throw Invalid_Argument("AONT::package: Invalid cipher");
@@ -66,9 +64,9 @@ void package(RandomNumberGenerator& rng,
xor_buf(final_block, package_key.begin(), cipher->BLOCK_SIZE);
}
-void unpackage(BlockCipher* cipher,
- const byte input[], u32bit input_len,
- byte output[])
+void aont_unpackage(BlockCipher* cipher,
+ const byte input[], u32bit input_len,
+ byte output[])
{
if(!cipher->valid_keylength(cipher->BLOCK_SIZE))
throw Invalid_Argument("AONT::unpackage: Invalid cipher");
@@ -116,5 +114,3 @@ void unpackage(BlockCipher* cipher,
}
}
-
-}
diff --git a/src/constructs/aont/package.h b/src/constructs/aont/package.h
index 9c23d1836..211623347 100644
--- a/src/constructs/aont/package.h
+++ b/src/constructs/aont/package.h
@@ -14,8 +14,6 @@
namespace Botan {
-namespace AllOrNothingTransform {
-
/**
* Rivest's Package Tranform
* @arg rng the random number generator to use
@@ -25,10 +23,10 @@ namespace AllOrNothingTransform {
* @arg output the output data buffer (must be at least
* input_len + cipher->BLOCK_SIZE bytes long)
*/
-void BOTAN_DLL package(RandomNumberGenerator& rng,
- BlockCipher* cipher,
- const byte input[], u32bit input_len,
- byte output[]);
+void BOTAN_DLL aont_package(RandomNumberGenerator& rng,
+ BlockCipher* cipher,
+ const byte input[], u32bit input_len,
+ byte output[]);
/**
* Rivest's Package Tranform (Inversion)
@@ -39,11 +37,9 @@ void BOTAN_DLL package(RandomNumberGenerator& rng,
* @arg output the output data buffer (must be at least
* input_len - cipher->BLOCK_SIZE bytes long)
*/
-void BOTAN_DLL unpackage(BlockCipher* cipher,
- const byte input[], u32bit input_len,
- byte output[]);
-
-}
+void BOTAN_DLL aont_unpackage(BlockCipher* cipher,
+ const byte input[], u32bit input_len,
+ byte output[]);
}
diff --git a/src/constructs/cryptobox/cryptobox.cpp b/src/constructs/cryptobox/cryptobox.cpp
index 371b52e66..7d27c0523 100644
--- a/src/constructs/cryptobox/cryptobox.cpp
+++ b/src/constructs/cryptobox/cryptobox.cpp
@@ -18,8 +18,6 @@
namespace Botan {
-namespace CryptoBox {
-
namespace {
/*
@@ -40,9 +38,9 @@ const u32bit PBKDF_OUTPUT_LEN = CIPHER_KEY_LEN + CIPHER_IV_LEN + MAC_KEY_LEN;
}
-std::string encrypt(const byte input[], u32bit input_len,
- const std::string& passphrase,
- RandomNumberGenerator& rng)
+std::string cryptobox_encrypt(const byte input[], u32bit input_len,
+ const std::string& passphrase,
+ RandomNumberGenerator& rng)
{
SecureVector<byte> pbkdf_salt(PBKDF_SALT_LEN);
rng.randomize(pbkdf_salt.begin(), pbkdf_salt.size());
@@ -91,8 +89,8 @@ std::string encrypt(const byte input[], u32bit input_len,
"BOTAN CRYPTOBOX MESSAGE");
}
-std::string decrypt(const byte input[], u32bit input_len,
- const std::string& passphrase)
+std::string cryptobox_decrypt(const byte input[], u32bit input_len,
+ const std::string& passphrase)
{
DataSource_Memory input_src(input, input_len);
SecureVector<byte> ciphertext =
@@ -120,7 +118,7 @@ std::string decrypt(const byte input[], u32bit input_len,
CIPHER_IV_LEN);
Pipe pipe(new Fork(
- get_cipher("Serpent/CTR-BE", cipher_key, iv, ENCRYPTION),
+ get_cipher("Serpent/CTR-BE", cipher_key, iv, DECRYPTION),
new MAC_Filter(new HMAC(new SHA_512),
mac_key, MAC_OUTPUT_LEN)));
@@ -141,5 +139,3 @@ std::string decrypt(const byte input[], u32bit input_len,
}
}
-
-}
diff --git a/src/constructs/cryptobox/cryptobox.h b/src/constructs/cryptobox/cryptobox.h
index a30cb244a..3dbb894ba 100644
--- a/src/constructs/cryptobox/cryptobox.h
+++ b/src/constructs/cryptobox/cryptobox.h
@@ -13,8 +13,6 @@
namespace Botan {
-namespace CryptoBox {
-
/**
* Encrypt a message
* @param input the input data
@@ -22,9 +20,9 @@ namespace CryptoBox {
* @param passphrase the passphrase used to encrypt the message
* @param rng a ref to a random number generator, such as AutoSeeded_RNG
*/
-BOTAN_DLL std::string encrypt(const byte input[], u32bit input_len,
- const std::string& passphrase,
- RandomNumberGenerator& rng);
+BOTAN_DLL std::string cryptobox_encrypt(const byte input[], u32bit input_len,
+ const std::string& passphrase,
+ RandomNumberGenerator& rng);
/**
* Decrypt a message encrypted with CryptoBox::encrypt
@@ -32,10 +30,8 @@ BOTAN_DLL std::string encrypt(const byte input[], u32bit input_len,
* @param input_len the length of input in bytes
* @param passphrase the passphrase used to encrypt the message
*/
-BOTAN_DLL std::string decrypt(const byte input[], u32bit input_len,
- const std::string& passphrase);
-
-}
+BOTAN_DLL std::string cryptobox_decrypt(const byte input[], u32bit input_len,
+ const std::string& passphrase);
}