summaryrefslogtreecommitdiff
path: root/src/libstrongswan/crypto/hashers/hasher.c
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2008-03-30 08:38:54 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2008-03-30 08:38:54 +0000
commit113868f64840631a2b10a2e8987268f2c6566552 (patch)
tree087c05184fd083ca653d1b85bd10c3c51361bb4a /src/libstrongswan/crypto/hashers/hasher.c
parentc9e3aaf0657e98bc047486ba87edf1489a39ba94 (diff)
downloadvyos-strongswan-113868f64840631a2b10a2e8987268f2c6566552.tar.gz
vyos-strongswan-113868f64840631a2b10a2e8987268f2c6566552.zip
- New upstream release.
Diffstat (limited to 'src/libstrongswan/crypto/hashers/hasher.c')
-rw-r--r--src/libstrongswan/crypto/hashers/hasher.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/libstrongswan/crypto/hashers/hasher.c b/src/libstrongswan/crypto/hashers/hasher.c
index 14bfb022f..9fa778aa6 100644
--- a/src/libstrongswan/crypto/hashers/hasher.c
+++ b/src/libstrongswan/crypto/hashers/hasher.c
@@ -6,8 +6,9 @@
*/
/*
- * Copyright (C) 2005-2006 Martin Willi
* Copyright (C) 2005 Jan Hutter
+ * Copyright (C) 2005-2006 Martin Willi
+ *
* Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -20,7 +21,7 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
- * RCSID $Id: hasher.c 3304 2007-10-12 23:18:42Z andreas $
+ * RCSID $Id: hasher.c 3423 2008-01-22 10:32:37Z andreas $
*/
@@ -110,6 +111,39 @@ hash_algorithm_t hasher_algorithm_from_oid(int oid)
/*
* Described in header.
*/
+int hasher_algorithm_to_oid(hash_algorithm_t alg)
+{
+ int oid;
+
+ switch (alg)
+ {
+ case HASH_MD2:
+ oid = OID_MD2;
+ break;
+ case HASH_MD5:
+ oid = OID_MD5;
+ break;
+ case HASH_SHA1:
+ oid = OID_SHA1;
+ break;
+ case HASH_SHA256:
+ oid = OID_SHA256;
+ break;
+ case HASH_SHA384:
+ oid = OID_SHA384;
+ break;
+ case HASH_SHA512:
+ oid = OID_SHA512;
+ break;
+ default:
+ oid = OID_UNKNOWN;
+ }
+ return oid;
+}
+
+/*
+ * Described in header.
+ */
int hasher_signature_algorithm_to_oid(hash_algorithm_t alg)
{
int oid;