Renaming Elliptic Curves to Supported Curves for better extension representation and avoid confusion.

This commit is contained in:
Moisés Guimarães
2014-02-03 16:11:57 -03:00
parent 51b3b1cb6c
commit 36b5bf0df1
7 changed files with 44 additions and 44 deletions

View File

@@ -1226,16 +1226,16 @@ then
AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_RENEGOTIATION_INDICATION" AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_RENEGOTIATION_INDICATION"
fi fi
# Elliptic Curves Extensions # Supported Elliptic Curves Extensions
AC_ARG_ENABLE([ellipticcurves], AC_ARG_ENABLE([supportedcurves],
[ --enable-ellipticcurves Enable Elliptic Curves (default: disabled)], [ --enable-supportedcurves Enable Supported Elliptic Curves (default: disabled)],
[ ENABLED_ELLIPTIC_CURVES=$enableval ], [ ENABLED_SUPPORTED_CURVES=$enableval ],
[ ENABLED_ELLIPTIC_CURVES=no ] [ ENABLED_SUPPORTED_CURVES=no ]
) )
if test "x$ENABLED_ELLIPTIC_CURVES" = "xyes" if test "x$ENABLED_SUPPORTED_CURVES" = "xyes"
then then
AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_ELLIPTIC_CURVES" AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SUPPORTED_CURVES"
fi fi
# TLS Extensions # TLS Extensions
@@ -1251,8 +1251,8 @@ then
ENABLED_MAX_FRAGMENT=yes ENABLED_MAX_FRAGMENT=yes
ENABLED_TRUNCATED_HMAC=yes ENABLED_TRUNCATED_HMAC=yes
ENABLED_RENEGOTIATION_INDICATION=yes ENABLED_RENEGOTIATION_INDICATION=yes
ENABLED_ELLIPTIC_CURVES=yes ENABLED_SUPPORTED_CURVES=yes
AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC -DHAVE_RENEGOTIATION_INDICATION -DHAVE_ELLIPTIC_CURVES" AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC -DHAVE_RENEGOTIATION_INDICATION -DHAVE_SUPPORTED_CURVES"
fi fi
# PKCS7 # PKCS7
@@ -1689,7 +1689,7 @@ echo " * SNI: $ENABLED_SNI"
echo " * Maximum Fragment Length: $ENABLED_MAX_FRAGMENT" echo " * Maximum Fragment Length: $ENABLED_MAX_FRAGMENT"
echo " * Truncated HMAC: $ENABLED_TRUNCATED_HMAC" echo " * Truncated HMAC: $ENABLED_TRUNCATED_HMAC"
echo " * Renegotiation Indication: $ENABLED_RENEGOTIATION_INDICATION" echo " * Renegotiation Indication: $ENABLED_RENEGOTIATION_INDICATION"
echo " * Elliptic Curves: $ENABLED_ELLIPTIC_CURVES" echo " * Supported Elliptic Curves: $ENABLED_SUPPORTED_CURVES"
echo " * All TLS Extensions: $ENABLED_TLSX" echo " * All TLS Extensions: $ENABLED_TLSX"
echo " * PKCS#7 $ENABLED_PKCS7" echo " * PKCS#7 $ENABLED_PKCS7"
echo " * wolfSCEP $ENABLED_WOLFSCEP" echo " * wolfSCEP $ENABLED_WOLFSCEP"

View File

@@ -1177,7 +1177,7 @@ CYASSL_LOCAL int TLSX_UseTruncatedHMAC(TLSX** extensions);
#endif /* HAVE_TRUNCATED_HMAC */ #endif /* HAVE_TRUNCATED_HMAC */
#ifdef HAVE_ELLIPTIC_CURVES #ifdef HAVE_SUPPORTED_CURVES
typedef struct EllipticCurve { typedef struct EllipticCurve {
word16 name; /* CurveNames */ word16 name; /* CurveNames */
@@ -1185,14 +1185,14 @@ typedef struct EllipticCurve {
} EllipticCurve; } EllipticCurve;
CYASSL_LOCAL int TLSX_UseEllipticCurve(TLSX** extensions, word16 name); CYASSL_LOCAL int TLSX_UseSupportedCurve(TLSX** extensions, word16 name);
#ifndef NO_CYASSL_SERVER #ifndef NO_CYASSL_SERVER
CYASSL_LOCAL int TLSX_ValidateEllipticCurves(CYASSL* ssl, byte first, CYASSL_LOCAL int TLSX_ValidateEllipticCurves(CYASSL* ssl, byte first,
byte second); byte second);
#endif #endif
#endif /* HAVE_ELLIPTIC_CURVES */ #endif /* HAVE_SUPPORTED_CURVES */
#endif /* HAVE_TLS_EXTENSIONS */ #endif /* HAVE_TLS_EXTENSIONS */

View File

@@ -1242,7 +1242,7 @@ CYASSL_API int CyaSSL_CTX_UseTruncatedHMAC(CYASSL_CTX* ctx);
#endif /* HAVE_TRUNCATED_HMAC */ #endif /* HAVE_TRUNCATED_HMAC */
/* Elliptic Curves */ /* Elliptic Curves */
#ifdef HAVE_ELLIPTIC_CURVES #ifdef HAVE_SUPPORTED_CURVES
enum { enum {
CYASSL_ECC_SECP160R1 = 0x10, CYASSL_ECC_SECP160R1 = 0x10,
@@ -1255,12 +1255,12 @@ enum {
#ifndef NO_CYASSL_CLIENT #ifndef NO_CYASSL_CLIENT
CYASSL_API int CyaSSL_UseEllipticCurve(CYASSL* ssl, unsigned short name); CYASSL_API int CyaSSL_UseSupportedCurve(CYASSL* ssl, unsigned short name);
CYASSL_API int CyaSSL_CTX_UseEllipticCurve(CYASSL_CTX* ctx, CYASSL_API int CyaSSL_CTX_UseSupportedCurve(CYASSL_CTX* ctx,
unsigned short name); unsigned short name);
#endif /* NO_CYASSL_CLIENT */ #endif /* NO_CYASSL_CLIENT */
#endif /* HAVE_ELLIPTIC_CURVES */ #endif /* HAVE_SUPPORTED_CURVES */
#define CYASSL_CRL_MONITOR 0x01 /* monitor this dir flag */ #define CYASSL_CRL_MONITOR 0x01 /* monitor this dir flag */

View File

@@ -9765,7 +9765,7 @@ static void PickHashSigAlgo(CYASSL* ssl,
} }
} }
#ifdef HAVE_ELLIPTIC_CURVES #ifdef HAVE_SUPPORTED_CURVES
if (!TLSX_ValidateEllipticCurves(ssl, first, second)) { if (!TLSX_ValidateEllipticCurves(ssl, first, second)) {
CYASSL_MSG("Don't have matching curves"); CYASSL_MSG("Don't have matching curves");
return 0; return 0;

View File

@@ -623,27 +623,27 @@ int CyaSSL_CTX_UseTruncatedHMAC(CYASSL_CTX* ctx)
#endif /* HAVE_TRUNCATED_HMAC */ #endif /* HAVE_TRUNCATED_HMAC */
/* Elliptic Curves */ /* Elliptic Curves */
#ifdef HAVE_ELLIPTIC_CURVES #ifdef HAVE_SUPPORTED_CURVES
#ifndef NO_CYASSL_CLIENT #ifndef NO_CYASSL_CLIENT
int CyaSSL_UseEllipticCurve(CYASSL* ssl, word16 name) int CyaSSL_UseSupportedCurve(CYASSL* ssl, word16 name)
{ {
if (ssl == NULL) if (ssl == NULL)
return BAD_FUNC_ARG; return BAD_FUNC_ARG;
return TLSX_UseEllipticCurve(&ssl->extensions, name); return TLSX_UseSupportedCurve(&ssl->extensions, name);
} }
int CyaSSL_CTX_UseEllipticCurve(CYASSL_CTX* ctx, word16 name) int CyaSSL_CTX_UseSupportedCurve(CYASSL_CTX* ctx, word16 name)
{ {
if (ctx == NULL) if (ctx == NULL)
return BAD_FUNC_ARG; return BAD_FUNC_ARG;
return TLSX_UseEllipticCurve(&ctx->extensions, name); return TLSX_UseSupportedCurve(&ctx->extensions, name);
} }
#endif /* NO_CYASSL_CLIENT */ #endif /* NO_CYASSL_CLIENT */
#endif /* HAVE_ELLIPTIC_CURVES */ #endif /* HAVE_SUPPORTED_CURVES */
#ifndef CYASSL_LEANPSK #ifndef CYASSL_LEANPSK

View File

@@ -1160,7 +1160,7 @@ static int TLSX_THM_Parse(CYASSL* ssl, byte* input, word16 length,
#endif /* HAVE_TRUNCATED_HMAC */ #endif /* HAVE_TRUNCATED_HMAC */
#ifdef HAVE_ELLIPTIC_CURVES #ifdef HAVE_SUPPORTED_CURVES
#ifndef HAVE_ECC #ifndef HAVE_ECC
#error "Elliptic Curves Extension requires Elliptic Curve Cryptography. \ #error "Elliptic Curves Extension requires Elliptic Curve Cryptography. \
@@ -1270,7 +1270,7 @@ static int TLSX_EllipticCurve_Parse(CYASSL* ssl, byte* input, word16 length,
ato16(input + offset, &name); ato16(input + offset, &name);
offset -= OPAQUE16_LEN; offset -= OPAQUE16_LEN;
r = TLSX_UseEllipticCurve(&ssl->extensions, name); r = TLSX_UseSupportedCurve(&ssl->extensions, name);
if (r) return r; /* throw error */ if (r) return r; /* throw error */
} }
@@ -1371,7 +1371,7 @@ int TLSX_ValidateEllipticCurves(CYASSL* ssl, byte first, byte second) {
#endif /* NO_CYASSL_SERVER */ #endif /* NO_CYASSL_SERVER */
int TLSX_UseEllipticCurve(TLSX** extensions, word16 name) int TLSX_UseSupportedCurve(TLSX** extensions, word16 name)
{ {
TLSX* extension = NULL; TLSX* extension = NULL;
EllipticCurve* curve = NULL; EllipticCurve* curve = NULL;
@@ -1456,7 +1456,7 @@ int TLSX_UseEllipticCurve(TLSX** extensions, word16 name)
#define EC_PARSE(a, b, c, d) 0 #define EC_PARSE(a, b, c, d) 0
#define EC_VALIDATE_REQUEST(a, b) #define EC_VALIDATE_REQUEST(a, b)
#endif /* HAVE_ELLIPTIC_CURVES */ #endif /* HAVE_SUPPORTED_CURVES */
TLSX* TLSX_Find(TLSX* list, TLSX_Type type) TLSX* TLSX_Find(TLSX* list, TLSX_Type type)
{ {
@@ -1788,7 +1788,7 @@ int TLSX_Parse(CYASSL* ssl, byte* input, word16 length, byte isRequest,
#elif defined(HAVE_SNI) \ #elif defined(HAVE_SNI) \
|| defined(HAVE_MAX_FRAGMENT) \ || defined(HAVE_MAX_FRAGMENT) \
|| defined(HAVE_TRUNCATED_HMAC) \ || defined(HAVE_TRUNCATED_HMAC) \
|| defined(HAVE_ELLIPTIC_CURVES) || defined(HAVE_SUPPORTED_CURVES)
#error "Using TLS extensions requires HAVE_TLS_EXTENSIONS to be defined." #error "Using TLS extensions requires HAVE_TLS_EXTENSIONS to be defined."

View File

@@ -56,9 +56,9 @@ static void test_CyaSSL_UseMaxFragment(void);
#ifdef HAVE_TRUNCATED_HMAC #ifdef HAVE_TRUNCATED_HMAC
static void test_CyaSSL_UseTruncatedHMAC(void); static void test_CyaSSL_UseTruncatedHMAC(void);
#endif /* HAVE_TRUNCATED_HMAC */ #endif /* HAVE_TRUNCATED_HMAC */
#ifdef HAVE_ELLIPTIC_CURVES #ifdef HAVE_SUPPORTED_CURVES
static void test_CyaSSL_UseEllipticCurve(void); static void test_CyaSSL_UseSupportedCurve(void);
#endif /* HAVE_ELLIPTIC_CURVES */ #endif /* HAVE_SUPPORTED_CURVES */
/* test function helpers */ /* test function helpers */
static int test_method(CYASSL_METHOD *method, const char *name); static int test_method(CYASSL_METHOD *method, const char *name);
@@ -119,9 +119,9 @@ int ApiTest(void)
#ifdef HAVE_TRUNCATED_HMAC #ifdef HAVE_TRUNCATED_HMAC
test_CyaSSL_UseTruncatedHMAC(); test_CyaSSL_UseTruncatedHMAC();
#endif /* HAVE_TRUNCATED_HMAC */ #endif /* HAVE_TRUNCATED_HMAC */
#ifdef HAVE_ELLIPTIC_CURVES #ifdef HAVE_SUPPORTED_CURVES
test_CyaSSL_UseEllipticCurve(); test_CyaSSL_UseSupportedCurve();
#endif /* HAVE_ELLIPTIC_CURVES */ #endif /* HAVE_SUPPORTED_CURVES */
test_CyaSSL_Cleanup(); test_CyaSSL_Cleanup();
printf(" End API Tests\n"); printf(" End API Tests\n");
@@ -542,8 +542,8 @@ static void test_CyaSSL_UseTruncatedHMAC(void)
} }
#endif /* HAVE_TRUNCATED_HMAC */ #endif /* HAVE_TRUNCATED_HMAC */
#ifdef HAVE_ELLIPTIC_CURVES #ifdef HAVE_SUPPORTED_CURVES
static void test_CyaSSL_UseEllipticCurve(void) static void test_CyaSSL_UseSupportedCurve(void)
{ {
CYASSL_CTX *ctx = CyaSSL_CTX_new(CyaSSLv23_client_method()); CYASSL_CTX *ctx = CyaSSL_CTX_new(CyaSSLv23_client_method());
CYASSL *ssl = CyaSSL_new(ctx); CYASSL *ssl = CyaSSL_new(ctx);
@@ -553,21 +553,21 @@ static void test_CyaSSL_UseEllipticCurve(void)
#ifndef NO_CYASSL_CLIENT #ifndef NO_CYASSL_CLIENT
/* error cases */ /* error cases */
AssertIntNE(1, CyaSSL_CTX_UseEllipticCurve(NULL, CYASSL_ECC_SECP160R1)); AssertIntNE(1, CyaSSL_CTX_UseSupportedCurve(NULL, CYASSL_ECC_SECP160R1));
AssertIntNE(1, CyaSSL_CTX_UseEllipticCurve(ctx, 0)); AssertIntNE(1, CyaSSL_CTX_UseSupportedCurve(ctx, 0));
AssertIntNE(1, CyaSSL_UseEllipticCurve(NULL, CYASSL_ECC_SECP160R1)); AssertIntNE(1, CyaSSL_UseSupportedCurve(NULL, CYASSL_ECC_SECP160R1));
AssertIntNE(1, CyaSSL_UseEllipticCurve(ssl, 0)); AssertIntNE(1, CyaSSL_UseSupportedCurve(ssl, 0));
/* success case */ /* success case */
AssertIntEQ(1, CyaSSL_CTX_UseEllipticCurve(ctx, CYASSL_ECC_SECP160R1)); AssertIntEQ(1, CyaSSL_CTX_UseSupportedCurve(ctx, CYASSL_ECC_SECP160R1));
AssertIntEQ(1, CyaSSL_UseEllipticCurve(ssl, CYASSL_ECC_SECP160R1)); AssertIntEQ(1, CyaSSL_UseSupportedCurve(ssl, CYASSL_ECC_SECP160R1));
#endif #endif
CyaSSL_free(ssl); CyaSSL_free(ssl);
CyaSSL_CTX_free(ctx); CyaSSL_CTX_free(ctx);
} }
#endif /* HAVE_ELLIPTIC_CURVES */ #endif /* HAVE_SUPPORTED_CURVES */
#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) #if !defined(NO_FILESYSTEM) && !defined(NO_CERTS)
/* Helper for testing CyaSSL_CTX_use_certificate_file() */ /* Helper for testing CyaSSL_CTX_use_certificate_file() */