check hash algorithms used in signatures

This commit is contained in:
Andreas Steffen
2007-09-11 20:10:38 +00:00
parent dd968b9b20
commit 2f9f5149c4
8 changed files with 194 additions and 148 deletions
+19 -7
View File
@@ -42,17 +42,18 @@ typedef struct hasher_t hasher_t;
* @ingroup hashers
*/
enum hash_algorithm_t {
HASH_MD2 = 0,
HASH_UNKNOWN = 0,
HASH_MD2 = 1,
/** Implemented in class md5_hasher_t */
HASH_MD5 = 1,
HASH_MD5 = 2,
/** Implemented in class sha1_hasher_t */
HASH_SHA1 = 2,
HASH_SHA1 = 3,
/** Implemented in class sha2_hasher_t */
HASH_SHA256 = 3,
HASH_SHA256 = 4,
/** Implemented in class sha2_hasher_t */
HASH_SHA384 = 4,
HASH_SHA384 = 5,
/** Implemented in class sha2_hasher_t */
HASH_SHA512 = 5,
HASH_SHA512 = 6,
};
#define HASH_SIZE_MD2 16
@@ -68,7 +69,6 @@ enum hash_algorithm_t {
*/
extern enum_name_t *hash_algorithm_names;
/**
* @brief Generic interface for all hash functions.
*
@@ -156,4 +156,16 @@ struct hasher_t {
*/
hasher_t *hasher_create(hash_algorithm_t hash_algorithm);
/**
* @brief Conversion of ASN.1 OID to hash algorithm.
*
* @param oid ASN.1 OID
* @return
* - hash algorithm
* - HASH_UNKNOWN if OID unsuported
*
* @ingroup hashers
*/
hash_algorithm_t hasher_algorithm_from_oid(int oid);
#endif /* HASHER_H_ */