Skip to content

Commit 37c1faa

Browse files
committed
fix macro protection for sp_*_cond_add_* in ARM SP asm to prevent unused function warning when used with RSA_LOW_MEM
1 parent c413165 commit 37c1faa

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

wolfcrypt/src/sp_arm32.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17706,6 +17706,7 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, const mp_int* em,
1770617706
}
1770717707

1770817708
#ifndef WOLFSSL_RSA_PUBLIC_ONLY
17709+
#if !defined(SP_RSA_PRIVATE_EXP_D) && !defined(RSA_LOW_MEM)
1770917710
#ifdef WOLFSSL_SP_SMALL
1771017711
/* Conditionally add a and b using the mask m.
1771117712
* m is -1 to add and 0 when not.
@@ -17911,6 +17912,7 @@ WC_OMIT_FRAME_POINTER static sp_digit sp_2048_cond_add_32(sp_digit* r,
1791117912
}
1791217913

1791317914
#endif /* WOLFSSL_SP_SMALL */
17915+
#endif /* !SP_RSA_PRIVATE_EXP_D && !RSA_LOW_MEM */
1791417916
/* RSA private key operation.
1791517917
*
1791617918
* in Array of bytes representing the number to exponentiate, base.
@@ -45428,6 +45430,7 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, const mp_int* em,
4542845430
}
4542945431

4543045432
#ifndef WOLFSSL_RSA_PUBLIC_ONLY
45433+
#if !defined(SP_RSA_PRIVATE_EXP_D) && !defined(RSA_LOW_MEM)
4543145434
#ifdef WOLFSSL_SP_SMALL
4543245435
/* Conditionally add a and b using the mask m.
4543345436
* m is -1 to add and 0 when not.
@@ -45689,6 +45692,7 @@ WC_OMIT_FRAME_POINTER static sp_digit sp_3072_cond_add_48(sp_digit* r,
4568945692
}
4569045693

4569145694
#endif /* WOLFSSL_SP_SMALL */
45695+
#endif /* !SP_RSA_PRIVATE_EXP_D && !RSA_LOW_MEM */
4569245696
/* RSA private key operation.
4569345697
*
4569445698
* in Array of bytes representing the number to exponentiate, base.
@@ -61034,6 +61038,7 @@ int sp_RsaPublic_4096(const byte* in, word32 inLen, const mp_int* em,
6103461038
}
6103561039

6103661040
#ifndef WOLFSSL_RSA_PUBLIC_ONLY
61041+
#if !defined(SP_RSA_PRIVATE_EXP_D) && !defined(RSA_LOW_MEM)
6103761042
#ifdef WOLFSSL_SP_SMALL
6103861043
/* Conditionally add a and b using the mask m.
6103961044
* m is -1 to add and 0 when not.
@@ -61351,6 +61356,7 @@ WC_OMIT_FRAME_POINTER static sp_digit sp_4096_cond_add_64(sp_digit* r,
6135161356
}
6135261357

6135361358
#endif /* WOLFSSL_SP_SMALL */
61359+
#endif /* !SP_RSA_PRIVATE_EXP_D && !RSA_LOW_MEM */
6135461360
/* RSA private key operation.
6135561361
*
6135661362
* in Array of bytes representing the number to exponentiate, base.

wolfcrypt/src/sp_arm64.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6140,6 +6140,7 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, const mp_int* em,
61406140
}
61416141

61426142
#ifndef WOLFSSL_RSA_PUBLIC_ONLY
6143+
#if !defined(SP_RSA_PRIVATE_EXP_D) && !defined(RSA_LOW_MEM)
61436144
#ifdef WOLFSSL_SP_SMALL
61446145
/* Conditionally add a and b using the mask m.
61456146
* m is -1 to add and 0 when not.
@@ -6175,6 +6176,7 @@ static sp_digit sp_2048_cond_add_16(sp_digit* r, const sp_digit* a, const sp_dig
61756176
return c;
61766177
}
61776178
#endif /* WOLFSSL_SP_SMALL */
6179+
#endif /* !SP_RSA_PRIVATE_EXP_D && !RSA_LOW_MEM */
61786180

61796181
/* RSA private key operation.
61806182
*
@@ -15515,6 +15517,7 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, const mp_int* em,
1551515517
}
1551615518

1551715519
#ifndef WOLFSSL_RSA_PUBLIC_ONLY
15520+
#if !defined(SP_RSA_PRIVATE_EXP_D) && !defined(RSA_LOW_MEM)
1551815521
#ifdef WOLFSSL_SP_SMALL
1551915522
/* Conditionally add a and b using the mask m.
1552015523
* m is -1 to add and 0 when not.
@@ -15550,6 +15553,7 @@ static sp_digit sp_3072_cond_add_24(sp_digit* r, const sp_digit* a, const sp_dig
1555015553
return c;
1555115554
}
1555215555
#endif /* WOLFSSL_SP_SMALL */
15556+
#endif /* !SP_RSA_PRIVATE_EXP_D && !RSA_LOW_MEM */
1555315557

1555415558
/* RSA private key operation.
1555515559
*
@@ -20524,6 +20528,7 @@ int sp_RsaPublic_4096(const byte* in, word32 inLen, const mp_int* em,
2052420528
}
2052520529

2052620530
#ifndef WOLFSSL_RSA_PUBLIC_ONLY
20531+
#if !defined(SP_RSA_PRIVATE_EXP_D) && !defined(RSA_LOW_MEM)
2052720532
#ifdef WOLFSSL_SP_SMALL
2052820533
/* Conditionally add a and b using the mask m.
2052920534
* m is -1 to add and 0 when not.
@@ -20559,6 +20564,7 @@ static sp_digit sp_4096_cond_add_32(sp_digit* r, const sp_digit* a, const sp_dig
2055920564
return c;
2056020565
}
2056120566
#endif /* WOLFSSL_SP_SMALL */
20567+
#endif /* !SP_RSA_PRIVATE_EXP_D && !RSA_LOW_MEM */
2056220568

2056320569
/* RSA private key operation.
2056420570
*

wolfcrypt/src/sp_armthumb.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28024,6 +28024,7 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, const mp_int* em,
2802428024
}
2802528025

2802628026
#ifndef WOLFSSL_RSA_PUBLIC_ONLY
28027+
#if !defined(SP_RSA_PRIVATE_EXP_D) && !defined(RSA_LOW_MEM)
2802728028
/* Conditionally add a and b using the mask m.
2802828029
* m is -1 to add and 0 when not.
2802928030
*
@@ -28093,6 +28094,7 @@ SP_NOINLINE static sp_digit sp_2048_cond_add_32(sp_digit* r, const sp_digit* a,
2809328094
return (word32)(size_t)r;
2809428095
}
2809528096

28097+
#endif /* !SP_RSA_PRIVATE_EXP_D && !RSA_LOW_MEM */
2809628098
/* RSA private key operation.
2809728099
*
2809828100
* in Array of bytes representing the number to exponentiate, base.
@@ -80194,6 +80196,7 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, const mp_int* em,
8019480196
}
8019580197

8019680198
#ifndef WOLFSSL_RSA_PUBLIC_ONLY
80199+
#if !defined(SP_RSA_PRIVATE_EXP_D) && !defined(RSA_LOW_MEM)
8019780200
/* Conditionally add a and b using the mask m.
8019880201
* m is -1 to add and 0 when not.
8019980202
*
@@ -80263,6 +80266,7 @@ SP_NOINLINE static sp_digit sp_3072_cond_add_48(sp_digit* r, const sp_digit* a,
8026380266
return (word32)(size_t)r;
8026480267
}
8026580268

80269+
#endif /* !SP_RSA_PRIVATE_EXP_D && !RSA_LOW_MEM */
8026680270
/* RSA private key operation.
8026780271
*
8026880272
* in Array of bytes representing the number to exponentiate, base.
@@ -92650,6 +92654,7 @@ int sp_RsaPublic_4096(const byte* in, word32 inLen, const mp_int* em,
9265092654
}
9265192655

9265292656
#ifndef WOLFSSL_RSA_PUBLIC_ONLY
92657+
#if !defined(SP_RSA_PRIVATE_EXP_D) && !defined(RSA_LOW_MEM)
9265392658
/* Conditionally add a and b using the mask m.
9265492659
* m is -1 to add and 0 when not.
9265592660
*
@@ -92724,6 +92729,7 @@ SP_NOINLINE static sp_digit sp_4096_cond_add_64(sp_digit* r, const sp_digit* a,
9272492729
return (word32)(size_t)r;
9272592730
}
9272692731

92732+
#endif /* !SP_RSA_PRIVATE_EXP_D && !RSA_LOW_MEM */
9272792733
/* RSA private key operation.
9272892734
*
9272992735
* in Array of bytes representing the number to exponentiate, base.

wolfcrypt/src/sp_cortexm.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8884,6 +8884,7 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, const mp_int* em,
88848884
}
88858885

88868886
#ifndef WOLFSSL_RSA_PUBLIC_ONLY
8887+
#if !defined(SP_RSA_PRIVATE_EXP_D) && !defined(RSA_LOW_MEM)
88878888
#ifdef WOLFSSL_SP_SMALL
88888889
/* Conditionally add a and b using the mask m.
88898890
* m is -1 to add and 0 when not.
@@ -9089,6 +9090,7 @@ WC_OMIT_FRAME_POINTER static sp_digit sp_2048_cond_add_32(sp_digit* r,
90899090
}
90909091

90919092
#endif /* WOLFSSL_SP_SMALL */
9093+
#endif /* !SP_RSA_PRIVATE_EXP_D && !RSA_LOW_MEM */
90929094
/* RSA private key operation.
90939095
*
90949096
* in Array of bytes representing the number to exponentiate, base.
@@ -21488,6 +21490,7 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, const mp_int* em,
2148821490
}
2148921491

2149021492
#ifndef WOLFSSL_RSA_PUBLIC_ONLY
21493+
#if !defined(SP_RSA_PRIVATE_EXP_D) && !defined(RSA_LOW_MEM)
2149121494
#ifdef WOLFSSL_SP_SMALL
2149221495
/* Conditionally add a and b using the mask m.
2149321496
* m is -1 to add and 0 when not.
@@ -21749,6 +21752,7 @@ WC_OMIT_FRAME_POINTER static sp_digit sp_3072_cond_add_48(sp_digit* r,
2174921752
}
2175021753

2175121754
#endif /* WOLFSSL_SP_SMALL */
21755+
#endif /* !SP_RSA_PRIVATE_EXP_D && !RSA_LOW_MEM */
2175221756
/* RSA private key operation.
2175321757
*
2175421758
* in Array of bytes representing the number to exponentiate, base.
@@ -29835,6 +29839,7 @@ int sp_RsaPublic_4096(const byte* in, word32 inLen, const mp_int* em,
2983529839
}
2983629840

2983729841
#ifndef WOLFSSL_RSA_PUBLIC_ONLY
29842+
#if !defined(SP_RSA_PRIVATE_EXP_D) && !defined(RSA_LOW_MEM)
2983829843
#ifdef WOLFSSL_SP_SMALL
2983929844
/* Conditionally add a and b using the mask m.
2984029845
* m is -1 to add and 0 when not.
@@ -30152,6 +30157,7 @@ WC_OMIT_FRAME_POINTER static sp_digit sp_4096_cond_add_64(sp_digit* r,
3015230157
}
3015330158

3015430159
#endif /* WOLFSSL_SP_SMALL */
30160+
#endif /* !SP_RSA_PRIVATE_EXP_D && !RSA_LOW_MEM */
3015530161
/* RSA private key operation.
3015630162
*
3015730163
* in Array of bytes representing the number to exponentiate, base.

0 commit comments

Comments
 (0)