• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

randombit / botan / 13210394651

08 Feb 2025 12:33AM UTC coverage: 91.656% (-0.006%) from 91.662%
13210394651

push

github

web-flow
Merge pull request #4642 from randombit/jack/target-info-header

Add internal target_info.h header

94837 of 103471 relevant lines covered (91.66%)

11243945.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.33
/src/fuzzer/ressol.cpp
1
/*
2
* (C) 2015,2016 Jack Lloyd
3
*
4
* Botan is released under the Simplified BSD License (see license.txt)
5
*/
6

7
#include "fuzzers.h"
8

9
#include <botan/numthry.h>
10
#include <botan/reducer.h>
11

12
void fuzz(std::span<const uint8_t> in) {
1,000✔
13
   // Ressol is mostly used for ECC point decompression so best to test smaller sizes
14
   static const size_t p_bits = 256;
1,000✔
15
   static const Botan::BigInt p = random_prime(fuzzer_rng(), p_bits);
1,000✔
16
   static const Botan::Modular_Reducer mod_p(p);
1,000✔
17

18
   if(in.size() > p_bits / 8) {
1,000✔
19
      return;
20
   }
21

22
   try {
33✔
23
      const Botan::BigInt a = Botan::BigInt::from_bytes(in);
33✔
24
      Botan::BigInt a_sqrt = Botan::sqrt_modulo_prime(a, p);
33✔
25

26
      if(a_sqrt > 0) {
33✔
27
         const Botan::BigInt a_redc = mod_p.reduce(a);
13✔
28
         const Botan::BigInt z = mod_p.square(a_sqrt);
13✔
29

30
         if(z != a_redc) {
13✔
31
            FUZZER_WRITE_AND_CRASH("A = " << a.to_hex_string() << "\n"
×
32
                                          << "P = " << p.to_hex_string() << "\n"
33
                                          << "R = " << a_sqrt.to_hex_string() << "\n"
34
                                          << "Z = " << z.to_hex_string() << "\n");
35
         }
36
      }
13✔
37
   } catch(Botan::Exception& e) {}
33✔
38
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc