diff --git a/ChangeLog b/ChangeLog index a74a95ef9..d2d587c91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,7 +9,7 @@ Features and X509parse. Changes - * Error codes are not (necessarily) negative anymore. Keep + * Error codes are not (necessarily) negative. Keep this is mind when checking for errors. * RSA_RAW renamed to SIG_RSA_RAW for consistency. * Fixed typo in name of POLARSSL_ERR_RSA_OUTPUT_TOO_LARGE. diff --git a/include/polarssl/aes.h b/include/polarssl/aes.h index 11db17ca7..5e18ab77a 100644 --- a/include/polarssl/aes.h +++ b/include/polarssl/aes.h @@ -26,7 +26,7 @@ #define AES_ENCRYPT 1 #define AES_DECRYPT 0 -#define POLARSSL_ERR_AES_INVALID_KEY_LENGTH 0x0800 +#define POLARSSL_ERR_AES_INVALID_KEY_LENGTH -0x0800 /** * \brief AES context structure diff --git a/include/polarssl/camellia.h b/include/polarssl/camellia.h index efdc11be9..2037e73bc 100644 --- a/include/polarssl/camellia.h +++ b/include/polarssl/camellia.h @@ -31,7 +31,7 @@ typedef UINT32 uint32_t; #define CAMELLIA_ENCRYPT 1 #define CAMELLIA_DECRYPT 0 -#define POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH 0x0a00 +#define POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH -0x0a00 /** * \brief CAMELLIA context structure diff --git a/include/polarssl/net.h b/include/polarssl/net.h index 29d666146..eff53cb5b 100644 --- a/include/polarssl/net.h +++ b/include/polarssl/net.h @@ -23,16 +23,16 @@ #ifndef POLARSSL_NET_H #define POLARSSL_NET_H -#define POLARSSL_ERR_NET_UNKNOWN_HOST 0x0F00 -#define POLARSSL_ERR_NET_SOCKET_FAILED 0x0F10 -#define POLARSSL_ERR_NET_CONNECT_FAILED 0x0F20 -#define POLARSSL_ERR_NET_BIND_FAILED 0x0F30 -#define POLARSSL_ERR_NET_LISTEN_FAILED 0x0F40 -#define POLARSSL_ERR_NET_ACCEPT_FAILED 0x0F50 -#define POLARSSL_ERR_NET_RECV_FAILED 0x0F60 -#define POLARSSL_ERR_NET_SEND_FAILED 0x0F70 -#define POLARSSL_ERR_NET_CONN_RESET 0x0F80 -#define POLARSSL_ERR_NET_TRY_AGAIN 0x0F90 +#define POLARSSL_ERR_NET_UNKNOWN_HOST -0x0F00 +#define POLARSSL_ERR_NET_SOCKET_FAILED -0x0F10 +#define POLARSSL_ERR_NET_CONNECT_FAILED -0x0F20 +#define POLARSSL_ERR_NET_BIND_FAILED -0x0F30 +#define POLARSSL_ERR_NET_LISTEN_FAILED -0x0F40 +#define POLARSSL_ERR_NET_ACCEPT_FAILED -0x0F50 +#define POLARSSL_ERR_NET_RECV_FAILED -0x0F60 +#define POLARSSL_ERR_NET_SEND_FAILED -0x0F70 +#define POLARSSL_ERR_NET_CONN_RESET -0x0F80 +#define POLARSSL_ERR_NET_TRY_AGAIN -0x0F90 #ifdef __cplusplus extern "C" { diff --git a/include/polarssl/rsa.h b/include/polarssl/rsa.h index 26dddbcd5..295a2db6f 100644 --- a/include/polarssl/rsa.h +++ b/include/polarssl/rsa.h @@ -28,14 +28,14 @@ /* * RSA Error codes */ -#define POLARSSL_ERR_RSA_BAD_INPUT_DATA 0x0400 -#define POLARSSL_ERR_RSA_INVALID_PADDING 0x0410 -#define POLARSSL_ERR_RSA_KEY_GEN_FAILED 0x0420 -#define POLARSSL_ERR_RSA_KEY_CHECK_FAILED 0x0430 -#define POLARSSL_ERR_RSA_PUBLIC_FAILED 0x0440 -#define POLARSSL_ERR_RSA_PRIVATE_FAILED 0x0450 -#define POLARSSL_ERR_RSA_VERIFY_FAILED 0x0460 -#define POLARSSL_ERR_RSA_OUTPUT_TOO_LARGE 0x0470 +#define POLARSSL_ERR_RSA_BAD_INPUT_DATA -0x0400 +#define POLARSSL_ERR_RSA_INVALID_PADDING -0x0410 +#define POLARSSL_ERR_RSA_KEY_GEN_FAILED -0x0420 +#define POLARSSL_ERR_RSA_KEY_CHECK_FAILED -0x0430 +#define POLARSSL_ERR_RSA_PUBLIC_FAILED -0x0440 +#define POLARSSL_ERR_RSA_PRIVATE_FAILED -0x0450 +#define POLARSSL_ERR_RSA_VERIFY_FAILED -0x0460 +#define POLARSSL_ERR_RSA_OUTPUT_TOO_LARGE -0x0470 /* * PKCS#1 constants diff --git a/include/polarssl/ssl.h b/include/polarssl/ssl.h index fa755574b..3868505f5 100644 --- a/include/polarssl/ssl.h +++ b/include/polarssl/ssl.h @@ -35,33 +35,33 @@ /* * SSL Error codes */ -#define POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE 0x1000 -#define POLARSSL_ERR_SSL_BAD_INPUT_DATA 0x1800 -#define POLARSSL_ERR_SSL_INVALID_MAC 0x2000 -#define POLARSSL_ERR_SSL_INVALID_RECORD 0x2800 -#define POLARSSL_ERR_SSL_INVALID_MODULUS_SIZE 0x3000 -#define POLARSSL_ERR_SSL_UNKNOWN_CIPHER 0x3800 -#define POLARSSL_ERR_SSL_NO_CIPHER_CHOSEN 0x4000 -#define POLARSSL_ERR_SSL_NO_SESSION_FOUND 0x4800 -#define POLARSSL_ERR_SSL_NO_CLIENT_CERTIFICATE 0x5000 -#define POLARSSL_ERR_SSL_CERTIFICATE_TOO_LARGE 0x5800 -#define POLARSSL_ERR_SSL_CERTIFICATE_REQUIRED 0x6000 -#define POLARSSL_ERR_SSL_PRIVATE_KEY_REQUIRED 0x6800 -#define POLARSSL_ERR_SSL_CA_CHAIN_REQUIRED 0x7000 -#define POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE 0x7800 -#define POLARSSL_ERR_SSL_FATAL_ALERT_MESSAGE 0x8000 -#define POLARSSL_ERR_SSL_PEER_VERIFY_FAILED 0x8800 -#define POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY 0x9000 -#define POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO 0x9800 -#define POLARSSL_ERR_SSL_BAD_HS_SERVER_HELLO 0xA000 -#define POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE 0xA800 -#define POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST 0xB000 -#define POLARSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE 0xB800 -#define POLARSSL_ERR_SSL_BAD_HS_SERVER_HELLO_DONE 0xC000 -#define POLARSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE 0xC800 -#define POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY 0xD000 -#define POLARSSL_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC 0xD800 -#define POLARSSL_ERR_SSL_BAD_HS_FINISHED 0xE000 +#define POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE -0x1000 +#define POLARSSL_ERR_SSL_BAD_INPUT_DATA -0x1800 +#define POLARSSL_ERR_SSL_INVALID_MAC -0x2000 +#define POLARSSL_ERR_SSL_INVALID_RECORD -0x2800 +#define POLARSSL_ERR_SSL_INVALID_MODULUS_SIZE -0x3000 +#define POLARSSL_ERR_SSL_UNKNOWN_CIPHER -0x3800 +#define POLARSSL_ERR_SSL_NO_CIPHER_CHOSEN -0x4000 +#define POLARSSL_ERR_SSL_NO_SESSION_FOUND -0x4800 +#define POLARSSL_ERR_SSL_NO_CLIENT_CERTIFICATE -0x5000 +#define POLARSSL_ERR_SSL_CERTIFICATE_TOO_LARGE -0x5800 +#define POLARSSL_ERR_SSL_CERTIFICATE_REQUIRED -0x6000 +#define POLARSSL_ERR_SSL_PRIVATE_KEY_REQUIRED -0x6800 +#define POLARSSL_ERR_SSL_CA_CHAIN_REQUIRED -0x7000 +#define POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE -0x7800 +#define POLARSSL_ERR_SSL_FATAL_ALERT_MESSAGE -0x8000 +#define POLARSSL_ERR_SSL_PEER_VERIFY_FAILED -0x8800 +#define POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY -0x9000 +#define POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO -0x9800 +#define POLARSSL_ERR_SSL_BAD_HS_SERVER_HELLO -0xA000 +#define POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE -0xA800 +#define POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST -0xB000 +#define POLARSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE -0xB800 +#define POLARSSL_ERR_SSL_BAD_HS_SERVER_HELLO_DONE -0xC000 +#define POLARSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE -0xC800 +#define POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY -0xD000 +#define POLARSSL_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC -0xD800 +#define POLARSSL_ERR_SSL_BAD_HS_FINISHED -0xE000 /* * Various constants diff --git a/include/polarssl/x509.h b/include/polarssl/x509.h index a218e8a9c..fbb1b6740 100644 --- a/include/polarssl/x509.h +++ b/include/polarssl/x509.h @@ -40,31 +40,31 @@ /* * X509 Error codes */ -#define POLARSSL_ERR_X509_FEATURE_UNAVAILABLE 0x0020 -#define POLARSSL_ERR_X509_CERT_INVALID_PEM 0x0040 -#define POLARSSL_ERR_X509_CERT_INVALID_FORMAT 0x0060 -#define POLARSSL_ERR_X509_CERT_INVALID_VERSION 0x0080 -#define POLARSSL_ERR_X509_CERT_INVALID_SERIAL 0x00A0 -#define POLARSSL_ERR_X509_CERT_INVALID_ALG 0x00C0 -#define POLARSSL_ERR_X509_CERT_INVALID_NAME 0x00E0 -#define POLARSSL_ERR_X509_CERT_INVALID_DATE 0x0100 -#define POLARSSL_ERR_X509_CERT_INVALID_PUBKEY 0x0120 -#define POLARSSL_ERR_X509_CERT_INVALID_SIGNATURE 0x0140 -#define POLARSSL_ERR_X509_CERT_INVALID_EXTENSIONS 0x0160 -#define POLARSSL_ERR_X509_CERT_UNKNOWN_VERSION 0x0180 -#define POLARSSL_ERR_X509_CERT_UNKNOWN_SIG_ALG 0x01A0 -#define POLARSSL_ERR_X509_CERT_UNKNOWN_PK_ALG 0x01C0 -#define POLARSSL_ERR_X509_CERT_SIG_MISMATCH 0x01E0 -#define POLARSSL_ERR_X509_CERT_VERIFY_FAILED 0x0200 -#define POLARSSL_ERR_X509_KEY_INVALID_PEM 0x0220 -#define POLARSSL_ERR_X509_KEY_INVALID_VERSION 0x0240 -#define POLARSSL_ERR_X509_KEY_INVALID_FORMAT 0x0260 -#define POLARSSL_ERR_X509_KEY_INVALID_ENC_IV 0x0280 -#define POLARSSL_ERR_X509_KEY_UNKNOWN_ENC_ALG 0x02A0 -#define POLARSSL_ERR_X509_KEY_PASSWORD_REQUIRED 0x02C0 -#define POLARSSL_ERR_X509_KEY_PASSWORD_MISMATCH 0x02E0 -#define POLARSSL_ERR_X509_POINT_ERROR 0x0300 -#define POLARSSL_ERR_X509_VALUE_TO_LENGTH 0x0320 +#define POLARSSL_ERR_X509_FEATURE_UNAVAILABLE -0x0020 +#define POLARSSL_ERR_X509_CERT_INVALID_PEM -0x0040 +#define POLARSSL_ERR_X509_CERT_INVALID_FORMAT -0x0060 +#define POLARSSL_ERR_X509_CERT_INVALID_VERSION -0x0080 +#define POLARSSL_ERR_X509_CERT_INVALID_SERIAL -0x00A0 +#define POLARSSL_ERR_X509_CERT_INVALID_ALG -0x00C0 +#define POLARSSL_ERR_X509_CERT_INVALID_NAME -0x00E0 +#define POLARSSL_ERR_X509_CERT_INVALID_DATE -0x0100 +#define POLARSSL_ERR_X509_CERT_INVALID_PUBKEY -0x0120 +#define POLARSSL_ERR_X509_CERT_INVALID_SIGNATURE -0x0140 +#define POLARSSL_ERR_X509_CERT_INVALID_EXTENSIONS -0x0160 +#define POLARSSL_ERR_X509_CERT_UNKNOWN_VERSION -0x0180 +#define POLARSSL_ERR_X509_CERT_UNKNOWN_SIG_ALG -0x01A0 +#define POLARSSL_ERR_X509_CERT_UNKNOWN_PK_ALG -0x01C0 +#define POLARSSL_ERR_X509_CERT_SIG_MISMATCH -0x01E0 +#define POLARSSL_ERR_X509_CERT_VERIFY_FAILED -0x0200 +#define POLARSSL_ERR_X509_KEY_INVALID_PEM -0x0220 +#define POLARSSL_ERR_X509_KEY_INVALID_VERSION -0x0240 +#define POLARSSL_ERR_X509_KEY_INVALID_FORMAT -0x0260 +#define POLARSSL_ERR_X509_KEY_INVALID_ENC_IV -0x0280 +#define POLARSSL_ERR_X509_KEY_UNKNOWN_ENC_ALG -0x02A0 +#define POLARSSL_ERR_X509_KEY_PASSWORD_REQUIRED -0x02C0 +#define POLARSSL_ERR_X509_KEY_PASSWORD_MISMATCH -0x02E0 +#define POLARSSL_ERR_X509_POINT_ERROR -0x0300 +#define POLARSSL_ERR_X509_VALUE_TO_LENGTH -0x0320 /* * X509 Verify codes