Skip to content

Commit 17a09d9

Browse files
committed
SP: no RNG fix
Don't use RNG API when WC_NO_RNG is defined.
1 parent 2a08d30 commit 17a09d9

7 files changed

Lines changed: 126 additions & 0 deletions

File tree

wolfcrypt/src/sp_arm32.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76369,6 +76369,7 @@ static void sp_256_from_bin(sp_digit* r, int size, const byte* a, int n)
7636976369
*/
7637076370
static int sp_256_ecc_gen_k_8(WC_RNG* rng, sp_digit* k)
7637176371
{
76372+
#ifndef WC_NO_RNG
7637276373
int err;
7637376374
byte buf[32];
7637476375

@@ -76385,6 +76386,11 @@ static int sp_256_ecc_gen_k_8(WC_RNG* rng, sp_digit* k)
7638576386
while (err == 0);
7638676387

7638776388
return err;
76389+
#else
76390+
(void)rng;
76391+
(void)k;
76392+
return NOT_COMPILED_IN;
76393+
#endif
7638876394
}
7638976395

7639076396
/* Makes a random EC key pair.
@@ -94128,6 +94134,7 @@ static void sp_384_from_bin(sp_digit* r, int size, const byte* a, int n)
9412894134
*/
9412994135
static int sp_384_ecc_gen_k_12(WC_RNG* rng, sp_digit* k)
9413094136
{
94137+
#ifndef WC_NO_RNG
9413194138
int err;
9413294139
byte buf[48];
9413394140

@@ -94144,6 +94151,11 @@ static int sp_384_ecc_gen_k_12(WC_RNG* rng, sp_digit* k)
9414494151
while (err == 0);
9414594152

9414694153
return err;
94154+
#else
94155+
(void)rng;
94156+
(void)k;
94157+
return NOT_COMPILED_IN;
94158+
#endif
9414794159
}
9414894160

9414994161
/* Makes a random EC key pair.
@@ -121873,6 +121885,7 @@ static void sp_521_from_bin(sp_digit* r, int size, const byte* a, int n)
121873121885
*/
121874121886
static int sp_521_ecc_gen_k_17(WC_RNG* rng, sp_digit* k)
121875121887
{
121888+
#ifndef WC_NO_RNG
121876121889
int err;
121877121890
byte buf[66];
121878121891

@@ -121890,6 +121903,11 @@ static int sp_521_ecc_gen_k_17(WC_RNG* rng, sp_digit* k)
121890121903
while (err == 0);
121891121904

121892121905
return err;
121906+
#else
121907+
(void)rng;
121908+
(void)k;
121909+
return NOT_COMPILED_IN;
121910+
#endif
121893121911
}
121894121912

121895121913
/* Makes a random EC key pair.

wolfcrypt/src/sp_arm64.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39763,6 +39763,7 @@ static void sp_256_from_bin(sp_digit* r, int size, const byte* a, int n)
3976339763
*/
3976439764
static int sp_256_ecc_gen_k_4(WC_RNG* rng, sp_digit* k)
3976539765
{
39766+
#ifndef WC_NO_RNG
3976639767
int err;
3976739768
byte buf[32];
3976839769

@@ -39779,6 +39780,11 @@ static int sp_256_ecc_gen_k_4(WC_RNG* rng, sp_digit* k)
3977939780
while (err == 0);
3978039781

3978139782
return err;
39783+
#else
39784+
(void)rng;
39785+
(void)k;
39786+
return NOT_COMPILED_IN;
39787+
#endif
3978239788
}
3978339789

3978439790
/* Makes a random EC key pair.
@@ -66503,6 +66509,7 @@ static void sp_384_from_bin(sp_digit* r, int size, const byte* a, int n)
6650366509
*/
6650466510
static int sp_384_ecc_gen_k_6(WC_RNG* rng, sp_digit* k)
6650566511
{
66512+
#ifndef WC_NO_RNG
6650666513
int err;
6650766514
byte buf[48];
6650866515

@@ -66519,6 +66526,11 @@ static int sp_384_ecc_gen_k_6(WC_RNG* rng, sp_digit* k)
6651966526
while (err == 0);
6652066527

6652166528
return err;
66529+
#else
66530+
(void)rng;
66531+
(void)k;
66532+
return NOT_COMPILED_IN;
66533+
#endif
6652266534
}
6652366535

6652466536
/* Makes a random EC key pair.
@@ -111641,6 +111653,7 @@ static void sp_521_from_bin(sp_digit* r, int size, const byte* a, int n)
111641111653
*/
111642111654
static int sp_521_ecc_gen_k_9(WC_RNG* rng, sp_digit* k)
111643111655
{
111656+
#ifndef WC_NO_RNG
111644111657
int err;
111645111658
byte buf[66];
111646111659

@@ -111658,6 +111671,11 @@ static int sp_521_ecc_gen_k_9(WC_RNG* rng, sp_digit* k)
111658111671
while (err == 0);
111659111672

111660111673
return err;
111674+
#else
111675+
(void)rng;
111676+
(void)k;
111677+
return NOT_COMPILED_IN;
111678+
#endif
111661111679
}
111662111680

111663111681
/* Makes a random EC key pair.

wolfcrypt/src/sp_armthumb.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103929,6 +103929,7 @@ static void sp_256_from_bin(sp_digit* r, int size, const byte* a, int n)
103929103929
*/
103930103930
static int sp_256_ecc_gen_k_8(WC_RNG* rng, sp_digit* k)
103931103931
{
103932+
#ifndef WC_NO_RNG
103932103933
int err;
103933103934
byte buf[32];
103934103935

@@ -103945,6 +103946,11 @@ static int sp_256_ecc_gen_k_8(WC_RNG* rng, sp_digit* k)
103945103946
while (err == 0);
103946103947

103947103948
return err;
103949+
#else
103950+
(void)rng;
103951+
(void)k;
103952+
return NOT_COMPILED_IN;
103953+
#endif
103948103954
}
103949103955

103950103956
/* Makes a random EC key pair.
@@ -114825,6 +114831,7 @@ static void sp_384_from_bin(sp_digit* r, int size, const byte* a, int n)
114825114831
*/
114826114832
static int sp_384_ecc_gen_k_12(WC_RNG* rng, sp_digit* k)
114827114833
{
114834+
#ifndef WC_NO_RNG
114828114835
int err;
114829114836
byte buf[48];
114830114837

@@ -114841,6 +114848,11 @@ static int sp_384_ecc_gen_k_12(WC_RNG* rng, sp_digit* k)
114841114848
while (err == 0);
114842114849

114843114850
return err;
114851+
#else
114852+
(void)rng;
114853+
(void)k;
114854+
return NOT_COMPILED_IN;
114855+
#endif
114844114856
}
114845114857

114846114858
/* Makes a random EC key pair.
@@ -129054,6 +129066,7 @@ static void sp_521_from_bin(sp_digit* r, int size, const byte* a, int n)
129054129066
*/
129055129067
static int sp_521_ecc_gen_k_17(WC_RNG* rng, sp_digit* k)
129056129068
{
129069+
#ifndef WC_NO_RNG
129057129070
int err;
129058129071
byte buf[66];
129059129072

@@ -129071,6 +129084,11 @@ static int sp_521_ecc_gen_k_17(WC_RNG* rng, sp_digit* k)
129071129084
while (err == 0);
129072129085

129073129086
return err;
129087+
#else
129088+
(void)rng;
129089+
(void)k;
129090+
return NOT_COMPILED_IN;
129091+
#endif
129074129092
}
129075129093

129076129094
/* Makes a random EC key pair.

wolfcrypt/src/sp_c32.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24850,6 +24850,7 @@ static void sp_256_from_bin(sp_digit* r, int size, const byte* a, int n)
2485024850
*/
2485124851
static int sp_256_ecc_gen_k_9(WC_RNG* rng, sp_digit* k)
2485224852
{
24853+
#ifndef WC_NO_RNG
2485324854
int err;
2485424855
byte buf[32];
2485524856

@@ -24866,6 +24867,11 @@ static int sp_256_ecc_gen_k_9(WC_RNG* rng, sp_digit* k)
2486624867
while (err == 0);
2486724868

2486824869
return err;
24870+
#else
24871+
(void)rng;
24872+
(void)k;
24873+
return NOT_COMPILED_IN;
24874+
#endif
2486924875
}
2487024876

2487124877
/* Makes a random EC key pair.
@@ -32887,6 +32893,7 @@ static void sp_384_from_bin(sp_digit* r, int size, const byte* a, int n)
3288732893
*/
3288832894
static int sp_384_ecc_gen_k_15(WC_RNG* rng, sp_digit* k)
3288932895
{
32896+
#ifndef WC_NO_RNG
3289032897
int err;
3289132898
byte buf[48];
3289232899

@@ -32903,6 +32910,11 @@ static int sp_384_ecc_gen_k_15(WC_RNG* rng, sp_digit* k)
3290332910
while (err == 0);
3290432911

3290532912
return err;
32913+
#else
32914+
(void)rng;
32915+
(void)k;
32916+
return NOT_COMPILED_IN;
32917+
#endif
3290632918
}
3290732919

3290832920
/* Makes a random EC key pair.
@@ -40972,6 +40984,7 @@ static void sp_521_from_bin(sp_digit* r, int size, const byte* a, int n)
4097240984
*/
4097340985
static int sp_521_ecc_gen_k_21(WC_RNG* rng, sp_digit* k)
4097440986
{
40987+
#ifndef WC_NO_RNG
4097540988
int err;
4097640989
byte buf[66];
4097740990

@@ -40989,6 +41002,11 @@ static int sp_521_ecc_gen_k_21(WC_RNG* rng, sp_digit* k)
4098941002
while (err == 0);
4099041003

4099141004
return err;
41005+
#else
41006+
(void)rng;
41007+
(void)k;
41008+
return NOT_COMPILED_IN;
41009+
#endif
4099241010
}
4099341011

4099441012
/* Makes a random EC key pair.

wolfcrypt/src/sp_c64.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25746,6 +25746,7 @@ static void sp_256_from_bin(sp_digit* r, int size, const byte* a, int n)
2574625746
*/
2574725747
static int sp_256_ecc_gen_k_5(WC_RNG* rng, sp_digit* k)
2574825748
{
25749+
#ifndef WC_NO_RNG
2574925750
int err;
2575025751
byte buf[32];
2575125752

@@ -25762,6 +25763,11 @@ static int sp_256_ecc_gen_k_5(WC_RNG* rng, sp_digit* k)
2576225763
while (err == 0);
2576325764

2576425765
return err;
25766+
#else
25767+
(void)rng;
25768+
(void)k;
25769+
return NOT_COMPILED_IN;
25770+
#endif
2576525771
}
2576625772

2576725773
/* Makes a random EC key pair.
@@ -33208,6 +33214,7 @@ static void sp_384_from_bin(sp_digit* r, int size, const byte* a, int n)
3320833214
*/
3320933215
static int sp_384_ecc_gen_k_7(WC_RNG* rng, sp_digit* k)
3321033216
{
33217+
#ifndef WC_NO_RNG
3321133218
int err;
3321233219
byte buf[48];
3321333220

@@ -33224,6 +33231,11 @@ static int sp_384_ecc_gen_k_7(WC_RNG* rng, sp_digit* k)
3322433231
while (err == 0);
3322533232

3322633233
return err;
33234+
#else
33235+
(void)rng;
33236+
(void)k;
33237+
return NOT_COMPILED_IN;
33238+
#endif
3322733239
}
3322833240

3322933241
/* Makes a random EC key pair.
@@ -40621,6 +40633,7 @@ static void sp_521_from_bin(sp_digit* r, int size, const byte* a, int n)
4062140633
*/
4062240634
static int sp_521_ecc_gen_k_9(WC_RNG* rng, sp_digit* k)
4062340635
{
40636+
#ifndef WC_NO_RNG
4062440637
int err;
4062540638
byte buf[66];
4062640639

@@ -40638,6 +40651,11 @@ static int sp_521_ecc_gen_k_9(WC_RNG* rng, sp_digit* k)
4063840651
while (err == 0);
4063940652

4064040653
return err;
40654+
#else
40655+
(void)rng;
40656+
(void)k;
40657+
return NOT_COMPILED_IN;
40658+
#endif
4064140659
}
4064240660

4064340661
/* Makes a random EC key pair.

wolfcrypt/src/sp_cortexm.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39460,6 +39460,7 @@ static void sp_256_from_bin(sp_digit* r, int size, const byte* a, int n)
3946039460
*/
3946139461
static int sp_256_ecc_gen_k_8(WC_RNG* rng, sp_digit* k)
3946239462
{
39463+
#ifndef WC_NO_RNG
3946339464
int err;
3946439465
byte buf[32];
3946539466

@@ -39476,6 +39477,11 @@ static int sp_256_ecc_gen_k_8(WC_RNG* rng, sp_digit* k)
3947639477
while (err == 0);
3947739478

3947839479
return err;
39480+
#else
39481+
(void)rng;
39482+
(void)k;
39483+
return NOT_COMPILED_IN;
39484+
#endif
3947939485
}
3948039486

3948139487
/* Makes a random EC key pair.
@@ -49519,6 +49525,7 @@ static void sp_384_from_bin(sp_digit* r, int size, const byte* a, int n)
4951949525
*/
4952049526
static int sp_384_ecc_gen_k_12(WC_RNG* rng, sp_digit* k)
4952149527
{
49528+
#ifndef WC_NO_RNG
4952249529
int err;
4952349530
byte buf[48];
4952449531

@@ -49535,6 +49542,11 @@ static int sp_384_ecc_gen_k_12(WC_RNG* rng, sp_digit* k)
4953549542
while (err == 0);
4953649543

4953749544
return err;
49545+
#else
49546+
(void)rng;
49547+
(void)k;
49548+
return NOT_COMPILED_IN;
49549+
#endif
4953849550
}
4953949551

4954049552
/* Makes a random EC key pair.
@@ -62277,6 +62289,7 @@ static void sp_521_from_bin(sp_digit* r, int size, const byte* a, int n)
6227762289
*/
6227862290
static int sp_521_ecc_gen_k_17(WC_RNG* rng, sp_digit* k)
6227962291
{
62292+
#ifndef WC_NO_RNG
6228062293
int err;
6228162294
byte buf[66];
6228262295

@@ -62294,6 +62307,11 @@ static int sp_521_ecc_gen_k_17(WC_RNG* rng, sp_digit* k)
6229462307
while (err == 0);
6229562308

6229662309
return err;
62310+
#else
62311+
(void)rng;
62312+
(void)k;
62313+
return NOT_COMPILED_IN;
62314+
#endif
6229762315
}
6229862316

6229962317
/* Makes a random EC key pair.

0 commit comments

Comments
 (0)