aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/buf_comp/buf_comp.h25
-rw-r--r--src/utils/cpuid.cpp2
-rw-r--r--src/utils/cpuid.h5
-rw-r--r--src/utils/datastor/datastor.h3
-rw-r--r--src/utils/debug.h2
-rw-r--r--src/utils/exceptn.h34
-rw-r--r--src/utils/prefetch.h8
-rw-r--r--src/utils/simd_32/simd_32.h2
-rw-r--r--src/utils/simd_32/simd_altivec.h2
-rw-r--r--src/utils/simd_32/simd_scalar.h6
-rw-r--r--src/utils/simd_32/simd_sse.h2
-rw-r--r--src/utils/time.cpp2
-rw-r--r--src/utils/time.h13
-rw-r--r--src/utils/ui.h3
-rw-r--r--src/utils/version.cpp2
-rw-r--r--src/utils/version.h16
-rw-r--r--src/utils/xor_buf.h2
17 files changed, 85 insertions, 44 deletions
diff --git a/src/utils/buf_comp/buf_comp.h b/src/utils/buf_comp/buf_comp.h
index 3f1e90bad..e807e6abf 100644
--- a/src/utils/buf_comp/buf_comp.h
+++ b/src/utils/buf_comp/buf_comp.h
@@ -1,4 +1,4 @@
-/**
+/*
* BufferedComputation
* (C) 1999-2007 Jack Lloyd
*
@@ -29,7 +29,7 @@ class BOTAN_DLL BufferedComputation
/**
* Add new input to process.
* @param in the input to process as a byte array
- * @param the length of the byte array
+ * @param length of param in in bytes
*/
void update(const byte in[], u32bit length) { add_data(in, length); }
@@ -67,7 +67,7 @@ class BOTAN_DLL BufferedComputation
/**
* Complete the computation and retrieve the
* final result.
- * @return a SecureVector holding the result
+ * @return SecureVector holding the result
*/
SecureVector<byte> final()
{
@@ -113,12 +113,27 @@ class BOTAN_DLL BufferedComputation
return final();
}
+ /**
+ * @param out_len the output length of this computation
+ */
BufferedComputation(u32bit out_len) : OUTPUT_LENGTH(out_len) {}
+
virtual ~BufferedComputation() {}
private:
BufferedComputation& operator=(const BufferedComputation&);
- virtual void add_data(const byte[], u32bit) = 0;
- virtual void final_result(byte[]) = 0;
+
+ /**
+ * Add more data to the computation
+ * @param input is an input buffer
+ * @param length is the length of input in bytes
+ */
+ virtual void add_data(const byte input[], u32bit length) = 0;
+
+ /**
+ * Write the final output to out
+ * @param out is an output buffer of OUTPUT_LENGTH
+ */
+ virtual void final_result(byte out[]) = 0;
};
}
diff --git a/src/utils/cpuid.cpp b/src/utils/cpuid.cpp
index 19a2db788..4837e7ac4 100644
--- a/src/utils/cpuid.cpp
+++ b/src/utils/cpuid.cpp
@@ -1,4 +1,4 @@
-/**
+/*
* Runtime CPU detection
* (C) 2009 Jack Lloyd
*
diff --git a/src/utils/cpuid.h b/src/utils/cpuid.h
index 1de97f129..a41e932fb 100644
--- a/src/utils/cpuid.h
+++ b/src/utils/cpuid.h
@@ -1,4 +1,4 @@
-/**
+/*
* Runtime CPU detection
* (C) 2009 Jack Lloyd
*
@@ -12,6 +12,9 @@
namespace Botan {
+/**
+* A class handling runtime CPU feature detection
+*/
class BOTAN_DLL CPUID
{
public:
diff --git a/src/utils/datastor/datastor.h b/src/utils/datastor/datastor.h
index 516d0a16b..26a0d418c 100644
--- a/src/utils/datastor/datastor.h
+++ b/src/utils/datastor/datastor.h
@@ -23,6 +23,9 @@ namespace Botan {
class BOTAN_DLL Data_Store
{
public:
+ /**
+ * A search function
+ */
bool operator==(const Data_Store&) const;
std::multimap<std::string, std::string> search_for(
diff --git a/src/utils/debug.h b/src/utils/debug.h
index 271e0047b..11de7010e 100644
--- a/src/utils/debug.h
+++ b/src/utils/debug.h
@@ -1,4 +1,4 @@
-/**
+/*
* Internal-use debugging functions for Botan
* (C) 2009 Jack Lloyd
*
diff --git a/src/utils/exceptn.h b/src/utils/exceptn.h
index 2ac88aaf6..6dff970b6 100644
--- a/src/utils/exceptn.h
+++ b/src/utils/exceptn.h
@@ -19,7 +19,7 @@ namespace Botan {
typedef std::runtime_error Exception;
typedef std::invalid_argument Invalid_Argument;
-/*
+/**
* Invalid_State Exception
*/
struct BOTAN_DLL Invalid_State : public Exception
@@ -29,7 +29,7 @@ struct BOTAN_DLL Invalid_State : public Exception
{}
};
-/*
+/**
* Lookup_Error Exception
*/
struct BOTAN_DLL Lookup_Error : public Exception
@@ -39,7 +39,7 @@ struct BOTAN_DLL Lookup_Error : public Exception
{}
};
-/*
+/**
* Internal_Error Exception
*/
struct BOTAN_DLL Internal_Error : public Exception
@@ -49,7 +49,7 @@ struct BOTAN_DLL Internal_Error : public Exception
{}
};
-/*
+/**
* Invalid_Key_Length Exception
*/
struct BOTAN_DLL Invalid_Key_Length : public Invalid_Argument
@@ -60,7 +60,7 @@ struct BOTAN_DLL Invalid_Key_Length : public Invalid_Argument
{}
};
-/*
+/**
* Invalid_Block_Size Exception
*/
struct BOTAN_DLL Invalid_Block_Size : public Invalid_Argument
@@ -72,7 +72,7 @@ struct BOTAN_DLL Invalid_Block_Size : public Invalid_Argument
{}
};
-/*
+/**
* Invalid_IV_Length Exception
*/
struct BOTAN_DLL Invalid_IV_Length : public Invalid_Argument
@@ -83,7 +83,7 @@ struct BOTAN_DLL Invalid_IV_Length : public Invalid_Argument
{}
};
-/*
+/**
* PRNG_Unseeded Exception
*/
struct BOTAN_DLL PRNG_Unseeded : public Invalid_State
@@ -93,7 +93,7 @@ struct BOTAN_DLL PRNG_Unseeded : public Invalid_State
{}
};
-/*
+/**
* Policy_Violation Exception
*/
struct BOTAN_DLL Policy_Violation : public Invalid_State
@@ -103,7 +103,7 @@ struct BOTAN_DLL Policy_Violation : public Invalid_State
{}
};
-/*
+/**
* Algorithm_Not_Found Exception
*/
struct BOTAN_DLL Algorithm_Not_Found : public Lookup_Error
@@ -113,7 +113,7 @@ struct BOTAN_DLL Algorithm_Not_Found : public Lookup_Error
{}
};
-/*
+/**
* Invalid_Algorithm_Name Exception
*/
struct BOTAN_DLL Invalid_Algorithm_Name : public Invalid_Argument
@@ -123,7 +123,7 @@ struct BOTAN_DLL Invalid_Algorithm_Name : public Invalid_Argument
{}
};
-/*
+/**
* Encoding_Error Exception
*/
struct BOTAN_DLL Encoding_Error : public Invalid_Argument
@@ -132,7 +132,7 @@ struct BOTAN_DLL Encoding_Error : public Invalid_Argument
Invalid_Argument("Encoding error: " + name) {}
};
-/*
+/**
* Decoding_Error Exception
*/
struct BOTAN_DLL Decoding_Error : public Invalid_Argument
@@ -141,7 +141,7 @@ struct BOTAN_DLL Decoding_Error : public Invalid_Argument
Invalid_Argument("Decoding error: " + name) {}
};
-/*
+/**
* Integrity_Failure Exception
*/
struct BOTAN_DLL Integrity_Failure : public Exception
@@ -150,7 +150,7 @@ struct BOTAN_DLL Integrity_Failure : public Exception
Exception("Integrity failure: " + what) {}
};
-/*
+/**
* Invalid_OID Exception
*/
struct BOTAN_DLL Invalid_OID : public Decoding_Error
@@ -159,7 +159,7 @@ struct BOTAN_DLL Invalid_OID : public Decoding_Error
Decoding_Error("Invalid ASN.1 OID: " + oid) {}
};
-/*
+/**
* Stream_IO_Error Exception
*/
struct BOTAN_DLL Stream_IO_Error : public Exception
@@ -169,7 +169,7 @@ struct BOTAN_DLL Stream_IO_Error : public Exception
{}
};
-/*
+/**
* Self Test Failure Exception
*/
struct BOTAN_DLL Self_Test_Failure : public Internal_Error
@@ -179,7 +179,7 @@ struct BOTAN_DLL Self_Test_Failure : public Internal_Error
{}
};
-/*
+/**
* Memory Allocation Exception
*/
struct BOTAN_DLL Memory_Exhaustion : public std::bad_alloc
diff --git a/src/utils/prefetch.h b/src/utils/prefetch.h
index ede196692..4928c44a0 100644
--- a/src/utils/prefetch.h
+++ b/src/utils/prefetch.h
@@ -12,10 +12,8 @@
namespace Botan {
-namespace PREFETCH {
-
template<typename T>
-inline void readonly(const T* addr, u32bit length)
+inline void prefetch_readonly(const T* addr, u32bit length)
{
#if defined(__GNUG__)
const u32bit Ts_per_cache_line = CPUID::cache_line_size() / sizeof(T);
@@ -26,7 +24,7 @@ inline void readonly(const T* addr, u32bit length)
}
template<typename T>
-inline void readwrite(const T* addr, u32bit length)
+inline void prefetch_readwrite(const T* addr, u32bit length)
{
#if defined(__GNUG__)
const u32bit Ts_per_cache_line = CPUID::cache_line_size() / sizeof(T);
@@ -38,6 +36,4 @@ inline void readwrite(const T* addr, u32bit length)
}
-}
-
#endif
diff --git a/src/utils/simd_32/simd_32.h b/src/utils/simd_32/simd_32.h
index 23dce0305..15be7713d 100644
--- a/src/utils/simd_32/simd_32.h
+++ b/src/utils/simd_32/simd_32.h
@@ -1,4 +1,4 @@
-/**
+/*
* Lightweight wrappers for SIMD operations
* (C) 2009 Jack Lloyd
*
diff --git a/src/utils/simd_32/simd_altivec.h b/src/utils/simd_32/simd_altivec.h
index 859a48a5f..44e2a4d2b 100644
--- a/src/utils/simd_32/simd_altivec.h
+++ b/src/utils/simd_32/simd_altivec.h
@@ -1,4 +1,4 @@
-/**
+/*
* Lightweight wrappers around AltiVec for 32-bit operations
* (C) 2009 Jack Lloyd
*
diff --git a/src/utils/simd_32/simd_scalar.h b/src/utils/simd_32/simd_scalar.h
index 5cf1a11c3..56b529025 100644
--- a/src/utils/simd_32/simd_scalar.h
+++ b/src/utils/simd_32/simd_scalar.h
@@ -1,4 +1,4 @@
-/**
+/*
* Scalar emulation of SIMD 32-bit operations
* (C) 2009 Jack Lloyd
*
@@ -13,6 +13,10 @@
namespace Botan {
+/**
+* Fake SIMD, using plain scalar operations
+* Often still faster than iterative on superscalar machines
+*/
class SIMD_Scalar
{
public:
diff --git a/src/utils/simd_32/simd_sse.h b/src/utils/simd_32/simd_sse.h
index 0189c2e4d..ad3857fbf 100644
--- a/src/utils/simd_32/simd_sse.h
+++ b/src/utils/simd_32/simd_sse.h
@@ -1,4 +1,4 @@
-/**
+/*
* Lightweight wrappers for SSE2 intrinsics for 32-bit operations
* (C) 2009 Jack Lloyd
*
diff --git a/src/utils/time.cpp b/src/utils/time.cpp
index bc9aa8a2f..4fea41c52 100644
--- a/src/utils/time.cpp
+++ b/src/utils/time.cpp
@@ -1,4 +1,4 @@
-/**
+/*
* Time Functions
* (C) 1999-2010 Jack Lloyd
*
diff --git a/src/utils/time.h b/src/utils/time.h
index 44ec704a4..c7a7e0e1a 100644
--- a/src/utils/time.h
+++ b/src/utils/time.h
@@ -1,4 +1,4 @@
-/**
+/*
* Time Functions
* (C) 1999-2009 Jack Lloyd
*
@@ -25,13 +25,22 @@ struct BOTAN_DLL calendar_point
byte minutes;
byte seconds;
+ /**
+ * Initialize a calendar_point
+ * @param y the year
+ * @param mon the month
+ * @param d the day
+ * @param h the hour
+ * @param min the minute
+ * @param sec the second
+ */
calendar_point(u32bit y, byte mon, byte d, byte h, byte min, byte sec) :
year(y), month(mon), day(d), hour(h), minutes(min), seconds(sec) {}
};
/*
* @param time_point a time point from the system clock
-* @returns calendar_point object representing this time point
+* @return calendar_point object representing this time point
*/
BOTAN_DLL calendar_point calendar_value(
const std::chrono::system_clock::time_point& time_point);
diff --git a/src/utils/ui.h b/src/utils/ui.h
index fe62c60fc..f69bb2c6d 100644
--- a/src/utils/ui.h
+++ b/src/utils/ui.h
@@ -13,8 +13,9 @@
namespace Botan {
-/*
+/**
* User Interface
+* Only really used for callbacks for PKCS #8 decryption
*/
class BOTAN_DLL User_Interface
{
diff --git a/src/utils/version.cpp b/src/utils/version.cpp
index ef591b4d7..ce2083bc0 100644
--- a/src/utils/version.cpp
+++ b/src/utils/version.cpp
@@ -26,6 +26,8 @@ std::string version_string()
std::to_string(version_patch());
}
+u32bit version_datestamp() { return BOTAN_VERSION_DATESTAMP; }
+
/*
* Return parts of the version as integers
*/
diff --git a/src/utils/version.h b/src/utils/version.h
index 3cc44e806..13d0ac8bb 100644
--- a/src/utils/version.h
+++ b/src/utils/version.h
@@ -19,25 +19,33 @@ namespace Botan {
/**
* Get the version string identifying the version of Botan.
-* @return the version string
+* @return version string
*/
BOTAN_DLL std::string version_string();
/**
+* Return the date this version of botan was released, in an
+* integer of the form YYYYMMDD. For instance a version released
+* on May 21, 2013 would return the integer 20130521
+* @return release date
+*/
+BOTAN_DLL u32bit version_datestamp();
+
+/**
* Get the major version number.
-* @return the major version number
+* @return major version number
*/
BOTAN_DLL u32bit version_major();
/**
* Get the minor version number.
-* @return the minor version number
+* @return minor version number
*/
BOTAN_DLL u32bit version_minor();
/**
* Get the patch number.
-* @return the patch number
+* @return patch number
*/
BOTAN_DLL u32bit version_patch();
diff --git a/src/utils/xor_buf.h b/src/utils/xor_buf.h
index 0d7d587c8..34abb48d3 100644
--- a/src/utils/xor_buf.h
+++ b/src/utils/xor_buf.h
@@ -1,4 +1,4 @@
-/**
+/*
* XOR operations
* (C) 1999-2008 Jack Lloyd
*