From cf4365f560c0bc8f3c064d34f92c959f8d7bd956 Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Wed, 16 Jan 2013 17:00:43 +0100 Subject: [PATCH] Updated error codes for ECP --- include/polarssl/ecp.h | 7 +++---- include/polarssl/error.h | 3 ++- library/ecp.c | 2 +- library/error.c | 11 +++++++++++ scripts/generate_errors.pl | 2 +- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/include/polarssl/ecp.h b/include/polarssl/ecp.h index 189e3f253..2d20693b6 100644 --- a/include/polarssl/ecp.h +++ b/include/polarssl/ecp.h @@ -3,7 +3,7 @@ * * \brief Elliptic curves over GF(p) * - * Copyright (C) 2012, Brainspark B.V. + * Copyright (C) 2006-2013, Brainspark B.V. * * This file is part of PolarSSL (http://www.polarssl.org) * Lead Maintainer: Paul Bakker @@ -31,10 +31,9 @@ /* * ECP error codes - * - * (Only one error code available...) */ -#define POLARSSL_ERR_ECP_GENERIC -0x007E /**< Generic ECP error */ +#define POLARSSL_ERR_ECP_BAD_INPUT_DATA -0x4F80 /**< Bad input parameters to function. */ +#define POLARSSL_ERR_ECP_GENERIC -0x4F00 /**< Generic ECP error */ /** * \brief ECP point structure (jacobian coordinates) diff --git a/include/polarssl/error.h b/include/polarssl/error.h index 736e8a795..32dc0a7fd 100644 --- a/include/polarssl/error.h +++ b/include/polarssl/error.h @@ -3,7 +3,7 @@ * * \brief Error to string translation * - * Copyright (C) 2006-2010, Brainspark B.V. + * Copyright (C) 2006-2013, Brainspark B.V. * * This file is part of PolarSSL (http://www.polarssl.org) * Lead Maintainer: Paul Bakker @@ -76,6 +76,7 @@ * X509 2 21 * DHM 3 6 * RSA 4 9 + * ECP 4 1 (Started from top) * MD 5 4 * CIPHER 6 5 * SSL 6 2 (Started from top) diff --git a/library/ecp.c b/library/ecp.c index dd913bead..119c75470 100644 --- a/library/ecp.c +++ b/library/ecp.c @@ -1,7 +1,7 @@ /* * Elliptic curves over GF(p) * - * Copyright (C) 2012, Brainspark B.V. + * Copyright (C) 2006-2013, Brainspark B.V. * * This file is part of PolarSSL (http://www.polarssl.org) * Lead Maintainer: Paul Bakker diff --git a/library/error.c b/library/error.c index 03abc3265..1e96ebba3 100644 --- a/library/error.c +++ b/library/error.c @@ -63,6 +63,10 @@ #include "polarssl/dhm.h" #endif +#if defined(POLARSSL_ECP_C) +#include "polarssl/ecp.h" +#endif + #if defined(POLARSSL_ENTROPY_C) #include "polarssl/entropy.h" #endif @@ -182,6 +186,13 @@ void error_strerror( int ret, char *buf, size_t buflen ) snprintf( buf, buflen, "DHM - Calculation of the DHM secret failed" ); #endif /* POLARSSL_DHM_C */ +#if defined(POLARSSL_ECP_C) + if( use_ret == -(POLARSSL_ERR_ECP_BAD_INPUT_DATA) ) + snprintf( buf, buflen, "ECP - Bad input parameters to function" ); + if( use_ret == -(POLARSSL_ERR_ECP_GENERIC) ) + snprintf( buf, buflen, "ECP - Generic ECP error" ); +#endif /* POLARSSL_ECP_C */ + #if defined(POLARSSL_MD_C) if( use_ret == -(POLARSSL_ERR_MD_FEATURE_UNAVAILABLE) ) snprintf( buf, buflen, "MD - The selected feature is not available" ); diff --git a/scripts/generate_errors.pl b/scripts/generate_errors.pl index e89496490..8184d78c2 100755 --- a/scripts/generate_errors.pl +++ b/scripts/generate_errors.pl @@ -12,7 +12,7 @@ my @low_level_modules = ( "AES", "ASN1", "BLOWFISH", "CAMELLIA", "BIGNUM", "BASE64", "XTEA", "PBKDF2", "PADLOCK", "DES", "NET", "CTR_DRBG", "ENTROPY", "MD2", "MD4", "MD5", "SHA1", "SHA2", "SHA4", "GCM" ); -my @high_level_modules = ( "PEM", "X509", "DHM", "RSA", "MD", "CIPHER", "SSL" ); +my @high_level_modules = ( "PEM", "X509", "DHM", "RSA", "ECP", "MD", "CIPHER", "SSL" ); my $line_separator = $/; undef $/;