Skip to content

Commit

Permalink
ec: Use static linkage on nistp521 felem_{square,mul} wrappers
Browse files Browse the repository at this point in the history
Runtime selection of implementations for felem_{square,mul} depends on
felem_{square,mul}_wrapper functions, which overwrite function points in
a similar design to that of .plt.got sections used by program loaders
during dynamic linking.

There's no reason why these functions need to have external linkage.
Mark static.

Signed-off-by: Rohan McLure <rohanmclure@linux.ibm.com>

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from #21471)
  • Loading branch information
Rohan McLure authored and tmshort committed Aug 4, 2023
1 parent 4c50610 commit 3e47a28
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crypto/ec/ecp_nistp521.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,8 +676,8 @@ static void felem_reduce(felem out, const largefelem in)
}

#if defined(ECP_NISTP521_ASM)
void felem_square_wrapper(largefelem out, const felem in);
void felem_mul_wrapper(largefelem out, const felem in1, const felem in2);
static void felem_square_wrapper(largefelem out, const felem in);
static void felem_mul_wrapper(largefelem out, const felem in1, const felem in2);

static void (*felem_square_p)(largefelem out, const felem in) =
felem_square_wrapper;
Expand All @@ -691,7 +691,7 @@ void p521_felem_mul(largefelem out, const felem in1, const felem in2);
# include "crypto/ppc_arch.h"
# endif

void felem_select(void)
static void felem_select(void)
{
# if defined(_ARCH_PPC64)
if ((OPENSSL_ppccap_P & PPC_MADD300) && (OPENSSL_ppccap_P & PPC_ALTIVEC)) {
Expand All @@ -707,13 +707,13 @@ void felem_select(void)
felem_mul_p = felem_mul_ref;
}

void felem_square_wrapper(largefelem out, const felem in)
static void felem_square_wrapper(largefelem out, const felem in)
{
felem_select();
felem_square_p(out, in);
}

void felem_mul_wrapper(largefelem out, const felem in1, const felem in2)
static void felem_mul_wrapper(largefelem out, const felem in1, const felem in2)
{
felem_select();
felem_mul_p(out, in1, in2);
Expand Down

0 comments on commit 3e47a28

Please sign in to comment.