diff options
author | Tobias Brunner <tobias@strongswan.org> | 2015-03-03 18:03:28 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2015-03-04 13:54:11 +0100 |
commit | 1d384bf8aacfdc40394a6c3b99b1fd8cd68d440f (patch) | |
tree | 5dd6b8ee38860896afb9e8a12773971685319c0d /src/libstrongswan/crypto/hashers/hash_algorithm_set.h | |
parent | b67ae0f89cbbbbbef1af1bdf93e4b59d2c5c37a0 (diff) | |
download | strongswan-1d384bf8aacfdc40394a6c3b99b1fd8cd68d440f.tar.bz2 strongswan-1d384bf8aacfdc40394a6c3b99b1fd8cd68d440f.tar.xz |
hash-algorithm-set: Add class to manage a set of hash algorithms
Diffstat (limited to 'src/libstrongswan/crypto/hashers/hash_algorithm_set.h')
-rw-r--r-- | src/libstrongswan/crypto/hashers/hash_algorithm_set.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/src/libstrongswan/crypto/hashers/hash_algorithm_set.h b/src/libstrongswan/crypto/hashers/hash_algorithm_set.h new file mode 100644 index 000000000..00e90cc2e --- /dev/null +++ b/src/libstrongswan/crypto/hashers/hash_algorithm_set.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2015 Tobias Brunner + * Hochschule fuer Technik Rapperswil + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +/** + * @defgroup hash_algorithm_set hash_algorithm_set + * @{ @ingroup crypto + */ + +#ifndef HASH_ALGORITHM_SET_H_ +#define HASH_ALGORITHM_SET_H_ + +typedef struct hash_algorithm_set_t hash_algorithm_set_t; + +#include <library.h> +#include <crypto/hashers/hasher.h> + +/** + * A set of hash algorithms + */ +struct hash_algorithm_set_t { + + /** + * Add the given algorithm to the set. + * + * @param alg hash algorithm + */ + void (*add)(hash_algorithm_set_t *this, hash_algorithm_t alg); + + /** + * Check if the given algorithm is contained in the set. + * + * @param alg hash algorithm + * @return TRUE if contained in set + */ + bool (*contains)(hash_algorithm_set_t *this, hash_algorithm_t alg); + + /** + * Number of hash algorithms contained in the set. + * + * @return number of algorithms + */ + int (*count)(hash_algorithm_set_t *this); + + /** + * Enumerate the algorithms contained in the set. + * + * @return enumerator over hash_algorithm_t (sorted by identifier) + */ + enumerator_t *(*create_enumerator)(hash_algorithm_set_t *this); + + /** + * Destroy a hash_algorithm_set_t instance + */ + void (*destroy)(hash_algorithm_set_t *this); +}; + +/** + * Create a set of hash algorithms. + * + * @return hash_algorithm_set_t instance + */ +hash_algorithm_set_t *hash_algorithm_set_create(); + +#endif /** HASH_ALGORITHM_SET_H_ @}*/ |