Skip to content

Commit 14dbba7

Browse files
douzzerpadelsbach
authored andcommitted
armasm: in prototypes for fe_cmov_table(), declare the base arg as const fe*.
1 parent 84f9b20 commit 14dbba7

3 files changed

Lines changed: 19 additions & 15 deletions

File tree

wolfcrypt/src/port/arm/armv8-32-curve25519_c.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -827,14 +827,15 @@ WC_OMIT_FRAME_POINTER int fe_isnegative(const fe a)
827827
defined(WOLFSSL_CURVE25519_USE_ED25519)
828828
#ifndef WC_NO_CACHE_RESISTANT
829829
#ifndef WOLFSSL_NO_VAR_ASSIGN_REG
830-
WC_OMIT_FRAME_POINTER void fe_cmov_table(fe* r_p, fe* base_p, signed char b_p)
830+
WC_OMIT_FRAME_POINTER void fe_cmov_table(fe* r_p, const fe* base_p,
831+
signed char b_p)
831832
#else
832-
WC_OMIT_FRAME_POINTER void fe_cmov_table(fe* r, fe* base, signed char b)
833+
WC_OMIT_FRAME_POINTER void fe_cmov_table(fe* r, const fe* base, signed char b)
833834
#endif /* WOLFSSL_NO_VAR_ASSIGN_REG */
834835
{
835836
#ifndef WOLFSSL_NO_VAR_ASSIGN_REG
836837
register fe* r asm ("r0") = (fe*)r_p;
837-
register fe* base asm ("r1") = (fe*)base_p;
838+
register const fe* base asm ("r1") = (const fe*)base_p;
838839
register signed char b asm ("r2") = (signed char)b_p;
839840
#endif /* !WOLFSSL_NO_VAR_ASSIGN_REG */
840841

@@ -2372,14 +2373,15 @@ WC_OMIT_FRAME_POINTER void fe_cmov_table(fe* r, fe* base, signed char b)
23722373

23732374
#else
23742375
#ifndef WOLFSSL_NO_VAR_ASSIGN_REG
2375-
WC_OMIT_FRAME_POINTER void fe_cmov_table(fe* r_p, fe* base_p, signed char b_p)
2376+
WC_OMIT_FRAME_POINTER void fe_cmov_table(fe* r_p, const fe* base_p,
2377+
signed char b_p)
23762378
#else
2377-
WC_OMIT_FRAME_POINTER void fe_cmov_table(fe* r, fe* base, signed char b)
2379+
WC_OMIT_FRAME_POINTER void fe_cmov_table(fe* r, const fe* base, signed char b)
23782380
#endif /* WOLFSSL_NO_VAR_ASSIGN_REG */
23792381
{
23802382
#ifndef WOLFSSL_NO_VAR_ASSIGN_REG
23812383
register fe* r asm ("r0") = (fe*)r_p;
2382-
register fe* base asm ("r1") = (fe*)base_p;
2384+
register const fe* base asm ("r1") = (const fe*)base_p;
23832385
register signed char b asm ("r2") = (signed char)b_p;
23842386
#endif /* !WOLFSSL_NO_VAR_ASSIGN_REG */
23852387

wolfcrypt/src/port/arm/armv8-curve25519_c.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ int fe_isnegative(const fe a)
255255
return (word32)(size_t)a;
256256
}
257257

258-
void fe_cmov_table(fe* r, fe* base, signed char b)
258+
void fe_cmov_table(fe* r, const fe* base, signed char b)
259259
{
260260
__asm__ __volatile__ (
261261
"stp x29, x30, [sp, #-32]!\n\t"
@@ -463,8 +463,8 @@ void fe_cmov_table(fe* r, fe* base, signed char b)
463463
"stp x12, x13, [%x[r], #64]\n\t"
464464
"stp x14, x15, [%x[r], #80]\n\t"
465465
"ldp x29, x30, [sp], #32\n\t"
466-
: [r] "+r" (r), [base] "+r" (base), [b] "+r" (b)
467-
:
466+
: [r] "+r" (r), [b] "+r" (b)
467+
: [base] "r" (base)
468468
: "memory", "cc", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10",
469469
"x11", "x12", "x13", "x14", "x15", "x16", "x17", "x19", "x20",
470470
"x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28"

wolfcrypt/src/port/arm/thumb2-curve25519_c.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -574,14 +574,15 @@ WC_OMIT_FRAME_POINTER int fe_isnegative(const fe a)
574574
#if defined(HAVE_ED25519_MAKE_KEY) || defined(HAVE_ED25519_SIGN) || defined(WOLFSSL_CURVE25519_USE_ED25519)
575575
#ifndef WC_NO_CACHE_RESISTANT
576576
#ifndef WOLFSSL_NO_VAR_ASSIGN_REG
577-
WC_OMIT_FRAME_POINTER void fe_cmov_table(fe* r_p, fe* base_p, signed char b_p)
577+
WC_OMIT_FRAME_POINTER void fe_cmov_table(fe* r_p, const fe* base_p,
578+
signed char b_p)
578579
#else
579-
WC_OMIT_FRAME_POINTER void fe_cmov_table(fe* r, fe* base, signed char b)
580+
WC_OMIT_FRAME_POINTER void fe_cmov_table(fe* r, const fe* base, signed char b)
580581
#endif /* !WOLFSSL_NO_VAR_ASSIGN_REG */
581582
{
582583
#ifndef WOLFSSL_NO_VAR_ASSIGN_REG
583584
register fe* r __asm__ ("r0") = (fe*)r_p;
584-
register fe* base __asm__ ("r1") = (fe*)base_p;
585+
register const fe* base __asm__ ("r1") = (const fe*)base_p;
585586
register signed char b __asm__ ("r2") = (signed char)b_p;
586587
#endif /* !WOLFSSL_NO_VAR_ASSIGN_REG */
587588

@@ -1558,14 +1559,15 @@ WC_OMIT_FRAME_POINTER void fe_cmov_table(fe* r, fe* base, signed char b)
15581559

15591560
#else
15601561
#ifndef WOLFSSL_NO_VAR_ASSIGN_REG
1561-
WC_OMIT_FRAME_POINTER void fe_cmov_table(fe* r_p, fe* base_p, signed char b_p)
1562+
WC_OMIT_FRAME_POINTER void fe_cmov_table(fe* r_p, const fe* base_p,
1563+
signed char b_p)
15621564
#else
1563-
WC_OMIT_FRAME_POINTER void fe_cmov_table(fe* r, fe* base, signed char b)
1565+
WC_OMIT_FRAME_POINTER void fe_cmov_table(fe* r, const fe* base, signed char b)
15641566
#endif /* !WOLFSSL_NO_VAR_ASSIGN_REG */
15651567
{
15661568
#ifndef WOLFSSL_NO_VAR_ASSIGN_REG
15671569
register fe* r __asm__ ("r0") = (fe*)r_p;
1568-
register fe* base __asm__ ("r1") = (fe*)base_p;
1570+
register const fe* base __asm__ ("r1") = (const fe*)base_p;
15691571
register signed char b __asm__ ("r2") = (signed char)b_p;
15701572
#endif /* !WOLFSSL_NO_VAR_ASSIGN_REG */
15711573

0 commit comments

Comments
 (0)