ERROR_ENTRY("Base64 decoding error.", GNUTLS_E_BASE64_DECODING_ERROR, 1 ),
ERROR_ENTRY("Base64 encoding error.", GNUTLS_E_BASE64_ENCODING_ERROR, 1 ),
ERROR_ENTRY("Parsing error in SRP password file.", GNUTLS_E_SRP_PWD_PARSING_ERROR, 1 ),
- ERROR_ENTRY("The requested data, were not available.", GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE, 0 ),
+ ERROR_ENTRY("The requested data were not available.", GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE, 0 ),
ERROR_ENTRY("Error in the pull function.", GNUTLS_E_PULL_ERROR, 1 ),
ERROR_ENTRY("Error in the push function.", GNUTLS_E_PUSH_ERROR, 1 ),
- ERROR_ENTRY("The upper limit in record packet sequence number has been reached. Wow!", GNUTLS_E_RECORD_LIMIT_REACHED, 1 ),
+ ERROR_ENTRY("The upper limit of record packet sequence numbers has been reached. Wow!", GNUTLS_E_RECORD_LIMIT_REACHED, 1 ),
ERROR_ENTRY("Error in the certificate.", GNUTLS_E_CERTIFICATE_ERROR, 1 ),
ERROR_ENTRY("Unknown Subject Alternative name in X.509 certificate.", GNUTLS_E_X509_UNKNOWN_SAN, 1 ),
ERROR_ENTRY("Unsupported critical extension in X.509 certificate.", GNUTLS_E_X509_UNSUPPORTED_CRITICAL_EXTENSION, 1 ),
- ERROR_ENTRY("Key usage violation in certificate, has been detected.", GNUTLS_E_KEY_USAGE_VIOLATION, 1 ),
+ ERROR_ENTRY("Key usage violation in certificate has been detected.", GNUTLS_E_KEY_USAGE_VIOLATION, 1 ),
ERROR_ENTRY("Function was interrupted.", GNUTLS_E_AGAIN, 0 ),
ERROR_ENTRY("Function was interrupted.", GNUTLS_E_INTERRUPTED, 0 ),
ERROR_ENTRY("Rehandshake was requested by the peer.", GNUTLS_E_REHANDSHAKE, 0 ),
ERROR_ENTRY("TLS Application data were received, while expected handshake data.", GNUTLS_E_GOT_APPLICATION_DATA, 1 ),
ERROR_ENTRY("Error in Database backend.", GNUTLS_E_DB_ERROR, 1 ),
ERROR_ENTRY("The certificate type is not supported.", GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE, 1 ),
- ERROR_ENTRY("The memory buffer given, is too short to hold parameters.", GNUTLS_E_SHORT_MEMORY_BUFFER, 1 ),
+ ERROR_ENTRY("The given memory buffer is too short to hold parameters.", GNUTLS_E_SHORT_MEMORY_BUFFER, 1 ),
ERROR_ENTRY("The request is invalid.", GNUTLS_E_INVALID_REQUEST, 1 ),
ERROR_ENTRY("An illegal parameter has been received.", GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER, 1 ),
ERROR_ENTRY("Error while reading file.", GNUTLS_E_FILE_ERROR, 1 ),
ERROR_ENTRY("The certificate has unsupported attributes.", GNUTLS_E_X509_UNSUPPORTED_ATTRIBUTE, 1),
ERROR_ENTRY("The hash algorithm is unknown.", GNUTLS_E_UNKNOWN_HASH_ALGORITHM, 1),
ERROR_ENTRY("The PKCS structure's content type is unknown.", GNUTLS_E_UNKNOWN_PKCS_CONTENT_TYPE, 1),
- ERROR_ENTRY("The PKCS structure's Bag type is unknown.", GNUTLS_E_UNKNOWN_PKCS_BAG_TYPE, 1),
- ERROR_ENTRY("The password given contains invalid characters.", GNUTLS_E_INVALID_PASSWORD, 1),
+ ERROR_ENTRY("The PKCS structure's bag type is unknown.", GNUTLS_E_UNKNOWN_PKCS_BAG_TYPE, 1),
+ ERROR_ENTRY("The given password contains invalid characters.", GNUTLS_E_INVALID_PASSWORD, 1),
ERROR_ENTRY("The Message Authentication Code verification failed.", GNUTLS_E_MAC_VERIFY_FAILED, 1),
- {0, 0, 0, 0}
+ {NULL, NULL, 0, 0}
};
#define GNUTLS_ERROR_LOOP(b) \
* may be fatal for you (your program).
*
* This is only useful if you are dealing with errors from the
- * record layer, or the handshake layer.
+ * record layer or the handshake layer.
*
**/
int gnutls_error_is_fatal(int error)
* @error: is an error returned by a gnutls function. Error is always a negative value.
*
* This function is like perror(). The only difference is that it accepts an
- * error returned by a gnutls function.
+ * error number returned by a gnutls function.
**/
void gnutls_perror(int error)
{
* gnutls_strerror - Returns a string with a description of an error
* @error: is an error returned by a gnutls function. Error is always a negative value.
*
- * This function is similar to strerror(). The only difference is that it
- * accepts an error (number) returned by a gnutls function.
+ * This function is similar to strerror(). Differences: it accepts an error
+ * number returned by a gnutls function; it might return NULL in the case of
+ * an unknown error number.
**/
const char* gnutls_strerror(int error)
{
*
* Sets the priority on the ciphers supported by gnutls.
* Priority is higher for ciphers specified before others.
- * After specifying the ciphers you want, you should add 0.
+ * After specifying the ciphers you want, you must append a 0.
* Note that the priority is set on the client. The server does
* not use the algorithm's priority except for disabling
* algorithms that were not specified.
**/
int gnutls_cipher_set_priority(gnutls_session session, const int *list)
{
- const int *_list = list;
int num = 0, i;
- while (*_list != 0) {
- num++;
- ++_list;
- }
-
- num = GMIN(MAX_ALGOS, num);
+ while (list[num] != 0) num++;
+ if (num > MAX_ALGOS) num = MAX_ALGOS;
session->internals.cipher_algorithm_priority.algorithms = num;
for (i = 0; i < num; i++) {
*
* Sets the priority on the key exchange algorithms supported by gnutls.
* Priority is higher for algorithms specified before others.
- * After specifying the algorithms you want, you should add 0.
+ * After specifying the algorithms you want, you must append a 0.
* Note that the priority is set on the client. The server does
* not use the algorithm's priority except for disabling
* algorithms that were not specified.
**/
int gnutls_kx_set_priority(gnutls_session session, const int *list)
{
- const int *_list = list;
int num = 0, i;
- while (*_list != 0) {
- num++;
- ++_list;
- }
-
-
- num = GMIN(MAX_ALGOS, num);
+ while (list[num] != 0) num++;
+ if (num > MAX_ALGOS) num = MAX_ALGOS;
session->internals.kx_algorithm_priority.algorithms = num;
for (i = 0; i < num; i++) {
*
* Sets the priority on the mac algorithms supported by gnutls.
* Priority is higher for algorithms specified before others.
- * After specifying the algorithms you want, you should add 0.
+ * After specifying the algorithms you want, you must append a 0.
* Note that the priority is set on the client. The server does
* not use the algorithm's priority except for disabling
* algorithms that were not specified.
**/
int gnutls_mac_set_priority(gnutls_session session, const int *list)
{
- const int *_list = list;
int num = 0, i;
- while (*_list != 0) {
- num++;
- ++_list;
- }
-
-
- num = GMIN(MAX_ALGOS, num);
+ while (list[num] != 0) num++;
+ if (num > MAX_ALGOS) num = MAX_ALGOS;
session->internals.mac_algorithm_priority.algorithms = num;
for (i = 0; i < num; i++) {
*
* Sets the priority on the compression algorithms supported by gnutls.
* Priority is higher for algorithms specified before others.
- * After specifying the algorithms you want, you should add 0.
+ * After specifying the algorithms you want, you must append a 0.
* Note that the priority is set on the client. The server does
* not use the algorithm's priority except for disabling
* algorithms that were not specified.
int gnutls_compression_set_priority(gnutls_session session,
const int *list)
{
- const int *_list = list;
int num = 0, i;
- while (*_list != 0) {
- num++;
- ++_list;
- }
-
- num = GMIN(MAX_ALGOS, num);
+ while (list[num] != 0) num++;
+ if (num > MAX_ALGOS) num = MAX_ALGOS;
session->internals.compression_method_priority.algorithms = num;
for (i = 0; i < num; i++) {
**/
int gnutls_protocol_set_priority(gnutls_session session, const int *list)
{
- const int *_list = list;
int num = 0, i;
- while (*_list != 0) {
- num++;
- ++_list;
- }
-
-
- num = GMIN(MAX_ALGOS, num);
+ while (list[num] != 0) num++;
+ if (num > MAX_ALGOS) num = MAX_ALGOS;
session->internals.protocol_priority.algorithms = num;
for (i = 0; i < num; i++) {
}
/* set the current version to the first in the chain.
- * This will be overriden later.
+ * This will be overridden later.
*/
if (num > 0)
- _gnutls_set_current_version(session,
- session->internals.
- protocol_priority.priority[0]);
+ _gnutls_set_current_version(session, list[0]);
return 0;
}
*
* Sets the priority on the certificate types supported by gnutls.
* Priority is higher for types specified before others.
- * After specifying the types you want, you should add 0.
+ * After specifying the types you want, you must append a 0.
* Note that the certificate type priority is set on the client.
* The server does not use the cert type priority except for disabling
* types that were not specified.
const int *list)
{
#ifdef HAVE_LIBOPENCDK
- const int *_list = list;
- int num = 0, i;
-
- while (*_list != 0) {
- num++;
- ++_list;
- }
+ int num = 0, i;
- num = GMIN(MAX_ALGOS, num);
+ while (list[num] != 0) num++;
+ if (num > MAX_ALGOS) num = MAX_ALGOS;
session->internals.cert_type_priority.algorithms = num;
for (i = 0; i < num; i++) {
return 0;
-#endif
+#else
return GNUTLS_E_UNIMPLEMENTED_FEATURE;
+#endif
}
/**
**/
int gnutls_set_default_priority(gnutls_session session)
{
- static const int protocol_priority[4] =
+ static const int protocol_priority[] =
{ GNUTLS_TLS1, GNUTLS_SSL3, 0 };
- static const int kx_priority[8] =
+ static const int kx_priority[] =
{ GNUTLS_KX_RSA, GNUTLS_KX_DHE_DSS, GNUTLS_KX_DHE_RSA, 0 };
- static const int cipher_priority[8] = {
+ static const int cipher_priority[] = {
GNUTLS_CIPHER_RIJNDAEL_256_CBC, GNUTLS_CIPHER_RIJNDAEL_128_CBC,
GNUTLS_CIPHER_3DES_CBC, GNUTLS_CIPHER_ARCFOUR_128, 0
};
- static const int comp_priority[4] = { GNUTLS_COMP_NULL, 0 };
- static const int mac_priority[4] =
+ static const int comp_priority[] = { GNUTLS_COMP_NULL, 0 };
+ static const int mac_priority[] =
{ GNUTLS_MAC_SHA, GNUTLS_MAC_MD5, 0 };
gnutls_cipher_set_priority(session, cipher_priority);
**/
int gnutls_set_default_export_priority(gnutls_session session)
{
- static const int protocol_priority[4] = {
+ static const int protocol_priority[] = {
GNUTLS_TLS1, GNUTLS_SSL3, 0
};
- static const int kx_priority[8] = {
+ static const int kx_priority[] = {
GNUTLS_KX_RSA, GNUTLS_KX_DHE_DSS, GNUTLS_KX_DHE_RSA,
GNUTLS_KX_RSA_EXPORT, 0
};
- static const int cipher_priority[8] = {
+ static const int cipher_priority[] = {
GNUTLS_CIPHER_RIJNDAEL_256_CBC, GNUTLS_CIPHER_RIJNDAEL_128_CBC,
GNUTLS_CIPHER_3DES_CBC, GNUTLS_CIPHER_ARCFOUR_128,
GNUTLS_CIPHER_ARCFOUR_40, 0
};
- static const int comp_priority[4] = { GNUTLS_COMP_NULL, 0 };
- static const int mac_priority[4] =
+ static const int comp_priority[] = { GNUTLS_COMP_NULL, 0 };
+ static const int mac_priority[] =
{ GNUTLS_MAC_SHA, GNUTLS_MAC_MD5, 0 };
gnutls_cipher_set_priority(session, cipher_priority);