summaryrefslogtreecommitdiff
path: root/xts.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2019-10-14 21:42:50 -0400
committerJeffrey Walton <noloader@gmail.com>2019-10-14 21:42:50 -0400
commit947525c5f3aa1c8bea9f27b735400d05dbaf1953 (patch)
tree817f95242ecc17daa7ebb02ea9f6e9a8a45bada4 /xts.h
parent1147fdfaa377f724cb037f239689e0bdbc39dda9 (diff)
downloadcryptopp-git-947525c5f3aa1c8bea9f27b735400d05dbaf1953.tar.gz
Update documentation
Diffstat (limited to 'xts.h')
-rw-r--r--xts.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/xts.h b/xts.h
index ede6685f..16093932 100644
--- a/xts.h
+++ b/xts.h
@@ -73,18 +73,37 @@ public:
{return 2*GetBlockCipher().GetValidKeyLength((n+1)/2);}
bool IsValidKeyLength(size_t keylength) const
{return keylength == GetValidKeyLength(keylength);}
+
+ /// \brief Validates the key length
+ /// \param length the size of the keying material, in bytes
+ /// \throws InvalidKeyLength if the key length is invalid
void ThrowIfInvalidKeyLength(size_t length);
/// Provides the block size of the cipher
/// \return the block size of the cipher, in bytes
unsigned int BlockSize() const
{return GetBlockCipher().BlockSize();}
+
+ /// \brief Provides the input block size most efficient for this cipher
+ /// \return The input block size that is most efficient for the cipher
+ /// \details The base class implementation returns MandatoryBlockSize().
+ /// \note Optimal input length is
+ /// <tt>n * OptimalBlockSize() - GetOptimalBlockSizeUsed()</tt> for
+ /// any <tt>n \> 0</tt>.
unsigned int GetOptimalBlockSize() const
{return GetBlockCipher().BlockSize()*ParallelBlocks;}
unsigned int MinLastBlockSize() const
{return GetBlockCipher().BlockSize()+1;}
unsigned int OptimalDataAlignment() const
{return GetBlockCipher().OptimalDataAlignment();}
+
+ /// \brief Validates the block size
+ /// \param length the block size of the cipher, in bytes
+ /// \throws InvalidArgument if the block size is invalid
+ /// \details If <tt>CRYPTOPP_XTS_WIDE_BLOCK_CIPHERS</tt> is 0,
+ /// then CIPHER must be a 16-byte block cipher. If
+ /// <tt>CRYPTOPP_XTS_WIDE_BLOCK_CIPHERS</tt> is non-zero then
+ /// CIPHER can be 16, 32, 64, or 128-byte block cipher.
void ThrowIfInvalidBlockSize(size_t length);
void SetKey(const byte *key, size_t length, const NameValuePairs &params = g_nullNameValuePairs);