61 | 12 | } mp_redc.cpp:void (anonymous namespace)::fuzz_mp_redc<4ul>(std::__1::span<unsigned char const, 18446744073709551615ul>) Line | Count | Source | 12 | 2 | void fuzz_mp_redc(std::span<const uint8_t> in) { | 13 | 2 | FUZZER_ASSERT_EQUAL(in.size(), (N * 3 + 1) * sizeof(word)); | 14 | | | 15 | 2 | word z[2 * N] = {0}; | 16 | | | 17 | 2 | word z_script[2 * N] = {0}; | 18 | 2 | word z_ref[2 * N] = {0}; | 19 | 2 | word p[N] = {0}; | 20 | 2 | word p_dash = 0; | 21 | | | 22 | 2 | word ws[2 * (N + 1)] = {0}; | 23 | | | 24 | 2 | std::memcpy(z, in.data(), sizeof(z)); | 25 | 2 | std::memcpy(p, in.data() + sizeof(z), sizeof(p)); | 26 | 2 | std::memcpy(&p_dash, in.data() + sizeof(z) + sizeof(p), sizeof(p_dash)); | 27 | | | 28 | 18 | for(size_t i = 0; i != 2 * N; ++i) { | 29 | 16 | z_script[i] = z_ref[i] = z[i]; | 30 | 16 | } | 31 | | | 32 | 2 | if(N == 4) { | 33 | 2 | Botan::bigint_monty_redc_4(z_script, p, p_dash, ws); | 34 | 2 | } else if(N == 6) { | 35 | 0 | Botan::bigint_monty_redc_6(z_script, p, p_dash, ws); | 36 | 0 | } else if(N == 8) { | 37 | 0 | Botan::bigint_monty_redc_8(z_script, p, p_dash, ws); | 38 | 0 | } else if(N == 16) { | 39 | 0 | Botan::bigint_monty_redc_16(z_script, p, p_dash, ws); | 40 | 0 | } else if(N == 24) { | 41 | 0 | Botan::bigint_monty_redc_24(z_script, p, p_dash, ws); | 42 | 0 | } else if(N == 32) { | 43 | 0 | Botan::bigint_monty_redc_32(z_script, p, p_dash, ws); | 44 | 0 | } else { | 45 | 0 | std::abort(); | 46 | 0 | } | 47 | | | 48 | 2 | Botan::bigint_monty_redc_generic(z_ref, 2 * N, p, N, p_dash, ws); | 49 | | | 50 | 18 | for(size_t i = 0; i != 2 * N; ++i) { | 51 | 16 | if(z_script[i] != z_ref[i]) { | 52 | 0 | dump_word_vec("input", z, 2 * N); | 53 | 0 | dump_word_vec("z_script", z_script, 2 * N); | 54 | 0 | dump_word_vec("z_ref", z_ref, 2 * N); | 55 | 0 | dump_word_vec("p", p, N); | 56 | 0 | dump_word_vec("p_dash", &p_dash, 1); | 57 | 0 | std::abort(); | 58 | 0 | } | 59 | 16 | } | 60 | 2 | compare_word_vec(z_script, 2 * N, z_ref, 2 * N, "redc generic vs specialized"); | 61 | 2 | } |
mp_redc.cpp:void (anonymous namespace)::fuzz_mp_redc<6ul>(std::__1::span<unsigned char const, 18446744073709551615ul>) Line | Count | Source | 12 | 2 | void fuzz_mp_redc(std::span<const uint8_t> in) { | 13 | 2 | FUZZER_ASSERT_EQUAL(in.size(), (N * 3 + 1) * sizeof(word)); | 14 | | | 15 | 2 | word z[2 * N] = {0}; | 16 | | | 17 | 2 | word z_script[2 * N] = {0}; | 18 | 2 | word z_ref[2 * N] = {0}; | 19 | 2 | word p[N] = {0}; | 20 | 2 | word p_dash = 0; | 21 | | | 22 | 2 | word ws[2 * (N + 1)] = {0}; | 23 | | | 24 | 2 | std::memcpy(z, in.data(), sizeof(z)); | 25 | 2 | std::memcpy(p, in.data() + sizeof(z), sizeof(p)); | 26 | 2 | std::memcpy(&p_dash, in.data() + sizeof(z) + sizeof(p), sizeof(p_dash)); | 27 | | | 28 | 26 | for(size_t i = 0; i != 2 * N; ++i) { | 29 | 24 | z_script[i] = z_ref[i] = z[i]; | 30 | 24 | } | 31 | | | 32 | 2 | if(N == 4) { | 33 | 0 | Botan::bigint_monty_redc_4(z_script, p, p_dash, ws); | 34 | 2 | } else if(N == 6) { | 35 | 2 | Botan::bigint_monty_redc_6(z_script, p, p_dash, ws); | 36 | 2 | } else if(N == 8) { | 37 | 0 | Botan::bigint_monty_redc_8(z_script, p, p_dash, ws); | 38 | 0 | } else if(N == 16) { | 39 | 0 | Botan::bigint_monty_redc_16(z_script, p, p_dash, ws); | 40 | 0 | } else if(N == 24) { | 41 | 0 | Botan::bigint_monty_redc_24(z_script, p, p_dash, ws); | 42 | 0 | } else if(N == 32) { | 43 | 0 | Botan::bigint_monty_redc_32(z_script, p, p_dash, ws); | 44 | 0 | } else { | 45 | 0 | std::abort(); | 46 | 0 | } | 47 | | | 48 | 2 | Botan::bigint_monty_redc_generic(z_ref, 2 * N, p, N, p_dash, ws); | 49 | | | 50 | 26 | for(size_t i = 0; i != 2 * N; ++i) { | 51 | 24 | if(z_script[i] != z_ref[i]) { | 52 | 0 | dump_word_vec("input", z, 2 * N); | 53 | 0 | dump_word_vec("z_script", z_script, 2 * N); | 54 | 0 | dump_word_vec("z_ref", z_ref, 2 * N); | 55 | 0 | dump_word_vec("p", p, N); | 56 | 0 | dump_word_vec("p_dash", &p_dash, 1); | 57 | 0 | std::abort(); | 58 | 0 | } | 59 | 24 | } | 60 | 2 | compare_word_vec(z_script, 2 * N, z_ref, 2 * N, "redc generic vs specialized"); | 61 | 2 | } |
mp_redc.cpp:void (anonymous namespace)::fuzz_mp_redc<8ul>(std::__1::span<unsigned char const, 18446744073709551615ul>) Line | Count | Source | 12 | 2 | void fuzz_mp_redc(std::span<const uint8_t> in) { | 13 | 2 | FUZZER_ASSERT_EQUAL(in.size(), (N * 3 + 1) * sizeof(word)); | 14 | | | 15 | 2 | word z[2 * N] = {0}; | 16 | | | 17 | 2 | word z_script[2 * N] = {0}; | 18 | 2 | word z_ref[2 * N] = {0}; | 19 | 2 | word p[N] = {0}; | 20 | 2 | word p_dash = 0; | 21 | | | 22 | 2 | word ws[2 * (N + 1)] = {0}; | 23 | | | 24 | 2 | std::memcpy(z, in.data(), sizeof(z)); | 25 | 2 | std::memcpy(p, in.data() + sizeof(z), sizeof(p)); | 26 | 2 | std::memcpy(&p_dash, in.data() + sizeof(z) + sizeof(p), sizeof(p_dash)); | 27 | | | 28 | 34 | for(size_t i = 0; i != 2 * N; ++i) { | 29 | 32 | z_script[i] = z_ref[i] = z[i]; | 30 | 32 | } | 31 | | | 32 | 2 | if(N == 4) { | 33 | 0 | Botan::bigint_monty_redc_4(z_script, p, p_dash, ws); | 34 | 2 | } else if(N == 6) { | 35 | 0 | Botan::bigint_monty_redc_6(z_script, p, p_dash, ws); | 36 | 2 | } else if(N == 8) { | 37 | 2 | Botan::bigint_monty_redc_8(z_script, p, p_dash, ws); | 38 | 2 | } else if(N == 16) { | 39 | 0 | Botan::bigint_monty_redc_16(z_script, p, p_dash, ws); | 40 | 0 | } else if(N == 24) { | 41 | 0 | Botan::bigint_monty_redc_24(z_script, p, p_dash, ws); | 42 | 0 | } else if(N == 32) { | 43 | 0 | Botan::bigint_monty_redc_32(z_script, p, p_dash, ws); | 44 | 0 | } else { | 45 | 0 | std::abort(); | 46 | 0 | } | 47 | | | 48 | 2 | Botan::bigint_monty_redc_generic(z_ref, 2 * N, p, N, p_dash, ws); | 49 | | | 50 | 34 | for(size_t i = 0; i != 2 * N; ++i) { | 51 | 32 | if(z_script[i] != z_ref[i]) { | 52 | 0 | dump_word_vec("input", z, 2 * N); | 53 | 0 | dump_word_vec("z_script", z_script, 2 * N); | 54 | 0 | dump_word_vec("z_ref", z_ref, 2 * N); | 55 | 0 | dump_word_vec("p", p, N); | 56 | 0 | dump_word_vec("p_dash", &p_dash, 1); | 57 | 0 | std::abort(); | 58 | 0 | } | 59 | 32 | } | 60 | 2 | compare_word_vec(z_script, 2 * N, z_ref, 2 * N, "redc generic vs specialized"); | 61 | 2 | } |
mp_redc.cpp:void (anonymous namespace)::fuzz_mp_redc<16ul>(std::__1::span<unsigned char const, 18446744073709551615ul>) Line | Count | Source | 12 | 2 | void fuzz_mp_redc(std::span<const uint8_t> in) { | 13 | 2 | FUZZER_ASSERT_EQUAL(in.size(), (N * 3 + 1) * sizeof(word)); | 14 | | | 15 | 2 | word z[2 * N] = {0}; | 16 | | | 17 | 2 | word z_script[2 * N] = {0}; | 18 | 2 | word z_ref[2 * N] = {0}; | 19 | 2 | word p[N] = {0}; | 20 | 2 | word p_dash = 0; | 21 | | | 22 | 2 | word ws[2 * (N + 1)] = {0}; | 23 | | | 24 | 2 | std::memcpy(z, in.data(), sizeof(z)); | 25 | 2 | std::memcpy(p, in.data() + sizeof(z), sizeof(p)); | 26 | 2 | std::memcpy(&p_dash, in.data() + sizeof(z) + sizeof(p), sizeof(p_dash)); | 27 | | | 28 | 66 | for(size_t i = 0; i != 2 * N; ++i) { | 29 | 64 | z_script[i] = z_ref[i] = z[i]; | 30 | 64 | } | 31 | | | 32 | 2 | if(N == 4) { | 33 | 0 | Botan::bigint_monty_redc_4(z_script, p, p_dash, ws); | 34 | 2 | } else if(N == 6) { | 35 | 0 | Botan::bigint_monty_redc_6(z_script, p, p_dash, ws); | 36 | 2 | } else if(N == 8) { | 37 | 0 | Botan::bigint_monty_redc_8(z_script, p, p_dash, ws); | 38 | 2 | } else if(N == 16) { | 39 | 2 | Botan::bigint_monty_redc_16(z_script, p, p_dash, ws); | 40 | 2 | } else if(N == 24) { | 41 | 0 | Botan::bigint_monty_redc_24(z_script, p, p_dash, ws); | 42 | 0 | } else if(N == 32) { | 43 | 0 | Botan::bigint_monty_redc_32(z_script, p, p_dash, ws); | 44 | 0 | } else { | 45 | 0 | std::abort(); | 46 | 0 | } | 47 | | | 48 | 2 | Botan::bigint_monty_redc_generic(z_ref, 2 * N, p, N, p_dash, ws); | 49 | | | 50 | 66 | for(size_t i = 0; i != 2 * N; ++i) { | 51 | 64 | if(z_script[i] != z_ref[i]) { | 52 | 0 | dump_word_vec("input", z, 2 * N); | 53 | 0 | dump_word_vec("z_script", z_script, 2 * N); | 54 | 0 | dump_word_vec("z_ref", z_ref, 2 * N); | 55 | 0 | dump_word_vec("p", p, N); | 56 | 0 | dump_word_vec("p_dash", &p_dash, 1); | 57 | 0 | std::abort(); | 58 | 0 | } | 59 | 64 | } | 60 | 2 | compare_word_vec(z_script, 2 * N, z_ref, 2 * N, "redc generic vs specialized"); | 61 | 2 | } |
mp_redc.cpp:void (anonymous namespace)::fuzz_mp_redc<24ul>(std::__1::span<unsigned char const, 18446744073709551615ul>) Line | Count | Source | 12 | 2 | void fuzz_mp_redc(std::span<const uint8_t> in) { | 13 | 2 | FUZZER_ASSERT_EQUAL(in.size(), (N * 3 + 1) * sizeof(word)); | 14 | | | 15 | 2 | word z[2 * N] = {0}; | 16 | | | 17 | 2 | word z_script[2 * N] = {0}; | 18 | 2 | word z_ref[2 * N] = {0}; | 19 | 2 | word p[N] = {0}; | 20 | 2 | word p_dash = 0; | 21 | | | 22 | 2 | word ws[2 * (N + 1)] = {0}; | 23 | | | 24 | 2 | std::memcpy(z, in.data(), sizeof(z)); | 25 | 2 | std::memcpy(p, in.data() + sizeof(z), sizeof(p)); | 26 | 2 | std::memcpy(&p_dash, in.data() + sizeof(z) + sizeof(p), sizeof(p_dash)); | 27 | | | 28 | 98 | for(size_t i = 0; i != 2 * N; ++i) { | 29 | 96 | z_script[i] = z_ref[i] = z[i]; | 30 | 96 | } | 31 | | | 32 | 2 | if(N == 4) { | 33 | 0 | Botan::bigint_monty_redc_4(z_script, p, p_dash, ws); | 34 | 2 | } else if(N == 6) { | 35 | 0 | Botan::bigint_monty_redc_6(z_script, p, p_dash, ws); | 36 | 2 | } else if(N == 8) { | 37 | 0 | Botan::bigint_monty_redc_8(z_script, p, p_dash, ws); | 38 | 2 | } else if(N == 16) { | 39 | 0 | Botan::bigint_monty_redc_16(z_script, p, p_dash, ws); | 40 | 2 | } else if(N == 24) { | 41 | 2 | Botan::bigint_monty_redc_24(z_script, p, p_dash, ws); | 42 | 2 | } else if(N == 32) { | 43 | 0 | Botan::bigint_monty_redc_32(z_script, p, p_dash, ws); | 44 | 0 | } else { | 45 | 0 | std::abort(); | 46 | 0 | } | 47 | | | 48 | 2 | Botan::bigint_monty_redc_generic(z_ref, 2 * N, p, N, p_dash, ws); | 49 | | | 50 | 98 | for(size_t i = 0; i != 2 * N; ++i) { | 51 | 96 | if(z_script[i] != z_ref[i]) { | 52 | 0 | dump_word_vec("input", z, 2 * N); | 53 | 0 | dump_word_vec("z_script", z_script, 2 * N); | 54 | 0 | dump_word_vec("z_ref", z_ref, 2 * N); | 55 | 0 | dump_word_vec("p", p, N); | 56 | 0 | dump_word_vec("p_dash", &p_dash, 1); | 57 | 0 | std::abort(); | 58 | 0 | } | 59 | 96 | } | 60 | 2 | compare_word_vec(z_script, 2 * N, z_ref, 2 * N, "redc generic vs specialized"); | 61 | 2 | } |
mp_redc.cpp:void (anonymous namespace)::fuzz_mp_redc<32ul>(std::__1::span<unsigned char const, 18446744073709551615ul>) Line | Count | Source | 12 | 2 | void fuzz_mp_redc(std::span<const uint8_t> in) { | 13 | 2 | FUZZER_ASSERT_EQUAL(in.size(), (N * 3 + 1) * sizeof(word)); | 14 | | | 15 | 2 | word z[2 * N] = {0}; | 16 | | | 17 | 2 | word z_script[2 * N] = {0}; | 18 | 2 | word z_ref[2 * N] = {0}; | 19 | 2 | word p[N] = {0}; | 20 | 2 | word p_dash = 0; | 21 | | | 22 | 2 | word ws[2 * (N + 1)] = {0}; | 23 | | | 24 | 2 | std::memcpy(z, in.data(), sizeof(z)); | 25 | 2 | std::memcpy(p, in.data() + sizeof(z), sizeof(p)); | 26 | 2 | std::memcpy(&p_dash, in.data() + sizeof(z) + sizeof(p), sizeof(p_dash)); | 27 | | | 28 | 130 | for(size_t i = 0; i != 2 * N; ++i) { | 29 | 128 | z_script[i] = z_ref[i] = z[i]; | 30 | 128 | } | 31 | | | 32 | 2 | if(N == 4) { | 33 | 0 | Botan::bigint_monty_redc_4(z_script, p, p_dash, ws); | 34 | 2 | } else if(N == 6) { | 35 | 0 | Botan::bigint_monty_redc_6(z_script, p, p_dash, ws); | 36 | 2 | } else if(N == 8) { | 37 | 0 | Botan::bigint_monty_redc_8(z_script, p, p_dash, ws); | 38 | 2 | } else if(N == 16) { | 39 | 0 | Botan::bigint_monty_redc_16(z_script, p, p_dash, ws); | 40 | 2 | } else if(N == 24) { | 41 | 0 | Botan::bigint_monty_redc_24(z_script, p, p_dash, ws); | 42 | 2 | } else if(N == 32) { | 43 | 2 | Botan::bigint_monty_redc_32(z_script, p, p_dash, ws); | 44 | 2 | } else { | 45 | 0 | std::abort(); | 46 | 0 | } | 47 | | | 48 | 2 | Botan::bigint_monty_redc_generic(z_ref, 2 * N, p, N, p_dash, ws); | 49 | | | 50 | 130 | for(size_t i = 0; i != 2 * N; ++i) { | 51 | 128 | if(z_script[i] != z_ref[i]) { | 52 | 0 | dump_word_vec("input", z, 2 * N); | 53 | 0 | dump_word_vec("z_script", z_script, 2 * N); | 54 | 0 | dump_word_vec("z_ref", z_ref, 2 * N); | 55 | 0 | dump_word_vec("p", p, N); | 56 | 0 | dump_word_vec("p_dash", &p_dash, 1); | 57 | 0 | std::abort(); | 58 | 0 | } | 59 | 128 | } | 60 | 2 | compare_word_vec(z_script, 2 * N, z_ref, 2 * N, "redc generic vs specialized"); | 61 | 2 | } |
|