summaryrefslogtreecommitdiff
path: root/lib/gnutls_algorithms.c
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2008-09-01 17:21:59 +0200
committerSimon Josefsson <simon@josefsson.org>2008-09-01 17:21:59 +0200
commit12f4162161b82256e2577b985dd74b074ac7db4e (patch)
treed11a00c7921c1608bd60b41077204c195bd7207d /lib/gnutls_algorithms.c
parentd382cf6ca80fc6537ebdb7d2c4c3131c5c6c38f6 (diff)
downloadgnutls-12f4162161b82256e2577b985dd74b074ac7db4e.tar.gz
Add gnutls_sign_list and gnutls_sign_get_id.
Suggested by Sam Varshavchik <mrsam@courier-mta.com>.
Diffstat (limited to 'lib/gnutls_algorithms.c')
-rw-r--r--lib/gnutls_algorithms.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/gnutls_algorithms.c b/lib/gnutls_algorithms.c
index 074879220a..9958474245 100644
--- a/lib/gnutls_algorithms.c
+++ b/lib/gnutls_algorithms.c
@@ -1744,6 +1744,19 @@ static const gnutls_sign_entry sign_algorithms[] = {
{0, 0, 0, 0, 0}
};
+/* Keep the contents of this struct the same as the previous one. */
+static const gnutls_sign_algorithm_t supported_sign[] = {
+ GNUTLS_SIGN_RSA_SHA1
+ GNUTLS_SIGN_RSA_SHA256,
+ GNUTLS_SIGN_RSA_SHA384,
+ GNUTLS_SIGN_RSA_SHA512,
+ GNUTLS_SIGN_RSA_RMD160,
+ GNUTLS_SIGN_DSA_SHA1,
+ GNUTLS_SIGN_RSA_MD5,
+ GNUTLS_SIGN_RSA_MD2,
+ 0
+};
+
#define GNUTLS_SIGN_LOOP(b) \
do { \
const gnutls_sign_entry *p; \
@@ -1773,6 +1786,41 @@ gnutls_sign_algorithm_get_name (gnutls_sign_algorithm_t sign)
return ret;
}
+/**
+ * gnutls_sign_list - Get a list of supported public key signature algorithms
+ *
+ * Get a list of supported public key signature algorithms.
+ *
+ * Returns: a zero-terminated list of #gnutls_sign_algorithm_t
+ * integers indicating the available ciphers.
+ *
+ **/
+const gnutls_sign_algorithm_t *
+gnutls_sign_list (void)
+{
+ return supported_sign;
+}
+
+/**
+ * gnutls_sign_get_id - Returns the gnutls id of the specified in signature algorithm
+ * @name: is a MAC algorithm name
+ *
+ * The names are compared in a case insensitive way.
+ *
+ * Returns: return a #gnutls_sign_algorithm_t value corresponding to
+ * the specified cipher, or %GNUTLS_SIGN_UNKNOWN on error.
+ **/
+gnutls_sign_algorithm_t
+gnutls_sign_get_id (const char *name)
+{
+ gnutls_sign_algorithm_t ret = GNUTLS_SIGN_UNKNOWN;
+
+ GNUTLS_SIGN_LOOP (if (strcasecmp (p->name, name) == 0) ret = p->id);
+
+ return ret;
+
+}
+
gnutls_sign_algorithm_t
_gnutls_x509_oid2sign_algorithm (const char *oid)
{