aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/entropy/cryptoapi_rng/es_capi.cpp4
-rw-r--r--src/entropy/cryptoapi_rng/es_capi.h6
-rw-r--r--src/filters/buf_filt.h34
-rw-r--r--src/filters/fd_unix/fd_unix.h18
-rw-r--r--src/filters/modes/eax/eax.h35
-rw-r--r--src/filters/pipe.h18
-rw-r--r--src/filters/secqueue.h23
-rw-r--r--src/rng/rng.h5
8 files changed, 127 insertions, 16 deletions
diff --git a/src/entropy/cryptoapi_rng/es_capi.cpp b/src/entropy/cryptoapi_rng/es_capi.cpp
index 1de76dabb..420977a9b 100644
--- a/src/entropy/cryptoapi_rng/es_capi.cpp
+++ b/src/entropy/cryptoapi_rng/es_capi.cpp
@@ -50,7 +50,7 @@ class CSP_Handle
}
-/**
+/*
* Gather Entropy from Win32 CAPI
*/
void Win32_CAPI_EntropySource::poll(Entropy_Accumulator& accum)
@@ -71,7 +71,7 @@ void Win32_CAPI_EntropySource::poll(Entropy_Accumulator& accum)
}
}
-/**
+/*
* Win32_Capi_Entropysource Constructor
*/
Win32_CAPI_EntropySource::Win32_CAPI_EntropySource(const std::string& provs)
diff --git a/src/entropy/cryptoapi_rng/es_capi.h b/src/entropy/cryptoapi_rng/es_capi.h
index f55713e92..cec7fba5e 100644
--- a/src/entropy/cryptoapi_rng/es_capi.h
+++ b/src/entropy/cryptoapi_rng/es_capi.h
@@ -23,7 +23,11 @@ class Win32_CAPI_EntropySource : public EntropySource
void poll(Entropy_Accumulator& accum);
- Win32_CAPI_EntropySource(const std::string& = "");
+ /**
+ * Win32_Capi_Entropysource Constructor
+ * @provs list of providers, seperated by ':'
+ */
+ Win32_CAPI_EntropySource(const std::string& provs = "");
private:
std::vector<u64bit> prov_types;
};
diff --git a/src/filters/buf_filt.h b/src/filters/buf_filt.h
index 0f8443453..87180e3e1 100644
--- a/src/filters/buf_filt.h
+++ b/src/filters/buf_filt.h
@@ -19,14 +19,46 @@ namespace Botan {
class BOTAN_DLL Buffered_Filter
{
public:
- void write(const byte[], size_t);
+ /**
+ * Write bytes into the buffered filter, which will them emit them
+ * in calls to buffered_block in the subclass
+ * @param in the input bytes
+ * @param length of in in bytes
+ */
+ void write(const byte in[], size_t length);
+
+ /**
+ * Finish a message, emitting to buffered_block and buffered_final
+ * Will throw an exception if less than final_minimum bytes were
+ * written into the filter.
+ */
void end_msg();
+ /**
+ * Initialize a Buffered_Filter
+ * @param block_size the function buffered_block will be called
+ * with inputs which are a multiple of this size
+ * @param final_minimum the function buffered_final will be called
+ * with at least this many bytes.
+ */
Buffered_Filter(size_t block_size, size_t final_minimum);
virtual ~Buffered_Filter() {}
protected:
+ /**
+ * The block processor, implemented by subclasses
+ * @param input some input bytes
+ * @param length the size of input, guaranteed to be a multiple
+ * of block_size
+ */
virtual void buffered_block(const byte input[], size_t length) = 0;
+
+ /**
+ * The final block, implemented by subclasses
+ * @param input some input bytes
+ * @param length the size of input, guaranteed to be at least
+ * final_minimum bytes
+ */
virtual void buffered_final(const byte input[], size_t length) = 0;
/**
diff --git a/src/filters/fd_unix/fd_unix.h b/src/filters/fd_unix/fd_unix.h
index 0ff220e50..8335aed9e 100644
--- a/src/filters/fd_unix/fd_unix.h
+++ b/src/filters/fd_unix/fd_unix.h
@@ -12,11 +12,21 @@
namespace Botan {
-/*
-* Unix I/O Operators for Pipe
+/**
+* Stream output operator; dumps the results from pipe's default
+* message to the output stream.
+* @param out file descriptor for an open output stream
+* @param pipe the pipe
+*/
+int BOTAN_DLL operator<<(int out, Pipe& pipe);
+
+/**
+* File descriptor input operator; dumps the remaining bytes of input
+* to the (assumed open) pipe message.
+* @param in file descriptor for an open input stream
+* @param pipe the pipe
*/
-int BOTAN_DLL operator<<(int, Pipe&);
-int BOTAN_DLL operator>>(int, Pipe&);
+int BOTAN_DLL operator>>(int in, Pipe& pipe);
}
diff --git a/src/filters/modes/eax/eax.h b/src/filters/modes/eax/eax.h
index c3dd213a2..e8efb9398 100644
--- a/src/filters/modes/eax/eax.h
+++ b/src/filters/modes/eax/eax.h
@@ -53,13 +53,44 @@ class BOTAN_DLL EAX_Base : public Keyed_Filter
EAX_Base(BlockCipher* cipher, size_t tag_size);
void start_msg();
- const size_t BLOCK_SIZE, TAG_SIZE;
+ /**
+ * The block size of the underlying cipher
+ */
+ const size_t BLOCK_SIZE;
+
+ /**
+ * The requested tag name
+ */
+ const size_t TAG_SIZE;
+
+ /**
+ * The name of the cipher
+ */
std::string cipher_name;
+ /**
+ * The stream cipher (CTR mode)
+ */
StreamCipher* ctr;
+
+ /**
+ * The MAC (CMAC)
+ */
MessageAuthenticationCode* cmac;
- SecureVector<byte> nonce_mac, header_mac;
+ /**
+ * The MAC of the nonce
+ */
+ SecureVector<byte> nonce_mac;
+
+ /**
+ * The MAC of the header
+ */
+ SecureVector<byte> header_mac;
+
+ /**
+ * A buffer for CTR mode encryption
+ */
SecureVector<byte> ctr_buf;
};
diff --git a/src/filters/pipe.h b/src/filters/pipe.h
index 5d2ccf81e..d26f91491 100644
--- a/src/filters/pipe.h
+++ b/src/filters/pipe.h
@@ -286,11 +286,21 @@ class BOTAN_DLL Pipe : public DataSource
bool inside_msg;
};
-/*
-* I/O Operators for Pipe
+/**
+* Stream output operator; dumps the results from pipe's default
+* message to the output stream.
+* @param out an output stream
+* @param pipe the pipe
+*/
+BOTAN_DLL std::ostream& operator<<(std::ostream& out, Pipe& pipe);
+
+/**
+* Stream input operator; dumps the remaining bytes of input
+* to the (assumed open) pipe message.
+* @param in the input stream
+* @param pipe the pipe
*/
-BOTAN_DLL std::ostream& operator<<(std::ostream&, Pipe&);
-BOTAN_DLL std::istream& operator>>(std::istream&, Pipe&);
+BOTAN_DLL std::istream& operator>>(std::istream& in, Pipe& pipe);
}
diff --git a/src/filters/secqueue.h b/src/filters/secqueue.h
index 82d70ef27..632ae857d 100644
--- a/src/filters/secqueue.h
+++ b/src/filters/secqueue.h
@@ -27,12 +27,31 @@ class BOTAN_DLL SecureQueue : public Fanout_Filter, public DataSource
size_t peek(byte[], size_t, size_t = 0) const;
bool end_of_data() const;
+
+ /**
+ * @return number of bytes available in the queue
+ */
size_t size() const;
+
bool attachable() { return false; }
- SecureQueue& operator=(const SecureQueue&);
+ /**
+ * SecureQueue assignment
+ * @param other the queue to copy
+ */
+ SecureQueue& operator=(const SecureQueue& other);
+
+ /**
+ * SecureQueue default constructor (creates empty queue)
+ */
SecureQueue();
- SecureQueue(const SecureQueue&);
+
+ /**
+ * SecureQueue copy constructor
+ * @param other the queue to copy
+ */
+ SecureQueue(const SecureQueue& other);
+
~SecureQueue() { destroy(); }
private:
void destroy();
diff --git a/src/rng/rng.h b/src/rng/rng.h
index 95e1f12cb..c078ef08f 100644
--- a/src/rng/rng.h
+++ b/src/rng/rng.h
@@ -32,6 +32,11 @@ class BOTAN_DLL RandomNumberGenerator
*/
virtual void randomize(byte output[], size_t length) = 0;
+ /**
+ * Return a random vector
+ * @param bytes number of bytes in the result
+ * @return randomized vector of length bytes
+ */
SecureVector<byte> random_vec(size_t bytes)
{
SecureVector<byte> output(bytes);