diff options
-rw-r--r-- | src/alloc/allocate.h | 34 | ||||
-rw-r--r-- | src/cert/x509/x509_obj.h | 36 | ||||
-rw-r--r-- | src/math/numbertheory/numthry.h | 10 |
3 files changed, 72 insertions, 8 deletions
diff --git a/src/alloc/allocate.h b/src/alloc/allocate.h index 819e2542c..5bce1f205 100644 --- a/src/alloc/allocate.h +++ b/src/alloc/allocate.h @@ -19,14 +19,42 @@ namespace Botan { class BOTAN_DLL Allocator { public: - static Allocator* get(bool); + /** + * Acquire a pointer to an allocator + * @param locking is true if the allocator should attempt to + * secure the memory (eg for using to store keys) + * @return pointer to an allocator; ownership remains with library, + * so do not delete + */ + static Allocator* get(bool locking); - virtual void* allocate(u32bit) = 0; - virtual void deallocate(void*, u32bit) = 0; + /** + * Allocate a block of memory + * @param n how many bytes to allocate + * @return pointer to n bytes of memory + */ + virtual void* allocate(u32bit n) = 0; + /** + * Deallocate memory allocated with allocate() + * @param ptr the pointer returned by allocate() + * @param n the size of the block pointed to by ptr + */ + virtual void deallocate(void* ptr, u32bit n) = 0; + + /** + * @return name of this allocator type + */ virtual std::string type() const = 0; + /** + * Initialize the allocator + */ virtual void init() {} + + /** + * Shutdown the allocator + */ virtual void destroy() {} virtual ~Allocator() {} diff --git a/src/cert/x509/x509_obj.h b/src/cert/x509/x509_obj.h index 52b76d218..28ee95073 100644 --- a/src/cert/x509/x509_obj.h +++ b/src/cert/x509/x509_obj.h @@ -23,8 +23,21 @@ namespace Botan { class BOTAN_DLL X509_Object { public: + + /** + * The underlying data that is to be or was signed + * @return data that is or was signed + */ SecureVector<byte> tbs_data() const; + + /** + * @return signature on tbs_data() + */ SecureVector<byte> signature() const; + + /** + * @return signature algorithm that was used to generate signature + */ AlgorithmIdentifier signature_algorithm() const; /** @@ -40,10 +53,29 @@ class BOTAN_DLL X509_Object const AlgorithmIdentifier& alg_id, const MemoryRegion<byte>& tbs); - bool check_signature(class Public_Key&) const; + /** + * Check the signature on this data + * @param key the public key purportedly used to sign this data + * @return true if the signature is valid, otherwise false + */ + bool check_signature(class Public_Key& key) const; - void encode(Pipe&, X509_Encoding = PEM) const; + /** + * Encode this to a pipe + * @deprecated use BER_encode or PEM_encode instead + * @param out the pipe to write to + * @param encoding the encoding to use + */ + void encode(Pipe& out, X509_Encoding encoding = PEM) const; + + /** + * @return BER encoding of this + */ SecureVector<byte> BER_encode() const; + + /** + * @return PEM encoding of this + */ std::string PEM_encode() const; X509_Object(DataSource&, const std::string&); diff --git a/src/math/numbertheory/numthry.h b/src/math/numbertheory/numthry.h index adaa403ca..1ab64b038 100644 --- a/src/math/numbertheory/numthry.h +++ b/src/math/numbertheory/numthry.h @@ -21,7 +21,9 @@ namespace Botan { * @param c an integer * @return (a*b)+c */ -BigInt BOTAN_DLL mul_add(const BigInt&, const BigInt&, const BigInt&); +BigInt BOTAN_DLL mul_add(const BigInt& a, + const BigInt& b, + const BigInt& c); /** * Fused subtract-multiply @@ -30,7 +32,9 @@ BigInt BOTAN_DLL mul_add(const BigInt&, const BigInt&, const BigInt&); * @param c an integer * @return (a-b)*c */ -BigInt BOTAN_DLL sub_mul(const BigInt&, const BigInt&, const BigInt&); +BigInt BOTAN_DLL sub_mul(const BigInt& a, + const BigInt& b, + const BigInt& c); /** * Return the absolute value @@ -207,7 +211,7 @@ bool BOTAN_DLL generate_dsa_primes(RandomNumberGenerator& rng, Algorithm_Factory& af, BigInt& p_out, BigInt& q_out, - u32bit p_bits, u32bit q_bits, + u32bit pbits, u32bit qbits, const MemoryRegion<byte>& seed); /** |