test_wc_curve25519_make_pub(): fix order of args to wc_curve25519_make_pub().

This commit is contained in:
Daniel Pouzzner
2020-08-06 18:37:00 -05:00
parent c325001d0d
commit f6acbd5f97
2 changed files with 8 additions and 7 deletions

View File

@@ -17120,7 +17120,7 @@ static int test_wc_curve25519_make_pub (void)
}
}
if (ret == 0) {
ret = wc_curve25519_make_pub((int)sizeof key.k.point, key.k.point, (int)sizeof out, out);
ret = wc_curve25519_make_pub((int)sizeof out, out, (int)sizeof key.k.point, key.k.point);
}
/*test bad cases*/
if (ret == 0) {
@@ -17130,19 +17130,19 @@ static int test_wc_curve25519_make_pub (void)
}
}
if (ret == 0) {
ret = wc_curve25519_make_pub((int)sizeof key.k.point, NULL, (int)sizeof out, out);
ret = wc_curve25519_make_pub((int)sizeof out, out, (int)sizeof key.k.point, NULL);
if (ret == ECC_BAD_ARG_E) {
ret = 0;
}
}
if (ret == 0) {
ret = wc_curve25519_make_pub((int)sizeof key.k.point, key.k.point, (int)sizeof out - 1, out);
ret = wc_curve25519_make_pub((int)sizeof out - 1, out, (int)sizeof key.k.point, key.k.point);
if (ret == ECC_BAD_ARG_E) {
ret = 0;
}
}
if (ret == 0) {
ret = wc_curve25519_make_pub((int)sizeof key.k.point, key.k.point, (int)sizeof out, NULL);
ret = wc_curve25519_make_pub((int)sizeof out, NULL, (int)sizeof key.k.point, key.k.point);
if (ret == ECC_BAD_ARG_E) {
ret = 0;
}
@@ -17150,7 +17150,7 @@ static int test_wc_curve25519_make_pub (void)
if (ret == 0) {
/* verify clamping test */
key.k.point[0] |= ~248;
ret = wc_curve25519_make_pub((int)sizeof key.k.point, key.k.point, (int)sizeof out, out);
ret = wc_curve25519_make_pub((int)sizeof out, out, (int)sizeof key.k.point, key.k.point);
if (ret == ECC_BAD_ARG_E) {
ret = 0;
}
@@ -17158,7 +17158,7 @@ static int test_wc_curve25519_make_pub (void)
}
/* repeat the expected-to-succeed test. */
if (ret == 0) {
ret = wc_curve25519_make_pub((int)sizeof key.k.point, key.k.point, (int)sizeof out, out);
ret = wc_curve25519_make_pub((int)sizeof out, out, (int)sizeof key.k.point, key.k.point);
}
printf(resultFmt, ret == 0 ? passed : failed);

View File

@@ -70,8 +70,9 @@ int wc_curve25519_make_pub(int public_size, byte* public, int private_size, cons
/* check clamping */
if ((private[0] & ~248) ||
(private[CURVE25519_KEYSIZE-1] & 128))
(private[CURVE25519_KEYSIZE-1] & 128)) {
return ECC_BAD_ARG_E;
}
#ifdef FREESCALE_LTC_ECC
{