From: Nikos Mavrogiannopoulos Date: Tue, 17 Jan 2012 18:47:12 +0000 (+0100) Subject: introduced GNUTLS_E_NO_PRIORITIES_WERE_SET. X-Git-Tag: gnutls-3_0_12~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2172d5aff8c7f18352fd6a3d2c17755b8f1eaf2;p=thirdparty%2Fgnutls.git introduced GNUTLS_E_NO_PRIORITIES_WERE_SET. --- diff --git a/lib/gnutls_errors.c b/lib/gnutls_errors.c index 72209ab98c..e1def739cb 100644 --- a/lib/gnutls_errors.c +++ b/lib/gnutls_errors.c @@ -51,6 +51,8 @@ static const gnutls_error_entry error_algorithms[] = { ERROR_ENTRY (N_("Success."), GNUTLS_E_SUCCESS, 0), ERROR_ENTRY (N_("Could not negotiate a supported cipher suite."), GNUTLS_E_UNKNOWN_CIPHER_SUITE, 1), + ERROR_ENTRY (N_("No priorities were setup."), + GNUTLS_E_NO_PRIORITIES_WERE_SET, 1), ERROR_ENTRY (N_("The cipher type is unsupported."), GNUTLS_E_UNKNOWN_CIPHER_TYPE, 1), ERROR_ENTRY (N_("The certificate and the given key do not match."), diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c index a3045512a5..b00212211b 100644 --- a/lib/gnutls_handshake.c +++ b/lib/gnutls_handshake.c @@ -2344,6 +2344,11 @@ gnutls_handshake (gnutls_session_t session) { int ret; record_parameters_st *params; + + /* sanity check. Verify that there are priorities setup. + */ + if (session->internals.priorities.protocol.algorithms == 0) + return gnutls_assert_val(GNUTLS_E_NO_PRIORITIES_WERE_SET); ret = _gnutls_epoch_get (session, session->security_parameters.epoch_next, ¶ms); diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in index 0f4aa044c5..2af7ae5884 100644 --- a/lib/includes/gnutls/gnutls.h.in +++ b/lib/includes/gnutls/gnutls.h.in @@ -1811,6 +1811,7 @@ gnutls_ecc_curve_t gnutls_ecc_curve_get(gnutls_session_t session); #define GNUTLS_E_PKCS11_REQUESTED_OBJECT_NOT_AVAILBLE -323 #define GNUTLS_E_CERTIFICATE_LIST_UNSORTED -324 #define GNUTLS_E_ILLEGAL_PARAMETER -325 +#define GNUTLS_E_NO_PRIORITIES_WERE_SET -326 #define GNUTLS_E_UNIMPLEMENTED_FEATURE -1250