535a69448b8f97c7a38bfc86bfd024a4df3ce559
2 * Copyright (C) 2005 Jan Hutter
3 * Copyright (C) 2005-2006 Martin Willi
5 * Hochschule fuer Technik Rapperswil
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 ENUM(hash_algorithm_names
, HASH_UNKNOWN
, HASH_MD4
,
35 * Described in header.
37 hash_algorithm_t
hasher_algorithm_from_oid(int oid
)
42 case OID_MD2_WITH_RSA
:
45 case OID_MD5_WITH_RSA
:
48 case OID_SHA1_WITH_RSA
:
51 case OID_SHA256_WITH_RSA
:
54 case OID_SHA384_WITH_RSA
:
57 case OID_SHA512_WITH_RSA
:
65 * Described in header.
67 int hasher_algorithm_to_oid(hash_algorithm_t alg
)
98 * Described in header.
100 int hasher_signature_algorithm_to_oid(hash_algorithm_t alg
)
107 oid
= OID_MD2_WITH_RSA
;
110 oid
= OID_MD5_WITH_RSA
;
113 oid
= OID_SHA1_WITH_RSA
;
116 oid
= OID_SHA256_WITH_RSA
;
119 oid
= OID_SHA384_WITH_RSA
;
122 oid
= OID_SHA512_WITH_RSA
;