Skip to content

Commit 34ae6de

Browse files
committed
testing: add rng failure test to CI
Add the rng failure test to the CI. Signed-off-by: Andreas Hatziiliou <[email protected]>
1 parent de2fa5c commit 34ae6de

File tree

5 files changed

+38
-10
lines changed

5 files changed

+38
-10
lines changed

.github/actions/config-variations/action.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ runs:
6262
extra_env: 'ASAN_OPTIONS=detect_leaks=1'
6363
examples: false # Some examples use a custom config themselves
6464
alloc: false # Requires custom config
65+
rng_fail: false # Requires custom config
6566
- name: "Custom zeroization (explicit_bzero)"
6667
if: ${{ inputs.tests == 'all' || contains(inputs.tests, 'custom-zeroize') }}
6768
uses: ./.github/actions/multi-functest
@@ -76,6 +77,7 @@ runs:
7677
opt: ${{ inputs.opt }}
7778
examples: false # Some examples use a custom config themselves
7879
alloc: false # Requires custom config
80+
rng_fail: false # Requires custom config
7981
- name: "Custom native capability functions (static ON)"
8082
if: ${{ inputs.tests == 'all' || contains(inputs.tests, 'native-cap-ON') }}
8183
uses: ./.github/actions/multi-functest
@@ -90,6 +92,7 @@ runs:
9092
opt: ${{ inputs.opt }}
9193
examples: false # Some examples use a custom config themselves
9294
alloc: false # Requires custom config
95+
rng_fail: false # Requires custom config
9396
- name: "Custom native capability functions (static OFF)"
9497
if: ${{ inputs.tests == 'all' || contains(inputs.tests, 'native-cap-OFF') }}
9598
uses: ./.github/actions/multi-functest
@@ -104,6 +107,7 @@ runs:
104107
opt: ${{ inputs.opt }}
105108
examples: false # Some examples use a custom config themselves
106109
alloc: false # Requires custom config
110+
rng_fail: false # Requires custom config
107111
- name: "Custom native capability functions (ID_AA64PFR1_EL1 detection)"
108112
if: ${{ (inputs.tests == 'all' || contains(inputs.tests, 'native-cap-ID_AA64PFR1_EL1')) && runner.os == 'Linux' && runner.arch == 'ARM64' }}
109113
uses: ./.github/actions/multi-functest
@@ -118,6 +122,7 @@ runs:
118122
opt: ${{ inputs.opt }}
119123
examples: false # Some examples use a custom config themselves
120124
alloc: false # Requires custom config
125+
rng_fail: false # Requires custom config
121126
- name: "Custom native capability functions (CPUID AVX2 detection)"
122127
if: ${{ (inputs.tests == 'all' || contains(inputs.tests, 'native-cap-CPUID_AVX2')) && runner.os == 'Linux' && runner.arch == 'X64' }}
123128
uses: ./.github/actions/multi-functest
@@ -132,6 +137,7 @@ runs:
132137
opt: ${{ inputs.opt }}
133138
examples: false # Some examples use a custom config themselves
134139
alloc: false # Requires custom config
140+
rng_fail: false # Requires custom config
135141
- name: "No ASM"
136142
if: ${{ inputs.tests == 'all' || contains(inputs.tests, 'no-asm') }}
137143
uses: ./.github/actions/multi-functest
@@ -146,6 +152,7 @@ runs:
146152
opt: ${{ inputs.opt }}
147153
examples: false # Some examples use a custom config themselves
148154
alloc: false # Requires custom config
155+
rng_fail: false # Requires custom config
149156
- name: "Serial FIPS202 (no batched Keccak)"
150157
if: ${{ inputs.tests == 'all' || contains(inputs.tests, 'serial-fips202') }}
151158
uses: ./.github/actions/multi-functest
@@ -160,6 +167,7 @@ runs:
160167
opt: ${{ inputs.opt }}
161168
examples: false # Some examples use a custom config themselves
162169
alloc: false # Requires custom config
170+
rng_fail: false # Requires custom config
163171
- name: "Custom randombytes"
164172
if: ${{ inputs.tests == 'all' || contains(inputs.tests, 'custom-randombytes') }}
165173
uses: ./.github/actions/multi-functest
@@ -174,6 +182,7 @@ runs:
174182
opt: ${{ inputs.opt }}
175183
examples: false # Some examples use a custom config themselves
176184
alloc: false # Requires custom config
185+
rng_fail: false # Requires custom config
177186
- name: "Custom memcpy"
178187
if: ${{ inputs.tests == 'all' || contains(inputs.tests, 'custom-memcpy') }}
179188
uses: ./.github/actions/multi-functest
@@ -188,6 +197,7 @@ runs:
188197
opt: ${{ inputs.opt }}
189198
examples: false # Some examples use a custom config themselves
190199
alloc: false # Requires custom config
200+
rng_fail: false # Requires custom config
191201
- name: "Custom memset"
192202
if: ${{ inputs.tests == 'all' || contains(inputs.tests, 'custom-memset') }}
193203
uses: ./.github/actions/multi-functest
@@ -202,6 +212,7 @@ runs:
202212
opt: ${{ inputs.opt }}
203213
examples: false # Some examples use a custom config themselves
204214
alloc: false # Requires custom config
215+
rng_fail: false # Requires custom config
205216
- name: "Custom stdlib (memcpy + memset)"
206217
if: ${{ inputs.tests == 'all' || contains(inputs.tests, 'custom-stdlib') }}
207218
uses: ./.github/actions/multi-functest
@@ -216,3 +227,4 @@ runs:
216227
opt: ${{ inputs.opt }}
217228
examples: false # Some examples use a custom config themselves
218229
alloc: false # Requires custom config
230+
rng_fail: false # Requires custom config

.github/actions/functest/action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ inputs:
6060
alloc:
6161
description: Determine whether to run alloc tests or not
6262
default: "true"
63+
rng_fail:
64+
description: Determine whether to run rng fail tests or not
65+
default: "true"
6366
extra_args:
6467
description: Additional arguments to pass to the tests script
6568
default: ""
@@ -81,6 +84,7 @@ runs:
8184
echo EXAMPLES="${{ inputs.examples == 'true' && 'examples' || 'no-examples' }}" >> $GITHUB_ENV
8285
echo STACK="${{ inputs.stack == 'true' && 'stack' || 'no-stack' }}" >> $GITHUB_ENV
8386
echo ALLOC="${{ inputs.alloc == 'true' && 'alloc' || 'no-alloc' }}" >> $GITHUB_ENV
87+
echo RNGFAIL="${{ inputs.rng_fail == 'true' && 'rng-fail' || 'no-rng-fail' }}" >> $GITHUB_ENV
8488
- name: Setup nix
8589
uses: ./.github/actions/setup-shell
8690
with:
@@ -111,11 +115,11 @@ runs:
111115
- $(python3 --version)
112116
- $(${{ inputs.cross_prefix }}${CC} --version | grep -m1 "")
113117
EOF
114-
- name: ${{ env.MODE }} ${{ inputs.opt }} tests (${{ env.FUNC }}, ${{ env.KAT }}, ${{ env.EXAMPLES }}, ${{ env.STACK }}, ${{ env.UNIT }}, ${{ env.ALLOC }})
118+
- name: ${{ env.MODE }} ${{ inputs.opt }} tests (${{ env.FUNC }}, ${{ env.KAT }}, ${{ env.EXAMPLES }}, ${{ env.STACK }}, ${{ env.UNIT }}, ${{ env.ALLOC }}, ${{ env.RNGFAIL }})
115119
shell: ${{ env.SHELL }}
116120
run: |
117121
make clean
118-
${{ inputs.extra_env }} ./scripts/tests all ${{ inputs.check_namespace == 'true' && '--check-namespace' || ''}} --exec-wrapper="${{ inputs.exec_wrapper }}" --cross-prefix="${{ inputs.cross_prefix }}" --cflags="${{ inputs.cflags }}" --ldflags="${{ inputs.ldflags }}" --opt=${{ inputs.opt }} --${{ env.FUNC }} --${{ env.KAT }} --${{ env.ACVP }} --${{ env.EXAMPLES }} --${{ env.STACK }} --${{ env.UNIT }} --${{ env.ALLOC }} -v ${{ inputs.extra_args }}
122+
${{ inputs.extra_env }} ./scripts/tests all ${{ inputs.check_namespace == 'true' && '--check-namespace' || ''}} --exec-wrapper="${{ inputs.exec_wrapper }}" --cross-prefix="${{ inputs.cross_prefix }}" --cflags="${{ inputs.cflags }}" --ldflags="${{ inputs.ldflags }}" --opt=${{ inputs.opt }} --${{ env.FUNC }} --${{ env.KAT }} --${{ env.ACVP }} --${{ env.EXAMPLES }} --${{ env.STACK }} --${{ env.UNIT }} --${{ env.ALLOC }} --${{ env.RNGFAIL }} -v ${{ inputs.extra_args }}
119123
- name: Post ${{ env.MODE }} Tests
120124
shell: ${{ env.SHELL }}
121125
if: success() || failure()

.github/actions/multi-functest/action.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ inputs:
5757
alloc:
5858
description: Determine whether to run alloc tests or not
5959
default: "true"
60+
rng_fail:
61+
description: Determine whether to run rng fail tests or not
62+
default: "true"
6063
extra_args:
6164
description: Additional arguments to pass to the tests script
6265
default: ""
@@ -86,6 +89,7 @@ runs:
8689
check_namespace: ${{ inputs.check_namespace }}
8790
stack: ${{ inputs.stack }}
8891
alloc: ${{ inputs.alloc }}
92+
rng_fail: ${{ inputs.rng_fail }}
8993
extra_args: ${{ inputs.extra_args }}
9094
extra_env: ${{ inputs.extra_env }}
9195
- name: Cross x86_64 Tests
@@ -110,6 +114,7 @@ runs:
110114
check_namespace: ${{ inputs.check_namespace }}
111115
stack: ${{ inputs.stack }}
112116
alloc: ${{ inputs.alloc }}
117+
rng_fail: ${{ inputs.rng_fail }}
113118
extra_args: ${{ inputs.extra_args }}
114119
extra_env: ${{ inputs.extra_env }}
115120
- name: Cross aarch64 Tests
@@ -134,6 +139,7 @@ runs:
134139
check_namespace: ${{ inputs.check_namespace }}
135140
stack: ${{ inputs.stack }}
136141
alloc: ${{ inputs.alloc }}
142+
rng_fail: ${{ inputs.rng_fail }}
137143
extra_args: ${{ inputs.extra_args }}
138144
extra_env: ${{ inputs.extra_env }}
139145
- name: Cross ppc64le Tests
@@ -158,6 +164,7 @@ runs:
158164
check_namespace: ${{ inputs.check_namespace }}
159165
stack: ${{ inputs.stack }}
160166
alloc: ${{ inputs.alloc }}
167+
rng_fail: ${{ inputs.rng_fail }}
161168
extra_args: ${{ inputs.extra_args }}
162169
extra_env: ${{ inputs.extra_env }}
163170
- name: Cross aarch64_be Tests
@@ -182,6 +189,7 @@ runs:
182189
check_namespace: ${{ inputs.check_namespace }}
183190
stack: ${{ inputs.stack }}
184191
alloc: ${{ inputs.alloc }}
192+
rng_fail: ${{ inputs.rng_fail }}
185193
extra_args: ${{ inputs.extra_args }}
186194
extra_env: ${{ inputs.extra_env }}
187195
- name: Cross riscv64 Tests (RVV, VLEN=128)
@@ -206,6 +214,7 @@ runs:
206214
check_namespace: ${{ inputs.check_namespace }}
207215
stack: ${{ inputs.stack }}
208216
alloc: ${{ inputs.alloc }}
217+
rng_fail: ${{ inputs.rng_fail }}
209218
extra_args: ${{ inputs.extra_args }}
210219
extra_env: ${{ inputs.extra_env }}
211220
- name: Cross riscv64 Tests (RVV, VLEN=256)
@@ -229,6 +238,7 @@ runs:
229238
check_namespace: ${{ inputs.check_namespace }}
230239
stack: ${{ inputs.stack }}
231240
alloc: ${{ inputs.alloc }}
241+
rng_fail: ${{ inputs.rng_fail }}
232242
extra_args: ${{ inputs.extra_args }}
233243
extra_env: ${{ inputs.extra_env }}
234244
- name: Cross riscv64 Tests (RVV, VLEN=512)
@@ -252,6 +262,7 @@ runs:
252262
check_namespace: ${{ inputs.check_namespace }}
253263
stack: ${{ inputs.stack }}
254264
alloc: ${{ inputs.alloc }}
265+
rng_fail: ${{ inputs.rng_fail }}
255266
extra_args: ${{ inputs.extra_args }}
256267
extra_env: ${{ inputs.extra_env }}
257268
- name: Cross riscv64 Tests (RVV, VLEN=1024)
@@ -275,6 +286,7 @@ runs:
275286
check_namespace: ${{ inputs.check_namespace }}
276287
stack: ${{ inputs.stack }}
277288
alloc: ${{ inputs.alloc }}
289+
rng_fail: ${{ inputs.rng_fail }}
278290
extra_args: ${{ inputs.extra_args }}
279291
extra_env: ${{ inputs.extra_env }}
280292
- name: Cross riscv32 Tests
@@ -299,6 +311,7 @@ runs:
299311
check_namespace: ${{ inputs.check_namespace }}
300312
stack: ${{ inputs.stack }}
301313
alloc: ${{ inputs.alloc }}
314+
rng_fail: ${{ inputs.rng_fail }}
302315
extra_args: ${{ inputs.extra_args }}
303316
extra_env: ${{ inputs.extra_env }}
304317

.github/workflows/baremetal.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ jobs:
3636
examples: false
3737
stack: false
3838
alloc: false
39+
rng_fail: false

test/test_rng_fail_config.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,9 @@ int mld_randombytes(uint8_t *out, size_t outlen);
436436
* Set this option and define `mld_sys_check_capability` if you
437437
* want to use a custom method to dispatch between implementations.
438438
*
439+
* Return value 1 indicates that a capability is supported.
440+
* Return value 0 indicates that a capability is not supported.
441+
*
439442
* If this option is not set, mldsa-native uses compile-time
440443
* feature detection only to decide which backend to use.
441444
*
@@ -668,14 +671,10 @@ int mld_randombytes(uint8_t *out, size_t outlen);
668671
* Name: MLD_CONFIG_REDUCE_RAM [EXPERIMENTAL]
669672
*
670673
* Description: Set this to reduce RAM usage.
674+
* This trades memory for performance.
671675
*
672-
* This configuration option is work in progress.
673-
*
674-
* At present it results the following memory saving in signing
675-
* with no impact on performance:
676-
* - ML-DSA-44: 4 KiB
677-
* - ML-DSA-65: 5 KiB
678-
* - ML-DSA-87: 7 KiB
676+
* For detailed expected memory savings, see the
677+
* mldsa-native README.
679678
*
680679
* This option is useful for embedded systems with tight RAM
681680
* constraints but relaxed performance requirements.
@@ -687,7 +686,6 @@ int mld_randombytes(uint8_t *out, size_t outlen);
687686
*****************************************************************************/
688687
/* #define MLD_CONFIG_REDUCE_RAM */
689688

690-
691689
/************************* Config internals ********************************/
692690

693691
#endif /* MLD_BUILD_INTERNAL */

0 commit comments

Comments
 (0)