fix ALT_ECC_SIZE in ssh mode

This commit is contained in:
toddouska
2015-07-02 13:48:58 -07:00
parent d2f34c11d3
commit b183bdc009
2 changed files with 7 additions and 41 deletions

View File

@ -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;

View File

@ -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))