1MPI core random basic: 0..1 2mpi_core_random_basic:0:"01":0 3 4MPI core random basic: 0..2 5mpi_core_random_basic:0:"02":0 6 7MPI core random basic: 1..2 8mpi_core_random_basic:1:"02":0 9 10MPI core random basic: 2^30..2^31 11mpi_core_random_basic:0x40000000:"80000000":0 12 13MPI core random basic: 0..2^128 14mpi_core_random_basic:0x40000000:"0100000000000000000000000000000000":0 15 16MPI core random basic: 2^30..2^129 17mpi_core_random_basic:0x40000000:"0200000000000000000000000000000000":0 18 19# Use the same data values for mpi_core_random_basic->NOT_ACCEPTABLE 20# and for mpi_XXX_random_values where we want to return NOT_ACCEPTABLE 21# but this isn't checked at runtime. 22MPI core random basic: 2^28-1..2^28+1 (NOT_ACCEPTABLE) 23mpi_core_random_basic:0x0fffffff:"10000001":MBEDTLS_ERR_MPI_NOT_ACCEPTABLE 24 25MPI random legacy=core: 2^28-1..2^28+1 (NOT_ACCEPTABLE) 26mpi_legacy_random_values:0x0fffffff:"10000001" 27 28MPI random mod=core: 2^28-1..2^28+1 (NOT_ACCEPTABLE) (Mont) 29mpi_mod_random_values:0x0fffffff:"10000001":MBEDTLS_MPI_MOD_REP_MONTGOMERY 30 31MPI random mod=core: 2^28-1..2^28+1 (NOT_ACCEPTABLE) (canon) 32mpi_mod_random_values:0x0fffffff:"10000001":MBEDTLS_MPI_MOD_REP_OPT_RED 33 34MPI core random basic: 2^29-1..2^29+1 (NOT_ACCEPTABLE) 35mpi_core_random_basic:0x1fffffff:"20000001":MBEDTLS_ERR_MPI_NOT_ACCEPTABLE 36 37MPI random legacy=core: 2^29-1..2^29+1 (NOT_ACCEPTABLE) 38mpi_legacy_random_values:0x1fffffff:"20000001" 39 40MPI random mod=core: 2^29-1..2^29+1 (NOT_ACCEPTABLE) (Mont) 41mpi_mod_random_values:0x1fffffff:"20000001":MBEDTLS_MPI_MOD_REP_MONTGOMERY 42 43MPI random mod=core: 2^29-1..2^29+1 (NOT_ACCEPTABLE) (canon) 44mpi_mod_random_values:0x1fffffff:"20000001":MBEDTLS_MPI_MOD_REP_OPT_RED 45 46MPI core random basic: 2^30-1..2^30+1 (NOT_ACCEPTABLE) 47mpi_core_random_basic:0x3fffffff:"40000001":MBEDTLS_ERR_MPI_NOT_ACCEPTABLE 48 49MPI random legacy=core: 2^30-1..2^30+1 (NOT_ACCEPTABLE) 50mpi_legacy_random_values:0x3fffffff:"40000001" 51 52MPI random mod=core: 2^30-1..2^30+1 (NOT_ACCEPTABLE) (Mont) 53mpi_mod_random_values:0x3fffffff:"40000001":MBEDTLS_MPI_MOD_REP_MONTGOMERY 54 55MPI random mod=core: 2^30-1..2^30+1 (NOT_ACCEPTABLE) (canon) 56mpi_mod_random_values:0x3fffffff:"40000001":MBEDTLS_MPI_MOD_REP_OPT_RED 57 58MPI core random basic: 2^31-1..2^31+1 (NOT_ACCEPTABLE) 59mpi_core_random_basic:0x7fffffff:"80000001":MBEDTLS_ERR_MPI_NOT_ACCEPTABLE 60 61MPI random legacy=core: 2^31-1..2^31+1 (NOT_ACCEPTABLE) 62mpi_legacy_random_values:0x7fffffff:"80000001" 63 64MPI random mod=core: 2^31-1..2^31+1 (NOT_ACCEPTABLE) (Mont) 65mpi_mod_random_values:0x7fffffff:"80000001":MBEDTLS_MPI_MOD_REP_MONTGOMERY 66 67MPI random mod=core: 2^31-1..2^31+1 (NOT_ACCEPTABLE) (canon) 68mpi_mod_random_values:0x7fffffff:"80000001":MBEDTLS_MPI_MOD_REP_OPT_RED 69 70MPI random in range: 1..2 71mpi_random_many:1:"02":1000 72 73MPI random in range: 1..3 74mpi_random_many:1:"03":1000 75 76MPI random in range: 1..4 77mpi_random_many:1:"04":1000 78 79MPI random in range: 1..5 80mpi_random_many:1:"05":1000 81 82MPI random in range: 1..6 83mpi_random_many:1:"06":1000 84 85MPI random in range: 1..7 86mpi_random_many:1:"07":1000 87 88MPI random in range: 1..8 89mpi_random_many:1:"08":1000 90 91MPI random in range: 1..9 92mpi_random_many:1:"09":1000 93 94MPI random in range: 1..10 95mpi_random_many:1:"0a":1000 96 97MPI random in range: 1..11 98mpi_random_many:1:"0b":1000 99 100MPI random in range: 1..12 101mpi_random_many:1:"0c":1000 102 103MPI random in range: 1..255 104mpi_random_many:1:"ff":200 105 106MPI random in range: 1..256 107mpi_random_many:1:"0100":200 108 109MPI random in range: 1..257 110mpi_random_many:1:"0101":200 111 112MPI random in range: 1..272 113mpi_random_many:1:"0110":200 114 115MPI random in range: 1..2^64-1 116mpi_random_many:1:"ffffffffffffffff":100 117 118MPI random in range: 1..2^64 119mpi_random_many:1:"010000000000000000":100 120 121MPI random in range: 1..2^64+1 122mpi_random_many:1:"010000000000000001":100 123 124MPI random in range: 1..2^64+2^63 125mpi_random_many:1:"018000000000000000":100 126 127MPI random in range: 1..2^65-1 128mpi_random_many:1:"01ffffffffffffffff":100 129 130MPI random in range: 1..2^65 131mpi_random_many:1:"020000000000000000":100 132 133MPI random in range: 1..2^65+1 134mpi_random_many:1:"020000000000000001":100 135 136MPI random in range: 1..2^65+2^64 137mpi_random_many:1:"030000000000000000":100 138 139MPI random in range: 1..2^66+2^65 140mpi_random_many:1:"060000000000000000":100 141 142MPI random in range: 1..2^71-1 143mpi_random_many:1:"7fffffffffffffffff":100 144 145MPI random in range: 1..2^71 146mpi_random_many:1:"800000000000000000":100 147 148MPI random in range: 1..2^71+1 149mpi_random_many:1:"800000000000000001":100 150 151MPI random in range: 1..2^71+2^70 152mpi_random_many:1:"c00000000000000000":100 153 154MPI random in range: 1..2^72-1 155mpi_random_many:1:"ffffffffffffffffff":100 156 157MPI random in range: 1..2^72 158mpi_random_many:1:"01000000000000000000":100 159 160MPI random in range: 1..2^72+1 161mpi_random_many:1:"01000000000000000001":100 162 163MPI random in range: 1..2^72+2^71 164mpi_random_many:1:"01800000000000000000":100 165 166MPI random in range: 0..1 167mpi_random_many:0:"04":10000 168 169MPI random in range: 0..4 170mpi_random_many:0:"04":10000 171 172MPI random in range: 2..4 173mpi_random_many:2:"04":10000 174 175MPI random in range: 3..4 176mpi_random_many:3:"04":10000 177 178MPI random in range: smaller result 179mpi_random_sizes:1:"aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbb":1:0 180 181MPI random in range: same size result (32-bit limbs) 182mpi_random_sizes:1:"aaaaaaaaaaaaaaaa":2:0 183 184MPI random in range: same size result (64-bit limbs) 185mpi_random_sizes:1:"aaaaaaaaaaaaaaaa":1:0 186 187MPI random in range: larger result 188mpi_random_sizes:1:"aaaaaaaaaaaaaaaa":3:0 189 190## The "0 limb in upper bound" tests rely on the fact that 191## mbedtls_mpi_read_binary() bases the size of the MPI on the size of 192## the input, without first checking for leading zeros. If this was 193## not the case, the tests would still pass, but would not exercise 194## the advertised behavior. 195MPI random in range: leading 0 limb in upper bound #0 196mpi_random_sizes:1:"00aaaaaaaaaaaaaaaa":0:0 197 198MPI random in range: leading 0 limb in upper bound #1 199mpi_random_sizes:1:"00aaaaaaaaaaaaaaaa":1:0 200 201MPI random in range: leading 0 limb in upper bound #2 202mpi_random_sizes:1:"00aaaaaaaaaaaaaaaa":2:0 203 204MPI random in range: leading 0 limb in upper bound #3 205mpi_random_sizes:1:"00aaaaaaaaaaaaaaaa":3:0 206 207MPI random in range: leading 0 limb in upper bound #4 208mpi_random_sizes:1:"00aaaaaaaaaaaaaaaa":4:0 209 210MPI random in range: previously small >0 211mpi_random_sizes:1:"1234567890":4:1 212 213MPI random in range: previously small <0 214mpi_random_sizes:1:"1234567890":4:-1 215 216MPI random in range: previously large >0 217mpi_random_sizes:1:"1234":4:65 218 219MPI random in range: previously large <0 220mpi_random_sizes:1:"1234":4:-65 221 222MPI random bad arguments: min < 0 223mpi_random_fail:-1:"04":MBEDTLS_ERR_MPI_BAD_INPUT_DATA 224 225MPI random bad arguments: min = N = 0 226mpi_random_fail:0:"00":MBEDTLS_ERR_MPI_BAD_INPUT_DATA 227 228MPI random bad arguments: min = N = 1 229mpi_random_fail:1:"01":MBEDTLS_ERR_MPI_BAD_INPUT_DATA 230 231MPI random bad arguments: min > N = 0 232mpi_random_fail:1:"00":MBEDTLS_ERR_MPI_BAD_INPUT_DATA 233 234MPI random bad arguments: min > N = 1 235mpi_random_fail:2:"01":MBEDTLS_ERR_MPI_BAD_INPUT_DATA 236 237MPI random bad arguments: min > N = 1, 0 limb in upper bound 238mpi_random_fail:2:"000000000000000001":MBEDTLS_ERR_MPI_BAD_INPUT_DATA 239 240MPI random legacy=core: 0..1 241mpi_legacy_random_values:0:"01" 242 243MPI random legacy=core: 0..2 244mpi_legacy_random_values:0:"02" 245 246MPI random legacy=core: 1..2 247mpi_legacy_random_values:1:"02" 248 249MPI random legacy=core: 2^30..2^31 250mpi_legacy_random_values:0x40000000:"80000000" 251 252MPI random legacy=core: 2^31-1..2^32-1 253mpi_legacy_random_values:0x7fffffff:"ffffffff" 254 255MPI random legacy=core: 0..2^256 256mpi_legacy_random_values:0:"010000000000000000000000000000000000000000000000000000000000000000" 257 258MPI random legacy=core: 0..2^256+1 259mpi_legacy_random_values:0:"010000000000000000000000000000000000000000000000000000000000000001" 260 261MPI random mod=core: 0..1 (Mont) 262mpi_mod_random_values:0:"01":MBEDTLS_MPI_MOD_REP_MONTGOMERY 263 264MPI random mod=core: 0..1 (canon) 265mpi_mod_random_values:0:"01":MBEDTLS_MPI_MOD_REP_OPT_RED 266 267MPI random mod=core: 0..3 (Mont) 268mpi_mod_random_values:0:"03":MBEDTLS_MPI_MOD_REP_MONTGOMERY 269 270MPI random mod=core: 0..3 (canon) 271mpi_mod_random_values:0:"03":MBEDTLS_MPI_MOD_REP_OPT_RED 272 273MPI random mod=core: 1..3 (Mont) 274mpi_mod_random_values:1:"03":MBEDTLS_MPI_MOD_REP_MONTGOMERY 275 276MPI random mod=core: 1..3 (canon) 277mpi_mod_random_values:1:"03":MBEDTLS_MPI_MOD_REP_OPT_RED 278 279MPI random mod=core: 2^30..2^31-1 (Mont) 280mpi_mod_random_values:0x40000000:"7fffffff":MBEDTLS_MPI_MOD_REP_MONTGOMERY 281 282MPI random mod=core: 2^30..2^31-1 (canon) 283mpi_mod_random_values:0x40000000:"7fffffff":MBEDTLS_MPI_MOD_REP_OPT_RED 284 285MPI random mod=core: 2^31-1..2^32-1 (Mont) 286mpi_mod_random_values:0x7fffffff:"ffffffff":MBEDTLS_MPI_MOD_REP_MONTGOMERY 287 288MPI random mod=core: 2^31-1..2^32-1 (canon) 289mpi_mod_random_values:0x7fffffff:"ffffffff":MBEDTLS_MPI_MOD_REP_OPT_RED 290 291MPI random mod=core: 0..2^256+1 (Mont) 292mpi_mod_random_values:0:"010000000000000000000000000000000000000000000000000000000000000001":MBEDTLS_MPI_MOD_REP_MONTGOMERY 293 294MPI random mod=core: 0..2^256+1 (canon) 295mpi_mod_random_values:0:"010000000000000000000000000000000000000000000000000000000000000001":MBEDTLS_MPI_MOD_REP_OPT_RED 296 297MPI random mod validation: 1 limb, good, 0..1 298mpi_mod_random_validation:0:"1":0:0 299 300MPI random mod validation: 1 limb, good, 1..3 301mpi_mod_random_validation:1:"3":0:0 302 303MPI random mod validation: 1 limb, good, 2..3 304mpi_mod_random_validation:2:"3":0:0 305 306MPI random mod validation: 1 limb, good, 3..5 307mpi_mod_random_validation:3:"5":0:0 308 309MPI random mod validation: 1 limb, good, 4..5 310mpi_mod_random_validation:4:"5":0:0 311 312MPI random mod validation: 1 limb, good, 5..7 313mpi_mod_random_validation:5:"7":0:0 314 315MPI random mod validation: 1 limb, good, 6..7 316mpi_mod_random_validation:6:"7":0:0 317 318MPI random mod validation: 1 limb, good, 0..0x123 319mpi_mod_random_validation:0:"123":0:0 320 321MPI random mod validation: 2+ limbs, good 322mpi_mod_random_validation:0:"01234567890123456789":0:0 323 324MPI random mod validation: 1 limb, output null 325mpi_mod_random_validation:0:"123":-1:MBEDTLS_ERR_MPI_BAD_INPUT_DATA 326 327MPI random mod validation: 1 limb, output too large 328mpi_mod_random_validation:0:"123":1:MBEDTLS_ERR_MPI_BAD_INPUT_DATA 329 330MPI random mod validation: 2+ limbs, output too small 331mpi_mod_random_validation:0:"01234567890123456789":-1:MBEDTLS_ERR_MPI_BAD_INPUT_DATA 332 333MPI random mod validation: 2+ limbs, output too large 334mpi_mod_random_validation:0:"01234567890123456789":1:MBEDTLS_ERR_MPI_BAD_INPUT_DATA 335 336MPI random mod validation: min == upper bound 337mpi_mod_random_validation:0x123:"123":-1:MBEDTLS_ERR_MPI_BAD_INPUT_DATA 338 339MPI random mod validation: min > upper bound 340mpi_mod_random_validation:0x124:"123":-1:MBEDTLS_ERR_MPI_BAD_INPUT_DATA 341