diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2007-11-18 20:40:27 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2007-11-18 20:40:27 +0200 |
commit | 33a4419dfc5509ab5f38bf36f4edeabfd8ad027c (patch) | |
tree | 2fa28352936d658f46fcfcacde526f301757cda5 | |
parent | 7339ff3ea7de5d03321f4f86636fd1705aabba20 (diff) | |
download | gnutls-33a4419dfc5509ab5f38bf36f4edeabfd8ad027c.tar.gz |
added gnutls_check_priority() to check syntax of priority strings.
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | doc/gnutls.texi | 1 | ||||
-rw-r--r-- | includes/gnutls/gnutls.h.in | 1 | ||||
-rw-r--r-- | lib/gnutls_priority.c | 26 | ||||
-rw-r--r-- | lib/gnutls_state.h | 2 |
5 files changed, 31 insertions, 1 deletions
@@ -18,6 +18,8 @@ the gnutls_set_priority(). ** Internal copy of OpenCDK upgraded to version 0.6.6. ** API and ABI modifications: +gnutls_check_priority: ADDED +gnutls_set_priority: ADDED gnutls_set_default_priority2: RENAMED to gnutls_set_priority() gnutls_mac_convert_priority: REMOVED gnutls_compression_convert_priority: REMOVED diff --git a/doc/gnutls.texi b/doc/gnutls.texi index d89c31baba..aeeecd8b8d 100644 --- a/doc/gnutls.texi +++ b/doc/gnutls.texi @@ -2298,7 +2298,6 @@ The following client is a very simple @acronym{SRP} @acronym{TLS} client which connects to a server and authenticates using a @emph{username} and a @emph{password}. The server may authenticate itself using a certificate, and in that case it has to be verified. -In this example we also show the usage of @ref{gnutls_kx_convert_priority}. @verbatiminclude examples/ex-client-srp.c diff --git a/includes/gnutls/gnutls.h.in b/includes/gnutls/gnutls.h.in index 0251fb43fa..17d0c11524 100644 --- a/includes/gnutls/gnutls.h.in +++ b/includes/gnutls/gnutls.h.in @@ -517,6 +517,7 @@ extern "C" /* if you just want some defaults, use the following. */ int gnutls_set_priority(gnutls_session_t session, const char *priority, char* syntax_error, size_t syntax_error_size); + int gnutls_check_priority(const char *priority, char *syntax_error, size_t syntax_error_size); /* Returns the name of a cipher suite */ const char *gnutls_cipher_suite_get_name (gnutls_kx_algorithm_t diff --git a/lib/gnutls_priority.c b/lib/gnutls_priority.c index 690cc5c5f1..867f7c3c65 100644 --- a/lib/gnutls_priority.c +++ b/lib/gnutls_priority.c @@ -610,6 +610,32 @@ error: } +/** + * gnutls_check_priority - Checks for syntax errors the given priority string + * @priority: is a string describing priorities + * @syntax_error: In case of an error an error string will be copied there. + * @syntax_error_size: the length of the previous string. + * + * Checks for syntax errors the given priority string. The rules are + * described in gnutls_set_priority(). + * + * On syntax error GNUTLS_E_INVALID_REQUEST is returned and 0 on success. + * + **/ +int +gnutls_check_priority(const char *priority, char *syntax_error, size_t syntax_error_size) +{ +gnutls_session t; +int ret; + + gnutls_init(&t, GNUTLS_SERVER); + ret = gnutls_set_priority( t, priority, syntax_error, syntax_error_size); + gnutls_deinit(t); + + return ret; +} + + /* New priority API with strings */ diff --git a/lib/gnutls_state.h b/lib/gnutls_state.h index ca5e641b52..7a920ee450 100644 --- a/lib/gnutls_state.h +++ b/lib/gnutls_state.h @@ -67,4 +67,6 @@ int _gnutls_PRF (gnutls_session_t session, const opaque * seed, int seed_size, int total_bytes, void *ret); +int gnutls_init (gnutls_session_t * session, gnutls_connection_end_t con_end); + #define DEFAULT_CERT_TYPE GNUTLS_CRT_X509 |