From b5bf176f4cd0e0208062b20ef16a15b69a3e7422 Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Sun, 19 Jul 2009 20:28:35 +0000
Subject: [PATCH] - Major change: Errors are now positive numbers instead of
negative. Reason: You cannot OR negative values correctly
---
include/polarssl/base64.h | 4 +--
include/polarssl/bignum.h | 14 ++++-----
include/polarssl/dhm.h | 12 ++++----
include/polarssl/net.h | 20 ++++++-------
include/polarssl/rsa.h | 16 +++++------
include/polarssl/ssl.h | 54 +++++++++++++++++------------------
include/polarssl/x509.h | 60 +++++++++++++++++++--------------------
7 files changed, 90 insertions(+), 90 deletions(-)
diff --git a/include/polarssl/base64.h b/include/polarssl/base64.h
index a439d5538..78919c70b 100644
--- a/include/polarssl/base64.h
+++ b/include/polarssl/base64.h
@@ -22,8 +22,8 @@
#ifndef POLARSSL_BASE64_H
#define POLARSSL_BASE64_H
-#define POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL -0x0010
-#define POLARSSL_ERR_BASE64_INVALID_CHARACTER -0x0012
+#define POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL 0x0010
+#define POLARSSL_ERR_BASE64_INVALID_CHARACTER 0x0012
#ifdef __cplusplus
extern "C" {
diff --git a/include/polarssl/bignum.h b/include/polarssl/bignum.h
index 8683a1eb2..d02520d0b 100644
--- a/include/polarssl/bignum.h
+++ b/include/polarssl/bignum.h
@@ -24,13 +24,13 @@
#include
-#define POLARSSL_ERR_MPI_FILE_IO_ERROR -0x0002
-#define POLARSSL_ERR_MPI_BAD_INPUT_DATA -0x0004
-#define POLARSSL_ERR_MPI_INVALID_CHARACTER -0x0006
-#define POLARSSL_ERR_MPI_BUFFER_TOO_SMALL -0x0008
-#define POLARSSL_ERR_MPI_NEGATIVE_VALUE -0x000A
-#define POLARSSL_ERR_MPI_DIVISION_BY_ZERO -0x000C
-#define POLARSSL_ERR_MPI_NOT_ACCEPTABLE -0x000E
+#define POLARSSL_ERR_MPI_FILE_IO_ERROR 0x0002
+#define POLARSSL_ERR_MPI_BAD_INPUT_DATA 0x0004
+#define POLARSSL_ERR_MPI_INVALID_CHARACTER 0x0006
+#define POLARSSL_ERR_MPI_BUFFER_TOO_SMALL 0x0008
+#define POLARSSL_ERR_MPI_NEGATIVE_VALUE 0x000A
+#define POLARSSL_ERR_MPI_DIVISION_BY_ZERO 0x000C
+#define POLARSSL_ERR_MPI_NOT_ACCEPTABLE 0x000E
#define MPI_CHK(f) if( ( ret = f ) != 0 ) goto cleanup
diff --git a/include/polarssl/dhm.h b/include/polarssl/dhm.h
index 219989e8e..597568193 100644
--- a/include/polarssl/dhm.h
+++ b/include/polarssl/dhm.h
@@ -24,12 +24,12 @@
#include "polarssl/bignum.h"
-#define POLARSSL_ERR_DHM_BAD_INPUT_DATA -0x0480
-#define POLARSSL_ERR_DHM_READ_PARAMS_FAILED -0x0490
-#define POLARSSL_ERR_DHM_MAKE_PARAMS_FAILED -0x04A0
-#define POLARSSL_ERR_DHM_READ_PUBLIC_FAILED -0x04B0
-#define POLARSSL_ERR_DHM_MAKE_PUBLIC_FAILED -0x04C0
-#define POLARSSL_ERR_DHM_CALC_SECRET_FAILED -0x04D0
+#define POLARSSL_ERR_DHM_BAD_INPUT_DATA 0x0480
+#define POLARSSL_ERR_DHM_READ_PARAMS_FAILED 0x0490
+#define POLARSSL_ERR_DHM_MAKE_PARAMS_FAILED 0x04A0
+#define POLARSSL_ERR_DHM_READ_PUBLIC_FAILED 0x04B0
+#define POLARSSL_ERR_DHM_MAKE_PUBLIC_FAILED 0x04C0
+#define POLARSSL_ERR_DHM_CALC_SECRET_FAILED 0x04D0
typedef struct
{
diff --git a/include/polarssl/net.h b/include/polarssl/net.h
index f135f911e..d07f0e393 100644
--- a/include/polarssl/net.h
+++ b/include/polarssl/net.h
@@ -22,16 +22,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 e61d75c6a..c2cd1212c 100644
--- a/include/polarssl/rsa.h
+++ b/include/polarssl/rsa.h
@@ -24,14 +24,14 @@
#include "polarssl/bignum.h"
-#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_TO_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_TO_LARGE 0x0470
/*
* PKCS#1 constants
diff --git a/include/polarssl/ssl.h b/include/polarssl/ssl.h
index b26e4edb6..313d1255a 100644
--- a/include/polarssl/ssl.h
+++ b/include/polarssl/ssl.h
@@ -31,33 +31,33 @@
#include "polarssl/sha1.h"
#include "polarssl/x509.h"
-#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 b7b971c70..1215e79ea 100644
--- a/include/polarssl/x509.h
+++ b/include/polarssl/x509.h
@@ -24,37 +24,37 @@
#include "polarssl/rsa.h"
-#define POLARSSL_ERR_ASN1_OUT_OF_DATA -0x0014
-#define POLARSSL_ERR_ASN1_UNEXPECTED_TAG -0x0016
-#define POLARSSL_ERR_ASN1_INVALID_LENGTH -0x0018
-#define POLARSSL_ERR_ASN1_LENGTH_MISMATCH -0x001A
-#define POLARSSL_ERR_ASN1_INVALID_DATA -0x001C
+#define POLARSSL_ERR_ASN1_OUT_OF_DATA 0x0014
+#define POLARSSL_ERR_ASN1_UNEXPECTED_TAG 0x0016
+#define POLARSSL_ERR_ASN1_INVALID_LENGTH 0x0018
+#define POLARSSL_ERR_ASN1_LENGTH_MISMATCH 0x001A
+#define POLARSSL_ERR_ASN1_INVALID_DATA 0x001C
-#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
#define BADCERT_EXPIRED 1
#define BADCERT_REVOKED 2