Skip to content

Commit 469760e

Browse files
committed
wc_ecc_shared_secret_ssh fix
- wc_ecc_shared_secret_ssh should either be declared or not. Having two different signatures for the same function is error prone. - Don't use wc_ecc_shared_secret_ssh in our code. Use wc_ecc_shared_secret directly.
1 parent d34b254 commit 469760e

4 files changed

Lines changed: 11 additions & 10 deletions

File tree

tests/api.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25052,14 +25052,15 @@ static int test_wc_ecc_pointFns(void)
2505225052

2505325053

2505425054
/*
25055-
* Testing wc_ecc_sahred_secret_ssh()
25055+
* Testing wc_ecc_shared_secret_ssh()
2505625056
*/
2505725057
static int test_wc_ecc_shared_secret_ssh(void)
2505825058
{
2505925059
EXPECT_DECLS;
2506025060
#if defined(HAVE_ECC) && defined(HAVE_ECC_DHE) && \
2506125061
!defined(WC_NO_RNG) && !defined(WOLFSSL_ATECC508A) && \
25062-
!defined(WOLFSSL_ATECC608A)
25062+
!defined(WOLFSSL_ATECC608A) && !defined(PLUTON_CRYPTO_ECC) && \
25063+
!defined(WOLFSSL_CRYPTOCELL)
2506325064
ecc_key key;
2506425065
ecc_key key2;
2506525066
WC_RNG rng;

wolfcrypt/src/evp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2497,9 +2497,9 @@ int wolfSSL_EVP_PKEY_derive(WOLFSSL_EVP_PKEY_CTX *ctx, unsigned char *key, size_
24972497
#endif
24982498
return WOLFSSL_FAILURE;
24992499
}
2500-
if (wc_ecc_shared_secret_ssh((ecc_key*)ctx->pkey->ecc->internal,
2501-
(ecc_point*)ctx->peerKey->ecc->pub_key->internal,
2502-
key, &len32) != MP_OKAY) {
2500+
if (wc_ecc_shared_secret((ecc_key*)ctx->pkey->ecc->internal,
2501+
(ecc_key*)ctx->peerKey->ecc->internal, key, &len32)
2502+
!= MP_OKAY) {
25032503
WOLFSSL_MSG("wc_ecc_shared_secret failed");
25042504
#if defined(ECC_TIMING_RESISTANT) && !defined(HAVE_SELFTEST) \
25052505
&& (!defined(HAVE_FIPS) || \

wolfcrypt/test/test.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28310,7 +28310,9 @@ static wc_test_ret_t ecc_mulmod_test(ecc_key* key1)
2831028310
#endif
2831128311

2831228312
#if defined(HAVE_ECC_DHE) && !defined(WC_NO_RNG) && \
28313-
!defined(WOLF_CRYPTO_CB_ONLY_ECC)
28313+
!defined(WOLF_CRYPTO_CB_ONLY_ECC) && !defined(WOLFSSL_ATECC508A) && \
28314+
!defined(WOLFSSL_ATECC608A) && !defined(PLUTON_CRYPTO_ECC) && \
28315+
!defined(WOLFSSL_CRYPTOCELL)
2831428316
static wc_test_ret_t ecc_ssh_test(ecc_key* key, WC_RNG* rng)
2831528317
{
2831628318
wc_test_ret_t ret;

wolfssl/wolfcrypt/ecc.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -659,10 +659,8 @@ WOLFSSL_LOCAL
659659
int wc_ecc_shared_secret_gen_sync(ecc_key* private_key,
660660
ecc_point* point, byte* out, word32* outlen);
661661

662-
#if defined(WOLFSSL_ATECC508A) || defined(WOLFSSL_ATECC608A) || \
663-
defined(PLUTON_CRYPTO_ECC) || defined(WOLFSSL_CRYPTOCELL)
664-
#define wc_ecc_shared_secret_ssh wc_ecc_shared_secret
665-
#else
662+
#if !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A) && \
663+
!defined(PLUTON_CRYPTO_ECC) && !defined(WOLFSSL_CRYPTOCELL)
666664
#define wc_ecc_shared_secret_ssh wc_ecc_shared_secret_ex /* For backwards compat */
667665
#endif
668666

0 commit comments

Comments
 (0)