From: Nikos Mavrogiannopoulos Date: Tue, 16 Nov 2010 14:17:43 +0000 (+0100) Subject: Added SIGN-ALL, CTYPE-ALL, COMP-ALL, and VERS-TLS-ALL priority strings. X-Git-Tag: gnutls_2_11_5~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e3452c242416ba2d5d4de4b1fd47c177bdef23ff;p=thirdparty%2Fgnutls.git Added SIGN-ALL, CTYPE-ALL, COMP-ALL, and VERS-TLS-ALL priority strings. --- diff --git a/NEWS b/NEWS index 65e721eee1..e444fc3525 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,10 @@ See the end for copying conditions. * Version 2.11.5 (unreleased) +** libgnutls: Added Added SIGN-ALL, CTYPE-ALL, COMP-ALL, and VERS-TLS-ALL +as priority strings. Those allow to set all the supported algorithms +at once. + ** p11tool: Introduced. It allows manipulating pkcs 11 tokens. ** gnutls-cli: Print channel binding only in verbose mode. diff --git a/lib/gnutls_priority.c b/lib/gnutls_priority.c index d7c6831ac5..5d6e4947ab 100644 --- a/lib/gnutls_priority.c +++ b/lib/gnutls_priority.c @@ -552,7 +552,9 @@ gnutls_priority_set (gnutls_session_t session, gnutls_priority_t priority) * To avoid collisions in order to specify a compression algorithm in * this string you have to prefix it with "COMP-", protocol versions * with "VERS-", signature algorithms with "SIGN-" and certificate types with "CTYPE-". All other - * algorithms don't need a prefix. + * algorithms don't need a prefix. The keywords "SIGN-ALL", "CTYPE-ALL", "COMP-ALL", + * and "VERS-TLS-ALL" can be used to add all the support signature types, certificate + * types, compression methods and supported TLS version numbers. * * Examples: * "NORMAL:!AES-128-CBC" means normal ciphers except for AES-128. @@ -560,7 +562,7 @@ gnutls_priority_set (gnutls_session_t session, gnutls_priority_t priority) * "EXPORT:!VERS-TLS1.0:+COMP-DEFLATE" means that export ciphers are * enabled, TLS 1.0 is disabled, and libz compression enabled. * - * "NONE:+VERS-TLS1.0:+AES-128-CBC:+RSA:+SHA1:+COMP-NULL:+SIGN-RSA-SHA1", "NORMAL", + * "NONE:+VERS-TLS-ALL:+AES-128-CBC:+RSA:+SHA1:+COMP-NULL:+SIGN-RSA-SHA1", "NORMAL", * "%COMPAT". * * Returns: On syntax error %GNUTLS_E_INVALID_REQUEST is returned, @@ -680,39 +682,67 @@ gnutls_priority_init (gnutls_priority_t * priority_cache, fn (&(*priority_cache)->kx, algo); else if (strncasecmp (&broken_list[i][1], "VERS-", 5) == 0) { - if ((algo = - gnutls_protocol_get_id (&broken_list[i][6])) != - GNUTLS_VERSION_UNKNOWN) - fn (&(*priority_cache)->protocol, algo); - else - goto error; + if (strncasecmp (&broken_list[i][1], "VERS-TLS-ALL", 12) == 0) + { + _set_priority (&(*priority_cache)->protocol, protocol_priority); + } + else + { + if ((algo = + gnutls_protocol_get_id (&broken_list[i][6])) != + GNUTLS_VERSION_UNKNOWN) + fn (&(*priority_cache)->protocol, algo); + else + goto error; + } } /* now check if the element is something like -ALGO */ else if (strncasecmp (&broken_list[i][1], "COMP-", 5) == 0) { - if ((algo = - gnutls_compression_get_id (&broken_list[i][6])) != - GNUTLS_COMP_UNKNOWN) - fn (&(*priority_cache)->compression, algo); - else - goto error; + if (strncasecmp (&broken_list[i][1], "COMP-ALL", 8) == 0) + { + _set_priority (&(*priority_cache)->compression, comp_priority); + } + else + { + if ((algo = + gnutls_compression_get_id (&broken_list[i][6])) != + GNUTLS_COMP_UNKNOWN) + fn (&(*priority_cache)->compression, algo); + else + goto error; + } } /* now check if the element is something like -ALGO */ else if (strncasecmp (&broken_list[i][1], "CTYPE-", 6) == 0) { - if ((algo = - gnutls_certificate_type_get_id (&broken_list[i][7])) != - GNUTLS_CRT_UNKNOWN) - fn (&(*priority_cache)->cert_type, algo); - else - goto error; + if (strncasecmp (&broken_list[i][1], "CTYPE-ALL", 9) == 0) + { + _set_priority (&(*priority_cache)->cert_type, cert_type_priority); + } + else + { + if ((algo = + gnutls_certificate_type_get_id (&broken_list[i][7])) != + GNUTLS_CRT_UNKNOWN) + fn (&(*priority_cache)->cert_type, algo); + else + goto error; + } } /* now check if the element is something like -ALGO */ else if (strncasecmp (&broken_list[i][1], "SIGN-", 5) == 0) { - if ((algo = - gnutls_sign_get_id (&broken_list[i][6])) != - GNUTLS_SIGN_UNKNOWN) - fn (&(*priority_cache)->sign_algo, algo); - else - goto error; + if (strncasecmp (&broken_list[i][1], "SIGN-ALL", 8) == 0) + { + _set_priority (&(*priority_cache)->sign_algo, sign_priority_default); + } + else + { + if ((algo = + gnutls_sign_get_id (&broken_list[i][6])) != + GNUTLS_SIGN_UNKNOWN) + fn (&(*priority_cache)->sign_algo, algo); + else + goto error; + } } /* now check if the element is something like -ALGO */ else goto error;