From b183bdc009ea7c445dfd529ef9e5dfb078dc5a82 Mon Sep 17 00:00:00 2001 From: toddouska Date: Thu, 2 Jul 2015 13:48:58 -0700 Subject: [PATCH] fix ALT_ECC_SIZE in ssh mode --- src/ssl.c | 46 ++++++--------------------------------------- wolfcrypt/src/ecc.c | 2 +- 2 files changed, 7 insertions(+), 41 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index e391095ce..49e7b8ef8 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -13216,37 +13216,20 @@ static int SetECPointInternal(WOLFSSL_EC_POINT *p) point = (ecc_point*)p->internal; -#ifndef ALT_ECC_SIZE - if (p->X != NULL && SetIndividualInternal(p->X, &point->x[0]) < 0) { + if (p->X != NULL && SetIndividualInternal(p->X, point->x) < 0) { WOLFSSL_MSG("ecc point X error"); return SSL_FATAL_ERROR; } - if (p->Y != NULL && SetIndividualInternal(p->Y, &point->y[0]) < 0) { + if (p->Y != NULL && SetIndividualInternal(p->Y, point->y) < 0) { WOLFSSL_MSG("ecc point Y error"); return SSL_FATAL_ERROR; } - if (p->Z != NULL && SetIndividualInternal(p->Z, &point->z[0]) < 0) { + if (p->Z != NULL && SetIndividualInternal(p->Z, point->z) < 0) { WOLFSSL_MSG("ecc point Z error"); return SSL_FATAL_ERROR; } -#else - if (p->X != NULL && SetIndividualInternal(p->X, &point->x) < 0) { - WOLFSSL_MSG("ecc point X error"); - return SSL_FATAL_ERROR; - } - - if (p->Y != NULL && SetIndividualInternal(p->Y, &point->y) < 0) { - WOLFSSL_MSG("ecc point Y error"); - return SSL_FATAL_ERROR; - } - - if (p->Z != NULL && SetIndividualInternal(p->Z, &point->z) < 0) { - WOLFSSL_MSG("ecc point Z error"); - return SSL_FATAL_ERROR; - } -#endif p->inSet = 1; @@ -13267,37 +13250,20 @@ static int SetECPointExternal(WOLFSSL_EC_POINT *p) point = (ecc_point*)p->internal; -#ifndef ALT_ECC_SIZE - if (SetIndividualExternal(&p->X, &point->x[0]) < 0) { + if (SetIndividualExternal(&p->X, point->x) < 0) { WOLFSSL_MSG("ecc point X error"); return SSL_FATAL_ERROR; } - if (SetIndividualExternal(&p->Y, &point->y[0]) < 0) { + if (SetIndividualExternal(&p->Y, point->y) < 0) { WOLFSSL_MSG("ecc point Y error"); return SSL_FATAL_ERROR; } - if (SetIndividualExternal(&p->Z, &point->z[0]) < 0) { + if (SetIndividualExternal(&p->Z, point->z) < 0) { WOLFSSL_MSG("ecc point Z error"); return SSL_FATAL_ERROR; } -#else - if (SetIndividualExternal(&p->X, &point->x) < 0) { - WOLFSSL_MSG("ecc point X error"); - return SSL_FATAL_ERROR; - } - - if (SetIndividualExternal(&p->Y, &point->y) < 0) { - WOLFSSL_MSG("ecc point Y error"); - return SSL_FATAL_ERROR; - } - - if (SetIndividualExternal(&p->Z, &point->z) < 0) { - WOLFSSL_MSG("ecc point Z error"); - return SSL_FATAL_ERROR; - } -#endif p->exSet = 1; diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index 2fc8d6db9..2a6612718 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -2436,7 +2436,7 @@ int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash, /* import point from der */ int wc_ecc_import_point_der(byte* in, word32 inLen, const int curve_idx, ecc_point* point) { - int err; + int err = 0; int compressed = 0; if (in == NULL || point == NULL || (ecc_is_valid_idx(curve_idx) == 0))