summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2013-07-25 13:36:46 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-07-25 13:36:46 +0200
commitf5f48c71159ad8e3f14148ff84d8892b9535ffb4 (patch)
tree81930575d6df8bbdb7c54f0c8c1874a515955f70
parentdc104efe31a0390f2ed742dd5c272ac8ba80b29b (diff)
downloadgnutls-f5f48c71159ad8e3f14148ff84d8892b9535ffb4.tar.gz
Added helper functions to export the available ciphers in a priority structure
-rw-r--r--NEWS4
-rw-r--r--lib/gnutls_priority.c63
-rw-r--r--lib/includes/gnutls/gnutls.h.in4
-rw-r--r--lib/libgnutls.map3
4 files changed, 73 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 5a2ff1e193..c545822ec8 100644
--- a/NEWS
+++ b/NEWS
@@ -8,7 +8,9 @@ See the end for copying conditions.
** libgnutls: Fixes in parsing of priority strings. Patch by Stefan Buehler.
** API and ABI modifications:
-No changes since last version.
+gnutls_priority_kx_list: Added
+gnutls_priority_mac_list: Added
+gnutls_priority_cipher_list: Added
* Version 3.2.2 (released 2013-07-14)
diff --git a/lib/gnutls_priority.c b/lib/gnutls_priority.c
index 4384088383..d4a079529c 100644
--- a/lib/gnutls_priority.c
+++ b/lib/gnutls_priority.c
@@ -1288,6 +1288,69 @@ gnutls_priority_ecc_curve_list (gnutls_priority_t pcache, const unsigned int** l
}
/**
+ * gnutls_priority_kx_list:
+ * @pcache: is a #gnutls_prioritity_t structure.
+ * @list: will point to an integer list
+ *
+ * Get a list of available key exchange methods in the priority
+ * structure.
+ *
+ * Returns: the number of curves, or an error code.
+ * Since: 3.2.3
+ **/
+int
+gnutls_priority_kx_list (gnutls_priority_t pcache, const unsigned int** list)
+{
+ if (pcache->kx.algorithms == 0)
+ return 0;
+
+ *list = pcache->kx.priority;
+ return pcache->kx.algorithms;
+}
+
+/**
+ * gnutls_priority_cipher_list:
+ * @pcache: is a #gnutls_prioritity_t structure.
+ * @list: will point to an integer list
+ *
+ * Get a list of available ciphers in the priority
+ * structure.
+ *
+ * Returns: the number of curves, or an error code.
+ * Since: 3.2.3
+ **/
+int
+gnutls_priority_cipher_list (gnutls_priority_t pcache, const unsigned int** list)
+{
+ if (pcache->cipher.algorithms == 0)
+ return 0;
+
+ *list = pcache->cipher.priority;
+ return pcache->cipher.algorithms;
+}
+
+/**
+ * gnutls_priority_mac_list:
+ * @pcache: is a #gnutls_prioritity_t structure.
+ * @list: will point to an integer list
+ *
+ * Get a list of available MAC algorithms in the priority
+ * structure.
+ *
+ * Returns: the number of curves, or an error code.
+ * Since: 3.2.3
+ **/
+int
+gnutls_priority_mac_list (gnutls_priority_t pcache, const unsigned int** list)
+{
+ if (pcache->mac.algorithms == 0)
+ return 0;
+
+ *list = pcache->mac.priority;
+ return pcache->mac.algorithms;
+}
+
+/**
* gnutls_priority_compression_list:
* @pcache: is a #gnutls_prioritity_t structure.
* @list: will point to an integer list
diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in
index 936f75aa5c..f2e6c8996c 100644
--- a/lib/includes/gnutls/gnutls.h.in
+++ b/lib/includes/gnutls/gnutls.h.in
@@ -1097,6 +1097,10 @@ gnutls_ecc_curve_t gnutls_ecc_curve_get(gnutls_session_t session);
int gnutls_priority_compression_list (gnutls_priority_t pcache, const unsigned int** list);
int gnutls_priority_ecc_curve_list (gnutls_priority_t pcache, const unsigned int** list);
+ int gnutls_priority_kx_list (gnutls_priority_t pcache, const unsigned int** list);
+ int gnutls_priority_cipher_list (gnutls_priority_t pcache, const unsigned int** list);
+ int gnutls_priority_mac_list (gnutls_priority_t pcache, const unsigned int** list);
+
/* for compatibility
*/
int gnutls_set_default_priority (gnutls_session_t session);
diff --git a/lib/libgnutls.map b/lib/libgnutls.map
index 375fe8ec26..2c40509cac 100644
--- a/lib/libgnutls.map
+++ b/lib/libgnutls.map
@@ -920,6 +920,9 @@ GNUTLS_3_1_0 {
gnutls_digest_list;
gnutls_digest_get_id;
gnutls_digest_get_name;
+ gnutls_priority_mac_list;
+ gnutls_priority_cipher_list;
+ gnutls_priority_kx_list;
} GNUTLS_3_0_0;
GNUTLS_PRIVATE {