_ZN5Botan15AlignmentBufferIhLm128ELNS_25AlignmentBufferFinalBlockE0EEC2Ev:
   62|  4.26k|      AlignmentBuffer() = default;
_ZN5Botan15AlignmentBufferIhLm128ELNS_25AlignmentBufferFinalBlockE0EE5clearEv:
   71|  80.9k|      void clear() {
   72|  80.9k|         zeroize_buffer(m_buffer.data(), m_buffer.size());
   73|  80.9k|         m_position = 0;
   74|  80.9k|      }
_ZN5Botan15AlignmentBufferIhLm128ELNS_25AlignmentBufferFinalBlockE0EED2Ev:
   64|  4.26k|      ~AlignmentBuffer() { secure_zeroize_buffer(m_buffer.data(), sizeof(T) * m_buffer.size()); }
_ZN5Botan15AlignmentBufferIhLm128ELNS_25AlignmentBufferFinalBlockE0EE21handle_unaligned_dataERNS_12BufferSlicerE:
  166|   157k|      [[nodiscard]] std::optional<std::span<const T>> handle_unaligned_data(BufferSlicer& slicer) {
  167|       |         // When the final block is to be deferred, we would need to store and
  168|       |         // hold a buffer that contains exactly one block until more data is
  169|       |         // passed or it is explicitly consumed.
  170|   157k|         const size_t defer = (defers_final_block()) ? 1 : 0;
  ------------------
  |  Branch (170:31): [True: 0, False: 157k]
  ------------------
  171|       |
  172|   157k|         if(in_alignment() && slicer.remaining() >= m_buffer.size() + defer) {
  ------------------
  |  Branch (172:13): [True: 136k, False: 21.3k]
  |  Branch (172:31): [True: 76.6k, False: 59.6k]
  ------------------
  173|       |            // We are currently in alignment and the passed-in data source
  174|       |            // contains enough data to benefit from aligned processing.
  175|       |            // Therefore, we don't copy anything into the intermittent buffer.
  176|  76.6k|            return std::nullopt;
  177|  76.6k|         }
  178|       |
  179|       |         // Fill the buffer with as much input data as needed to reach alignment
  180|       |         // or until the input source is depleted.
  181|  80.9k|         const auto elements_to_consume = std::min(m_buffer.size() - m_position, slicer.remaining());
  182|  80.9k|         append(slicer.take(elements_to_consume));
  183|       |
  184|       |         // If we collected enough data, we push out one full block. When
  185|       |         // deferring the final block is enabled, we additionally check that
  186|       |         // more input data is available to continue processing a consecutive
  187|       |         // block.
  188|  80.9k|         if(ready_to_consume() && (!defers_final_block() || !slicer.empty())) {
  ------------------
  |  Branch (188:13): [True: 0, False: 80.9k]
  |  Branch (188:36): [True: 0, False: 0]
  |  Branch (188:61): [True: 0, False: 0]
  ------------------
  189|      0|            return consume();
  190|  80.9k|         } else {
  191|  80.9k|            return std::nullopt;
  192|  80.9k|         }
  193|  80.9k|      }
_ZNK5Botan15AlignmentBufferIhLm128ELNS_25AlignmentBufferFinalBlockE0EE18defers_final_blockEv:
  233|   234k|      constexpr bool defers_final_block() const {
  234|   234k|         return FINAL_BLOCK_STRATEGY == AlignmentBufferFinalBlock::must_be_deferred;
  235|   234k|      }
_ZN5Botan15AlignmentBufferIhLm128ELNS_25AlignmentBufferFinalBlockE0EE6appendENSt3__14spanIKhLm18446744073709551615EEE:
   90|   140k|      void append(std::span<const T> elements) {
   91|   140k|         BOTAN_ASSERT_NOMSG(elements.size() <= elements_until_alignment());
  ------------------
  |  |   77|   140k|   do {                                                                     \
  |  |   78|   140k|      /* NOLINTNEXTLINE(*-simplify-boolean-expr) */                         \
  |  |   79|   140k|      if(!(expr)) {                                                         \
  |  |  ------------------
  |  |  |  Branch (79:10): [True: 0, False: 140k]
  |  |  ------------------
  |  |   80|      0|         /* NOLINTNEXTLINE(bugprone-lambda-function-name) */                \
  |  |   81|      0|         Botan::assertion_failure(#expr, "", __func__, __FILE__, __LINE__); \
  |  |   82|      0|      }                                                                     \
  |  |   83|   140k|   } while(0)
  |  |  ------------------
  |  |  |  Branch (83:12): [Folded, False: 140k]
  |  |  ------------------
  ------------------
   92|   140k|         std::copy(elements.begin(), elements.end(), m_buffer.begin() + m_position);
   93|   140k|         m_position += elements.size();
   94|   140k|      }
_ZNK5Botan15AlignmentBufferIhLm128ELNS_25AlignmentBufferFinalBlockE0EE24elements_until_alignmentEv:
  221|   319k|      size_t elements_until_alignment() const { return m_buffer.size() - m_position; }
_ZNK5Botan15AlignmentBufferIhLm128ELNS_25AlignmentBufferFinalBlockE0EE16ready_to_consumeEv:
  231|   259k|      bool ready_to_consume() const { return m_position == m_buffer.size(); }
_ZN5Botan15AlignmentBufferIhLm128ELNS_25AlignmentBufferFinalBlockE0EE7consumeEv:
  200|  59.6k|      [[nodiscard]] std::span<const T> consume() {
  201|  59.6k|         BOTAN_ASSERT_NOMSG(ready_to_consume());
  ------------------
  |  |   77|  59.6k|   do {                                                                     \
  |  |   78|  59.6k|      /* NOLINTNEXTLINE(*-simplify-boolean-expr) */                         \
  |  |   79|  59.6k|      if(!(expr)) {                                                         \
  |  |  ------------------
  |  |  |  Branch (79:10): [True: 0, False: 59.6k]
  |  |  ------------------
  |  |   80|      0|         /* NOLINTNEXTLINE(bugprone-lambda-function-name) */                \
  |  |   81|      0|         Botan::assertion_failure(#expr, "", __func__, __FILE__, __LINE__); \
  |  |   82|      0|      }                                                                     \
  |  |   83|  59.6k|   } while(0)
  |  |  ------------------
  |  |  |  Branch (83:12): [Folded, False: 59.6k]
  |  |  ------------------
  ------------------
  202|  59.6k|         m_position = 0;
  203|  59.6k|         return m_buffer;
  204|  59.6k|      }
_ZNK5Botan15AlignmentBufferIhLm128ELNS_25AlignmentBufferFinalBlockE0EE12in_alignmentEv:
  226|   392k|      bool in_alignment() const { return m_position == 0; }
_ZNK5Botan15AlignmentBufferIhLm128ELNS_25AlignmentBufferFinalBlockE0EE23aligned_data_to_processERNS_12BufferSlicerE:
  126|  76.6k|      [[nodiscard]] std::tuple<std::span<const uint8_t>, size_t> aligned_data_to_process(BufferSlicer& slicer) const {
  127|  76.6k|         BOTAN_ASSERT_NOMSG(in_alignment());
  ------------------
  |  |   77|  76.6k|   do {                                                                     \
  |  |   78|  76.6k|      /* NOLINTNEXTLINE(*-simplify-boolean-expr) */                         \
  |  |   79|  76.6k|      if(!(expr)) {                                                         \
  |  |  ------------------
  |  |  |  Branch (79:10): [True: 0, False: 76.6k]
  |  |  ------------------
  |  |   80|      0|         /* NOLINTNEXTLINE(bugprone-lambda-function-name) */                \
  |  |   81|      0|         Botan::assertion_failure(#expr, "", __func__, __FILE__, __LINE__); \
  |  |   82|      0|      }                                                                     \
  |  |   83|  76.6k|   } while(0)
  |  |  ------------------
  |  |  |  Branch (83:12): [Folded, False: 76.6k]
  |  |  ------------------
  ------------------
  128|       |
  129|       |         // When the final block is to be deferred, the last block must not be
  130|       |         // selected for processing if there is no (unaligned) extra input data.
  131|  76.6k|         const size_t defer = (defers_final_block()) ? 1 : 0;
  ------------------
  |  Branch (131:31): [True: 0, False: 76.6k]
  ------------------
  132|  76.6k|         const size_t full_blocks_to_process = (slicer.remaining() - defer) / m_buffer.size();
  133|  76.6k|         return {slicer.take(full_blocks_to_process * m_buffer.size()), full_blocks_to_process};
  134|  76.6k|      }
_ZN5Botan15AlignmentBufferIhLm128ELNS_25AlignmentBufferFinalBlockE0EE18fill_up_with_zerosEv:
   79|  59.6k|      void fill_up_with_zeros() {
   80|  59.6k|         if(!ready_to_consume()) {
  ------------------
  |  Branch (80:13): [True: 59.6k, False: 0]
  ------------------
   81|  59.6k|            zeroize_buffer(&m_buffer[m_position], elements_until_alignment());
   82|  59.6k|            m_position = m_buffer.size();
   83|  59.6k|         }
   84|  59.6k|      }
_ZN5Botan15AlignmentBufferIhLm128ELNS_25AlignmentBufferFinalBlockE0EE20directly_modify_lastEm:
  113|  59.6k|      std::span<T> directly_modify_last(size_t elements) {
  114|  59.6k|         BOTAN_ASSERT_NOMSG(size() >= elements);
  ------------------
  |  |   77|  59.6k|   do {                                                                     \
  |  |   78|  59.6k|      /* NOLINTNEXTLINE(*-simplify-boolean-expr) */                         \
  |  |   79|  59.6k|      if(!(expr)) {                                                         \
  |  |  ------------------
  |  |  |  Branch (79:10): [True: 0, False: 59.6k]
  |  |  ------------------
  |  |   80|      0|         /* NOLINTNEXTLINE(bugprone-lambda-function-name) */                \
  |  |   81|      0|         Botan::assertion_failure(#expr, "", __func__, __FILE__, __LINE__); \
  |  |   82|      0|      }                                                                     \
  |  |   83|  59.6k|   } while(0)
  |  |  ------------------
  |  |  |  Branch (83:12): [Folded, False: 59.6k]
  |  |  ------------------
  ------------------
  115|  59.6k|         return std::span(m_buffer).last(elements);
  116|  59.6k|      }
_ZNK5Botan15AlignmentBufferIhLm128ELNS_25AlignmentBufferFinalBlockE0EE4sizeEv:
  217|  59.6k|      constexpr size_t size() const { return m_buffer.size(); }

_ZN5Botan6chooseITkNSt3__117unsigned_integralEmEET_S2_S2_S2_:
  216|  21.8M|BOTAN_FORCE_INLINE constexpr T choose(T mask, T a, T b) {
  217|       |   //return (mask & a) | (~mask & b);
  218|  21.8M|   return (b ^ (mask & (a ^ b)));
  219|  21.8M|}
_ZN5Botan8majorityITkNSt3__117unsigned_integralEmEET_S2_S2_S2_:
  222|  10.9M|BOTAN_FORCE_INLINE constexpr T majority(T a, T b, T c) {
  223|       |   /*
  224|       |   Considering each bit of a, b, c individually
  225|       |
  226|       |   If a xor b is set, then c is the deciding vote.
  227|       |
  228|       |   If a xor b is not set then either a and b are both set or both unset.
  229|       |   In either case the value of c doesn't matter, and examining b (or a)
  230|       |   allows us to determine which case we are in.
  231|       |   */
  232|  10.9M|   return choose(a ^ b, c, b);
  233|  10.9M|}

_ZN5Botan13reverse_bytesITkNSt3__117unsigned_integralEmQooooooeqstT_Li1EeqstS2_Li2EeqstS2_Li4EeqstS2_Li8EEES2_S2_:
   27|  2.71M|inline constexpr T reverse_bytes(T x) {
   28|       |   if constexpr(sizeof(T) == 1) {
   29|       |      return x;
   30|       |   } else if constexpr(sizeof(T) == 2) {
   31|       |#if BOTAN_COMPILER_HAS_BUILTIN(__builtin_bswap16)
   32|       |      return static_cast<T>(__builtin_bswap16(x));
   33|       |#else
   34|       |      return static_cast<T>((x << 8) | (x >> 8));
   35|       |#endif
   36|       |   } else if constexpr(sizeof(T) == 4) {
   37|       |#if BOTAN_COMPILER_HAS_BUILTIN(__builtin_bswap32)
   38|       |      return static_cast<T>(__builtin_bswap32(x));
   39|       |#else
   40|       |      // MSVC at least recognizes this as a bswap
   41|       |      return static_cast<T>(((x & 0x000000FF) << 24) | ((x & 0x0000FF00) << 8) | ((x & 0x00FF0000) >> 8) |
   42|       |                            ((x & 0xFF000000) >> 24));
   43|       |#endif
   44|  2.71M|   } else if constexpr(sizeof(T) == 8) {
   45|  2.71M|#if BOTAN_COMPILER_HAS_BUILTIN(__builtin_bswap64)
   46|  2.71M|      return static_cast<T>(__builtin_bswap64(x));
   47|       |#else
   48|       |      uint32_t hi = static_cast<uint32_t>(x >> 32);
   49|       |      uint32_t lo = static_cast<uint32_t>(x);
   50|       |
   51|       |      hi = reverse_bytes(hi);
   52|       |      lo = reverse_bytes(lo);
   53|       |
   54|       |      return (static_cast<T>(lo) << 32) | hi;
   55|       |#endif
   56|  2.71M|   }
   57|  2.71M|}

_ZN5Botan12BufferSlicerC2ENSt3__14spanIKhLm18446744073709551615EEE:
   25|   294k|      explicit BufferSlicer(std::span<const uint8_t> buffer) : m_remaining(buffer) {}
_ZNK5Botan12BufferSlicer5emptyEv:
   68|   315k|      bool empty() const { return m_remaining.empty(); }
_ZN5Botan12BufferSlicer4takeEm:
   37|   157k|      std::span<const uint8_t> take(const size_t count) {
   38|   157k|         BOTAN_STATE_CHECK(remaining() >= count);
  ------------------
  |  |   51|   157k|   do {                                                         \
  |  |   52|   157k|      /* NOLINTNEXTLINE(*-simplify-boolean-expr) */             \
  |  |   53|   157k|      if(!(expr)) {                                             \
  |  |  ------------------
  |  |  |  Branch (53:10): [True: 0, False: 157k]
  |  |  ------------------
  |  |   54|      0|         /* NOLINTNEXTLINE(bugprone-lambda-function-name) */    \
  |  |   55|      0|         Botan::throw_invalid_state(#expr, __func__, __FILE__); \
  |  |   56|      0|      }                                                         \
  |  |   57|   157k|   } while(0)
  |  |  ------------------
  |  |  |  Branch (57:12): [Folded, False: 157k]
  |  |  ------------------
  ------------------
   39|   157k|         auto result = m_remaining.first(count);
   40|   157k|         m_remaining = m_remaining.subspan(count);
   41|   157k|         return result;
   42|   157k|      }
_ZNK5Botan12BufferSlicer9remainingEv:
   66|   588k|      size_t remaining() const { return m_remaining.size(); }
_ZN5Botan12BufferSlicer4takeILm128EEENSt3__14spanIKhXT_EEEv:
   45|   136k|      std::span<const uint8_t, count> take() {
   46|   136k|         BOTAN_STATE_CHECK(remaining() >= count);
  ------------------
  |  |   51|   136k|   do {                                                         \
  |  |   52|   136k|      /* NOLINTNEXTLINE(*-simplify-boolean-expr) */             \
  |  |   53|   136k|      if(!(expr)) {                                             \
  |  |  ------------------
  |  |  |  Branch (53:10): [True: 0, False: 136k]
  |  |  ------------------
  |  |   54|      0|         /* NOLINTNEXTLINE(bugprone-lambda-function-name) */    \
  |  |   55|      0|         Botan::throw_invalid_state(#expr, __func__, __FILE__); \
  |  |   56|      0|      }                                                         \
  |  |   57|   136k|   } while(0)
  |  |  ------------------
  |  |  |  Branch (57:12): [Folded, False: 136k]
  |  |  ------------------
  ------------------
   47|   136k|         auto result = m_remaining.first<count>();
   48|   136k|         m_remaining = m_remaining.subspan(count);
   49|   136k|         return result;
   50|   136k|      }

_ZN16botan_rng_structC2ENSt3__110unique_ptrIN5Botan21RandomNumberGeneratorENS0_14default_deleteIS3_EEEE:
   63|  4.26k|         explicit NAME(std::unique_ptr<TYPE> x) : botan_struct(std::move(x)) {} \
_ZNK9Botan_FFI12botan_structIN5Botan21RandomNumberGeneratorELj1224866241EE8magic_okEv:
   50|  4.26k|      bool magic_ok() const { return (m_magic == MAGIC); }
ffi_rng.cpp:_ZN9Botan_FFI15ffi_guard_thunkITkNSt3__19invocableEZ14botan_rng_initE3$_0EEiPKcT_:
   95|  4.26k|int ffi_guard_thunk(const char* func_name, T thunk) {
   96|  4.26k|   ffi_clear_last_exception();
   97|       |
   98|  4.26k|   try {
   99|  4.26k|      return thunk();
  100|  4.26k|   } catch(std::bad_alloc&) {
  101|      0|      return ffi_error_exception_thrown(func_name, "bad_alloc", BOTAN_FFI_ERROR_OUT_OF_MEMORY);
  102|      0|   } catch(Botan_FFI::FFI_Error& e) {
  103|      0|      return ffi_error_exception_thrown(func_name, e.what(), e.error_code());
  104|      0|   } catch(Botan::Exception& e) {
  105|      0|      return ffi_error_exception_thrown(func_name, e.what(), e.error_type());
  106|      0|   } catch(std::exception& e) {
  107|      0|      return ffi_error_exception_thrown(func_name, e.what(), BOTAN_FFI_ERROR_EXCEPTION_THROWN);
  108|      0|   } catch(...) {
  109|      0|      return ffi_error_exception_thrown(func_name, "unknown exception", BOTAN_FFI_ERROR_EXCEPTION_THROWN);
  110|      0|   }
  111|  4.26k|}
_ZN9Botan_FFI14ffi_new_objectIP16botan_rng_structJNSt3__110unique_ptrIN5Botan21RandomNumberGeneratorENS3_14default_deleteIS6_EEEEEEE15BOTAN_FFI_ERRORPT_DpOT0_:
  178|  4.26k|BOTAN_FFI_ERROR ffi_new_object(T* obj, Args&&... args) {
  179|  4.26k|   if(obj == nullptr) {
  ------------------
  |  Branch (179:7): [True: 0, False: 4.26k]
  ------------------
  180|      0|      return BOTAN_FFI_ERROR_NULL_POINTER;
  181|      0|   }
  182|       |   // NOLINTNEXTLINE(*-owning-memory)
  183|  4.26k|   *obj = new std::remove_pointer_t<T>(std::forward<Args>(args)...);
  184|  4.26k|   return BOTAN_FFI_SUCCESS;
  185|  4.26k|}
_ZN9Botan_FFI12botan_structIN5Botan21RandomNumberGeneratorELj1224866241EEC2ENSt3__110unique_ptrIS2_NS4_14default_deleteIS2_EEEE:
   38|  4.26k|      explicit botan_struct(std::unique_ptr<T> obj) : m_magic(MAGIC), m_obj(std::move(obj)) {}
_ZN9Botan_FFI12botan_structIN5Botan21RandomNumberGeneratorELj1224866241EED2Ev:
   40|  4.26k|      virtual ~botan_struct() {
   41|  4.26k|         m_magic = 0;
   42|  4.26k|         m_obj.reset();  // NOLINT(*-ambiguous-smartptr-reset-call)
   43|  4.26k|      }
_ZN9Botan_FFI17ffi_delete_objectIN5Botan21RandomNumberGeneratorELj1224866241EEEiPNS_12botan_structIT_XT0_EEEPKc:
  161|  4.26k|int ffi_delete_object(botan_struct<T, M>* obj, const char* func_name) {
  162|  4.26k|   return ffi_guard_thunk(func_name, [=]() -> int {
  163|       |      // ignore delete of null objects
  164|  4.26k|      if(obj == nullptr) {
  165|  4.26k|         return BOTAN_FFI_SUCCESS;
  166|  4.26k|      }
  167|       |
  168|  4.26k|      if(!obj->magic_ok()) {
  169|  4.26k|         return BOTAN_FFI_ERROR_INVALID_OBJECT;
  170|  4.26k|      }
  171|       |
  172|  4.26k|      delete obj;  // NOLINT(*-owning-memory)
  173|  4.26k|      return BOTAN_FFI_SUCCESS;
  174|  4.26k|   });
  175|  4.26k|}
_ZN9Botan_FFI15ffi_guard_thunkITkNSt3__19invocableEZNS_17ffi_delete_objectIN5Botan21RandomNumberGeneratorELj1224866241EEEiPNS_12botan_structIT_XT0_EEEPKcEUlvE_EEiSA_S6_:
   95|  4.26k|int ffi_guard_thunk(const char* func_name, T thunk) {
   96|  4.26k|   ffi_clear_last_exception();
   97|       |
   98|  4.26k|   try {
   99|  4.26k|      return thunk();
  100|  4.26k|   } catch(std::bad_alloc&) {
  101|      0|      return ffi_error_exception_thrown(func_name, "bad_alloc", BOTAN_FFI_ERROR_OUT_OF_MEMORY);
  102|      0|   } catch(Botan_FFI::FFI_Error& e) {
  103|      0|      return ffi_error_exception_thrown(func_name, e.what(), e.error_code());
  104|      0|   } catch(Botan::Exception& e) {
  105|      0|      return ffi_error_exception_thrown(func_name, e.what(), e.error_type());
  106|      0|   } catch(std::exception& e) {
  107|      0|      return ffi_error_exception_thrown(func_name, e.what(), BOTAN_FFI_ERROR_EXCEPTION_THROWN);
  108|      0|   } catch(...) {
  109|      0|      return ffi_error_exception_thrown(func_name, "unknown exception", BOTAN_FFI_ERROR_EXCEPTION_THROWN);
  110|      0|   }
  111|  4.26k|}
_ZZN9Botan_FFI17ffi_delete_objectIN5Botan21RandomNumberGeneratorELj1224866241EEEiPNS_12botan_structIT_XT0_EEEPKcENKUlvE_clEv:
  162|  4.26k|   return ffi_guard_thunk(func_name, [=]() -> int {
  163|       |      // ignore delete of null objects
  164|  4.26k|      if(obj == nullptr) {
  ------------------
  |  Branch (164:10): [True: 0, False: 4.26k]
  ------------------
  165|      0|         return BOTAN_FFI_SUCCESS;
  166|      0|      }
  167|       |
  168|  4.26k|      if(!obj->magic_ok()) {
  ------------------
  |  Branch (168:10): [True: 0, False: 4.26k]
  ------------------
  169|      0|         return BOTAN_FFI_ERROR_INVALID_OBJECT;
  170|      0|      }
  171|       |
  172|  4.26k|      delete obj;  // NOLINT(*-owning-memory)
  173|  4.26k|      return BOTAN_FFI_SUCCESS;
  174|  4.26k|   });

_ZN5Botan11checked_mulITkNSt3__117unsigned_integralEmEENS1_8optionalIT_EES3_S3_:
   46|  25.5k|constexpr inline std::optional<T> checked_mul(T a, T b) {
   47|       |   // Multiplication by 1U is a hack to work around C's insane
   48|       |   // integer promotion rules.
   49|       |   // https://stackoverflow.com/questions/24795651
   50|  25.5k|   const T r = (1U * a) * b;
   51|       |   // If a == 0 then the multiply certainly did not overflow
   52|       |   // Otherwise r / a == b unless overflow occurred
   53|  25.5k|   if(a != 0 && r / a != b) {
  ------------------
  |  Branch (53:7): [True: 25.5k, False: 0]
  |  Branch (53:17): [True: 0, False: 25.5k]
  ------------------
   54|      0|      return {};
   55|      0|   }
   56|  25.5k|   return r;
   57|  25.5k|}

_ZN5Botan6detail9store_anyILNSt3__16endianE64206ENS0_10AutoDetectETkNS0_20unsigned_integralishEmQoosr3stdE7same_asIS4_T0_Esr3stdE7same_asIT1_S5_EEEvS6_Ph:
  711|  59.6k|inline constexpr void store_any(T in, uint8_t out[]) {
  712|       |   // asserts that *out points to enough bytes to write into
  713|  59.6k|   store_any<endianness, InT>(in, std::span<uint8_t, sizeof(T)>(out, sizeof(T)));
  714|  59.6k|}
_ZN5Botan6detail9store_anyILNSt3__16endianE64206ENS0_10AutoDetectETkNS0_20unsigned_integralishEmTkNS_6ranges23contiguous_output_rangeIhEENS2_4spanIhLm8EEEQsr3stdE7same_asIS4_T0_EEEvT1_OT2_:
  646|  59.6k|inline constexpr void store_any(T in, OutR&& out_range) {
  647|  59.6k|   store_any<endianness, T>(in, std::forward<OutR>(out_range));
  648|  59.6k|}
_ZN5Botan6detail9store_anyILNSt3__16endianE64206ETkNS0_20unsigned_integralishEmTkNS_6ranges23contiguous_output_rangeIhEENS2_4spanIhLm8EEEQnt15custom_storableINS0_19wrapped_type_helperIu14__remove_cvrefIT0_EE4typeEEEEvS9_OT1_:
  525|   536k|inline constexpr void store_any(WrappedInT wrapped_in, OutR&& out_range) {
  526|   536k|   const auto in = detail::unwrap_strong_type_or_enum(wrapped_in);
  527|   536k|   using InT = decltype(in);
  528|   536k|   ranges::assert_exact_byte_length<sizeof(in)>(out_range);
  529|   536k|   const std::span out{out_range};
  530|       |
  531|       |   // At compile time we cannot use `typecast_copy` as it uses `std::memcpy`
  532|       |   // internally to copy ranges on a byte-by-byte basis, which is not allowed
  533|       |   // in a `constexpr` context.
  534|   536k|   if(std::is_constant_evaluated()) /* TODO: C++23: if consteval {} */ {
  ------------------
  |  Branch (534:7): [Folded, False: 536k]
  ------------------
  535|      0|      return fallback_store_any<endianness, InT>(in, std::forward<OutR>(out_range));
  536|   536k|   } else {
  537|       |      if constexpr(sizeof(InT) == 1) {
  538|       |         out[0] = static_cast<uint8_t>(in);
  539|       |      } else if constexpr(endianness == std::endian::native) {
  540|       |         typecast_copy(out, in);
  541|   536k|      } else {
  542|   536k|         static_assert(opposite(endianness) == std::endian::native);
  543|   536k|         typecast_copy(out, reverse_bytes(in));
  544|   536k|      }
  545|   536k|   }
  546|   536k|}
_ZN5Botan6detail26unwrap_strong_type_or_enumITkNS0_20unsigned_integralishEmEEDaT_:
  190|   536k|constexpr auto unwrap_strong_type_or_enum(InT t) {
  191|       |   if constexpr(std::is_enum_v<InT>) {
  192|       |      // TODO: C++23: use std::to_underlying(in) instead
  193|       |      return static_cast<std::underlying_type_t<InT>>(t);
  194|   536k|   } else {
  195|   536k|      return Botan::unwrap_strong_type(t);
  196|   536k|   }
  197|   536k|}
_ZN5Botan6detail8load_anyILNSt3__16endianE64206ETkNS0_20unsigned_integralishEmTkNS_6ranges16contiguous_rangeIhEENS2_4spanIKhLm8EEEQnt15custom_loadableINS0_19wrapped_type_helperIu14__remove_cvrefIT0_EE4typeEEEESA_OT1_:
  278|  2.18M|inline constexpr WrappedOutT load_any(InR&& in_range) {
  279|  2.18M|   using OutT = detail::wrapped_type<WrappedOutT>;
  280|  2.18M|   ranges::assert_exact_byte_length<sizeof(OutT)>(in_range);
  281|       |
  282|  2.18M|   return detail::wrap_strong_type_or_enum<WrappedOutT>([&]() -> OutT {
  283|       |      // At compile time we cannot use `typecast_copy` as it uses `std::memcpy`
  284|       |      // internally to copy ranges on a byte-by-byte basis, which is not allowed
  285|       |      // in a `constexpr` context.
  286|  2.18M|      if(std::is_constant_evaluated()) /* TODO: C++23: if consteval {} */ {
  287|  2.18M|         return fallback_load_any<endianness, OutT>(std::forward<InR>(in_range));
  288|  2.18M|      } else {
  289|  2.18M|         const std::span in{in_range};
  290|  2.18M|         if constexpr(sizeof(OutT) == 1) {
  291|  2.18M|            return static_cast<OutT>(in[0]);
  292|  2.18M|         } else if constexpr(endianness == std::endian::native) {
  293|  2.18M|            return typecast_copy<OutT>(in);
  294|  2.18M|         } else {
  295|  2.18M|            static_assert(opposite(endianness) == std::endian::native);
  296|  2.18M|            return reverse_bytes(typecast_copy<OutT>(in));
  297|  2.18M|         }
  298|  2.18M|      }
  299|  2.18M|   }());
  300|  2.18M|}
_ZN5Botan6detail24wrap_strong_type_or_enumITkNS0_20unsigned_integralishEmTkNSt3__117unsigned_integralEmEEDaT0_:
  200|  2.18M|constexpr auto wrap_strong_type_or_enum(T t) {
  201|       |   if constexpr(std::is_enum_v<OutT>) {
  202|       |      return static_cast<OutT>(t);
  203|  2.18M|   } else {
  204|  2.18M|      return Botan::wrap_strong_type<OutT>(t);
  205|  2.18M|   }
  206|  2.18M|}
_ZZN5Botan6detail8load_anyILNSt3__16endianE64206ETkNS0_20unsigned_integralishEmTkNS_6ranges16contiguous_rangeIhEENS2_4spanIKhLm8EEEQnt15custom_loadableINS0_19wrapped_type_helperIu14__remove_cvrefIT0_EE4typeEEEESA_OT1_ENKUlvE_clEv:
  282|  2.18M|   return detail::wrap_strong_type_or_enum<WrappedOutT>([&]() -> OutT {
  283|       |      // At compile time we cannot use `typecast_copy` as it uses `std::memcpy`
  284|       |      // internally to copy ranges on a byte-by-byte basis, which is not allowed
  285|       |      // in a `constexpr` context.
  286|  2.18M|      if(std::is_constant_evaluated()) /* TODO: C++23: if consteval {} */ {
  ------------------
  |  Branch (286:10): [Folded, False: 2.18M]
  ------------------
  287|      0|         return fallback_load_any<endianness, OutT>(std::forward<InR>(in_range));
  288|  2.18M|      } else {
  289|  2.18M|         const std::span in{in_range};
  290|       |         if constexpr(sizeof(OutT) == 1) {
  291|       |            return static_cast<OutT>(in[0]);
  292|       |         } else if constexpr(endianness == std::endian::native) {
  293|       |            return typecast_copy<OutT>(in);
  294|  2.18M|         } else {
  295|  2.18M|            static_assert(opposite(endianness) == std::endian::native);
  296|  2.18M|            return reverse_bytes(typecast_copy<OutT>(in));
  297|  2.18M|         }
  298|  2.18M|      }
  299|  2.18M|   }());
_ZN5Botan6detail9store_anyILNSt3__16endianE64206EmTkNS_6ranges23contiguous_output_rangeIhEENS2_4spanIhLm8EEETpTkNS0_20unsigned_integralishEJmEQaagtsZT2_Li0Eooaasr3stdE7same_asINS0_10AutoDetectET0_E10all_same_vIDpT2_Eaa20unsigned_integralishIS9_E10all_same_vIS9_SB_EEEvOT1_SB_:
  582|   477k|inline constexpr void store_any(OutR&& out /* NOLINT(*-std-forward) */, Ts... ins) {
  583|   477k|   ranges::assert_exact_byte_length<(sizeof(Ts) + ...)>(out);
  584|   477k|   auto store_one = [off = 0]<typename T>(auto o, T i) mutable {
  585|   477k|      store_any<endianness, T>(i, o.subspan(off).template first<sizeof(T)>());
  586|   477k|      off += sizeof(T);
  587|   477k|   };
  588|       |
  589|   477k|   (store_one(std::span{out}, ins), ...);
  590|   477k|}
_ZZN5Botan6detail9store_anyILNSt3__16endianE64206EmTkNS_6ranges23contiguous_output_rangeIhEENS2_4spanIhLm8EEETpTkNS0_20unsigned_integralishEJmEQaagtsZT2_Li0Eooaasr3stdE7same_asINS0_10AutoDetectET0_E10all_same_vIDpT2_Eaa20unsigned_integralishIS9_E10all_same_vIS9_SB_EEEvOT1_SB_ENUlTyS9_T_E_clImS7_EEDaS9_SE_:
  584|   477k|   auto store_one = [off = 0]<typename T>(auto o, T i) mutable {
  585|   477k|      store_any<endianness, T>(i, o.subspan(off).template first<sizeof(T)>());
  586|   477k|      off += sizeof(T);
  587|   477k|   };
_ZN5Botan8store_beINS_6detail10AutoDetectEJRKmPhEEEDaDpOT0_:
  745|  59.6k|inline constexpr auto store_be(ParamTs&&... params) {
  746|  59.6k|   return detail::store_any<std::endian::big, ModifierT>(std::forward<ParamTs>(params)...);
  747|  59.6k|}
_ZN5Botan7load_beINS_6detail10AutoDetectEJRNSt3__15arrayImLm16EEENS3_4spanIKhLm128EEEEEEDaDpOT0_:
  504|   136k|inline constexpr auto load_be(ParamTs&&... params) {
  505|   136k|   return detail::load_any<std::endian::big, OutT>(std::forward<ParamTs>(params)...);
  506|   136k|}
_ZN5Botan6detail8load_anyILNSt3__16endianE64206ENS0_10AutoDetectETkNS_6ranges23contiguous_output_rangeERNS2_5arrayImLm16EEETkNS5_16contiguous_rangeIhEENS2_4spanIKhLm128EEEQaa20unsigned_integralishINS2_11conditionalIXsr21__is_primary_templateINS2_15iterator_traitsIu14__remove_cvrefIDTclL_ZNS2_6ranges5__cpo5beginEEclsr3stdE7declvalIRT1_EEEEEEEEE5valueENS2_26indirectly_readable_traitsISK_EESL_E4type10value_typeEEoosr3stdE7same_asIS4_T0_Esr3stdE7same_asISR_SQ_EEEvOSH_RKT2_:
  355|   136k|inline constexpr void load_any(OutR&& out /* NOLINT(*-std-forward) */, const InR& in) {
  356|   136k|   ranges::assert_equal_byte_lengths(out, in);
  357|   136k|   using element_type = std::ranges::range_value_t<OutR>;
  358|       |
  359|   136k|   auto load_elementwise = [&] {
  360|   136k|      constexpr size_t bytes_per_element = sizeof(element_type);
  361|   136k|      std::span<const uint8_t> in_s(in);
  362|   136k|      for(auto& out_elem : out) {
  363|   136k|         out_elem = load_any<endianness, element_type>(in_s.template first<bytes_per_element>());
  364|   136k|         in_s = in_s.subspan(bytes_per_element);
  365|   136k|      }
  366|   136k|   };
  367|       |
  368|       |   // At compile time we cannot use `typecast_copy` as it uses `std::memcpy`
  369|       |   // internally to copy ranges on a byte-by-byte basis, which is not allowed
  370|       |   // in a `constexpr` context.
  371|   136k|   if(std::is_constant_evaluated()) /* TODO: C++23: if consteval {} */ {
  ------------------
  |  Branch (371:7): [Folded, False: 136k]
  ------------------
  372|      0|      load_elementwise();
  373|   136k|   } else {
  374|       |      if constexpr(endianness == std::endian::native && !custom_loadable<element_type>) {
  375|       |         typecast_copy(out, in);
  376|   136k|      } else {
  377|   136k|         load_elementwise();
  378|   136k|      }
  379|   136k|   }
  380|   136k|}
_ZZN5Botan6detail8load_anyILNSt3__16endianE64206ENS0_10AutoDetectETkNS_6ranges23contiguous_output_rangeERNS2_5arrayImLm16EEETkNS5_16contiguous_rangeIhEENS2_4spanIKhLm128EEEQaa20unsigned_integralishINS2_11conditionalIXsr21__is_primary_templateINS2_15iterator_traitsIu14__remove_cvrefIDTclL_ZNS2_6ranges5__cpo5beginEEclsr3stdE7declvalIRT1_EEEEEEEEE5valueENS2_26indirectly_readable_traitsISK_EESL_E4type10value_typeEEoosr3stdE7same_asIS4_T0_Esr3stdE7same_asISR_SQ_EEEvOSH_RKT2_ENKUlvE_clEv:
  359|   136k|   auto load_elementwise = [&] {
  360|   136k|      constexpr size_t bytes_per_element = sizeof(element_type);
  361|   136k|      std::span<const uint8_t> in_s(in);
  362|  2.18M|      for(auto& out_elem : out) {
  ------------------
  |  Branch (362:26): [True: 2.18M, False: 136k]
  ------------------
  363|  2.18M|         out_elem = load_any<endianness, element_type>(in_s.template first<bytes_per_element>());
  364|  2.18M|         in_s = in_s.subspan(bytes_per_element);
  365|  2.18M|      }
  366|   136k|   };
_ZN5Botan11copy_out_beITkNS_6ranges14spanable_rangeENSt3__16vectorImNS_16secure_allocatorImEEEEEEvNS2_4spanIhLm18446744073709551615EEERKT_:
  773|  59.6k|inline void copy_out_be(std::span<uint8_t> out, const InR& in) {
  774|  59.6k|   using T = std::ranges::range_value_t<InR>;
  775|  59.6k|   std::span<const T> in_s{in};
  776|  59.6k|   const auto remaining_bytes = detail::copy_out_any_word_aligned_portion<std::endian::big>(out, in_s);
  777|       |
  778|       |   // copy remaining bytes as a partial word
  779|  59.6k|   for(size_t i = 0; i < remaining_bytes; ++i) {
  ------------------
  |  Branch (779:22): [True: 0, False: 59.6k]
  ------------------
  780|      0|      out[i] = get_byte_var(i, in_s.front());
  781|      0|   }
  782|  59.6k|}
_ZN5Botan6detail33copy_out_any_word_aligned_portionILNSt3__16endianE64206ETkNS0_20unsigned_integralishEmEEmRNS2_4spanIhLm18446744073709551615EEERNS4_IKT0_Lm18446744073709551615EEE:
  752|  59.6k|inline size_t copy_out_any_word_aligned_portion(std::span<uint8_t>& out, std::span<const T>& in) {
  753|  59.6k|   const size_t full_words = out.size() / sizeof(T);
  754|  59.6k|   const size_t full_word_bytes = full_words * sizeof(T);
  755|  59.6k|   const size_t remaining_bytes = out.size() - full_word_bytes;
  756|  59.6k|   BOTAN_ASSERT_NOMSG(in.size_bytes() >= full_word_bytes + remaining_bytes);
  ------------------
  |  |   77|  59.6k|   do {                                                                     \
  |  |   78|  59.6k|      /* NOLINTNEXTLINE(*-simplify-boolean-expr) */                         \
  |  |   79|  59.6k|      if(!(expr)) {                                                         \
  |  |  ------------------
  |  |  |  Branch (79:10): [True: 0, False: 59.6k]
  |  |  ------------------
  |  |   80|      0|         /* NOLINTNEXTLINE(bugprone-lambda-function-name) */                \
  |  |   81|      0|         Botan::assertion_failure(#expr, "", __func__, __FILE__, __LINE__); \
  |  |   82|      0|      }                                                                     \
  |  |   83|  59.6k|   } while(0)
  |  |  ------------------
  |  |  |  Branch (83:12): [Folded, False: 59.6k]
  |  |  ------------------
  ------------------
  757|       |
  758|       |   // copy full words
  759|  59.6k|   store_any<endianness, T>(out.first(full_word_bytes), in.first(full_words));
  760|  59.6k|   out = out.subspan(full_word_bytes);
  761|  59.6k|   in = in.subspan(full_words);
  762|       |
  763|  59.6k|   return remaining_bytes;
  764|  59.6k|}
_ZN5Botan6detail9store_anyILNSt3__16endianE64206EmTkNS_6ranges23contiguous_output_rangeIhEENS2_4spanIhLm18446744073709551615EEETkNS4_14spanable_rangeENS6_IKmLm18446744073709551615EEEQoosr3stdE7same_asINS0_10AutoDetectET0_Esr3stdE7same_asISB_NS2_11conditionalIXsr21__is_primary_templateINS2_15iterator_traitsIu14__remove_cvrefIDTclL_ZNS2_6ranges5__cpo5beginEEclsr3stdE7declvalIRT2_EEEEEEEEE5valueENS2_26indirectly_readable_traitsISJ_EESK_E4type10value_typeEEEEvOT1_RKSG_:
  603|  59.6k|inline constexpr void store_any(OutR&& out /* NOLINT(*-std-forward) */, const InR& in) {
  604|  59.6k|   ranges::assert_equal_byte_lengths(out, in);
  605|  59.6k|   using element_type = std::ranges::range_value_t<InR>;
  606|       |
  607|  59.6k|   auto store_elementwise = [&] {
  608|  59.6k|      constexpr size_t bytes_per_element = sizeof(element_type);
  609|  59.6k|      std::span<uint8_t> out_s(out);
  610|  59.6k|      for(auto in_elem : in) {
  611|  59.6k|         store_any<endianness, element_type>(out_s.template first<bytes_per_element>(), in_elem);
  612|  59.6k|         out_s = out_s.subspan(bytes_per_element);
  613|  59.6k|      }
  614|  59.6k|   };
  615|       |
  616|       |   // At compile time we cannot use `typecast_copy` as it uses `std::memcpy`
  617|       |   // internally to copy ranges on a byte-by-byte basis, which is not allowed
  618|       |   // in a `constexpr` context.
  619|  59.6k|   if(std::is_constant_evaluated()) /* TODO: C++23: if consteval {} */ {
  ------------------
  |  Branch (619:7): [Folded, False: 59.6k]
  ------------------
  620|      0|      store_elementwise();
  621|  59.6k|   } else {
  622|       |      if constexpr(endianness == std::endian::native && !custom_storable<element_type>) {
  623|       |         typecast_copy(out, in);
  624|  59.6k|      } else {
  625|  59.6k|         store_elementwise();
  626|  59.6k|      }
  627|  59.6k|   }
  628|  59.6k|}
_ZZN5Botan6detail9store_anyILNSt3__16endianE64206EmTkNS_6ranges23contiguous_output_rangeIhEENS2_4spanIhLm18446744073709551615EEETkNS4_14spanable_rangeENS6_IKmLm18446744073709551615EEEQoosr3stdE7same_asINS0_10AutoDetectET0_Esr3stdE7same_asISB_NS2_11conditionalIXsr21__is_primary_templateINS2_15iterator_traitsIu14__remove_cvrefIDTclL_ZNS2_6ranges5__cpo5beginEEclsr3stdE7declvalIRT2_EEEEEEEEE5valueENS2_26indirectly_readable_traitsISJ_EESK_E4type10value_typeEEEEvOT1_RKSG_ENKUlvE_clEv:
  607|  59.6k|   auto store_elementwise = [&] {
  608|  59.6k|      constexpr size_t bytes_per_element = sizeof(element_type);
  609|  59.6k|      std::span<uint8_t> out_s(out);
  610|   477k|      for(auto in_elem : in) {
  ------------------
  |  Branch (610:24): [True: 477k, False: 59.6k]
  ------------------
  611|   477k|         store_any<endianness, element_type>(out_s.template first<bytes_per_element>(), in_elem);
  612|   477k|         out_s = out_s.subspan(bytes_per_element);
  613|   477k|      }
  614|  59.6k|   };

_ZN5Botan18MerkleDamgard_HashINS_7SHA_512EEC2Ev:
   42|  4.26k|      MerkleDamgard_Hash() { clear(); }
_ZN5Botan18MerkleDamgard_HashINS_7SHA_512EE5clearEv:
   70|  80.9k|      void clear() {
   71|  80.9k|         MD::init(m_digest);
   72|  80.9k|         m_buffer.clear();
   73|  80.9k|         m_count = 0;
   74|  80.9k|      }
_ZN5Botan18MerkleDamgard_HashINS_7SHA_512EE6updateENSt3__14spanIKhLm18446744073709551615EEE:
   44|   157k|      void update(std::span<const uint8_t> input) {
   45|   157k|         BufferSlicer in(input);
   46|       |
   47|   315k|         while(!in.empty()) {
  ------------------
  |  Branch (47:16): [True: 157k, False: 157k]
  ------------------
   48|   157k|            if(const auto one_block = m_buffer.handle_unaligned_data(in)) {
  ------------------
  |  Branch (48:27): [True: 0, False: 157k]
  ------------------
   49|      0|               MD::compress_n(m_digest, one_block.value(), 1);
   50|      0|            }
   51|       |
   52|   157k|            if(m_buffer.in_alignment()) {
  ------------------
  |  Branch (52:16): [True: 76.6k, False: 80.9k]
  ------------------
   53|  76.6k|               const auto [aligned_data, full_blocks] = m_buffer.aligned_data_to_process(in);
   54|  76.6k|               if(full_blocks > 0) {
  ------------------
  |  Branch (54:19): [True: 76.6k, False: 0]
  ------------------
   55|  76.6k|                  MD::compress_n(m_digest, aligned_data, full_blocks);
   56|  76.6k|               }
   57|  76.6k|            }
   58|   157k|         }
   59|       |
   60|   157k|         m_count += input.size();
   61|   157k|      }
_ZN5Botan18MerkleDamgard_HashINS_7SHA_512EE5finalENSt3__14spanIhLm18446744073709551615EEE:
   63|  59.6k|      void final(std::span<uint8_t> output) {
   64|  59.6k|         append_padding_bit();
   65|  59.6k|         append_counter_and_finalize();
   66|  59.6k|         copy_output(output);
   67|  59.6k|         clear();
   68|  59.6k|      }
_ZN5Botan18MerkleDamgard_HashINS_7SHA_512EE18append_padding_bitEv:
   77|  59.6k|      void append_padding_bit() {
   78|  59.6k|         BOTAN_ASSERT_NOMSG(!m_buffer.ready_to_consume());
  ------------------
  |  |   77|  59.6k|   do {                                                                     \
  |  |   78|  59.6k|      /* NOLINTNEXTLINE(*-simplify-boolean-expr) */                         \
  |  |   79|  59.6k|      if(!(expr)) {                                                         \
  |  |  ------------------
  |  |  |  Branch (79:10): [True: 0, False: 59.6k]
  |  |  ------------------
  |  |   80|      0|         /* NOLINTNEXTLINE(bugprone-lambda-function-name) */                \
  |  |   81|      0|         Botan::assertion_failure(#expr, "", __func__, __FILE__, __LINE__); \
  |  |   82|      0|      }                                                                     \
  |  |   83|  59.6k|   } while(0)
  |  |  ------------------
  |  |  |  Branch (83:12): [Folded, False: 59.6k]
  |  |  ------------------
  ------------------
   79|  59.6k|         if constexpr(MD::bit_endianness == MD_Endian::Big) {
   80|  59.6k|            const uint8_t final_byte = 0x80;
   81|  59.6k|            m_buffer.append({&final_byte, 1});
   82|       |         } else {
   83|       |            const uint8_t final_byte = 0x01;
   84|       |            m_buffer.append({&final_byte, 1});
   85|       |         }
   86|  59.6k|      }
_ZN5Botan18MerkleDamgard_HashINS_7SHA_512EE27append_counter_and_finalizeEv:
   88|  59.6k|      void append_counter_and_finalize() {
   89|       |         // Compress the remaining data if the final data block does not provide
   90|       |         // enough space for the counter bytes.
   91|  59.6k|         if(m_buffer.elements_until_alignment() < MD::ctr_bytes) {
  ------------------
  |  Branch (91:13): [True: 0, False: 59.6k]
  ------------------
   92|      0|            m_buffer.fill_up_with_zeros();
   93|      0|            MD::compress_n(m_digest, m_buffer.consume(), 1);
   94|      0|         }
   95|       |
   96|       |         // Make sure that any remaining bytes in the very last block are zero.
   97|  59.6k|         BOTAN_ASSERT_NOMSG(m_buffer.elements_until_alignment() >= MD::ctr_bytes);
  ------------------
  |  |   77|  59.6k|   do {                                                                     \
  |  |   78|  59.6k|      /* NOLINTNEXTLINE(*-simplify-boolean-expr) */                         \
  |  |   79|  59.6k|      if(!(expr)) {                                                         \
  |  |  ------------------
  |  |  |  Branch (79:10): [True: 0, False: 59.6k]
  |  |  ------------------
  |  |   80|      0|         /* NOLINTNEXTLINE(bugprone-lambda-function-name) */                \
  |  |   81|      0|         Botan::assertion_failure(#expr, "", __func__, __FILE__, __LINE__); \
  |  |   82|      0|      }                                                                     \
  |  |   83|  59.6k|   } while(0)
  |  |  ------------------
  |  |  |  Branch (83:12): [Folded, False: 59.6k]
  |  |  ------------------
  ------------------
   98|  59.6k|         m_buffer.fill_up_with_zeros();
   99|       |
  100|       |         // Replace a bunch of the right-most zero-padding with the counter bytes.
  101|  59.6k|         const uint64_t bit_count = m_count * 8;
  102|  59.6k|         auto last_bytes = m_buffer.directly_modify_last(sizeof(bit_count));
  103|  59.6k|         if constexpr(MD::byte_endianness == MD_Endian::Big) {
  104|  59.6k|            store_be(bit_count, last_bytes.data());
  105|       |         } else {
  106|       |            store_le(bit_count, last_bytes.data());
  107|       |         }
  108|       |
  109|       |         // Compress the very last block.
  110|  59.6k|         MD::compress_n(m_digest, m_buffer.consume(), 1);
  111|  59.6k|      }
_ZN5Botan18MerkleDamgard_HashINS_7SHA_512EE11copy_outputENSt3__14spanIhLm18446744073709551615EEE:
  113|  59.6k|      void copy_output(std::span<uint8_t> output) {
  114|  59.6k|         BOTAN_ASSERT_NOMSG(output.size() >= MD::output_bytes);
  ------------------
  |  |   77|  59.6k|   do {                                                                     \
  |  |   78|  59.6k|      /* NOLINTNEXTLINE(*-simplify-boolean-expr) */                         \
  |  |   79|  59.6k|      if(!(expr)) {                                                         \
  |  |  ------------------
  |  |  |  Branch (79:10): [True: 0, False: 59.6k]
  |  |  ------------------
  |  |   80|      0|         /* NOLINTNEXTLINE(bugprone-lambda-function-name) */                \
  |  |   81|      0|         Botan::assertion_failure(#expr, "", __func__, __FILE__, __LINE__); \
  |  |   82|      0|      }                                                                     \
  |  |   83|  59.6k|   } while(0)
  |  |  ------------------
  |  |  |  Branch (83:12): [Folded, False: 59.6k]
  |  |  ------------------
  ------------------
  115|       |
  116|  59.6k|         if constexpr(MD::byte_endianness == MD_Endian::Big) {
  117|  59.6k|            copy_out_be(output.first(MD::output_bytes), m_digest);
  118|       |         } else {
  119|       |            copy_out_le(output.first(MD::output_bytes), m_digest);
  120|       |         }
  121|  59.6k|      }

_ZN5Botan14zeroize_bufferITkNSt3__117unsigned_integralEhEEvPT_m:
   37|   140k|inline void zeroize_buffer(T buf[], size_t n) {
   38|   140k|   if(n > 0) {
  ------------------
  |  Branch (38:7): [True: 140k, False: 0]
  ------------------
   39|   140k|      std::memset(buf, 0, sizeof(T) * n);
   40|   140k|   }
   41|   140k|}

_ZN5Botan3rhoILm14ELm18ELm41ETkNSt3__117unsigned_integralEmEET2_S2_:
   53|  10.9M|BOTAN_FORCE_INLINE constexpr T rho(T x) {
   54|  10.9M|   return rotr<R1>(x) ^ rotr<R2>(x) ^ rotr<R3>(x);
   55|  10.9M|}
_ZN5Botan4rotrILm14ETkNSt3__117unsigned_integralEmEET0_S2_QaagtT_Li0EltT_mlLi8EstS2_:
   37|  10.9M|{
   38|  10.9M|   return static_cast<T>((input >> ROT) | (input << (8 * sizeof(T) - ROT)));
   39|  10.9M|}
_ZN5Botan4rotrILm18ETkNSt3__117unsigned_integralEmEET0_S2_QaagtT_Li0EltT_mlLi8EstS2_:
   37|  10.9M|{
   38|  10.9M|   return static_cast<T>((input >> ROT) | (input << (8 * sizeof(T) - ROT)));
   39|  10.9M|}
_ZN5Botan4rotrILm41ETkNSt3__117unsigned_integralEmEET0_S2_QaagtT_Li0EltT_mlLi8EstS2_:
   37|  10.9M|{
   38|  10.9M|   return static_cast<T>((input >> ROT) | (input << (8 * sizeof(T) - ROT)));
   39|  10.9M|}
_ZN5Botan3rhoILm28ELm34ELm39ETkNSt3__117unsigned_integralEmEET2_S2_:
   53|  10.9M|BOTAN_FORCE_INLINE constexpr T rho(T x) {
   54|  10.9M|   return rotr<R1>(x) ^ rotr<R2>(x) ^ rotr<R3>(x);
   55|  10.9M|}
_ZN5Botan4rotrILm28ETkNSt3__117unsigned_integralEmEET0_S2_QaagtT_Li0EltT_mlLi8EstS2_:
   37|  10.9M|{
   38|  10.9M|   return static_cast<T>((input >> ROT) | (input << (8 * sizeof(T) - ROT)));
   39|  10.9M|}
_ZN5Botan4rotrILm34ETkNSt3__117unsigned_integralEmEET0_S2_QaagtT_Li0EltT_mlLi8EstS2_:
   37|  10.9M|{
   38|  10.9M|   return static_cast<T>((input >> ROT) | (input << (8 * sizeof(T) - ROT)));
   39|  10.9M|}
_ZN5Botan4rotrILm39ETkNSt3__117unsigned_integralEmEET0_S2_QaagtT_Li0EltT_mlLi8EstS2_:
   37|  10.9M|{
   38|  10.9M|   return static_cast<T>((input >> ROT) | (input << (8 * sizeof(T) - ROT)));
   39|  10.9M|}
_ZN5Botan5sigmaILm19ELm61ELm6ETkNSt3__117unsigned_integralEmEET2_S2_:
   45|  10.9M|BOTAN_FORCE_INLINE constexpr T sigma(T x) {
   46|  10.9M|   return rotr<R1>(x) ^ rotr<R2>(x) ^ (x >> S);
   47|  10.9M|}
_ZN5Botan4rotrILm19ETkNSt3__117unsigned_integralEmEET0_S2_QaagtT_Li0EltT_mlLi8EstS2_:
   37|  10.9M|{
   38|  10.9M|   return static_cast<T>((input >> ROT) | (input << (8 * sizeof(T) - ROT)));
   39|  10.9M|}
_ZN5Botan4rotrILm61ETkNSt3__117unsigned_integralEmEET0_S2_QaagtT_Li0EltT_mlLi8EstS2_:
   37|  10.9M|{
   38|  10.9M|   return static_cast<T>((input >> ROT) | (input << (8 * sizeof(T) - ROT)));
   39|  10.9M|}
_ZN5Botan5sigmaILm1ELm8ELm7ETkNSt3__117unsigned_integralEmEET2_S2_:
   45|  10.9M|BOTAN_FORCE_INLINE constexpr T sigma(T x) {
   46|  10.9M|   return rotr<R1>(x) ^ rotr<R2>(x) ^ (x >> S);
   47|  10.9M|}
_ZN5Botan4rotrILm1ETkNSt3__117unsigned_integralEmEET0_S2_QaagtT_Li0EltT_mlLi8EstS2_:
   37|  10.9M|{
   38|  10.9M|   return static_cast<T>((input >> ROT) | (input << (8 * sizeof(T) - ROT)));
   39|  10.9M|}
_ZN5Botan4rotrILm8ETkNSt3__117unsigned_integralEmEET0_S2_QaagtT_Li0EltT_mlLi8EstS2_:
   37|  10.9M|{
   38|  10.9M|   return static_cast<T>((input >> ROT) | (input << (8 * sizeof(T) - ROT)));
   39|  10.9M|}

_ZNK5Botan9SCAN_Name9algo_nameEv:
   38|  4.26k|      const std::string& algo_name() const { return m_alg_name; }
_ZNK5Botan9SCAN_Name9arg_countEv:
   43|  8.52k|      size_t arg_count() const { return m_args.size(); }

_ZNK5Botan7SHA_51213output_lengthEv:
   74|   123k|      size_t output_length() const override { return output_bytes; }
_ZNK5Botan7SHA_51215hash_block_sizeEv:
   76|  4.26k|      size_t hash_block_size() const override { return block_bytes; }
_ZN5Botan7SHA_5125clearEv:
   84|  17.0k|      void clear() override { m_md.clear(); }

_ZN5Botan9SHA2_64_FEmmmRmmmmS0_S0_mmmm:
   31|  10.9M|                                  uint64_t magic) {
   32|  10.9M|   H += magic + rho<14, 18, 41>(E) + choose(E, F, G) + M1;
   33|  10.9M|   D += H;
   34|  10.9M|   H += rho<28, 34, 39>(A) + majority(A, B, C);
   35|  10.9M|   M1 += sigma<19, 61, 6>(M2) + M3 + sigma<1, 8, 7>(M4);
   36|  10.9M|}

_ZN5Botan20Buffered_Computation6updateENSt3__14spanIKhLm18446744073709551615EEE:
   41|   196k|      void update(std::span<const uint8_t> in) { add_data(in); }
_ZN5Botan20Buffered_Computation6updateEh:
   90|  12.7k|      void update(uint8_t in) { add_data({&in, 1}); }
_ZN5Botan20Buffered_ComputationD2Ev:
  169|  8.52k|      virtual ~Buffered_Computation() = default;
_ZN5Botan20Buffered_Computation5finalITkNS_8concepts21resizable_byte_bufferENSt3__16vectorIhNS_16secure_allocatorIhEEEEEEvRT_:
  127|  29.8k|      void final(T& out) {
  128|  29.8k|         out.resize(output_length());
  129|  29.8k|         final_result(out);
  130|  29.8k|      }

_ZNK5Botan9HMAC_DRBG31max_number_of_bytes_per_requestEv:
  151|  4.26k|      size_t max_number_of_bytes_per_request() const override { return m_max_number_of_bytes_per_request; }

_ZN5Botan11clear_bytesEPvm:
  101|  34.0k|inline constexpr void clear_bytes(void* ptr, size_t bytes) {
  102|  34.0k|   if(bytes > 0) {
  ------------------
  |  Branch (102:7): [True: 34.0k, False: 0]
  ------------------
  103|  34.0k|      std::memset(ptr, 0, bytes);
  104|  34.0k|   }
  105|  34.0k|}
_ZN5Botan8copy_memIhQsr3stdE12is_trivial_vIu7__decayIT_EEEEvPS1_PKS1_m:
  144|  4.26k|inline constexpr void copy_mem(T* out, const T* in, size_t n) {
  145|  4.26k|   BOTAN_ASSERT_IMPLICATION(n > 0, in != nullptr && out != nullptr, "If n > 0 then args are not null");
  ------------------
  |  |  103|  4.26k|   do {                                                                                          \
  |  |  104|  4.26k|      /* NOLINTNEXTLINE(*-simplify-boolean-expr) */                                              \
  |  |  105|  8.52k|      if((expr1) && !(expr2)) {                                                                  \
  |  |  ------------------
  |  |  |  Branch (105:10): [True: 4.26k, False: 0]
  |  |  |  Branch (105:23): [True: 4.26k, False: 0]
  |  |  |  Branch (105:23): [True: 4.26k, False: 0]
  |  |  ------------------
  |  |  106|      0|         /* NOLINTNEXTLINE(bugprone-lambda-function-name) */                                     \
  |  |  107|      0|         Botan::assertion_failure(#expr1 " implies " #expr2, msg, __func__, __FILE__, __LINE__); \
  |  |  108|      0|      }                                                                                          \
  |  |  109|  4.26k|   } while(0)
  |  |  ------------------
  |  |  |  Branch (109:12): [Folded, False: 4.26k]
  |  |  ------------------
  ------------------
  146|       |
  147|  4.26k|   if(in != nullptr && out != nullptr && n > 0) {
  ------------------
  |  Branch (147:7): [True: 4.26k, False: 0]
  |  Branch (147:24): [True: 4.26k, False: 0]
  |  Branch (147:42): [True: 4.26k, False: 0]
  ------------------
  148|  4.26k|      std::memmove(out, in, sizeof(T) * n);
  149|  4.26k|   }
  150|  4.26k|}
_ZN5Botan13typecast_copyITkNS_6ranges23contiguous_output_rangeERKNSt3__14spanIhLm8EEEmQaaaasr3stdE23is_trivially_copyable_vIT0_Entsr3std6rangesE5rangeIS7_Esr3stdE23is_trivially_copyable_vINS2_11conditionalIXsr21__is_primary_templateINS2_15iterator_traitsIu14__remove_cvrefIDTclL_ZNS2_6ranges5__cpo5beginEEclsr3stdE7declvalIRT_EEEEEEEEE5valueENS2_26indirectly_readable_traitsISF_EESG_E4type10value_typeEEEEvOSC_RKS7_:
  199|   536k|inline constexpr void typecast_copy(ToR&& out /* NOLINT(*-std-forward) */, const FromT& in) {
  200|   536k|   typecast_copy(out, std::span<const FromT, 1>(&in, 1));
  201|   536k|}
_ZN5Botan13typecast_copyITkNS_6ranges23contiguous_output_rangeERKNSt3__14spanIhLm8EEETkNS1_16contiguous_rangeENS3_IKmLm1EEEQaasr3stdE23is_trivially_copyable_vINS2_11conditionalIXsr21__is_primary_templateINS2_15iterator_traitsIu14__remove_cvrefIDTclL_ZNS2_6ranges5__cpo5beginEEclsr3stdE7declvalIRT0_EEEEEEEEE5valueENS2_26indirectly_readable_traitsISG_EESH_E4type10value_typeEEsr3stdE23is_trivially_copyable_vINS9_IXsr21__is_primary_templateINSA_Iu14__remove_cvrefIDTclL_ZNSC_5beginEEclsr3stdE7declvalIRT_EEEEEEEEE5valueENSI_ISQ_EESR_E4type10value_typeEEEEvOSN_RKSD_:
  176|   536k|inline constexpr void typecast_copy(ToR&& out /* NOLINT(*-std-forward) */, const FromR& in) {
  177|   536k|   ranges::assert_equal_byte_lengths(out, in);
  178|   536k|   std::memcpy(std::ranges::data(out), std::ranges::data(in), ranges::size_bytes(out));
  179|   536k|}
_ZN5Botan13typecast_copyImTkNS_6ranges16contiguous_rangeENSt3__14spanIKhLm8EEEQaaaasr3stdE26is_default_constructible_vIT_Esr3stdE23is_trivially_copyable_vIS6_Esr3stdE23is_trivially_copyable_vINS2_11conditionalIXsr21__is_primary_templateINS2_15iterator_traitsIu14__remove_cvrefIDTclL_ZNS2_6ranges5__cpo5beginEEclsr3stdE7declvalIRT0_EEEEEEEEE5valueENS2_26indirectly_readable_traitsISE_EESF_E4type10value_typeEEEES6_RKSB_:
  210|  2.18M|inline constexpr ToT typecast_copy(const FromR& src) {
  211|  2.18M|   ToT dst;  // NOLINT(*-member-init)
  212|  2.18M|   typecast_copy(dst, src);
  213|  2.18M|   return dst;
  214|  2.18M|}
_ZN5Botan13typecast_copyImTkNS_6ranges16contiguous_rangeENSt3__14spanIKhLm8EEEQaaaasr3stdE23is_trivially_copyable_vINS2_11conditionalIXsr21__is_primary_templateINS2_15iterator_traitsIu14__remove_cvrefIDTclL_ZNS2_6ranges5__cpo5beginEEclsr3stdE7declvalIRT0_EEEEEEEEE5valueENS2_26indirectly_readable_traitsISD_EESE_E4type10value_typeEEsr3stdE23is_trivially_copyable_vIT_Entsr3std6rangesE5rangeISK_EEEvRSK_RKSA_:
  188|  2.18M|inline constexpr void typecast_copy(ToT& out, const FromR& in) {
  189|  2.18M|   typecast_copy(std::span<ToT, 1>(&out, 1), in);
  190|  2.18M|}
_ZN5Botan13typecast_copyITkNS_6ranges23contiguous_output_rangeENSt3__14spanImLm1EEETkNS1_16contiguous_rangeENS3_IKhLm8EEEQaasr3stdE23is_trivially_copyable_vINS2_11conditionalIXsr21__is_primary_templateINS2_15iterator_traitsIu14__remove_cvrefIDTclL_ZNS2_6ranges5__cpo5beginEEclsr3stdE7declvalIRT0_EEEEEEEEE5valueENS2_26indirectly_readable_traitsISE_EESF_E4type10value_typeEEsr3stdE23is_trivially_copyable_vINS7_IXsr21__is_primary_templateINS8_Iu14__remove_cvrefIDTclL_ZNSA_5beginEEclsr3stdE7declvalIRT_EEEEEEEEE5valueENSG_ISO_EESP_E4type10value_typeEEEEvOSL_RKSB_:
  176|  2.18M|inline constexpr void typecast_copy(ToR&& out /* NOLINT(*-std-forward) */, const FromR& in) {
  177|  2.18M|   ranges::assert_equal_byte_lengths(out, in);
  178|  2.18M|   std::memcpy(std::ranges::data(out), std::ranges::data(in), ranges::size_bytes(out));
  179|  2.18M|}
_ZN5Botan9clear_memIhEEvPT_m:
  118|  34.0k|inline constexpr void clear_mem(T* ptr, size_t n) {
  119|  34.0k|   clear_bytes(ptr, sizeof(T) * n);
  120|  34.0k|}
_ZN5Botan8copy_memITkNS_6ranges23contiguous_output_rangeENSt3__14spanIhLm18446744073709551615EEETkNS1_16contiguous_rangeENS3_IKhLm18446744073709551615EEEQaasr3stdE9is_same_vINS2_11conditionalIXsr21__is_primary_templateINS2_15iterator_traitsIu14__remove_cvrefIDTclL_ZNS2_6ranges5__cpo5beginEEclsr3stdE7declvalIRT_EEEEEEEEE5valueENS2_26indirectly_readable_traitsISE_EESF_E4type10value_typeENS7_IXsr21__is_primary_templateINS8_Iu14__remove_cvrefIDTclL_ZNSA_5beginEEclsr3stdE7declvalIRT0_EEEEEEEEE5valueENSG_ISO_EESP_E4type10value_typeEEsr3stdE23is_trivially_copyable_vIST_EEEvOSB_RKSL_:
  160|  17.0k|inline constexpr void copy_mem(OutR&& out /* NOLINT(*-std-forward) */, const InR& in) {
  161|  17.0k|   ranges::assert_equal_byte_lengths(out, in);
  162|  17.0k|   if(std::is_constant_evaluated()) {
  ------------------
  |  Branch (162:7): [Folded, False: 17.0k]
  ------------------
  163|      0|      std::copy(std::ranges::begin(in), std::ranges::end(in), std::ranges::begin(out));
  164|  17.0k|   } else if(ranges::size_bytes(out) > 0) {
  ------------------
  |  Branch (164:14): [True: 17.0k, False: 0]
  ------------------
  165|  17.0k|      std::memmove(std::ranges::data(out), std::ranges::data(in), ranges::size_bytes(out));
  166|  17.0k|   }
  167|  17.0k|}

_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeENSt3__14spanIhLm18446744073709551615EEETpTkNS0_14spanable_rangeEJNS3_IKhLm18446744073709551615EEEEEEvRKT_DpRKT0_QgtsZT0_Li0E:
  100|  17.0k|{
  101|  17.0k|   const std::span s0{r0};
  102|       |
  103|       |   if constexpr(statically_spanable_range<R0>) {
  104|       |      constexpr size_t expected_size = s0.size_bytes();
  105|       |      (assert_exact_byte_length<expected_size>(rs), ...);
  106|  17.0k|   } else {
  107|  17.0k|      const size_t expected_size = s0.size_bytes();
  108|  17.0k|      const bool correct_size =
  109|  17.0k|         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
  110|       |
  111|  17.0k|      if(!correct_size) {
  ------------------
  |  Branch (111:10): [True: 0, False: 17.0k]
  ------------------
  112|      0|         memory_region_size_violation();
  113|      0|      }
  114|  17.0k|   }
  115|  17.0k|}
_ZN5Botan6ranges24assert_exact_byte_lengthILm8ETkNS0_14spanable_rangeENSt3__14spanIhLm8EEEEEvRKT0_:
   77|  1.01M|inline constexpr void assert_exact_byte_length(const R& r) {
   78|  1.01M|   const std::span s{r};
   79|  1.01M|   if constexpr(statically_spanable_range<R>) {
   80|  1.01M|      static_assert(s.size_bytes() == expected, "memory region does not have expected byte lengths");
   81|       |   } else {
   82|       |      if(s.size_bytes() != expected) {
   83|       |         memory_region_size_violation();
   84|       |      }
   85|       |   }
   86|  1.01M|}
_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeENSt3__14spanIhLm8EEETpTkNS0_14spanable_rangeEJNS3_IKmLm1EEEEEEvRKT_DpRKT0_QgtsZT0_Li0E:
  100|   536k|{
  101|   536k|   const std::span s0{r0};
  102|       |
  103|   536k|   if constexpr(statically_spanable_range<R0>) {
  104|   536k|      constexpr size_t expected_size = s0.size_bytes();
  105|   536k|      (assert_exact_byte_length<expected_size>(rs), ...);
  106|       |   } else {
  107|       |      const size_t expected_size = s0.size_bytes();
  108|       |      const bool correct_size =
  109|       |         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
  110|       |
  111|       |      if(!correct_size) {
  112|       |         memory_region_size_violation();
  113|       |      }
  114|       |   }
  115|   536k|}
_ZN5Botan6ranges24assert_exact_byte_lengthILm8ETkNS0_14spanable_rangeENSt3__14spanIKmLm1EEEEEvRKT0_:
   77|   536k|inline constexpr void assert_exact_byte_length(const R& r) {
   78|   536k|   const std::span s{r};
   79|   536k|   if constexpr(statically_spanable_range<R>) {
   80|   536k|      static_assert(s.size_bytes() == expected, "memory region does not have expected byte lengths");
   81|       |   } else {
   82|       |      if(s.size_bytes() != expected) {
   83|       |         memory_region_size_violation();
   84|       |      }
   85|       |   }
   86|   536k|}
_ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeENSt3__14spanIhLm8EEEEEmRKT_:
   59|   536k|inline constexpr size_t size_bytes(const spanable_range auto& r) {
   60|   536k|   return std::span{r}.size_bytes();
   61|   536k|}
_ZN5Botan6ranges24assert_exact_byte_lengthILm8ETkNS0_14spanable_rangeENSt3__14spanIKhLm8EEEEEvRKT0_:
   77|  4.36M|inline constexpr void assert_exact_byte_length(const R& r) {
   78|  4.36M|   const std::span s{r};
   79|  4.36M|   if constexpr(statically_spanable_range<R>) {
   80|  4.36M|      static_assert(s.size_bytes() == expected, "memory region does not have expected byte lengths");
   81|       |   } else {
   82|       |      if(s.size_bytes() != expected) {
   83|       |         memory_region_size_violation();
   84|       |      }
   85|       |   }
   86|  4.36M|}
_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeENSt3__14spanImLm1EEETpTkNS0_14spanable_rangeEJNS3_IKhLm8EEEEEEvRKT_DpRKT0_QgtsZT0_Li0E:
  100|  2.18M|{
  101|  2.18M|   const std::span s0{r0};
  102|       |
  103|  2.18M|   if constexpr(statically_spanable_range<R0>) {
  104|  2.18M|      constexpr size_t expected_size = s0.size_bytes();
  105|  2.18M|      (assert_exact_byte_length<expected_size>(rs), ...);
  106|       |   } else {
  107|       |      const size_t expected_size = s0.size_bytes();
  108|       |      const bool correct_size =
  109|       |         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
  110|       |
  111|       |      if(!correct_size) {
  112|       |         memory_region_size_violation();
  113|       |      }
  114|       |   }
  115|  2.18M|}
_ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeENSt3__14spanImLm1EEEEEmRKT_:
   59|  2.18M|inline constexpr size_t size_bytes(const spanable_range auto& r) {
   60|  2.18M|   return std::span{r}.size_bytes();
   61|  2.18M|}
_ZN5Botan6ranges10size_bytesITkNS0_14spanable_rangeENSt3__14spanIhLm18446744073709551615EEEEEmRKT_:
   59|  34.0k|inline constexpr size_t size_bytes(const spanable_range auto& r) {
   60|  34.0k|   return std::span{r}.size_bytes();
   61|  34.0k|}
_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeENSt3__14spanIhLm18446744073709551615EEETpTkNS0_14spanable_rangeEJNS3_IKmLm18446744073709551615EEEEEEvRKT_DpRKT0_QgtsZT0_Li0E:
  100|  59.6k|{
  101|  59.6k|   const std::span s0{r0};
  102|       |
  103|       |   if constexpr(statically_spanable_range<R0>) {
  104|       |      constexpr size_t expected_size = s0.size_bytes();
  105|       |      (assert_exact_byte_length<expected_size>(rs), ...);
  106|  59.6k|   } else {
  107|  59.6k|      const size_t expected_size = s0.size_bytes();
  108|  59.6k|      const bool correct_size =
  109|  59.6k|         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
  110|       |
  111|  59.6k|      if(!correct_size) {
  ------------------
  |  Branch (111:10): [True: 0, False: 59.6k]
  ------------------
  112|      0|         memory_region_size_violation();
  113|      0|      }
  114|  59.6k|   }
  115|  59.6k|}
_ZN5Botan6ranges25assert_equal_byte_lengthsITkNS0_14spanable_rangeENSt3__15arrayImLm16EEETpTkNS0_14spanable_rangeEJNS2_4spanIKhLm128EEEEEEvRKT_DpRKT0_QgtsZT0_Li0E:
  100|   136k|{
  101|   136k|   const std::span s0{r0};
  102|       |
  103|   136k|   if constexpr(statically_spanable_range<R0>) {
  104|   136k|      constexpr size_t expected_size = s0.size_bytes();
  105|   136k|      (assert_exact_byte_length<expected_size>(rs), ...);
  106|       |   } else {
  107|       |      const size_t expected_size = s0.size_bytes();
  108|       |      const bool correct_size =
  109|       |         ((std::span<const std::ranges::range_value_t<Rs>>{rs}.size_bytes() == expected_size) && ...);
  110|       |
  111|       |      if(!correct_size) {
  112|       |         memory_region_size_violation();
  113|       |      }
  114|       |   }
  115|   136k|}
_ZN5Botan6ranges24assert_exact_byte_lengthILm128ETkNS0_14spanable_rangeENSt3__14spanIKhLm128EEEEEvRKT0_:
   77|   136k|inline constexpr void assert_exact_byte_length(const R& r) {
   78|   136k|   const std::span s{r};
   79|   136k|   if constexpr(statically_spanable_range<R>) {
   80|   136k|      static_assert(s.size_bytes() == expected, "memory region does not have expected byte lengths");
   81|       |   } else {
   82|       |      if(s.size_bytes() != expected) {
   83|       |         memory_region_size_violation();
   84|       |      }
   85|       |   }
   86|   136k|}

_ZN5Botan21RandomNumberGenerator10random_vecITkNS_8concepts21resizable_byte_bufferENSt3__16vectorIhNS_16secure_allocatorIhEEEEEEvRT_m:
  255|  4.26k|      void random_vec(T& v, size_t bytes) {
  256|  4.26k|         v.resize(bytes);
  257|  4.26k|         random_vec(v);
  258|  4.26k|      }
_ZN5Botan21RandomNumberGenerator10random_vecENSt3__14spanIhLm18446744073709551615EEE:
  244|  4.26k|      void random_vec(std::span<uint8_t> v) { this->randomize(v); }
_ZN5Botan21RandomNumberGenerator9randomizeENSt3__14spanIhLm18446744073709551615EEE:
   86|  4.26k|      void randomize(std::span<uint8_t> output) { this->fill_bytes_with_input(output, {}); }
_ZN5Botan21RandomNumberGenerator11add_entropyENSt3__14spanIKhLm18446744073709551615EEE:
  114|  4.26k|      void add_entropy(std::span<const uint8_t> input) { this->fill_bytes_with_input({}, input); }
_ZN5Botan21RandomNumberGenerator9next_byteEv:
  292|  4.26k|      uint8_t next_byte() {
  293|  4.26k|         uint8_t b = 0;
  294|  4.26k|         this->fill_bytes_with_input(std::span(&b, 1), {});
  295|  4.26k|         return b;
  296|  4.26k|      }
_ZN5Botan21RandomNumberGeneratorC2Ev:
   57|  8.52k|      RandomNumberGenerator() = default;
_ZN5Botan21RandomNumberGeneratorD2Ev:
   52|  8.52k|      virtual ~RandomNumberGenerator() = default;
_ZN5Botan21RandomNumberGenerator10random_vecITkNS_8concepts21resizable_byte_bufferENSt3__16vectorIhNS_16secure_allocatorIhEEEEQsr3stdE21default_initializableIT_EEES8_m:
  270|  4.26k|      T random_vec(size_t bytes) {
  271|  4.26k|         T result;
  272|  4.26k|         random_vec(result, bytes);
  273|  4.26k|         return result;
  274|  4.26k|      }

_ZN5Botan16secure_allocatorIhE10deallocateEPhm:
  102|  21.3k|      void deallocate(T* p, std::size_t n) { deallocate_memory(p, n, sizeof(T)); }
_ZN5Botan16secure_allocatorIhE8allocateEm:
   95|  21.3k|      T* allocate(std::size_t n) { return static_cast<T*>(allocate_memory(n, sizeof(T))); }
_ZN5Botan16secure_allocatorImE10deallocateEPmm:
  102|  4.26k|      void deallocate(T* p, std::size_t n) { deallocate_memory(p, n, sizeof(T)); }
_ZN5Botan16secure_allocatorImE8allocateEm:
   95|  4.26k|      T* allocate(std::size_t n) { return static_cast<T*>(allocate_memory(n, sizeof(T))); }

_ZN5Botan12Stateful_RNGC2ERNS_21RandomNumberGeneratorEm:
   49|  4.26k|            m_underlying_rng(&rng), m_reseed_interval(reseed_interval) {}
_ZNK5Botan12Stateful_RNG13accepts_inputEv:
   91|  4.26k|      bool accepts_input() const final { return true; }

_ZN5Botan18unwrap_strong_typeIRmEEDcOT_:
  328|   536k|[[nodiscard]] constexpr decltype(auto) unwrap_strong_type(T&& t) {
  329|   536k|   if constexpr(!concepts::strong_type<std::remove_cvref_t<T>>) {
  330|       |      // If the parameter type isn't a strong type, return it as is.
  331|   536k|      return std::forward<T>(t);
  332|       |   } else {
  333|       |      // Unwrap the strong type and return the underlying value.
  334|       |      return std::forward<T>(t).get();
  335|       |   }
  336|   536k|}
_ZN5Botan16wrap_strong_typeImRmQoosr3stdE18constructible_fromIT_T0_Eaasr8conceptsE11strong_typeIS2_Esr3stdE18constructible_fromINS2_12wrapped_typeES3_EEEDcOS3_:
  353|  2.18M|[[nodiscard]] constexpr decltype(auto) wrap_strong_type(ParamT&& t) {
  354|  2.18M|   if constexpr(std::same_as<std::remove_cvref_t<ParamT>, T>) {
  355|       |      // Noop, if the parameter type already is the desired return type.
  356|  2.18M|      return std::forward<ParamT>(t);
  357|       |   } else if constexpr(std::constructible_from<T, ParamT>) {
  358|       |      // Implicit conversion from the parameter type to the return type.
  359|       |      return T{std::forward<ParamT>(t)};
  360|       |   } else {
  361|       |      // Explicitly calling the wrapped type's constructor to support
  362|       |      // implicit conversions on types that mark their constructors as explicit.
  363|       |      static_assert(concepts::strong_type<T> && std::constructible_from<typename T::wrapped_type, ParamT>);
  364|       |      return T{typename T::wrapped_type{std::forward<ParamT>(t)}};
  365|       |   }
  366|  2.18M|}

_ZNK5Botan18SymmetricAlgorithm15valid_keylengthEm:
  143|  17.0k|      bool valid_keylength(size_t length) const { return key_spec().valid_keylength(length); }
_ZNK5Botan24Key_Length_Specification15valid_keylengthEm:
   44|  17.0k|      bool valid_keylength(size_t length) const {
   45|  17.0k|         return ((length >= m_min_keylen) && (length <= m_max_keylen) && (length % m_keylen_mod == 0));
  ------------------
  |  Branch (45:18): [True: 17.0k, False: 0]
  |  Branch (45:46): [True: 17.0k, False: 0]
  |  Branch (45:74): [True: 17.0k, False: 0]
  ------------------
   46|  17.0k|      }
_ZN5Botan24Key_Length_SpecificationC2Emmm:
   37|  17.0k|            m_min_keylen(min_k), m_max_keylen(max_k > 0 ? max_k : min_k), m_keylen_mod(k_mod) {}
  ------------------
  |  Branch (37:47): [True: 17.0k, False: 0]
  ------------------
_ZNK5Botan18SymmetricAlgorithm23assert_key_material_setEv:
  180|  80.9k|      void assert_key_material_set() const { assert_key_material_set(has_keying_material()); }
_ZNK5Botan18SymmetricAlgorithm23assert_key_material_setEb:
  186|  80.9k|      void assert_key_material_set(bool predicate) const {
  187|  80.9k|         if(!predicate) {
  ------------------
  |  Branch (187:13): [True: 0, False: 80.9k]
  ------------------
  188|      0|            throw_key_not_set_error();
  189|      0|         }
  190|  80.9k|      }
_ZN5Botan18SymmetricAlgorithmD2Ev:
   90|  4.26k|      virtual ~SymmetricAlgorithm() = default;
_ZN5Botan18SymmetricAlgorithmC2Ev:
   88|  4.26k|      SymmetricAlgorithm() = default;

_ZN5Botan20Buffered_Computation5finalENSt3__14spanIhLm18446744073709551615EEE:
   54|  59.6k|void Buffered_Computation::final(std::span<uint8_t> out) {
   55|  59.6k|   BOTAN_ARG_CHECK(out.size() >= output_length(), "Output buffer has insufficient capacity");
  ------------------
  |  |   35|  59.6k|   do {                                                          \
  |  |   36|  59.6k|      /* NOLINTNEXTLINE(*-simplify-boolean-expr) */              \
  |  |   37|  59.6k|      if(!(expr)) {                                              \
  |  |  ------------------
  |  |  |  Branch (37:10): [True: 0, False: 59.6k]
  |  |  ------------------
  |  |   38|      0|         /* NOLINTNEXTLINE(bugprone-lambda-function-name) */     \
  |  |   39|      0|         Botan::throw_invalid_argument(msg, __func__, __FILE__); \
  |  |   40|      0|      }                                                          \
  |  |   41|  59.6k|   } while(0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded, False: 59.6k]
  |  |  ------------------
  ------------------
   56|       |   // Pass exactly output_length() bytes so that an oversized buffer has the
   57|       |   // result written to its leading bytes with the remainder left untouched.
   58|  59.6k|   final_result(out.first(output_length()));
   59|  59.6k|}

_ZN5Botan18SymmetricAlgorithm7set_keyENSt3__14spanIKhLm18446744073709551615EEE:
   22|  17.0k|void SymmetricAlgorithm::set_key(std::span<const uint8_t> key) {
   23|  17.0k|   if(!valid_keylength(key.size())) {
  ------------------
  |  Branch (23:7): [True: 0, False: 17.0k]
  ------------------
   24|      0|      throw Invalid_Key_Length(name(), key.size());
   25|      0|   }
   26|  17.0k|   key_schedule(key);
   27|  17.0k|}

_ZN9Botan_FFI24ffi_clear_last_exceptionEv:
   85|  8.52k|void ffi_clear_last_exception() {
   86|  8.52k|   g_last_exception_what.clear();
   87|  8.52k|}
botan_scrub_mem:
  340|  15.1k|int botan_scrub_mem(void* mem, size_t bytes) {
  341|  15.1k|   if(bytes > 0 && mem == nullptr) {
  ------------------
  |  Branch (341:7): [True: 820, False: 14.3k]
  |  Branch (341:20): [True: 0, False: 820]
  ------------------
  342|      0|      return BOTAN_FFI_ERROR_NULL_POINTER;
  343|      0|   }
  344|  15.1k|   Botan::secure_scrub_memory(mem, bytes);
  345|  15.1k|   return BOTAN_FFI_SUCCESS;
  346|  15.1k|}

botan_rng_init:
   38|  4.26k|int botan_rng_init(botan_rng_t* rng_out, const char* rng_type) {
   39|  4.26k|   return ffi_guard_thunk(__func__, [=]() -> int {
   40|  4.26k|      if(rng_out == nullptr) {
   41|  4.26k|         return BOTAN_FFI_ERROR_NULL_POINTER;
   42|  4.26k|      }
   43|       |
   44|  4.26k|      const std::string rng_type_s(rng_type != nullptr ? rng_type : "system");
   45|       |
   46|  4.26k|      std::unique_ptr<Botan::RandomNumberGenerator> rng;
   47|       |
   48|  4.26k|      if(rng_type_s == "system") {
   49|  4.26k|         rng = std::make_unique<Botan::System_RNG>();
   50|  4.26k|      } else if(rng_type_s == "user" || rng_type_s == "user-threadsafe") {
   51|  4.26k|         rng = std::make_unique<Botan::AutoSeeded_RNG>();
   52|  4.26k|      } else if(rng_type_s == "null") {
   53|  4.26k|         rng = std::make_unique<Botan::Null_RNG>();
   54|  4.26k|      }
   55|       |#if defined(BOTAN_HAS_PROCESSOR_RNG)
   56|       |      else if((rng_type_s == "rdrand" || rng_type_s == "hwrng") && Botan::Processor_RNG::available()) {
   57|       |         rng = std::make_unique<Botan::Processor_RNG>();
   58|       |      }
   59|       |#endif
   60|       |#if defined(BOTAN_HAS_JITTER_RNG)
   61|       |      else if(rng_type_s == "jitter") {
   62|       |         rng = std::make_unique<Botan::Jitter_RNG>();
   63|       |      }
   64|       |#endif
   65|       |#if defined(BOTAN_HAS_ESDM_RNG)
   66|       |      else if(rng_type_s == "esdm-full") {
   67|       |         rng = std::make_unique<Botan::ESDM_RNG>(false);
   68|       |      } else if(rng_type_s == "esdm-pr") {
   69|       |         rng = std::make_unique<Botan::ESDM_RNG>(true);
   70|       |      }
   71|       |#endif
   72|       |
   73|  4.26k|      if(!rng) {
   74|  4.26k|         return BOTAN_FFI_ERROR_NOT_IMPLEMENTED;
   75|  4.26k|      }
   76|       |
   77|  4.26k|      return ffi_new_object(rng_out, std::move(rng));
   78|  4.26k|   });
   79|  4.26k|}
botan_rng_destroy:
  164|  4.26k|int botan_rng_destroy(botan_rng_t rng) {
  165|  4.26k|   return BOTAN_FFI_CHECKED_DELETE(rng);
  ------------------
  |  |  188|  4.26k|#define BOTAN_FFI_CHECKED_DELETE(o) ffi_delete_object(o, __func__)
  ------------------
  166|  4.26k|}
ffi_rng.cpp:_ZZ14botan_rng_initENK3$_0clEv:
   39|  4.26k|   return ffi_guard_thunk(__func__, [=]() -> int {
   40|  4.26k|      if(rng_out == nullptr) {
  ------------------
  |  Branch (40:10): [True: 0, False: 4.26k]
  ------------------
   41|      0|         return BOTAN_FFI_ERROR_NULL_POINTER;
   42|      0|      }
   43|       |
   44|  4.26k|      const std::string rng_type_s(rng_type != nullptr ? rng_type : "system");
  ------------------
  |  Branch (44:36): [True: 4.26k, False: 0]
  ------------------
   45|       |
   46|  4.26k|      std::unique_ptr<Botan::RandomNumberGenerator> rng;
   47|       |
   48|  4.26k|      if(rng_type_s == "system") {
  ------------------
  |  Branch (48:10): [True: 0, False: 4.26k]
  ------------------
   49|      0|         rng = std::make_unique<Botan::System_RNG>();
   50|  4.26k|      } else if(rng_type_s == "user" || rng_type_s == "user-threadsafe") {
  ------------------
  |  Branch (50:17): [True: 4.26k, False: 0]
  |  Branch (50:41): [True: 0, False: 0]
  ------------------
   51|  4.26k|         rng = std::make_unique<Botan::AutoSeeded_RNG>();
   52|  4.26k|      } else if(rng_type_s == "null") {
  ------------------
  |  Branch (52:17): [True: 0, False: 0]
  ------------------
   53|      0|         rng = std::make_unique<Botan::Null_RNG>();
   54|      0|      }
   55|       |#if defined(BOTAN_HAS_PROCESSOR_RNG)
   56|       |      else if((rng_type_s == "rdrand" || rng_type_s == "hwrng") && Botan::Processor_RNG::available()) {
   57|       |         rng = std::make_unique<Botan::Processor_RNG>();
   58|       |      }
   59|       |#endif
   60|       |#if defined(BOTAN_HAS_JITTER_RNG)
   61|       |      else if(rng_type_s == "jitter") {
   62|       |         rng = std::make_unique<Botan::Jitter_RNG>();
   63|       |      }
   64|       |#endif
   65|       |#if defined(BOTAN_HAS_ESDM_RNG)
   66|       |      else if(rng_type_s == "esdm-full") {
   67|       |         rng = std::make_unique<Botan::ESDM_RNG>(false);
   68|       |      } else if(rng_type_s == "esdm-pr") {
   69|       |         rng = std::make_unique<Botan::ESDM_RNG>(true);
   70|       |      }
   71|       |#endif
   72|       |
   73|  4.26k|      if(!rng) {
  ------------------
  |  Branch (73:10): [True: 0, False: 4.26k]
  ------------------
   74|      0|         return BOTAN_FFI_ERROR_NOT_IMPLEMENTED;
   75|      0|      }
   76|       |
   77|  4.26k|      return ffi_new_object(rng_out, std::move(rng));
   78|  4.26k|   });

_ZN5Botan12HashFunction6createENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEES5_:
  111|  4.26k|std::unique_ptr<HashFunction> HashFunction::create(std::string_view algo_spec, std::string_view provider) {
  112|       |#if defined(BOTAN_HAS_COMMONCRYPTO)
  113|       |   if(provider.empty() || provider == "commoncrypto") {
  114|       |      if(auto hash = make_commoncrypto_hash(algo_spec))
  115|       |         return hash;
  116|       |
  117|       |      if(!provider.empty())
  118|       |         return nullptr;
  119|       |   }
  120|       |#endif
  121|       |
  122|  4.26k|   if(provider.empty() == false && provider != "base") {
  ------------------
  |  Branch (122:7): [True: 0, False: 4.26k]
  |  Branch (122:36): [True: 0, False: 0]
  ------------------
  123|      0|      return nullptr;  // unknown provider
  124|      0|   }
  125|       |
  126|  4.26k|#if defined(BOTAN_HAS_SHA1)
  127|  4.26k|   if(algo_spec == "SHA-1") {
  ------------------
  |  Branch (127:7): [True: 0, False: 4.26k]
  ------------------
  128|      0|      return std::make_unique<SHA_1>();
  129|      0|   }
  130|  4.26k|#endif
  131|       |
  132|  4.26k|#if defined(BOTAN_HAS_SHA2_32)
  133|  4.26k|   if(algo_spec == "SHA-224") {
  ------------------
  |  Branch (133:7): [True: 0, False: 4.26k]
  ------------------
  134|      0|      return std::make_unique<SHA_224>();
  135|      0|   }
  136|       |
  137|  4.26k|   if(algo_spec == "SHA-256") {
  ------------------
  |  Branch (137:7): [True: 0, False: 4.26k]
  ------------------
  138|      0|      return std::make_unique<SHA_256>();
  139|      0|   }
  140|  4.26k|#endif
  141|       |
  142|  4.26k|#if defined(BOTAN_HAS_SHA2_64)
  143|  4.26k|   if(algo_spec == "SHA-384") {
  ------------------
  |  Branch (143:7): [True: 0, False: 4.26k]
  ------------------
  144|      0|      return std::make_unique<SHA_384>();
  145|      0|   }
  146|       |
  147|  4.26k|   if(algo_spec == "SHA-512") {
  ------------------
  |  Branch (147:7): [True: 4.26k, False: 0]
  ------------------
  148|  4.26k|      return std::make_unique<SHA_512>();
  149|  4.26k|   }
  150|       |
  151|      0|   if(algo_spec == "SHA-512-256") {
  ------------------
  |  Branch (151:7): [True: 0, False: 0]
  ------------------
  152|      0|      return std::make_unique<SHA_512_256>();
  153|      0|   }
  154|      0|#endif
  155|       |
  156|      0|#if defined(BOTAN_HAS_RIPEMD_160)
  157|      0|   if(algo_spec == "RIPEMD-160") {
  ------------------
  |  Branch (157:7): [True: 0, False: 0]
  ------------------
  158|      0|      return std::make_unique<RIPEMD_160>();
  159|      0|   }
  160|      0|#endif
  161|       |
  162|       |#if defined(BOTAN_HAS_WHIRLPOOL)
  163|       |   if(algo_spec == "Whirlpool") {
  164|       |      return std::make_unique<Whirlpool>();
  165|       |   }
  166|       |#endif
  167|       |
  168|      0|#if defined(BOTAN_HAS_MD5)
  169|      0|   if(algo_spec == "MD5") {
  ------------------
  |  Branch (169:7): [True: 0, False: 0]
  ------------------
  170|      0|      return std::make_unique<MD5>();
  171|      0|   }
  172|      0|#endif
  173|       |
  174|       |#if defined(BOTAN_HAS_MD4)
  175|       |   if(algo_spec == "MD4") {
  176|       |      return std::make_unique<MD4>();
  177|       |   }
  178|       |#endif
  179|       |
  180|       |#if defined(BOTAN_HAS_GOST_34_11)
  181|       |   if(algo_spec == "GOST-R-34.11-94" || algo_spec == "GOST-34.11") {
  182|       |      return std::make_unique<GOST_34_11>();
  183|       |   }
  184|       |#endif
  185|       |
  186|       |#if defined(BOTAN_HAS_ADLER32)
  187|       |   if(algo_spec == "Adler32") {
  188|       |      return std::make_unique<Adler32>();
  189|       |   }
  190|       |#endif
  191|       |
  192|       |#if defined(BOTAN_HAS_ASCON_HASH256)
  193|       |   if(algo_spec == "Ascon-Hash256") {
  194|       |      return std::make_unique<Ascon_Hash256>();
  195|       |   }
  196|       |#endif
  197|       |
  198|      0|#if defined(BOTAN_HAS_CRC24)
  199|      0|   if(algo_spec == "CRC24") {
  ------------------
  |  Branch (199:7): [True: 0, False: 0]
  ------------------
  200|      0|      return std::make_unique<CRC24>();
  201|      0|   }
  202|      0|#endif
  203|       |
  204|       |#if defined(BOTAN_HAS_CRC32)
  205|       |   if(algo_spec == "CRC32") {
  206|       |      return std::make_unique<CRC32>();
  207|       |   }
  208|       |#endif
  209|       |
  210|       |#if defined(BOTAN_HAS_STREEBOG)
  211|       |   if(algo_spec == "Streebog-256") {
  212|       |      return std::make_unique<Streebog>(256);
  213|       |   }
  214|       |   if(algo_spec == "Streebog-512") {
  215|       |      return std::make_unique<Streebog>(512);
  216|       |   }
  217|       |#endif
  218|       |
  219|      0|#if defined(BOTAN_HAS_SM3)
  220|      0|   if(algo_spec == "SM3") {
  ------------------
  |  Branch (220:7): [True: 0, False: 0]
  ------------------
  221|      0|      return std::make_unique<SM3>();
  222|      0|   }
  223|      0|#endif
  224|       |
  225|      0|   const SCAN_Name req(algo_spec);
  226|       |
  227|       |#if defined(BOTAN_HAS_SKEIN_512)
  228|       |   if(req.algo_name() == "Skein-512") {
  229|       |      return std::make_unique<Skein_512>(req.arg_as_integer(0, 512), req.arg(1, ""));
  230|       |   }
  231|       |#endif
  232|       |
  233|      0|#if defined(BOTAN_HAS_BLAKE2B)
  234|      0|   if(req.algo_name() == "Blake2b" || req.algo_name() == "BLAKE2b") {
  ------------------
  |  Branch (234:7): [True: 0, False: 0]
  |  Branch (234:39): [True: 0, False: 0]
  ------------------
  235|      0|      return std::make_unique<BLAKE2b>(req.arg_as_integer(0, 512));
  236|      0|   }
  237|      0|#endif
  238|       |
  239|       |#if defined(BOTAN_HAS_BLAKE2S)
  240|       |   if(req.algo_name() == "Blake2s" || req.algo_name() == "BLAKE2s") {
  241|       |      return std::make_unique<BLAKE2s>(req.arg_as_integer(0, 256));
  242|       |   }
  243|       |#endif
  244|       |
  245|       |#if defined(BOTAN_HAS_KECCAK)
  246|       |   if(req.algo_name() == "Keccak-1600") {
  247|       |      return std::make_unique<Keccak_1600>(req.arg_as_integer(0, 512));
  248|       |   }
  249|       |#endif
  250|       |
  251|      0|#if defined(BOTAN_HAS_SHA3)
  252|      0|   if(req.algo_name() == "SHA-3") {
  ------------------
  |  Branch (252:7): [True: 0, False: 0]
  ------------------
  253|      0|      return std::make_unique<SHA_3>(req.arg_as_integer(0, 512));
  254|      0|   }
  255|      0|#endif
  256|       |
  257|      0|#if defined(BOTAN_HAS_SHAKE)
  258|      0|   if(req.algo_name() == "SHAKE-128" && req.arg_count() == 1) {
  ------------------
  |  Branch (258:7): [True: 0, False: 0]
  |  Branch (258:41): [True: 0, False: 0]
  ------------------
  259|      0|      return std::make_unique<SHAKE_128>(req.arg_as_integer(0));
  260|      0|   }
  261|      0|   if(req.algo_name() == "SHAKE-256" && req.arg_count() == 1) {
  ------------------
  |  Branch (261:7): [True: 0, False: 0]
  |  Branch (261:41): [True: 0, False: 0]
  ------------------
  262|      0|      return std::make_unique<SHAKE_256>(req.arg_as_integer(0));
  263|      0|   }
  264|      0|#endif
  265|       |
  266|       |#if defined(BOTAN_HAS_PARALLEL_HASH)
  267|       |   if(req.algo_name() == "Parallel") {
  268|       |      std::vector<std::unique_ptr<HashFunction>> hashes;
  269|       |
  270|       |      for(size_t i = 0; i != req.arg_count(); ++i) {
  271|       |         auto h = HashFunction::create(req.arg(i));
  272|       |         if(!h) {
  273|       |            return nullptr;
  274|       |         }
  275|       |         hashes.push_back(std::move(h));
  276|       |      }
  277|       |
  278|       |      return std::make_unique<Parallel>(hashes);
  279|       |   }
  280|       |#endif
  281|       |
  282|      0|#if defined(BOTAN_HAS_TRUNCATED_HASH)
  283|      0|   if(req.algo_name() == "Truncated" && req.arg_count() == 2) {
  ------------------
  |  Branch (283:7): [True: 0, False: 0]
  |  Branch (283:41): [True: 0, False: 0]
  ------------------
  284|      0|      auto hash = HashFunction::create(req.arg(0));
  285|      0|      if(!hash) {
  ------------------
  |  Branch (285:10): [True: 0, False: 0]
  ------------------
  286|      0|         return nullptr;
  287|      0|      }
  288|       |
  289|      0|      return std::make_unique<Truncated_Hash>(std::move(hash), req.arg_as_integer(1));
  290|      0|   }
  291|      0|#endif
  292|       |
  293|       |#if defined(BOTAN_HAS_COMB4P)
  294|       |   if(req.algo_name() == "Comb4P" && req.arg_count() == 2) {
  295|       |      auto h1 = HashFunction::create(req.arg(0));
  296|       |      auto h2 = HashFunction::create(req.arg(1));
  297|       |
  298|       |      if(h1 && h2) {
  299|       |         return std::make_unique<Comb4P>(std::move(h1), std::move(h2));
  300|       |      }
  301|       |   }
  302|       |#endif
  303|       |
  304|      0|   return nullptr;
  305|      0|}

_ZN5Botan7SHA_51215compress_digestERNSt3__16vectorImNS_16secure_allocatorImEEEENS1_4spanIKhLm18446744073709551615EEEm:
   56|   136k|void SHA_512::compress_digest(digest_type& digest, std::span<const uint8_t> input, size_t blocks) {
   57|       |#if defined(BOTAN_HAS_SHA2_64_X86)
   58|       |   if(CPUID::has(CPUID::Feature::SHA512)) {
   59|       |      return compress_digest_x86(digest, input, blocks);
   60|       |   }
   61|       |#endif
   62|       |
   63|       |#if defined(BOTAN_HAS_SHA2_64_ARMV8)
   64|       |   if(CPUID::has(CPUID::Feature::SHA2_512)) {
   65|       |      return compress_digest_armv8(digest, input, blocks);
   66|       |   }
   67|       |#endif
   68|       |
   69|       |#if defined(BOTAN_HAS_SHA2_64_X86_AVX512)
   70|       |   if(CPUID::has(CPUID::Feature::AVX512, CPUID::Feature::BMI)) {
   71|       |      return compress_digest_x86_avx512(digest, input, blocks);
   72|       |   }
   73|       |#endif
   74|       |
   75|       |#if defined(BOTAN_HAS_SHA2_64_X86_AVX2)
   76|       |   if(CPUID::has(CPUID::Feature::AVX2, CPUID::Feature::BMI)) {
   77|       |      return compress_digest_x86_avx2(digest, input, blocks);
   78|       |   }
   79|       |#endif
   80|       |
   81|   136k|   uint64_t A = digest[0];
   82|   136k|   uint64_t B = digest[1];
   83|   136k|   uint64_t C = digest[2];
   84|   136k|   uint64_t D = digest[3];
   85|   136k|   uint64_t E = digest[4];
   86|   136k|   uint64_t F = digest[5];
   87|   136k|   uint64_t G = digest[6];
   88|   136k|   uint64_t H = digest[7];
   89|       |
   90|   136k|   std::array<uint64_t, 16> W{};
   91|       |
   92|   136k|   BufferSlicer in(input);
   93|       |
   94|   272k|   for(size_t i = 0; i != blocks; ++i) {
  ------------------
  |  Branch (94:22): [True: 136k, False: 136k]
  ------------------
   95|   136k|      load_be(W, in.take<block_bytes>());
   96|       |
   97|       |      // clang-format off
   98|       |
   99|   136k|      SHA2_64_F(A, B, C, D, E, F, G, H, W[ 0], W[14], W[ 9], W[ 1], 0x428A2F98D728AE22);
  100|   136k|      SHA2_64_F(H, A, B, C, D, E, F, G, W[ 1], W[15], W[10], W[ 2], 0x7137449123EF65CD);
  101|   136k|      SHA2_64_F(G, H, A, B, C, D, E, F, W[ 2], W[ 0], W[11], W[ 3], 0xB5C0FBCFEC4D3B2F);
  102|   136k|      SHA2_64_F(F, G, H, A, B, C, D, E, W[ 3], W[ 1], W[12], W[ 4], 0xE9B5DBA58189DBBC);
  103|   136k|      SHA2_64_F(E, F, G, H, A, B, C, D, W[ 4], W[ 2], W[13], W[ 5], 0x3956C25BF348B538);
  104|   136k|      SHA2_64_F(D, E, F, G, H, A, B, C, W[ 5], W[ 3], W[14], W[ 6], 0x59F111F1B605D019);
  105|   136k|      SHA2_64_F(C, D, E, F, G, H, A, B, W[ 6], W[ 4], W[15], W[ 7], 0x923F82A4AF194F9B);
  106|   136k|      SHA2_64_F(B, C, D, E, F, G, H, A, W[ 7], W[ 5], W[ 0], W[ 8], 0xAB1C5ED5DA6D8118);
  107|   136k|      SHA2_64_F(A, B, C, D, E, F, G, H, W[ 8], W[ 6], W[ 1], W[ 9], 0xD807AA98A3030242);
  108|   136k|      SHA2_64_F(H, A, B, C, D, E, F, G, W[ 9], W[ 7], W[ 2], W[10], 0x12835B0145706FBE);
  109|   136k|      SHA2_64_F(G, H, A, B, C, D, E, F, W[10], W[ 8], W[ 3], W[11], 0x243185BE4EE4B28C);
  110|   136k|      SHA2_64_F(F, G, H, A, B, C, D, E, W[11], W[ 9], W[ 4], W[12], 0x550C7DC3D5FFB4E2);
  111|   136k|      SHA2_64_F(E, F, G, H, A, B, C, D, W[12], W[10], W[ 5], W[13], 0x72BE5D74F27B896F);
  112|   136k|      SHA2_64_F(D, E, F, G, H, A, B, C, W[13], W[11], W[ 6], W[14], 0x80DEB1FE3B1696B1);
  113|   136k|      SHA2_64_F(C, D, E, F, G, H, A, B, W[14], W[12], W[ 7], W[15], 0x9BDC06A725C71235);
  114|   136k|      SHA2_64_F(B, C, D, E, F, G, H, A, W[15], W[13], W[ 8], W[ 0], 0xC19BF174CF692694);
  115|   136k|      SHA2_64_F(A, B, C, D, E, F, G, H, W[ 0], W[14], W[ 9], W[ 1], 0xE49B69C19EF14AD2);
  116|   136k|      SHA2_64_F(H, A, B, C, D, E, F, G, W[ 1], W[15], W[10], W[ 2], 0xEFBE4786384F25E3);
  117|   136k|      SHA2_64_F(G, H, A, B, C, D, E, F, W[ 2], W[ 0], W[11], W[ 3], 0x0FC19DC68B8CD5B5);
  118|   136k|      SHA2_64_F(F, G, H, A, B, C, D, E, W[ 3], W[ 1], W[12], W[ 4], 0x240CA1CC77AC9C65);
  119|   136k|      SHA2_64_F(E, F, G, H, A, B, C, D, W[ 4], W[ 2], W[13], W[ 5], 0x2DE92C6F592B0275);
  120|   136k|      SHA2_64_F(D, E, F, G, H, A, B, C, W[ 5], W[ 3], W[14], W[ 6], 0x4A7484AA6EA6E483);
  121|   136k|      SHA2_64_F(C, D, E, F, G, H, A, B, W[ 6], W[ 4], W[15], W[ 7], 0x5CB0A9DCBD41FBD4);
  122|   136k|      SHA2_64_F(B, C, D, E, F, G, H, A, W[ 7], W[ 5], W[ 0], W[ 8], 0x76F988DA831153B5);
  123|   136k|      SHA2_64_F(A, B, C, D, E, F, G, H, W[ 8], W[ 6], W[ 1], W[ 9], 0x983E5152EE66DFAB);
  124|   136k|      SHA2_64_F(H, A, B, C, D, E, F, G, W[ 9], W[ 7], W[ 2], W[10], 0xA831C66D2DB43210);
  125|   136k|      SHA2_64_F(G, H, A, B, C, D, E, F, W[10], W[ 8], W[ 3], W[11], 0xB00327C898FB213F);
  126|   136k|      SHA2_64_F(F, G, H, A, B, C, D, E, W[11], W[ 9], W[ 4], W[12], 0xBF597FC7BEEF0EE4);
  127|   136k|      SHA2_64_F(E, F, G, H, A, B, C, D, W[12], W[10], W[ 5], W[13], 0xC6E00BF33DA88FC2);
  128|   136k|      SHA2_64_F(D, E, F, G, H, A, B, C, W[13], W[11], W[ 6], W[14], 0xD5A79147930AA725);
  129|   136k|      SHA2_64_F(C, D, E, F, G, H, A, B, W[14], W[12], W[ 7], W[15], 0x06CA6351E003826F);
  130|   136k|      SHA2_64_F(B, C, D, E, F, G, H, A, W[15], W[13], W[ 8], W[ 0], 0x142929670A0E6E70);
  131|   136k|      SHA2_64_F(A, B, C, D, E, F, G, H, W[ 0], W[14], W[ 9], W[ 1], 0x27B70A8546D22FFC);
  132|   136k|      SHA2_64_F(H, A, B, C, D, E, F, G, W[ 1], W[15], W[10], W[ 2], 0x2E1B21385C26C926);
  133|   136k|      SHA2_64_F(G, H, A, B, C, D, E, F, W[ 2], W[ 0], W[11], W[ 3], 0x4D2C6DFC5AC42AED);
  134|   136k|      SHA2_64_F(F, G, H, A, B, C, D, E, W[ 3], W[ 1], W[12], W[ 4], 0x53380D139D95B3DF);
  135|   136k|      SHA2_64_F(E, F, G, H, A, B, C, D, W[ 4], W[ 2], W[13], W[ 5], 0x650A73548BAF63DE);
  136|   136k|      SHA2_64_F(D, E, F, G, H, A, B, C, W[ 5], W[ 3], W[14], W[ 6], 0x766A0ABB3C77B2A8);
  137|   136k|      SHA2_64_F(C, D, E, F, G, H, A, B, W[ 6], W[ 4], W[15], W[ 7], 0x81C2C92E47EDAEE6);
  138|   136k|      SHA2_64_F(B, C, D, E, F, G, H, A, W[ 7], W[ 5], W[ 0], W[ 8], 0x92722C851482353B);
  139|   136k|      SHA2_64_F(A, B, C, D, E, F, G, H, W[ 8], W[ 6], W[ 1], W[ 9], 0xA2BFE8A14CF10364);
  140|   136k|      SHA2_64_F(H, A, B, C, D, E, F, G, W[ 9], W[ 7], W[ 2], W[10], 0xA81A664BBC423001);
  141|   136k|      SHA2_64_F(G, H, A, B, C, D, E, F, W[10], W[ 8], W[ 3], W[11], 0xC24B8B70D0F89791);
  142|   136k|      SHA2_64_F(F, G, H, A, B, C, D, E, W[11], W[ 9], W[ 4], W[12], 0xC76C51A30654BE30);
  143|   136k|      SHA2_64_F(E, F, G, H, A, B, C, D, W[12], W[10], W[ 5], W[13], 0xD192E819D6EF5218);
  144|   136k|      SHA2_64_F(D, E, F, G, H, A, B, C, W[13], W[11], W[ 6], W[14], 0xD69906245565A910);
  145|   136k|      SHA2_64_F(C, D, E, F, G, H, A, B, W[14], W[12], W[ 7], W[15], 0xF40E35855771202A);
  146|   136k|      SHA2_64_F(B, C, D, E, F, G, H, A, W[15], W[13], W[ 8], W[ 0], 0x106AA07032BBD1B8);
  147|   136k|      SHA2_64_F(A, B, C, D, E, F, G, H, W[ 0], W[14], W[ 9], W[ 1], 0x19A4C116B8D2D0C8);
  148|   136k|      SHA2_64_F(H, A, B, C, D, E, F, G, W[ 1], W[15], W[10], W[ 2], 0x1E376C085141AB53);
  149|   136k|      SHA2_64_F(G, H, A, B, C, D, E, F, W[ 2], W[ 0], W[11], W[ 3], 0x2748774CDF8EEB99);
  150|   136k|      SHA2_64_F(F, G, H, A, B, C, D, E, W[ 3], W[ 1], W[12], W[ 4], 0x34B0BCB5E19B48A8);
  151|   136k|      SHA2_64_F(E, F, G, H, A, B, C, D, W[ 4], W[ 2], W[13], W[ 5], 0x391C0CB3C5C95A63);
  152|   136k|      SHA2_64_F(D, E, F, G, H, A, B, C, W[ 5], W[ 3], W[14], W[ 6], 0x4ED8AA4AE3418ACB);
  153|   136k|      SHA2_64_F(C, D, E, F, G, H, A, B, W[ 6], W[ 4], W[15], W[ 7], 0x5B9CCA4F7763E373);
  154|   136k|      SHA2_64_F(B, C, D, E, F, G, H, A, W[ 7], W[ 5], W[ 0], W[ 8], 0x682E6FF3D6B2B8A3);
  155|   136k|      SHA2_64_F(A, B, C, D, E, F, G, H, W[ 8], W[ 6], W[ 1], W[ 9], 0x748F82EE5DEFB2FC);
  156|   136k|      SHA2_64_F(H, A, B, C, D, E, F, G, W[ 9], W[ 7], W[ 2], W[10], 0x78A5636F43172F60);
  157|   136k|      SHA2_64_F(G, H, A, B, C, D, E, F, W[10], W[ 8], W[ 3], W[11], 0x84C87814A1F0AB72);
  158|   136k|      SHA2_64_F(F, G, H, A, B, C, D, E, W[11], W[ 9], W[ 4], W[12], 0x8CC702081A6439EC);
  159|   136k|      SHA2_64_F(E, F, G, H, A, B, C, D, W[12], W[10], W[ 5], W[13], 0x90BEFFFA23631E28);
  160|   136k|      SHA2_64_F(D, E, F, G, H, A, B, C, W[13], W[11], W[ 6], W[14], 0xA4506CEBDE82BDE9);
  161|   136k|      SHA2_64_F(C, D, E, F, G, H, A, B, W[14], W[12], W[ 7], W[15], 0xBEF9A3F7B2C67915);
  162|   136k|      SHA2_64_F(B, C, D, E, F, G, H, A, W[15], W[13], W[ 8], W[ 0], 0xC67178F2E372532B);
  163|   136k|      SHA2_64_F(A, B, C, D, E, F, G, H, W[ 0], W[14], W[ 9], W[ 1], 0xCA273ECEEA26619C);
  164|   136k|      SHA2_64_F(H, A, B, C, D, E, F, G, W[ 1], W[15], W[10], W[ 2], 0xD186B8C721C0C207);
  165|   136k|      SHA2_64_F(G, H, A, B, C, D, E, F, W[ 2], W[ 0], W[11], W[ 3], 0xEADA7DD6CDE0EB1E);
  166|   136k|      SHA2_64_F(F, G, H, A, B, C, D, E, W[ 3], W[ 1], W[12], W[ 4], 0xF57D4F7FEE6ED178);
  167|   136k|      SHA2_64_F(E, F, G, H, A, B, C, D, W[ 4], W[ 2], W[13], W[ 5], 0x06F067AA72176FBA);
  168|   136k|      SHA2_64_F(D, E, F, G, H, A, B, C, W[ 5], W[ 3], W[14], W[ 6], 0x0A637DC5A2C898A6);
  169|   136k|      SHA2_64_F(C, D, E, F, G, H, A, B, W[ 6], W[ 4], W[15], W[ 7], 0x113F9804BEF90DAE);
  170|   136k|      SHA2_64_F(B, C, D, E, F, G, H, A, W[ 7], W[ 5], W[ 0], W[ 8], 0x1B710B35131C471B);
  171|   136k|      SHA2_64_F(A, B, C, D, E, F, G, H, W[ 8], W[ 6], W[ 1], W[ 9], 0x28DB77F523047D84);
  172|   136k|      SHA2_64_F(H, A, B, C, D, E, F, G, W[ 9], W[ 7], W[ 2], W[10], 0x32CAAB7B40C72493);
  173|   136k|      SHA2_64_F(G, H, A, B, C, D, E, F, W[10], W[ 8], W[ 3], W[11], 0x3C9EBE0A15C9BEBC);
  174|   136k|      SHA2_64_F(F, G, H, A, B, C, D, E, W[11], W[ 9], W[ 4], W[12], 0x431D67C49C100D4C);
  175|   136k|      SHA2_64_F(E, F, G, H, A, B, C, D, W[12], W[10], W[ 5], W[13], 0x4CC5D4BECB3E42B6);
  176|   136k|      SHA2_64_F(D, E, F, G, H, A, B, C, W[13], W[11], W[ 6], W[14], 0x597F299CFC657E2A);
  177|   136k|      SHA2_64_F(C, D, E, F, G, H, A, B, W[14], W[12], W[ 7], W[15], 0x5FCB6FAB3AD6FAEC);
  178|   136k|      SHA2_64_F(B, C, D, E, F, G, H, A, W[15], W[13], W[ 8], W[ 0], 0x6C44198C4A475817);
  179|       |
  180|       |      // clang-format on
  181|       |
  182|   136k|      A = (digest[0] += A);
  183|   136k|      B = (digest[1] += B);
  184|   136k|      C = (digest[2] += C);
  185|   136k|      D = (digest[3] += D);
  186|   136k|      E = (digest[4] += E);
  187|   136k|      F = (digest[5] += F);
  188|   136k|      G = (digest[6] += G);
  189|   136k|      H = (digest[7] += H);
  190|   136k|   }
  191|   136k|}
_ZN5Botan7SHA_51210compress_nERNSt3__16vectorImNS_16secure_allocatorImEEEENS1_4spanIKhLm18446744073709551615EEEm:
  213|   136k|void SHA_512::compress_n(digest_type& digest, std::span<const uint8_t> input, size_t blocks) {
  214|   136k|   SHA_512::compress_digest(digest, input, blocks);
  215|   136k|}
_ZN5Botan7SHA_5124initERNSt3__16vectorImNS_16secure_allocatorImEEEE:
  239|  80.9k|void SHA_512::init(digest_type& digest) {
  240|  80.9k|   digest.assign({0x6A09E667F3BCC908,
  241|  80.9k|                  0xBB67AE8584CAA73B,
  242|  80.9k|                  0x3C6EF372FE94F82B,
  243|  80.9k|                  0xA54FF53A5F1D36F1,
  244|  80.9k|                  0x510E527FADE682D1,
  245|  80.9k|                  0x9B05688C2B3E6C1F,
  246|  80.9k|                  0x1F83D9ABFB41BD6B,
  247|  80.9k|                  0x5BE0CD19137E2179});
  248|  80.9k|}
_ZN5Botan7SHA_5128add_dataENSt3__14spanIKhLm18446744073709551615EEE:
  278|   157k|void SHA_512::add_data(std::span<const uint8_t> input) {
  279|   157k|   m_md.update(input);
  280|   157k|}
_ZN5Botan7SHA_51212final_resultENSt3__14spanIhLm18446744073709551615EEE:
  290|  59.6k|void SHA_512::final_result(std::span<uint8_t> output) {
  291|  59.6k|   m_md.final(output);
  292|  59.6k|}

_ZN5Botan4HMAC8add_dataENSt3__14spanIKhLm18446744073709551615EEE:
   21|  51.1k|void HMAC::add_data(std::span<const uint8_t> input) {
   22|  51.1k|   assert_key_material_set();
   23|  51.1k|   m_hash->update(input);
   24|  51.1k|}
_ZN5Botan4HMAC12final_resultENSt3__14spanIhLm18446744073709551615EEE:
   29|  29.8k|void HMAC::final_result(std::span<uint8_t> mac) {
   30|  29.8k|   assert_key_material_set();
   31|  29.8k|   m_hash->final(mac);
   32|  29.8k|   m_hash->update(m_okey);
   33|  29.8k|   m_hash->update(mac.first(m_hash_output_length));
   34|  29.8k|   m_hash->final(mac);
   35|  29.8k|   m_hash->update(m_ikey);
   36|  29.8k|}
_ZNK5Botan4HMAC8key_specEv:
   48|  17.0k|Key_Length_Specification HMAC::key_spec() const {
   49|       |   // Support very long lengths for things like PBKDF2 and the TLS PRF
   50|  17.0k|   return Key_Length_Specification(0, 8192);
   51|  17.0k|}
_ZNK5Botan4HMAC13output_lengthEv:
   53|  38.3k|size_t HMAC::output_length() const {
   54|  38.3k|   return m_hash_output_length;
   55|  38.3k|}
_ZNK5Botan4HMAC19has_keying_materialEv:
   57|  80.9k|bool HMAC::has_keying_material() const {
   58|  80.9k|   return !m_okey.empty();
   59|  80.9k|}
_ZN5Botan4HMAC12key_scheduleENSt3__14spanIKhLm18446744073709551615EEE:
   64|  17.0k|void HMAC::key_schedule(std::span<const uint8_t> key) {
   65|  17.0k|   const uint8_t ipad = 0x36;
   66|  17.0k|   const uint8_t opad = 0x5C;
   67|       |
   68|  17.0k|   m_hash->clear();
   69|       |
   70|  17.0k|   m_ikey.resize(m_hash_block_size);
   71|  17.0k|   m_okey.resize(m_hash_block_size);
   72|       |
   73|  17.0k|   clear_mem(m_ikey.data(), m_ikey.size());
   74|  17.0k|   clear_mem(m_okey.data(), m_okey.size());
   75|       |
   76|       |   /*
   77|       |   * Sometimes the HMAC key length itself is sensitive, as with PBKDF2 where it
   78|       |   * reveals the length of the passphrase. Make some attempt to hide this to
   79|       |   * side channels. Clearly if the secret is longer than the block size then the
   80|       |   * branch to hash first reveals that. In addition, counting the number of
   81|       |   * compression functions executed reveals the size at the granularity of the
   82|       |   * hash function's block size.
   83|       |   *
   84|       |   * The greater concern is for smaller keys; being able to detect when a
   85|       |   * passphrase is say 4 bytes may assist choosing weaker targets. Even though
   86|       |   * the loop bounds are constant, we can only actually read key[0..length] so
   87|       |   * it doesn't seem possible to make this computation truly constant time.
   88|       |   *
   89|       |   * We don't mind leaking if the length is exactly zero since that's
   90|       |   * trivial to simply check.
   91|       |   */
   92|       |
   93|  17.0k|   if(key.size() > m_hash_block_size) {
  ------------------
  |  Branch (93:7): [True: 0, False: 17.0k]
  ------------------
   94|      0|      m_hash->update(key);
   95|      0|      m_hash->final(m_ikey.data());
   96|  17.0k|   } else if(key.size() >= 20) {
  ------------------
  |  Branch (96:14): [True: 17.0k, False: 0]
  ------------------
   97|       |      // For long keys we just leak the length either it is a cryptovariable
   98|       |      // or a long enough password that just the length is not a useful signal
   99|  17.0k|      copy_mem(std::span{m_ikey}.first(key.size()), key);
  100|  17.0k|   } else if(!key.empty()) {
  ------------------
  |  Branch (100:14): [True: 0, False: 0]
  ------------------
  101|      0|      for(size_t i = 0, i_mod_length = 0; i != m_hash_block_size; ++i) {
  ------------------
  |  Branch (101:43): [True: 0, False: 0]
  ------------------
  102|       |         /*
  103|       |         access key[i % length] but avoiding division due to variable
  104|       |         time computation on some processors.
  105|       |         */
  106|      0|         auto needs_reduction = CT::Mask<size_t>::is_lte(key.size(), i_mod_length);
  107|      0|         i_mod_length = needs_reduction.select(0, i_mod_length);
  108|      0|         const uint8_t kb = key[i_mod_length];
  109|       |
  110|      0|         auto in_range = CT::Mask<size_t>::is_lt(i, key.size());
  111|      0|         m_ikey[i] = static_cast<uint8_t>(in_range.if_set_return(kb));
  112|      0|         i_mod_length += 1;
  113|      0|      }
  114|      0|   }
  115|       |
  116|  2.19M|   for(size_t i = 0; i != m_hash_block_size; ++i) {
  ------------------
  |  Branch (116:22): [True: 2.18M, False: 17.0k]
  ------------------
  117|  2.18M|      m_ikey[i] ^= ipad;
  118|  2.18M|      m_okey[i] = m_ikey[i] ^ ipad ^ opad;
  119|  2.18M|   }
  120|       |
  121|  17.0k|   m_hash->update(m_ikey);
  122|  17.0k|}
_ZN5Botan4HMACC2ENSt3__110unique_ptrINS_12HashFunctionENS1_14default_deleteIS3_EEEE:
  151|  4.26k|      m_hash(std::move(hash)),
  152|  4.26k|      m_hash_output_length(m_hash->output_length()),
  153|  4.26k|      m_hash_block_size(m_hash->hash_block_size()) {
  154|  4.26k|   BOTAN_ARG_CHECK(m_hash_output_length >= 8, "HMAC is not compatible with this hash function");
  ------------------
  |  |   35|  4.26k|   do {                                                          \
  |  |   36|  4.26k|      /* NOLINTNEXTLINE(*-simplify-boolean-expr) */              \
  |  |   37|  4.26k|      if(!(expr)) {                                              \
  |  |  ------------------
  |  |  |  Branch (37:10): [True: 0, False: 4.26k]
  |  |  ------------------
  |  |   38|      0|         /* NOLINTNEXTLINE(bugprone-lambda-function-name) */     \
  |  |   39|      0|         Botan::throw_invalid_argument(msg, __func__, __FILE__); \
  |  |   40|      0|      }                                                          \
  |  |   41|  4.26k|   } while(0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded, False: 4.26k]
  |  |  ------------------
  ------------------
  155|  4.26k|   BOTAN_ARG_CHECK(m_hash_block_size >= m_hash_output_length, "HMAC is not compatible with this hash function");
  ------------------
  |  |   35|  4.26k|   do {                                                          \
  |  |   36|  4.26k|      /* NOLINTNEXTLINE(*-simplify-boolean-expr) */              \
  |  |   37|  4.26k|      if(!(expr)) {                                              \
  |  |  ------------------
  |  |  |  Branch (37:10): [True: 0, False: 4.26k]
  |  |  ------------------
  |  |   38|      0|         /* NOLINTNEXTLINE(bugprone-lambda-function-name) */     \
  |  |   39|      0|         Botan::throw_invalid_argument(msg, __func__, __FILE__); \
  |  |   40|      0|      }                                                          \
  |  |   41|  4.26k|   } while(0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded, False: 4.26k]
  |  |  ------------------
  ------------------
  156|  4.26k|}

_ZN5Botan25MessageAuthenticationCode6createENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEES5_:
   51|  4.26k|                                                                             std::string_view provider) {
   52|  4.26k|   const SCAN_Name req(algo_spec);
   53|       |
   54|       |#if defined(BOTAN_HAS_BLAKE2BMAC)
   55|       |   if(req.algo_name() == "Blake2b" || req.algo_name() == "BLAKE2b") {
   56|       |      if(provider.empty() || provider == "base") {
   57|       |         return std::make_unique<BLAKE2bMAC>(req.arg_as_integer(0, 512));
   58|       |      }
   59|       |   }
   60|       |#endif
   61|       |
   62|       |#if defined(BOTAN_HAS_GMAC)
   63|       |   if(req.algo_name() == "GMAC" && req.arg_count() == 1) {
   64|       |      if(provider.empty() || provider == "base") {
   65|       |         if(auto bc = BlockCipher::create(req.arg(0))) {
   66|       |            return std::make_unique<GMAC>(std::move(bc));
   67|       |         }
   68|       |      }
   69|       |   }
   70|       |#endif
   71|       |
   72|  4.26k|#if defined(BOTAN_HAS_HMAC)
   73|  4.26k|   if(req.algo_name() == "HMAC" && req.arg_count() == 1) {
  ------------------
  |  Branch (73:7): [True: 4.26k, False: 0]
  |  Branch (73:36): [True: 4.26k, False: 0]
  ------------------
   74|  4.26k|      if(provider.empty() || provider == "base") {
  ------------------
  |  Branch (74:10): [True: 4.26k, False: 0]
  |  Branch (74:30): [True: 0, False: 0]
  ------------------
   75|  4.26k|         if(auto hash = HashFunction::create(req.arg(0))) {
  ------------------
  |  Branch (75:18): [True: 4.26k, False: 0]
  ------------------
   76|  4.26k|            return std::make_unique<HMAC>(std::move(hash));
   77|  4.26k|         }
   78|  4.26k|      }
   79|  4.26k|   }
   80|      0|#endif
   81|       |
   82|       |#if defined(BOTAN_HAS_POLY1305)
   83|       |   if(req.algo_name() == "Poly1305" && req.arg_count() == 0) {
   84|       |      if(provider.empty() || provider == "base") {
   85|       |         return std::make_unique<Poly1305>();
   86|       |      }
   87|       |   }
   88|       |#endif
   89|       |
   90|       |#if defined(BOTAN_HAS_SIPHASH)
   91|       |   if(req.algo_name() == "SipHash") {
   92|       |      if(provider.empty() || provider == "base") {
   93|       |         return std::make_unique<SipHash>(req.arg_as_integer(0, 2), req.arg_as_integer(1, 4));
   94|       |      }
   95|       |   }
   96|       |#endif
   97|       |
   98|      0|#if defined(BOTAN_HAS_CMAC)
   99|      0|   if((req.algo_name() == "CMAC" || req.algo_name() == "OMAC") && req.arg_count() == 1) {
  ------------------
  |  Branch (99:8): [True: 0, False: 0]
  |  Branch (99:37): [True: 0, False: 0]
  |  Branch (99:67): [True: 0, False: 0]
  ------------------
  100|      0|      if(provider.empty() || provider == "base") {
  ------------------
  |  Branch (100:10): [True: 0, False: 0]
  |  Branch (100:30): [True: 0, False: 0]
  ------------------
  101|      0|         if(auto bc = BlockCipher::create(req.arg(0))) {
  ------------------
  |  Branch (101:18): [True: 0, False: 0]
  ------------------
  102|      0|            return std::make_unique<CMAC>(std::move(bc));
  103|      0|         }
  104|      0|      }
  105|      0|   }
  106|      0|#endif
  107|       |
  108|       |#if defined(BOTAN_HAS_ANSI_X919_MAC)
  109|       |   if(req.algo_name() == "X9.19-MAC") {
  110|       |      if(provider.empty() || provider == "base") {
  111|       |         return std::make_unique<ANSI_X919_MAC>();
  112|       |      }
  113|       |   }
  114|       |#endif
  115|       |
  116|      0|#if defined(BOTAN_HAS_KMAC)
  117|      0|   if(req.algo_name() == "KMAC-128") {
  ------------------
  |  Branch (117:7): [True: 0, False: 0]
  ------------------
  118|      0|      if(provider.empty() || provider == "base") {
  ------------------
  |  Branch (118:10): [True: 0, False: 0]
  |  Branch (118:30): [True: 0, False: 0]
  ------------------
  119|      0|         if(req.arg_count() != 1) {
  ------------------
  |  Branch (119:13): [True: 0, False: 0]
  ------------------
  120|      0|            throw Invalid_Argument(
  121|      0|               "invalid algorithm specification for KMAC-128: need exactly one argument for output bit length");
  122|      0|         }
  123|      0|         return std::make_unique<KMAC128>(req.arg_as_integer(0));
  124|      0|      }
  125|      0|   }
  126|       |
  127|      0|   if(req.algo_name() == "KMAC-256") {
  ------------------
  |  Branch (127:7): [True: 0, False: 0]
  ------------------
  128|      0|      if(provider.empty() || provider == "base") {
  ------------------
  |  Branch (128:10): [True: 0, False: 0]
  |  Branch (128:30): [True: 0, False: 0]
  ------------------
  129|      0|         if(req.arg_count() != 1) {
  ------------------
  |  Branch (129:13): [True: 0, False: 0]
  ------------------
  130|      0|            throw Invalid_Argument(
  131|      0|               "invalid algorithm specification for KMAC-256: need exactly one argument for output bit length");
  132|      0|         }
  133|      0|         return std::make_unique<KMAC256>(req.arg_as_integer(0));
  134|      0|      }
  135|      0|   }
  136|      0|#endif
  137|       |
  138|      0|   BOTAN_UNUSED(req);
  ------------------
  |  |  144|      0|#define BOTAN_UNUSED Botan::ignore_params
  ------------------
  139|      0|   BOTAN_UNUSED(provider);
  ------------------
  |  |  144|      0|#define BOTAN_UNUSED Botan::ignore_params
  ------------------
  140|       |
  141|      0|   return nullptr;
  142|      0|}

_ZN5Botan14AutoSeeded_RNGD2Ev:
   46|  4.26k|AutoSeeded_RNG::~AutoSeeded_RNG() = default;
_ZN5Botan14AutoSeeded_RNGC2Em:
   68|  4.26k|AutoSeeded_RNG::AutoSeeded_RNG(size_t reseed_interval) {
   69|  4.26k|#if defined(BOTAN_HAS_SYSTEM_RNG)
   70|  4.26k|   m_rng = std::make_unique<HMAC_DRBG>(auto_rng_hmac(), system_rng(), reseed_interval);
   71|       |#elif defined(BOTAN_HAS_ENTROPY_SOURCE)
   72|       |   m_rng = std::make_unique<HMAC_DRBG>(auto_rng_hmac(), Entropy_Sources::global_sources(), reseed_interval);
   73|       |#else
   74|       |   BOTAN_UNUSED(reseed_interval);
   75|       |   throw Not_Implemented("AutoSeeded_RNG default constructor not available due to no RNG or entropy sources");
   76|       |#endif
   77|       |
   78|  4.26k|   force_reseed();
   79|  4.26k|}
_ZN5Botan14AutoSeeded_RNG12force_reseedEv:
   81|  4.26k|void AutoSeeded_RNG::force_reseed() {
   82|  4.26k|   m_rng->force_reseed();
   83|  4.26k|   m_rng->next_byte();
   84|       |
   85|  4.26k|   if(!m_rng->is_seeded()) {
  ------------------
  |  Branch (85:7): [True: 0, False: 4.26k]
  ------------------
   86|      0|      throw Internal_Error("AutoSeeded_RNG reseeding failed");
   87|      0|   }
   88|  4.26k|}
auto_rng.cpp:_ZN5Botan12_GLOBAL__N_113auto_rng_hmacEv:
   26|  4.26k|std::unique_ptr<MessageAuthenticationCode> auto_rng_hmac() {
   27|  4.26k|   const std::string possible_auto_rng_hmacs[] = {
   28|  4.26k|      "HMAC(SHA-512)",
   29|  4.26k|      "HMAC(SHA-256)",
   30|  4.26k|   };
   31|       |
   32|  4.26k|   for(const auto& hmac : possible_auto_rng_hmacs) {
  ------------------
  |  Branch (32:25): [True: 4.26k, False: 0]
  ------------------
   33|  4.26k|      if(auto mac = MessageAuthenticationCode::create(hmac)) {
  ------------------
  |  Branch (33:15): [True: 4.26k, False: 0]
  ------------------
   34|  4.26k|         return mac;
   35|  4.26k|      }
   36|  4.26k|   }
   37|       |
   38|       |   // This shouldn't happen since this module has a dependency on sha2_32
   39|      0|   throw Internal_Error("AutoSeeded_RNG: No usable HMAC hash found");
   40|  4.26k|}

_ZN5Botan9HMAC_DRBGD2Ev:
   60|  4.26k|HMAC_DRBG::~HMAC_DRBG() = default;
_ZN5Botan9HMAC_DRBGC2ENSt3__110unique_ptrINS_25MessageAuthenticationCodeENS1_14default_deleteIS3_EEEERNS_21RandomNumberGeneratorEmm:
   66|  4.26k|      Stateful_RNG(underlying_rng, reseed_interval),
   67|  4.26k|      m_mac(check_not_null(std::move(prf))),
   68|  4.26k|      m_max_number_of_bytes_per_request(max_number_of_bytes_per_request),
   69|  4.26k|      m_security_level(hmac_drbg_security_level(m_mac->output_length())) {
   70|  4.26k|   check_limits(reseed_interval, max_number_of_bytes_per_request);
   71|       |
   72|  4.26k|   clear();
   73|  4.26k|}
_ZN5Botan9HMAC_DRBG11clear_stateEv:
  116|  4.26k|void HMAC_DRBG::clear_state() {
  117|  4.26k|   if(m_V.empty()) {
  ------------------
  |  Branch (117:7): [True: 4.26k, False: 0]
  ------------------
  118|  4.26k|      const size_t output_length = m_mac->output_length();
  119|  4.26k|      m_V.resize(output_length);
  120|  4.26k|      m_T.resize(output_length);
  121|  4.26k|   }
  122|       |
  123|  4.26k|   std::fill(m_V.begin(), m_V.end(), 0x01);
  124|  4.26k|   m_mac->set_key(std::vector<uint8_t>(m_V.size(), 0x00));
  125|  4.26k|}
_ZN5Botan9HMAC_DRBG15generate_outputENSt3__14spanIhLm18446744073709551615EEENS2_IKhLm18446744073709551615EEE:
  135|  4.26k|void HMAC_DRBG::generate_output(std::span<uint8_t> output, std::span<const uint8_t> input) {
  136|       |   // This is an internal function, callers should have validated this beforehand
  137|  4.26k|   BOTAN_ASSERT_NOMSG(!output.empty());
  ------------------
  |  |   77|  4.26k|   do {                                                                     \
  |  |   78|  4.26k|      /* NOLINTNEXTLINE(*-simplify-boolean-expr) */                         \
  |  |   79|  4.26k|      if(!(expr)) {                                                         \
  |  |  ------------------
  |  |  |  Branch (79:10): [True: 0, False: 4.26k]
  |  |  ------------------
  |  |   80|      0|         /* NOLINTNEXTLINE(bugprone-lambda-function-name) */                \
  |  |   81|      0|         Botan::assertion_failure(#expr, "", __func__, __FILE__, __LINE__); \
  |  |   82|      0|      }                                                                     \
  |  |   83|  4.26k|   } while(0)
  |  |  ------------------
  |  |  |  Branch (83:12): [Folded, False: 4.26k]
  |  |  ------------------
  ------------------
  138|       |
  139|  4.26k|   if(!input.empty()) {
  ------------------
  |  Branch (139:7): [True: 0, False: 4.26k]
  ------------------
  140|      0|      update(input);
  141|      0|   }
  142|       |
  143|  8.52k|   while(!output.empty()) {
  ------------------
  |  Branch (143:10): [True: 4.26k, False: 4.26k]
  ------------------
  144|  4.26k|      const size_t to_copy = std::min(output.size(), m_V.size());
  145|  4.26k|      m_mac->update(m_V);
  146|  4.26k|      m_mac->final(m_V);
  147|  4.26k|      copy_mem(output.data(), m_V.data(), to_copy);
  148|       |
  149|  4.26k|      output = output.subspan(to_copy);
  150|  4.26k|   }
  151|       |
  152|  4.26k|   update(input);
  153|  4.26k|}
_ZN5Botan9HMAC_DRBG6updateENSt3__14spanIKhLm18446744073709551615EEE:
  159|  8.52k|void HMAC_DRBG::update(std::span<const uint8_t> input) {
  160|  8.52k|   m_mac->update(m_V);
  161|  8.52k|   m_mac->update(0x00);
  162|  8.52k|   if(!input.empty()) {
  ------------------
  |  Branch (162:7): [True: 4.26k, False: 4.26k]
  ------------------
  163|  4.26k|      m_mac->update(input);
  164|  4.26k|   }
  165|  8.52k|   m_mac->final(m_T);
  166|  8.52k|   m_mac->set_key(m_T);
  167|       |
  168|  8.52k|   m_mac->update(m_V);
  169|  8.52k|   m_mac->final(m_V);
  170|       |
  171|  8.52k|   if(!input.empty()) {
  ------------------
  |  Branch (171:7): [True: 4.26k, False: 4.26k]
  ------------------
  172|  4.26k|      m_mac->update(m_V);
  173|  4.26k|      m_mac->update(0x01);
  174|  4.26k|      m_mac->update(input);
  175|  4.26k|      m_mac->final(m_T);
  176|  4.26k|      m_mac->set_key(m_T);
  177|       |
  178|  4.26k|      m_mac->update(m_V);
  179|  4.26k|      m_mac->final(m_V);
  180|  4.26k|   }
  181|  8.52k|}
_ZNK5Botan9HMAC_DRBG14security_levelEv:
  183|  12.7k|size_t HMAC_DRBG::security_level() const {
  184|  12.7k|   return m_security_level;
  185|  12.7k|}
hmac_drbg.cpp:_ZN5Botan12_GLOBAL__N_124hmac_drbg_security_levelEm:
   21|  4.26k|size_t hmac_drbg_security_level(size_t mac_output_length) {
   22|       |   // security strength of the hash function
   23|       |   // for pre-image resistance (see NIST SP 800-57)
   24|       |   // SHA-1: 128 bits
   25|       |   // SHA-224, SHA-512/224: 192 bits,
   26|       |   // SHA-256, SHA-512/256, SHA-384, SHA-512: >= 256 bits
   27|       |   // NIST SP 800-90A only supports up to 256 bits though
   28|       |
   29|  4.26k|   if(mac_output_length < 20) {
  ------------------
  |  Branch (29:7): [True: 0, False: 4.26k]
  ------------------
   30|      0|      throw Invalid_Argument(fmt("HMAC_DRBG MAC output length {} is too small", mac_output_length));
   31|      0|   }
   32|       |
   33|  4.26k|   if(mac_output_length < 32) {
  ------------------
  |  Branch (33:7): [True: 0, False: 4.26k]
  ------------------
   34|      0|      return (mac_output_length - 4) * 8;
   35|  4.26k|   } else {
   36|  4.26k|      return 32 * 8;
   37|  4.26k|   }
   38|  4.26k|}
hmac_drbg.cpp:_ZN5Botan12_GLOBAL__N_112check_limitsEmm:
   40|  4.26k|void check_limits(size_t reseed_interval, size_t max_number_of_bytes_per_request) {
   41|       |   // SP800-90A permits up to 2^48, but it is not usable on 32 bit
   42|       |   // platforms, so we only allow up to 2^24, which is still reasonably high
   43|  4.26k|   if(reseed_interval == 0 || reseed_interval > static_cast<size_t>(1) << 24) {
  ------------------
  |  Branch (43:7): [True: 0, False: 4.26k]
  |  Branch (43:31): [True: 0, False: 4.26k]
  ------------------
   44|      0|      throw Invalid_Argument("Invalid value for reseed_interval");
   45|      0|   }
   46|       |
   47|  4.26k|   if(max_number_of_bytes_per_request == 0 || max_number_of_bytes_per_request > 64 * 1024) {
  ------------------
  |  Branch (47:7): [True: 0, False: 4.26k]
  |  Branch (47:47): [True: 0, False: 4.26k]
  ------------------
   48|      0|      throw Invalid_Argument("Invalid value for max_number_of_bytes_per_request");
   49|      0|   }
   50|  4.26k|}
hmac_drbg.cpp:_ZN5Botan12_GLOBAL__N_114check_not_nullINS_25MessageAuthenticationCodeEEENSt3__110unique_ptrIT_NS3_14default_deleteIS5_EEEES8_:
   53|  4.26k|std::unique_ptr<T> check_not_null(std::unique_ptr<T> obj) {
   54|  4.26k|   BOTAN_ARG_CHECK(obj != nullptr, "Argument must not be null");
  ------------------
  |  |   35|  4.26k|   do {                                                          \
  |  |   36|  4.26k|      /* NOLINTNEXTLINE(*-simplify-boolean-expr) */              \
  |  |   37|  4.26k|      if(!(expr)) {                                              \
  |  |  ------------------
  |  |  |  Branch (37:10): [True: 0, False: 4.26k]
  |  |  ------------------
  |  |   38|      0|         /* NOLINTNEXTLINE(bugprone-lambda-function-name) */     \
  |  |   39|      0|         Botan::throw_invalid_argument(msg, __func__, __FILE__); \
  |  |   40|      0|      }                                                          \
  |  |   41|  4.26k|   } while(0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded, False: 4.26k]
  |  |  ------------------
  ------------------
   55|  4.26k|   return obj;
   56|  4.26k|}

_ZN5Botan21RandomNumberGenerator15reseed_from_rngERS0_m:
   65|  4.26k|void RandomNumberGenerator::reseed_from_rng(RandomNumberGenerator& rng, size_t poll_bits) {
   66|  4.26k|   if(this->accepts_input()) {
  ------------------
  |  Branch (66:7): [True: 4.26k, False: 0]
  ------------------
   67|  4.26k|      this->add_entropy(rng.random_vec(poll_bits / 8));
   68|  4.26k|   }
   69|  4.26k|}

_ZN5Botan12Stateful_RNG5clearEv:
   15|  4.26k|void Stateful_RNG::clear() {
   16|  4.26k|   const lock_guard_type<recursive_mutex_type> lock(m_mutex);
   17|  4.26k|   m_reseed_counter = 0;
   18|  4.26k|   m_last_pid = 0;
   19|  4.26k|   clear_state();
   20|  4.26k|}
_ZN5Botan12Stateful_RNG12force_reseedEv:
   22|  4.26k|void Stateful_RNG::force_reseed() {
   23|  4.26k|   const lock_guard_type<recursive_mutex_type> lock(m_mutex);
   24|  4.26k|   m_reseed_counter = 0;
   25|  4.26k|}
_ZNK5Botan12Stateful_RNG9is_seededEv:
   27|  12.7k|bool Stateful_RNG::is_seeded() const {
   28|  12.7k|   const lock_guard_type<recursive_mutex_type> lock(m_mutex);
   29|  12.7k|   return m_reseed_counter > 0;
   30|  12.7k|}
_ZN5Botan12Stateful_RNG23generate_batched_outputENSt3__14spanIhLm18446744073709551615EEENS2_IKhLm18446744073709551615EEE:
   39|  4.26k|void Stateful_RNG::generate_batched_output(std::span<uint8_t> output, std::span<const uint8_t> input) {
   40|  4.26k|   BOTAN_ASSERT_NOMSG(!output.empty());
  ------------------
  |  |   77|  4.26k|   do {                                                                     \
  |  |   78|  4.26k|      /* NOLINTNEXTLINE(*-simplify-boolean-expr) */                         \
  |  |   79|  4.26k|      if(!(expr)) {                                                         \
  |  |  ------------------
  |  |  |  Branch (79:10): [True: 0, False: 4.26k]
  |  |  ------------------
  |  |   80|      0|         /* NOLINTNEXTLINE(bugprone-lambda-function-name) */                \
  |  |   81|      0|         Botan::assertion_failure(#expr, "", __func__, __FILE__, __LINE__); \
  |  |   82|      0|      }                                                                     \
  |  |   83|  4.26k|   } while(0)
  |  |  ------------------
  |  |  |  Branch (83:12): [Folded, False: 4.26k]
  |  |  ------------------
  ------------------
   41|       |
   42|  4.26k|   const size_t max_per_request = max_number_of_bytes_per_request();
   43|       |
   44|  4.26k|   if(max_per_request == 0) {
  ------------------
  |  Branch (44:7): [True: 0, False: 4.26k]
  ------------------
   45|       |      // no limit
   46|      0|      reseed_check();
   47|      0|      this->generate_output(output, input);
   48|  4.26k|   } else {
   49|  8.52k|      while(!output.empty()) {
  ------------------
  |  Branch (49:13): [True: 4.26k, False: 4.26k]
  ------------------
   50|  4.26k|         const size_t this_req = std::min(max_per_request, output.size());
   51|       |
   52|  4.26k|         reseed_check();
   53|  4.26k|         this->generate_output(output.subspan(0, this_req), input);
   54|       |
   55|       |         // only include the input for the first iteration
   56|  4.26k|         input = {};
   57|       |
   58|  4.26k|         output = output.subspan(this_req);
   59|  4.26k|      }
   60|  4.26k|   }
   61|  4.26k|}
_ZN5Botan12Stateful_RNG21fill_bytes_with_inputENSt3__14spanIhLm18446744073709551615EEENS2_IKhLm18446744073709551615EEE:
   63|  8.52k|void Stateful_RNG::fill_bytes_with_input(std::span<uint8_t> output, std::span<const uint8_t> input) {
   64|  8.52k|   const lock_guard_type<recursive_mutex_type> lock(m_mutex);
   65|       |
   66|  8.52k|   if(output.empty()) {
  ------------------
  |  Branch (66:7): [True: 4.26k, False: 4.26k]
  ------------------
   67|       |      // Special case for exclusively adding entropy to the stateful RNG.
   68|  4.26k|      this->update(input);
   69|       |
   70|  4.26k|      if(8 * input.size() >= security_level()) {
  ------------------
  |  Branch (70:10): [True: 4.26k, False: 0]
  ------------------
   71|  4.26k|         reset_reseed_counter();
   72|  4.26k|      }
   73|  4.26k|   } else {
   74|  4.26k|      generate_batched_output(output, input);
   75|  4.26k|   }
   76|  8.52k|}
_ZN5Botan12Stateful_RNG15reseed_from_rngERNS_21RandomNumberGeneratorEm:
   90|  4.26k|void Stateful_RNG::reseed_from_rng(RandomNumberGenerator& rng, size_t poll_bits) {
   91|  4.26k|   const lock_guard_type<recursive_mutex_type> lock(m_mutex);
   92|       |
   93|  4.26k|   RandomNumberGenerator::reseed_from_rng(rng, poll_bits);
   94|       |
   95|  4.26k|   if(poll_bits >= security_level()) {
  ------------------
  |  Branch (95:7): [True: 4.26k, False: 0]
  ------------------
   96|  4.26k|      reset_reseed_counter();
   97|  4.26k|   }
   98|  4.26k|}
_ZN5Botan12Stateful_RNG20reset_reseed_counterEv:
  100|  8.52k|void Stateful_RNG::reset_reseed_counter() {
  101|       |   // Lock is held whenever this function is called
  102|  8.52k|   m_reseed_counter = 1;
  103|  8.52k|   m_last_pid = OS::get_process_id();
  104|  8.52k|}
_ZN5Botan12Stateful_RNG12reseed_checkEv:
  106|  4.26k|void Stateful_RNG::reseed_check() {
  107|       |   // Lock is held whenever this function is called
  108|       |
  109|  4.26k|   const uint32_t cur_pid = OS::get_process_id();
  110|       |
  111|  4.26k|   const bool fork_detected = (m_last_pid > 0) && (cur_pid != m_last_pid);
  ------------------
  |  Branch (111:31): [True: 0, False: 4.26k]
  |  Branch (111:51): [True: 0, False: 0]
  ------------------
  112|       |
  113|  4.26k|   if(is_seeded() == false || fork_detected || (m_reseed_interval > 0 && m_reseed_counter >= m_reseed_interval)) {
  ------------------
  |  Branch (113:7): [True: 4.26k, False: 0]
  |  Branch (113:31): [True: 0, False: 0]
  |  Branch (113:49): [True: 0, False: 0]
  |  Branch (113:74): [True: 0, False: 0]
  ------------------
  114|  4.26k|      m_reseed_counter = 0;
  115|  4.26k|      m_last_pid = cur_pid;
  116|       |
  117|  4.26k|      if(m_underlying_rng != nullptr) {
  ------------------
  |  Branch (117:10): [True: 4.26k, False: 0]
  ------------------
  118|  4.26k|         reseed_from_rng(*m_underlying_rng, security_level());
  119|  4.26k|      }
  120|       |
  121|  4.26k|      if(m_entropy_sources != nullptr) {
  ------------------
  |  Branch (121:10): [True: 0, False: 4.26k]
  ------------------
  122|      0|         reseed_from_sources(*m_entropy_sources, security_level());
  123|      0|      }
  124|       |
  125|  4.26k|      if(!is_seeded()) {
  ------------------
  |  Branch (125:10): [True: 0, False: 4.26k]
  ------------------
  126|      0|         if(fork_detected) {
  ------------------
  |  Branch (126:13): [True: 0, False: 0]
  ------------------
  127|      0|            throw Invalid_State("Detected use of fork but cannot reseed DRBG");
  128|      0|         } else {
  129|      0|            throw PRNG_Unseeded(name());
  130|      0|         }
  131|      0|      }
  132|  4.26k|   } else {
  133|      0|      BOTAN_ASSERT(m_reseed_counter != 0, "RNG is seeded");
  ------------------
  |  |   64|      0|   do {                                                                                 \
  |  |   65|      0|      /* NOLINTNEXTLINE(*-simplify-boolean-expr) */                                     \
  |  |   66|      0|      if(!(expr)) {                                                                     \
  |  |  ------------------
  |  |  |  Branch (66:10): [True: 0, False: 0]
  |  |  ------------------
  |  |   67|      0|         /* NOLINTNEXTLINE(bugprone-lambda-function-name) */                            \
  |  |   68|      0|         Botan::assertion_failure(#expr, assertion_made, __func__, __FILE__, __LINE__); \
  |  |   69|      0|      }                                                                                 \
  |  |   70|      0|   } while(0)
  |  |  ------------------
  |  |  |  Branch (70:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  134|      0|      m_reseed_counter += 1;
  135|      0|   }
  136|  4.26k|}

_ZN5Botan10system_rngEv:
  377|  4.26k|RandomNumberGenerator& system_rng() {
  378|  4.26k|   static System_RNG_Impl g_system_rng;
  379|  4.26k|   return g_system_rng;
  380|  4.26k|}
system_rng.cpp:_ZN5Botan12_GLOBAL__N_115System_RNG_Impl21fill_bytes_with_inputENSt3__14spanIhLm18446744073709551615EEENS3_IKhLm18446744073709551615EEE:
  215|  4.26k|      void fill_bytes_with_input(std::span<uint8_t> output, std::span<const uint8_t> /* ignored */) override {
  216|  4.26k|         const unsigned int flags = 0;
  217|       |
  218|  4.26k|         uint8_t* buf = output.data();
  219|  4.26k|         size_t len = output.size();
  220|  8.52k|         while(len > 0) {
  ------------------
  |  Branch (220:16): [True: 4.26k, False: 4.26k]
  ------------------
  221|       |   #if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 25
  222|       |            const ssize_t got = ::syscall(SYS_getrandom, buf, len, flags);
  223|       |   #else
  224|  4.26k|            const ssize_t got = ::getrandom(buf, len, flags);
  225|  4.26k|   #endif
  226|       |
  227|  4.26k|            if(got < 0) {
  ------------------
  |  Branch (227:16): [True: 0, False: 4.26k]
  ------------------
  228|      0|               if(errno == EINTR) {
  ------------------
  |  Branch (228:19): [True: 0, False: 0]
  ------------------
  229|      0|                  continue;
  230|      0|               }
  231|      0|               throw System_Error("System_RNG getrandom failed", errno);
  232|      0|            }
  233|       |
  234|  4.26k|            if(got == 0) {
  ------------------
  |  Branch (234:16): [True: 0, False: 4.26k]
  ------------------
  235|      0|               throw System_Error("System_RNG getrandom unexpectedly returned 0");
  236|      0|            }
  237|       |
  238|  4.26k|            buf += got;
  239|  4.26k|            len -= got;
  240|  4.26k|         }
  241|  4.26k|      }

_ZN5Botan15allocate_memoryEmm:
   21|  25.5k|BOTAN_MALLOC_FN void* allocate_memory(size_t elems, size_t elem_size) {
   22|  25.5k|   if(elems == 0 || elem_size == 0) {
  ------------------
  |  Branch (22:7): [True: 0, False: 25.5k]
  |  Branch (22:21): [True: 0, False: 25.5k]
  ------------------
   23|      0|      return nullptr;
   24|      0|   }
   25|       |
   26|       |   // Some calloc implementations do not check for overflow (?!?)
   27|  25.5k|   if(!checked_mul(elems, elem_size).has_value()) {
  ------------------
  |  Branch (27:7): [True: 0, False: 25.5k]
  ------------------
   28|      0|      throw std::bad_alloc();
   29|      0|   }
   30|       |
   31|       |#if defined(BOTAN_HAS_LOCKING_ALLOCATOR)
   32|       |   // NOLINTNEXTLINE(*-const-correctness) bug in clang-tidy
   33|       |   if(void* p = mlock_allocator::instance().allocate(elems, elem_size)) {
   34|       |      return p;
   35|       |   }
   36|       |#endif
   37|       |
   38|       |#if defined(BOTAN_TARGET_OS_HAS_ALLOC_CONCEAL)
   39|       |   void* ptr = ::calloc_conceal(elems, elem_size);
   40|       |#else
   41|       |   // NOLINTNEXTLINE(*-const-correctness) bug in clang-tidy
   42|  25.5k|   void* ptr = std::calloc(elems, elem_size);  // NOLINT(*-no-malloc,*-owning-memory)
   43|  25.5k|#endif
   44|  25.5k|   if(ptr == nullptr) {
  ------------------
  |  Branch (44:7): [True: 0, False: 25.5k]
  ------------------
   45|      0|      [[unlikely]] throw std::bad_alloc();
   46|      0|   }
   47|  25.5k|   return ptr;
   48|  25.5k|}
_ZN5Botan17deallocate_memoryEPvmm:
   50|  25.5k|void deallocate_memory(void* p, size_t elems, size_t elem_size) {
   51|  25.5k|   if(p == nullptr) {
  ------------------
  |  Branch (51:7): [True: 0, False: 25.5k]
  ------------------
   52|      0|      [[unlikely]] return;
   53|      0|   }
   54|       |
   55|  25.5k|   secure_scrub_memory(p, elems * elem_size);
   56|       |
   57|       |#if defined(BOTAN_HAS_LOCKING_ALLOCATOR)
   58|       |   if(mlock_allocator::instance().deallocate(p, elems, elem_size)) {
   59|       |      return;
   60|       |   }
   61|       |#endif
   62|       |
   63|  25.5k|   std::free(p);  // NOLINT(*-no-malloc,*-owning-memory)
   64|  25.5k|}

_ZN5Botan19secure_scrub_memoryEPvm:
   25|  40.7k|void secure_scrub_memory(void* ptr, size_t n) {
   26|  40.7k|   return secure_zeroize_buffer(ptr, n);
   27|  40.7k|}
_ZN5Botan21secure_zeroize_bufferEPvm:
   29|  45.0k|void secure_zeroize_buffer(void* ptr, size_t n) {
   30|  45.0k|   if(n == 0) {
  ------------------
  |  Branch (30:7): [True: 14.3k, False: 30.6k]
  ------------------
   31|  14.3k|      return;
   32|  14.3k|   }
   33|       |
   34|       |#if defined(BOTAN_TARGET_OS_HAS_RTLSECUREZEROMEMORY)
   35|       |   ::RtlSecureZeroMemory(ptr, n);
   36|       |
   37|       |#elif defined(BOTAN_TARGET_OS_HAS_EXPLICIT_BZERO)
   38|  30.6k|   ::explicit_bzero(ptr, n);
   39|       |
   40|       |#elif defined(BOTAN_TARGET_OS_HAS_EXPLICIT_MEMSET)
   41|       |   (void)::explicit_memset(ptr, 0, n);
   42|       |
   43|       |#else
   44|       |   /*
   45|       |   * Call memset through a static volatile pointer, which the compiler should
   46|       |   * not elide. This construct should be safe in conforming compilers, but who
   47|       |   * knows. This has been checked to generate the expected code, which saves the
   48|       |   * memset address in the data segment and unconditionally loads and jumps to
   49|       |   * that address, with the following targets:
   50|       |   *
   51|       |   * x86-64: Clang 19, GCC 6, 11, 13, 14
   52|       |   * riscv64: GCC 14
   53|       |   * aarch64: GCC 14
   54|       |   * armv7: GCC 14
   55|       |   *
   56|       |   * Actually all of them generated the expected jump even without marking the
   57|       |   * function pointer as volatile. However this seems worth including as an
   58|       |   * additional precaution.
   59|       |   */
   60|       |   static void* (*const volatile memset_ptr)(void*, int, size_t) = std::memset;
   61|       |   (memset_ptr)(ptr, 0, n);
   62|       |#endif
   63|  30.6k|}

_ZN5Botan2OS14get_process_idEv:
   77|  12.7k|uint32_t OS::get_process_id() {
   78|  12.7k|#if defined(BOTAN_TARGET_OS_HAS_POSIX1)
   79|  12.7k|   return ::getpid();
   80|       |#elif defined(BOTAN_TARGET_OS_HAS_WIN32)
   81|       |   return ::GetCurrentProcessId();
   82|       |#elif defined(BOTAN_TARGET_OS_IS_LLVM) || defined(BOTAN_TARGET_OS_IS_NONE)
   83|       |   return 0;  // truly no meaningful value
   84|       |#else
   85|       |   #error "Missing get_process_id"
   86|       |#endif
   87|  12.7k|}

_ZN5Botan9SCAN_NameC2ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   61|  4.26k|SCAN_Name::SCAN_Name(std::string_view algo_spec) : m_orig_algo_spec(algo_spec) {
   62|  4.26k|   if(algo_spec.empty()) {
  ------------------
  |  Branch (62:7): [True: 0, False: 4.26k]
  ------------------
   63|      0|      throw Invalid_Argument("Expected algorithm name, got empty string");
   64|      0|   }
   65|       |
   66|       |   // Fast path for a bare name with no arguments or modes (eg "SHA-256"),
   67|       |   // which is the common case. Equivalent to the general parse below, which
   68|       |   // for such input produces a single token and no args/modes.
   69|  4.26k|   if(algo_spec.find_first_of("(),/") == std::string_view::npos) {
  ------------------
  |  Branch (69:7): [True: 0, False: 4.26k]
  ------------------
   70|      0|      m_alg_name = std::string(algo_spec);
   71|      0|      return;
   72|      0|   }
   73|       |
   74|  4.26k|   std::vector<std::pair<size_t, std::string>> name;
   75|  4.26k|   size_t level = 0;
   76|  4.26k|   std::pair<size_t, std::string> accum = std::make_pair(level, "");
   77|       |
   78|  4.26k|   bool expect_token = true;
   79|       |
   80|  55.3k|   for(const char c : algo_spec) {
  ------------------
  |  Branch (80:21): [True: 55.3k, False: 4.26k]
  ------------------
   81|  55.3k|      if(c == '/' || c == ',' || c == '(' || c == ')') {
  ------------------
  |  Branch (81:10): [True: 0, False: 55.3k]
  |  Branch (81:22): [True: 0, False: 55.3k]
  |  Branch (81:34): [True: 4.26k, False: 51.1k]
  |  Branch (81:46): [True: 4.26k, False: 46.8k]
  ------------------
   82|  8.52k|         if(c == '(') {
  ------------------
  |  Branch (82:13): [True: 4.26k, False: 4.26k]
  ------------------
   83|  4.26k|            ++level;
   84|  4.26k|         } else if(c == ')') {
  ------------------
  |  Branch (84:20): [True: 4.26k, False: 0]
  ------------------
   85|  4.26k|            if(level == 0) {
  ------------------
  |  Branch (85:16): [True: 0, False: 4.26k]
  ------------------
   86|      0|               throw Invalid_Algorithm_Name(m_orig_algo_spec);
   87|      0|            }
   88|  4.26k|            --level;
   89|  4.26k|         }
   90|       |
   91|  8.52k|         if(c == '/' && level > 0) {
  ------------------
  |  Branch (91:13): [True: 0, False: 8.52k]
  |  Branch (91:25): [True: 0, False: 0]
  ------------------
   92|      0|            accum.second.push_back(c);
   93|      0|            expect_token = false;
   94|  8.52k|         } else {
   95|  8.52k|            if(expect_token) {
  ------------------
  |  Branch (95:16): [True: 0, False: 8.52k]
  ------------------
   96|      0|               throw Invalid_Algorithm_Name(m_orig_algo_spec);
   97|      0|            }
   98|  8.52k|            if(!accum.second.empty()) {
  ------------------
  |  Branch (98:16): [True: 8.52k, False: 0]
  ------------------
   99|  8.52k|               name.push_back(accum);
  100|  8.52k|            }
  101|  8.52k|            accum = std::make_pair(level, "");
  102|  8.52k|            expect_token = (c != ')');
  103|  8.52k|         }
  104|  46.8k|      } else {
  105|  46.8k|         accum.second.push_back(c);
  106|  46.8k|         expect_token = false;
  107|  46.8k|      }
  108|  55.3k|   }
  109|       |
  110|  4.26k|   if(!accum.second.empty()) {
  ------------------
  |  Branch (110:7): [True: 0, False: 4.26k]
  ------------------
  111|      0|      name.push_back(accum);
  112|      0|   }
  113|       |
  114|  4.26k|   if(level != 0) {
  ------------------
  |  Branch (114:7): [True: 0, False: 4.26k]
  ------------------
  115|      0|      throw Invalid_Algorithm_Name(m_orig_algo_spec);
  116|      0|   }
  117|       |
  118|  4.26k|   if(expect_token) {
  ------------------
  |  Branch (118:7): [True: 0, False: 4.26k]
  ------------------
  119|       |      // A trailing separator with no following token, eg "Foo/" or "Foo,"
  120|      0|      throw Invalid_Algorithm_Name(m_orig_algo_spec);
  121|      0|   }
  122|       |
  123|  4.26k|   if(name.empty()) {
  ------------------
  |  Branch (123:7): [True: 0, False: 4.26k]
  ------------------
  124|      0|      throw Invalid_Algorithm_Name(m_orig_algo_spec);
  125|      0|   }
  126|       |
  127|  4.26k|   m_alg_name = name[0].second;
  128|       |
  129|  4.26k|   bool in_modes = false;
  130|       |
  131|  8.52k|   for(size_t i = 1; i != name.size(); ++i) {
  ------------------
  |  Branch (131:22): [True: 4.26k, False: 4.26k]
  ------------------
  132|  4.26k|      if(name[i].first == 0) {
  ------------------
  |  Branch (132:10): [True: 0, False: 4.26k]
  ------------------
  133|      0|         m_mode_info.push_back(make_arg(name, i));
  134|      0|         in_modes = true;
  135|  4.26k|      } else if(name[i].first == 1 && !in_modes) {
  ------------------
  |  Branch (135:17): [True: 4.26k, False: 0]
  |  Branch (135:39): [True: 4.26k, False: 0]
  ------------------
  136|  4.26k|         m_args.push_back(make_arg(name, i));
  137|  4.26k|      }
  138|  4.26k|   }
  139|  4.26k|}
_ZNK5Botan9SCAN_Name3argEm:
  141|  4.26k|std::string SCAN_Name::arg(size_t i) const {
  142|  4.26k|   if(i >= arg_count()) {
  ------------------
  |  Branch (142:7): [True: 0, False: 4.26k]
  ------------------
  143|      0|      throw Invalid_Argument("SCAN_Name::arg " + std::to_string(i) + " out of range for '" + to_string() + "'");
  144|      0|   }
  145|  4.26k|   return m_args[i];
  146|  4.26k|}
scan_name.cpp:_ZN5Botan12_GLOBAL__N_18make_argERKNSt3__16vectorINS1_4pairImNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEENS7_ISA_EEEEm:
   18|  4.26k|std::string make_arg(const std::vector<std::pair<size_t, std::string>>& name, size_t start) {
   19|  4.26k|   std::string output = name[start].second;
   20|  4.26k|   size_t level = name[start].first;
   21|       |
   22|  4.26k|   size_t paren_depth = 0;
   23|       |
   24|  4.26k|   for(size_t i = start + 1; i != name.size(); ++i) {
  ------------------
  |  Branch (24:30): [True: 0, False: 4.26k]
  ------------------
   25|      0|      if(name[i].first <= name[start].first) {
  ------------------
  |  Branch (25:10): [True: 0, False: 0]
  ------------------
   26|      0|         break;
   27|      0|      }
   28|       |
   29|      0|      if(name[i].first > level) {
  ------------------
  |  Branch (29:10): [True: 0, False: 0]
  ------------------
   30|      0|         for(size_t j = level; j < name[i].first; j++) {
  ------------------
  |  Branch (30:32): [True: 0, False: 0]
  ------------------
   31|      0|            output += "(";
   32|      0|            ++paren_depth;
   33|      0|         }
   34|      0|         output += name[i].second;
   35|      0|      } else if(name[i].first < level) {
  ------------------
  |  Branch (35:17): [True: 0, False: 0]
  ------------------
   36|      0|         for(size_t j = name[i].first; j < level; j++) {
  ------------------
  |  Branch (36:40): [True: 0, False: 0]
  ------------------
   37|      0|            output += ")";
   38|      0|            BOTAN_ASSERT_NOMSG(paren_depth != 0);
  ------------------
  |  |   77|      0|   do {                                                                     \
  |  |   78|      0|      /* NOLINTNEXTLINE(*-simplify-boolean-expr) */                         \
  |  |   79|      0|      if(!(expr)) {                                                         \
  |  |  ------------------
  |  |  |  Branch (79:10): [True: 0, False: 0]
  |  |  ------------------
  |  |   80|      0|         /* NOLINTNEXTLINE(bugprone-lambda-function-name) */                \
  |  |   81|      0|         Botan::assertion_failure(#expr, "", __func__, __FILE__, __LINE__); \
  |  |   82|      0|      }                                                                     \
  |  |   83|      0|   } while(0)
  |  |  ------------------
  |  |  |  Branch (83:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
   39|      0|            --paren_depth;
   40|      0|         }
   41|      0|         output += "," + name[i].second;
   42|      0|      } else {
   43|      0|         if(output[output.size() - 1] != '(') {
  ------------------
  |  Branch (43:13): [True: 0, False: 0]
  ------------------
   44|      0|            output += ",";
   45|      0|         }
   46|      0|         output += name[i].second;
   47|      0|      }
   48|       |
   49|      0|      level = name[i].first;
   50|      0|   }
   51|       |
   52|  4.26k|   for(size_t i = 0; i != paren_depth; ++i) {
  ------------------
  |  Branch (52:22): [True: 0, False: 4.26k]
  ------------------
   53|      0|      output += ")";
   54|      0|   }
   55|       |
   56|  4.26k|   return output;
   57|  4.26k|}

_ZN3rnp8KeyStoreC2ERNS_15SecurityContextE:
   80|  4.26k|    KeyStore(SecurityContext &ctx) : path(""), format(KeyFormat::Unknown), secctx(ctx){};

_ZN3rnp11str_case_eqEPKcS1_:
   82|  3.53k|{
   83|  7.55k|    while (*s1 && *s2) {
  ------------------
  |  Branch (83:12): [True: 6.31k, False: 1.24k]
  |  Branch (83:19): [True: 6.31k, False: 4]
  ------------------
   84|  6.31k|        if (std::tolower(*s1) != std::tolower(*s2)) {
  ------------------
  |  Branch (84:13): [True: 2.29k, False: 4.01k]
  ------------------
   85|  2.29k|            return false;
   86|  2.29k|        }
   87|  4.01k|        s1++;
   88|  4.01k|        s2++;
   89|  4.01k|    }
   90|  1.24k|    return !*s1 && !*s2;
  ------------------
  |  Branch (90:12): [True: 1.24k, False: 4]
  |  Branch (90:20): [True: 1.13k, False: 102]
  ------------------
   91|  3.53k|}

LLVMFuzzerTestOneInput:
   42|  4.26k|{
   43|  4.26k|    rnp::SecurityContext ctx;
   44|  4.26k|    rnp::KeyStore        ks(ctx);
   45|  4.26k|    pgp_source_t         memsrc = {};
   46|       |
   47|  4.26k|    init_mem_src(&memsrc, data, size, false);
   48|  4.26k|    ks.load_g10(memsrc);
   49|  4.26k|    memsrc.close();
   50|       |
   51|  4.26k|    return 0;
   52|  4.26k|}

_ZN3rnp12backend_initEPPv:
  192|  4.26k|{
  193|  4.26k|    return true;
  194|  4.26k|}
_ZN3rnp14backend_finishEPv:
  198|  4.26k|{
  199|       |    // Do nothing
  200|  4.26k|}

_ZN3pgp3dsa3Key12clear_secretEv:
   56|    174|    {
   57|    174|        x.forget();
   58|    174|    }
_ZN3pgp3dsa3KeyD2Ev:
   61|    171|    {
   62|    171|        clear_secret();
   63|    171|    }

_ZN3pgp2ec3Key12clear_secretEv:
  125|     77|    {
  126|     77|        x.forget();
  127|     77|    }
_ZN3pgp2ec3KeyD2Ev:
  130|     75|    {
  131|     75|        clear_secret();
  132|     75|    }

_ZN3pgp2eg3Key12clear_secretEv:
   62|    332|    {
   63|    332|        x.forget();
   64|    332|    }
_ZN3pgp2eg3KeyD2Ev:
   67|    331|    {
   68|    331|        clear_secret();
   69|    331|    }

_Z12secure_clearPvm:
   35|  15.1k|{
   36|  15.1k|    botan_scrub_mem(vp, size);
   37|  15.1k|}

_ZN3pgp3mpi6assignEPKhm:
  107|  2.48k|{
  108|  2.48k|    data_.assign(val, val + size);
  109|  2.48k|}
_ZN3pgp3mpi6forgetEv:
  125|  8.06k|{
  126|  8.06k|    secure_clear(data_.data(), data_.size());
  127|  8.06k|    data_.resize(0);
  128|  8.06k|}

_ZN3rnp3RNGC2ENS0_4TypeE:
   34|  4.26k|{
   35|  4.26k|    if (botan_rng_init(&botan_rng, type == Type::DRBG ? "user" : NULL)) {
  ------------------
  |  Branch (35:9): [True: 0, False: 4.26k]
  |  Branch (35:36): [True: 4.26k, False: 0]
  ------------------
   36|      0|        throw rnp::rnp_exception(RNP_ERROR_RNG);
   37|      0|    }
   38|  4.26k|}
_ZN3rnp3RNGD2Ev:
   41|  4.26k|{
   42|  4.26k|    (void) botan_rng_destroy(botan_rng);
   43|  4.26k|}

_ZN3pgp3rsa3Key12clear_secretEv:
   61|  1.80k|    {
   62|  1.80k|        d.forget();
   63|  1.80k|        p.forget();
   64|  1.80k|        q.forget();
   65|  1.80k|        u.forget();
   66|  1.80k|    }
_ZN3pgp3rsa3KeyD2Ev:
   69|  1.79k|    {
   70|  1.79k|        clear_secret();
   71|  1.79k|    }

_ZN3pgp11FingerprintC2Ev:
   38|    942|Fingerprint::Fingerprint() : keyid_({})
   39|    942|{
   40|    942|}
_ZNK3pgp11Fingerprint4dataEv:
  131|    157|{
  132|    157|    return fp_.data();
  133|    157|}
_ZNK3pgp11Fingerprint4sizeEv:
  137|    157|{
  138|    157|    return fp_.size();
  139|    157|}

_ZNKSt3__14hashIN3pgp11FingerprintEEclERKS2_:
   90|    157|    {
   91|       |        /* since fingerprint value is hash itself, we may use its low bytes */
   92|    157|        size_t res = 0;
   93|    157|        size_t copy = std::min(sizeof(res), fp.size());
   94|    157|        std::memcpy(&res, fp.data(), copy);
   95|    157|        return res;
   96|    157|    }

_ZN14pgp_validity_t5resetEv:
   59|    314|{
   60|    314|    validated = false;
   61|    314|    valid = false;
   62|    314|    expired = false;
   63|    314|}
_ZN3rnp3KeyC2ERKS0_b:
  445|    157|{
  446|       |    /* Do some checks for g10 keys */
  447|    157|    if (src.format == KeyFormat::G10) {
  ------------------
  |  Branch (447:9): [True: 157, False: 0]
  ------------------
  448|    157|        if (pubonly) {
  ------------------
  |  Branch (448:13): [True: 0, False: 157]
  ------------------
  449|      0|            RNP_LOG("attempt to copy public part from g10 key");
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  450|      0|            throw std::invalid_argument("pubonly");
  451|      0|        }
  452|    157|    }
  453|       |
  454|    157|    if (pubonly) {
  ------------------
  |  Branch (454:9): [True: 0, False: 157]
  ------------------
  455|      0|        pkt_ = pgp_key_pkt_t(src.pkt_, true);
  456|      0|        rawpkt_ = RawPacket(pkt_);
  457|    157|    } else {
  458|    157|        pkt_ = src.pkt_;
  459|    157|        rawpkt_ = src.rawpkt_;
  460|    157|    }
  461|       |
  462|    157|    uids_ = src.uids_;
  463|    157|    sigs_ = src.sigs_;
  464|    157|    sigs_map_ = src.sigs_map_;
  465|    157|    keysigs_ = src.keysigs_;
  466|    157|    subkey_fps_ = src.subkey_fps_;
  467|    157|    primary_fp_set_ = src.primary_fp_set_;
  468|    157|    primary_fp_ = src.primary_fp_;
  469|    157|    expiration_ = src.expiration_;
  470|    157|    flags_ = src.flags_;
  471|    157|    fingerprint_ = src.fingerprint_;
  472|    157|    grip_ = src.grip_;
  473|    157|    uid0_ = src.uid0_;
  474|    157|    uid0_set_ = src.uid0_set_;
  475|    157|    revoked_ = src.revoked_;
  476|    157|    revocation_ = src.revocation_;
  477|    157|    revokers_ = src.revokers_;
  478|    157|    format = src.format;
  479|    157|    validity_ = src.validity_;
  480|    157|    valid_till_ = src.valid_till_;
  481|    157|}
_ZN3rnp3Key7set_pktERK13pgp_key_pkt_t:
  840|    157|{
  841|    157|    pkt_ = pkt;
  842|    157|}
_ZNK3rnp3Key10is_primaryEv:
 1050|    157|{
 1051|    157|    return is_primary_key_pkt(pkt_.tag);
 1052|    157|}
_ZNK3rnp3Key9is_subkeyEv:
 1056|    785|{
 1057|    785|    return is_subkey_pkt(pkt_.tag);
 1058|    785|}
_ZNK3rnp3Key9validatedEv:
 1088|    157|{
 1089|    157|    return validity_.validated;
 1090|    157|}
_ZNK3rnp3Key2fpEv:
 1140|    314|{
 1141|    314|    return fingerprint_;
 1142|    314|}
_ZNK3rnp3Key12subkey_countEv:
 1193|    157|{
 1194|    157|    return subkey_fps_.size();
 1195|    157|}
_ZN3rnp3Key10set_rawpktERKNS_9RawPacketE:
 1241|    157|{
 1242|    157|    rawpkt_ = src;
 1243|    157|}
_ZN3rnp3Key14latest_selfsigEjb:
 1528|    471|{
 1529|    471|    uint32_t   latest = 0;
 1530|    471|    Signature *res = nullptr;
 1531|       |
 1532|    471|    for (auto &sigid : sigs_) {
  ------------------
  |  Branch (1532:22): [True: 0, False: 471]
  ------------------
 1533|      0|        auto &sig = get_sig(sigid);
 1534|      0|        if (validated && !sig.validity.valid()) {
  ------------------
  |  Branch (1534:13): [True: 0, False: 0]
  |  Branch (1534:26): [True: 0, False: 0]
  ------------------
 1535|      0|            continue;
 1536|      0|        }
 1537|      0|        bool skip = false;
 1538|      0|        switch (uid) {
 1539|      0|        case UserID::None:
  ------------------
  |  Branch (1539:9): [True: 0, False: 0]
  ------------------
 1540|      0|            skip = (sig.uid != UserID::None) || !is_direct_self(sig);
  ------------------
  |  Branch (1540:20): [True: 0, False: 0]
  |  Branch (1540:49): [True: 0, False: 0]
  ------------------
 1541|      0|            break;
 1542|      0|        case UserID::Primary: {
  ------------------
  |  Branch (1542:9): [True: 0, False: 0]
  ------------------
 1543|      0|            skip = !is_self_cert(sig) ||
  ------------------
  |  Branch (1543:20): [True: 0, False: 0]
  ------------------
 1544|      0|                   !sig.sig.get_subpkt(pgp::pkt::sigsub::Type::PrimaryUserID) ||
  ------------------
  |  Branch (1544:20): [True: 0, False: 0]
  ------------------
 1545|      0|                   !sig.sig.primary_uid() || (sig.uid == UserID::None);
  ------------------
  |  Branch (1545:20): [True: 0, False: 0]
  |  Branch (1545:46): [True: 0, False: 0]
  ------------------
 1546|      0|            break;
 1547|      0|        }
 1548|      0|        case UserID::Any:
  ------------------
  |  Branch (1548:9): [True: 0, False: 0]
  ------------------
 1549|      0|            skip = !is_self_cert(sig) || (sig.uid == UserID::None);
  ------------------
  |  Branch (1549:20): [True: 0, False: 0]
  |  Branch (1549:42): [True: 0, False: 0]
  ------------------
 1550|      0|            break;
 1551|      0|        default:
  ------------------
  |  Branch (1551:9): [True: 0, False: 0]
  ------------------
 1552|      0|            skip = (sig.uid != uid) || !is_self_cert(sig);
  ------------------
  |  Branch (1552:20): [True: 0, False: 0]
  |  Branch (1552:40): [True: 0, False: 0]
  ------------------
 1553|      0|            break;
 1554|      0|        }
 1555|      0|        if (skip) {
  ------------------
  |  Branch (1555:13): [True: 0, False: 0]
  ------------------
 1556|      0|            continue;
 1557|      0|        }
 1558|       |
 1559|      0|        uint32_t creation = sig.sig.creation();
 1560|      0|        if (creation >= latest) {
  ------------------
  |  Branch (1560:13): [True: 0, False: 0]
  ------------------
 1561|      0|            latest = creation;
 1562|      0|            res = &sig;
 1563|      0|        }
 1564|      0|    }
 1565|       |
 1566|       |    /* if there is later self-sig for the same uid without primary flag, then drop res */
 1567|    471|    if ((uid == UserID::Primary) && res) {
  ------------------
  |  Branch (1567:9): [True: 157, False: 314]
  |  Branch (1567:37): [True: 0, False: 157]
  ------------------
 1568|      0|        auto overres = latest_selfsig(res->uid, validated);
 1569|      0|        if (overres && (overres->sig.creation() > res->sig.creation())) {
  ------------------
  |  Branch (1569:13): [True: 0, False: 0]
  |  Branch (1569:24): [True: 0, False: 0]
  ------------------
 1570|      0|            res = nullptr;
 1571|      0|        }
 1572|      0|    }
 1573|    471|    return res;
 1574|    471|}
_ZN3rnp3Key24validate_self_signaturesERKNS_15SecurityContextE:
 1974|    157|{
 1975|    157|    for (auto &sigid : sigs_) {
  ------------------
  |  Branch (1975:22): [True: 0, False: 157]
  ------------------
 1976|      0|        auto &sig = get_sig(sigid);
 1977|      0|        if (sig.validity.validated()) {
  ------------------
  |  Branch (1977:13): [True: 0, False: 0]
  ------------------
 1978|      0|            continue;
 1979|      0|        }
 1980|      0|        if (!is_signer(sig)) {
  ------------------
  |  Branch (1980:13): [True: 0, False: 0]
  ------------------
 1981|      0|            continue;
 1982|      0|        }
 1983|       |
 1984|      0|        if (is_direct_self(sig) || is_self_cert(sig) || is_uid_revocation(sig) ||
  ------------------
  |  Branch (1984:13): [True: 0, False: 0]
  |  Branch (1984:36): [True: 0, False: 0]
  |  Branch (1984:57): [True: 0, False: 0]
  ------------------
 1985|      0|            is_revocation(sig)) {
  ------------------
  |  Branch (1985:13): [True: 0, False: 0]
  ------------------
 1986|      0|            validate_sig(*this, sig, ctx);
 1987|      0|        }
 1988|      0|    }
 1989|    157|}
_ZN3rnp3Key22validate_desig_revokesERNS_8KeyStoreE:
 2008|    157|{
 2009|    157|    if (revokers_.empty()) {
  ------------------
  |  Branch (2009:9): [True: 157, False: 0]
  ------------------
 2010|    157|        return false;
 2011|    157|    }
 2012|      0|    bool refresh = false;
 2013|      0|    for (auto &sigid : sigs_) {
  ------------------
  |  Branch (2013:22): [True: 0, False: 0]
  ------------------
 2014|      0|        auto &sig = get_sig(sigid);
 2015|      0|        if (!is_revocation(sig) || is_signer(sig)) {
  ------------------
  |  Branch (2015:13): [True: 0, False: 0]
  |  Branch (2015:36): [True: 0, False: 0]
  ------------------
 2016|      0|            continue;
 2017|      0|        }
 2018|       |        /* Don't think we should deal with sigs without issuer's fingerprint */
 2019|      0|        if (!sig.sig.has_keyfp() || !has_revoker(sig.sig.keyfp())) {
  ------------------
  |  Branch (2019:13): [True: 0, False: 0]
  |  Branch (2019:13): [True: 0, False: 0]
  |  Branch (2019:37): [True: 0, False: 0]
  ------------------
 2020|      0|            continue;
 2021|      0|        }
 2022|       |        /* If signature was validated and valid, do not re-validate it */
 2023|      0|        if (sig.validity.valid()) {
  ------------------
  |  Branch (2023:13): [True: 0, False: 0]
  ------------------
 2024|      0|            continue;
 2025|      0|        }
 2026|       |
 2027|      0|        auto revoker = keyring.get_signer(sig.sig);
 2028|      0|        if (!revoker) {
  ------------------
  |  Branch (2028:13): [True: 0, False: 0]
  ------------------
 2029|      0|            continue;
 2030|      0|        }
 2031|       |
 2032|      0|        revoker->validate_sig(*this, sig, keyring.secctx);
 2033|      0|        if (sig.validity.valid()) {
  ------------------
  |  Branch (2033:13): [True: 0, False: 0]
  ------------------
 2034|       |            /* return true only if new valid revocation was added */
 2035|      0|            refresh = true;
 2036|      0|        }
 2037|      0|    }
 2038|       |
 2039|      0|    return refresh;
 2040|    157|}
_ZN3rnp3Key16validate_primaryERNS_8KeyStoreE:
 2044|    157|{
 2045|       |    /* validate signatures if needed */
 2046|    157|    validate_self_signatures(keyring.secctx);
 2047|       |    /* designated revokers may have changed */
 2048|    157|    refresh_revokers();
 2049|       |
 2050|       |    /* consider public key as valid on this level if it is not expired and has at least one
 2051|       |     * valid self-signature, and is not revoked */
 2052|    157|    validity_.reset();
 2053|    157|    validity_.validated = true;
 2054|    157|    bool has_cert = false;
 2055|    157|    bool has_expired = false;
 2056|       |    /* check whether key is revoked */
 2057|    157|    for (auto &sigid : sigs_) {
  ------------------
  |  Branch (2057:22): [True: 0, False: 157]
  ------------------
 2058|      0|        auto &sig = get_sig(sigid);
 2059|      0|        if (!sig.validity.valid()) {
  ------------------
  |  Branch (2059:13): [True: 0, False: 0]
  ------------------
 2060|      0|            continue;
 2061|      0|        }
 2062|      0|        if (is_revocation(sig) && is_authorized(sig)) {
  ------------------
  |  Branch (2062:13): [True: 0, False: 0]
  |  Branch (2062:35): [True: 0, False: 0]
  ------------------
 2063|      0|            return;
 2064|      0|        }
 2065|      0|    }
 2066|       |    /* if we have direct-key signature, then it has higher priority for expiration check */
 2067|    157|    uint64_t now = keyring.secctx.time();
 2068|    157|    auto     dirsig = latest_selfsig(UserID::None);
 2069|    157|    if (dirsig) {
  ------------------
  |  Branch (2069:9): [True: 0, False: 157]
  ------------------
 2070|      0|        has_expired = expired_with(*dirsig, now);
 2071|      0|        has_cert = !has_expired;
 2072|      0|    }
 2073|       |    /* if we have primary uid and it is more restrictive, then use it as well */
 2074|    157|    Signature *prisig = nullptr;
 2075|    157|    if (!has_expired && (prisig = latest_selfsig(UserID::Primary))) {
  ------------------
  |  Branch (2075:9): [True: 157, False: 0]
  |  Branch (2075:25): [True: 0, False: 157]
  ------------------
 2076|      0|        has_expired = expired_with(*prisig, now);
 2077|      0|        has_cert = !has_expired;
 2078|      0|    }
 2079|       |    /* if we don't have direct-key sig and primary uid, use the latest self-cert */
 2080|    157|    Signature *latest = nullptr;
 2081|    157|    if (!dirsig && !prisig && (latest = latest_selfsig(UserID::Any))) {
  ------------------
  |  Branch (2081:9): [True: 157, False: 0]
  |  Branch (2081:20): [True: 157, False: 0]
  |  Branch (2081:31): [True: 0, False: 157]
  ------------------
 2082|      0|        has_expired = expired_with(*latest, now);
 2083|      0|        has_cert = !has_expired;
 2084|      0|    }
 2085|       |
 2086|       |    /* we have at least one non-expiring key self-signature */
 2087|    157|    if (has_cert) {
  ------------------
  |  Branch (2087:9): [True: 0, False: 157]
  ------------------
 2088|      0|        validity_.valid = true;
 2089|      0|        return;
 2090|      0|    }
 2091|       |    /* we have valid self-signature which expires key */
 2092|    157|    if (has_expired) {
  ------------------
  |  Branch (2092:9): [True: 0, False: 157]
  ------------------
 2093|      0|        validity_.expired = true;
 2094|      0|        return;
 2095|      0|    }
 2096|       |
 2097|       |    /* let's check whether key has at least one valid subkey binding */
 2098|    157|    for (size_t i = 0; i < subkey_count(); i++) {
  ------------------
  |  Branch (2098:24): [True: 0, False: 157]
  ------------------
 2099|      0|        Key *sub = keyring.get_subkey(*this, i);
 2100|      0|        if (!sub) {
  ------------------
  |  Branch (2100:13): [True: 0, False: 0]
  ------------------
 2101|      0|            continue;
 2102|      0|        }
 2103|      0|        sub->validate_self_signatures(*this, keyring.secctx);
 2104|      0|        auto sig = sub->latest_binding();
 2105|      0|        if (!sig) {
  ------------------
  |  Branch (2105:13): [True: 0, False: 0]
  ------------------
 2106|      0|            continue;
 2107|      0|        }
 2108|       |        /* check whether subkey is expired - then do not mark key as valid */
 2109|      0|        if (sub->expired_with(*sig, now)) {
  ------------------
  |  Branch (2109:13): [True: 0, False: 0]
  ------------------
 2110|      0|            continue;
 2111|      0|        }
 2112|      0|        validity_.valid = true;
 2113|      0|        return;
 2114|      0|    }
 2115|    157|}
_ZN3rnp3Key8validateERNS_8KeyStoreE:
 2150|    157|{
 2151|    157|    validity_.reset();
 2152|    157|    if (!is_subkey()) {
  ------------------
  |  Branch (2152:9): [True: 157, False: 0]
  ------------------
 2153|    157|        validate_primary(keyring);
 2154|    157|        return;
 2155|    157|    }
 2156|      0|    Key *primary = nullptr;
 2157|      0|    if (has_primary_fp()) {
  ------------------
  |  Branch (2157:9): [True: 0, False: 0]
  ------------------
 2158|      0|        primary = keyring.get_key(primary_fp());
 2159|      0|    }
 2160|      0|    validate_subkey(primary, keyring.secctx);
 2161|      0|}
_ZN3rnp3Key10revalidateERNS_8KeyStoreE:
 2165|    157|{
 2166|    157|    if (is_subkey()) {
  ------------------
  |  Branch (2166:9): [True: 0, False: 157]
  ------------------
 2167|      0|        Key *primary = keyring.primary_key(*this);
 2168|      0|        if (primary) {
  ------------------
  |  Branch (2168:13): [True: 0, False: 0]
  ------------------
 2169|      0|            primary->revalidate(keyring);
 2170|      0|        } else {
 2171|      0|            validate_subkey(NULL, keyring.secctx);
 2172|      0|        }
 2173|      0|        return;
 2174|      0|    }
 2175|       |
 2176|    157|    validate_desig_revokes(keyring);
 2177|    157|    validate(keyring);
 2178|    157|    if (!refresh_data(keyring.secctx)) {
  ------------------
  |  Branch (2178:9): [True: 157, False: 0]
  ------------------
 2179|    157|        RNP_LOG("Failed to refresh key data");
  ------------------
  |  |   84|    157|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|    157|    do {                                                                                 \
  |  |  |  |   77|    157|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 157, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|    157|            break;                                                                       \
  |  |  |  |   79|    157|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2180|    157|    }
 2181|       |    /* validate/re-validate all subkeys as well */
 2182|    157|    for (auto &fp : subkey_fps_) {
  ------------------
  |  Branch (2182:19): [True: 0, False: 157]
  ------------------
 2183|      0|        Key *subkey = keyring.get_key(fp);
 2184|      0|        if (subkey) {
  ------------------
  |  Branch (2184:13): [True: 0, False: 0]
  ------------------
 2185|      0|            subkey->validate_subkey(this, keyring.secctx);
 2186|      0|            if (!subkey->refresh_data(this, keyring.secctx)) {
  ------------------
  |  Branch (2186:17): [True: 0, False: 0]
  ------------------
 2187|      0|                RNP_LOG("Failed to refresh subkey data");
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2188|      0|            }
 2189|      0|        }
 2190|      0|    }
 2191|    157|}
_ZN3rnp3Key16refresh_revokersEv:
 2433|    157|{
 2434|    157|    revokers_.clear();
 2435|    157|    for (auto &sigid : sigs_) {
  ------------------
  |  Branch (2435:22): [True: 0, False: 157]
  ------------------
 2436|      0|        auto &sig = get_sig(sigid);
 2437|       |        /* pick designated revokers only from direct-key signatures */
 2438|      0|        if (!sig.validity.valid() || !is_direct_self(sig)) {
  ------------------
  |  Branch (2438:13): [True: 0, False: 0]
  |  Branch (2438:38): [True: 0, False: 0]
  ------------------
 2439|      0|            continue;
 2440|      0|        }
 2441|      0|        if (!sig.sig.has_revoker()) {
  ------------------
  |  Branch (2441:13): [True: 0, False: 0]
  ------------------
 2442|      0|            continue;
 2443|      0|        }
 2444|      0|        add_revoker(sig.sig.revoker());
 2445|      0|    }
 2446|    157|}
_ZN3rnp3Key12refresh_dataERKNS_15SecurityContextE:
 2478|    157|{
 2479|    157|    if (!is_primary()) {
  ------------------
  |  Branch (2479:9): [True: 157, False: 0]
  ------------------
 2480|    157|        RNP_LOG("key must be primary");
  ------------------
  |  |   84|    157|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|    157|    do {                                                                                 \
  |  |  |  |   77|    157|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 157, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|    157|            break;                                                                       \
  |  |  |  |   79|    157|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2481|    157|        return false;
 2482|    157|    }
 2483|       |    /* validate self-signatures if not done yet */
 2484|      0|    validate_self_signatures(ctx);
 2485|       |    /* key expiration */
 2486|      0|    expiration_ = 0;
 2487|       |    /* if we have direct-key signature, then it has higher priority */
 2488|      0|    auto dirsig = latest_selfsig(UserID::None);
 2489|      0|    if (dirsig) {
  ------------------
  |  Branch (2489:9): [True: 0, False: 0]
  ------------------
 2490|      0|        expiration_ = dirsig->sig.key_expiration();
 2491|      0|    }
 2492|       |    /* if we have primary uid and it is more restrictive, then use it as well */
 2493|      0|    auto prisig = latest_selfsig(UserID::Primary);
 2494|      0|    if (prisig && prisig->sig.key_expiration() &&
  ------------------
  |  Branch (2494:9): [True: 0, False: 0]
  |  Branch (2494:19): [True: 0, False: 0]
  ------------------
 2495|      0|        (!expiration_ || (prisig->sig.key_expiration() < expiration_))) {
  ------------------
  |  Branch (2495:10): [True: 0, False: 0]
  |  Branch (2495:26): [True: 0, False: 0]
  ------------------
 2496|      0|        expiration_ = prisig->sig.key_expiration();
 2497|      0|    }
 2498|       |    /* if we don't have direct-key sig and primary uid, use the latest self-cert */
 2499|      0|    auto latest = latest_selfsig(UserID::Any);
 2500|      0|    if (!dirsig && !prisig && latest) {
  ------------------
  |  Branch (2500:9): [True: 0, False: 0]
  |  Branch (2500:20): [True: 0, False: 0]
  |  Branch (2500:31): [True: 0, False: 0]
  ------------------
 2501|      0|        expiration_ = latest->sig.key_expiration();
 2502|      0|    }
 2503|       |    /* key flags: check in direct-key sig first, then primary uid, and then latest */
 2504|      0|    if (dirsig && dirsig->sig.has_subpkt(PGP_SIG_SUBPKT_KEY_FLAGS)) {
  ------------------
  |  Branch (2504:9): [True: 0, False: 0]
  |  Branch (2504:19): [True: 0, False: 0]
  ------------------
 2505|      0|        flags_ = dirsig->sig.key_flags();
 2506|      0|    } else if (prisig && prisig->sig.has_subpkt(PGP_SIG_SUBPKT_KEY_FLAGS)) {
  ------------------
  |  Branch (2506:16): [True: 0, False: 0]
  |  Branch (2506:26): [True: 0, False: 0]
  ------------------
 2507|      0|        flags_ = prisig->sig.key_flags();
 2508|      0|    } else if (latest && latest->sig.has_subpkt(PGP_SIG_SUBPKT_KEY_FLAGS)) {
  ------------------
  |  Branch (2508:16): [True: 0, False: 0]
  |  Branch (2508:26): [True: 0, False: 0]
  ------------------
 2509|      0|        flags_ = latest->sig.key_flags();
 2510|      0|    } else {
 2511|      0|        flags_ = pgp_pk_alg_capabilities(alg());
 2512|      0|    }
 2513|       |    /* designated revokers */
 2514|      0|    refresh_revokers();
 2515|       |    /* revocation(s) */
 2516|      0|    refresh_revocations();
 2517|       |    /* valid till */
 2518|      0|    valid_till_ = valid_till_common(expired());
 2519|       |    /* userid validities */
 2520|      0|    for (auto &uid : uids_) {
  ------------------
  |  Branch (2520:20): [True: 0, False: 0]
  ------------------
 2521|      0|        uid.valid = false;
 2522|      0|    }
 2523|      0|    for (auto &sigid : sigs_) {
  ------------------
  |  Branch (2523:22): [True: 0, False: 0]
  ------------------
 2524|      0|        auto &sig = get_sig(sigid);
 2525|       |        /* consider userid as valid if it has at least one non-expired self-sig */
 2526|      0|        if (!sig.validity.valid() || !sig.is_cert() || !is_signer(sig) ||
  ------------------
  |  Branch (2526:13): [True: 0, False: 0]
  |  Branch (2526:38): [True: 0, False: 0]
  |  Branch (2526:56): [True: 0, False: 0]
  ------------------
 2527|      0|            sig.expired(ctx.time())) {
  ------------------
  |  Branch (2527:13): [True: 0, False: 0]
  ------------------
 2528|      0|            continue;
 2529|      0|        }
 2530|      0|        if (sig.uid >= uid_count()) {
  ------------------
  |  Branch (2530:13): [True: 0, False: 0]
  ------------------
 2531|      0|            continue;
 2532|      0|        }
 2533|      0|        get_uid(sig.uid).valid = true;
 2534|      0|    }
 2535|       |    /* check whether uid is revoked */
 2536|      0|    for (auto &uid : uids_) {
  ------------------
  |  Branch (2536:20): [True: 0, False: 0]
  ------------------
 2537|      0|        if (uid.revoked) {
  ------------------
  |  Branch (2537:13): [True: 0, False: 0]
  ------------------
 2538|      0|            uid.valid = false;
 2539|      0|        }
 2540|      0|    }
 2541|       |    /* primary userid: use latest one which is not overridden by later non-primary selfsig */
 2542|      0|    uid0_set_ = false;
 2543|      0|    if (prisig && get_uid(prisig->uid).valid) {
  ------------------
  |  Branch (2543:9): [True: 0, False: 0]
  |  Branch (2543:19): [True: 0, False: 0]
  ------------------
 2544|      0|        uid0_ = prisig->uid;
 2545|      0|        uid0_set_ = true;
 2546|      0|    }
 2547|      0|    return true;
 2548|    157|}

_ZN3rnp3KeyC2Ev:
   90|    314|    Key() = default;
_ZN3rnp3KeyaSEOS0_:
   97|    157|    Key &operator=(Key &&) = default;

_ZN3pgp11KeyMaterialD2Ev:
  252|  1.25k|{
  253|  1.25k|}
_ZN3pgp11KeyMaterial12clear_secretEv:
  309|     12|{
  310|     12|    secret_ = false;
  311|     12|}
_ZN3pgp11KeyMaterial6createE16pgp_pubkey_alg_tRKNS_3rsa3KeyE:
  462|    809|{
  463|    809|    return std::unique_ptr<KeyMaterial>(new RSAKeyMaterial(alg, key));
  464|    809|}
_ZN3pgp11KeyMaterial6createERKNS_3dsa3KeyE:
  468|     39|{
  469|     39|    return std::unique_ptr<KeyMaterial>(new DSAKeyMaterial(key));
  470|     39|}
_ZN3pgp11KeyMaterial6createE16pgp_pubkey_alg_tRKNS_2eg3KeyE:
  474|     74|{
  475|     74|    return std::unique_ptr<KeyMaterial>(new EGKeyMaterial(alg, key));
  476|     74|}
_ZN3pgp11KeyMaterial6createE16pgp_pubkey_alg_tRKNS_2ec3KeyE:
  480|     16|{
  481|     16|    switch (alg) {
  482|      3|    case PGP_PKA_ECDSA:
  ------------------
  |  Branch (482:5): [True: 3, False: 13]
  ------------------
  483|      3|        return std::unique_ptr<KeyMaterial>(new ECDSAKeyMaterial(key));
  484|      9|    case PGP_PKA_ECDH:
  ------------------
  |  Branch (484:5): [True: 9, False: 7]
  ------------------
  485|      9|        return std::unique_ptr<KeyMaterial>(new ECDHKeyMaterial(key));
  486|      4|    case PGP_PKA_EDDSA:
  ------------------
  |  Branch (486:5): [True: 4, False: 12]
  ------------------
  487|      4|        return std::unique_ptr<KeyMaterial>(new EDDSAKeyMaterial(key));
  488|      0|    case PGP_PKA_SM2:
  ------------------
  |  Branch (488:5): [True: 0, False: 16]
  ------------------
  489|      0|        return std::unique_ptr<KeyMaterial>(new SM2KeyMaterial(key));
  490|      0|    default:
  ------------------
  |  Branch (490:5): [True: 0, False: 16]
  ------------------
  491|      0|        throw std::invalid_argument("Invalid EC algorithm.");
  492|     16|    }
  493|     16|}
_ZN3pgp14RSAKeyMaterial5cloneEv:
  497|     96|{
  498|     96|    return std::unique_ptr<KeyMaterial>(new RSAKeyMaterial(*this));
  499|     96|}
_ZN3pgp14RSAKeyMaterial12clear_secretEv:
  516|      6|{
  517|      6|    key_.clear_secret();
  518|      6|    KeyMaterial::clear_secret();
  519|      6|}
_ZN3pgp14RSAKeyMaterial10set_secretERKNS_3mpiES3_S3_S3_:
  624|     42|{
  625|     42|    key_.d = d;
  626|     42|    key_.p = p;
  627|     42|    key_.q = q;
  628|     42|    key_.u = u;
  629|     42|    secret_ = true;
  630|     42|}
_ZN3pgp14DSAKeyMaterial5cloneEv:
  676|     68|{
  677|     68|    return std::unique_ptr<KeyMaterial>(new DSAKeyMaterial(*this));
  678|     68|}
_ZN3pgp14DSAKeyMaterial12clear_secretEv:
  697|      3|{
  698|      3|    key_.clear_secret();
  699|      3|    KeyMaterial::clear_secret();
  700|      3|}
_ZN3pgp14DSAKeyMaterial10set_secretERKNS_3mpiE:
  782|     31|{
  783|     31|    key_.x = x;
  784|     31|    secret_ = true;
  785|     31|}
_ZN3pgp13EGKeyMaterial5cloneEv:
  831|    126|{
  832|    126|    return std::unique_ptr<KeyMaterial>(new EGKeyMaterial(*this));
  833|    126|}
_ZN3pgp13EGKeyMaterial12clear_secretEv:
  851|      1|{
  852|      1|    key_.clear_secret();
  853|      1|    KeyMaterial::clear_secret();
  854|      1|}
_ZN3pgp13EGKeyMaterial10set_secretERKNS_3mpiE:
  938|     62|{
  939|     62|    key_.x = x;
  940|     62|    secret_ = true;
  941|     62|}
_ZN3pgp13ECKeyMaterial12clear_secretEv:
  981|      2|{
  982|      2|    key_.clear_secret();
  983|      2|    KeyMaterial::clear_secret();
  984|      2|}
_ZN3pgp13ECKeyMaterial10set_secretERKNS_3mpiE:
 1058|     10|{
 1059|     10|    key_.x = x;
 1060|     10|    secret_ = true;
 1061|     10|}
_ZN3pgp16ECDSAKeyMaterial5cloneEv:
 1101|      2|{
 1102|      2|    return std::unique_ptr<KeyMaterial>(new ECDSAKeyMaterial(*this));
 1103|      2|}
_ZN3pgp15ECDHKeyMaterial5cloneEv:
 1160|     16|{
 1161|     16|    return std::unique_ptr<KeyMaterial>(new ECDHKeyMaterial(*this));
 1162|     16|}
_ZN3pgp16EDDSAKeyMaterial5cloneEv:
 1285|      6|{
 1286|      6|    return std::unique_ptr<KeyMaterial>(new EDDSAKeyMaterial(*this));
 1287|      6|}

_ZN3pgp11KeyMaterialC2E16pgp_pubkey_alg_tb:
  180|    938|        : validity_({}), alg_(kalg), secret_(secret){};
_ZN3pgp14RSAKeyMaterialC2E16pgp_pubkey_alg_tRKNS_3rsa3KeyEb:
  234|    809|        : KeyMaterial(kalg, secret), key_(key){};
_ZN3pgp14DSAKeyMaterialC2ERKNS_3dsa3KeyEb:
  277|     39|        : KeyMaterial(PGP_PKA_DSA, secret), key_(key){};
_ZN3pgp13EGKeyMaterialC2E16pgp_pubkey_alg_tRKNS_2eg3KeyEb:
  314|     74|        : KeyMaterial(kalg, secret), key_(key){};
_ZN3pgp13ECKeyMaterialC2E16pgp_pubkey_alg_tRKNS_2ec3KeyEb:
  352|     16|        : KeyMaterial(kalg, secret), key_(key){};
_ZN3pgp16ECDSAKeyMaterialC2ERKNS_2ec3KeyEb:
  375|      3|        : ECKeyMaterial(PGP_PKA_ECDSA, key, secret){};
_ZN3pgp15ECDHKeyMaterialC2ERKNS_2ec3KeyEb:
  394|      9|        : ECKeyMaterial(PGP_PKA_ECDH, key, secret){};
_ZN3pgp16EDDSAKeyMaterialC2ERKNS_2ec3KeyEb:
  420|      4|        : ECKeyMaterial(PGP_PKA_EDDSA, key, secret){};

_Z14rnp_log_switchv:
   53|  7.55k|{
   54|  7.55k|    if (_rnp_log_switch < 0) {
  ------------------
  |  Branch (54:9): [True: 1, False: 7.55k]
  ------------------
   55|      1|        const char *var = getenv(RNP_LOG_CONSOLE);
   56|      1|        _rnp_log_switch = (var && strcmp(var, "0")) ? 1 : 0;
  ------------------
  |  Branch (56:28): [True: 0, False: 1]
  |  Branch (56:35): [True: 0, False: 0]
  ------------------
   57|      1|    }
   58|  7.55k|    return !_rnp_log_disable && !!_rnp_log_switch;
  ------------------
  |  Branch (58:12): [True: 7.55k, False: 0]
  |  Branch (58:33): [True: 0, False: 7.55k]
  ------------------
   59|  7.55k|}

_ZN3rnp9RawPacketC2EPKhm14pgp_pkt_type_t:
   33|    157|RawPacket::RawPacket(const uint8_t *data, size_t len, pgp_pkt_type_t atag) : tag_(atag)
   34|    157|{
   35|    157|    if (data && len) {
  ------------------
  |  Branch (35:9): [True: 157, False: 0]
  |  Branch (35:17): [True: 157, False: 0]
  ------------------
   36|    157|        data_.assign(data, data + len);
   37|    157|    }
   38|    157|}

_ZN3rnp9RawPacketC2Ev:
   42|    471|    RawPacket() : tag_(PGP_PKT_RESERVED){};

_ZN3rnp15SecurityProfile8add_ruleEONS_12SecurityRuleE:
   75|  34.0k|{
   76|  34.0k|    rules_.emplace_back(rule);
   77|  34.0k|    return rules_.back();
   78|  34.0k|}
_ZN3rnp15SecurityContextC2Ev:
  185|  4.26k|SecurityContext::SecurityContext() : time_(0), prov_state_(NULL), rng(RNG::Type::DRBG)
  186|  4.26k|{
  187|       |    /* Initialize crypto provider if needed (currently only for OpenSSL 3.0) */
  188|  4.26k|    if (!rnp::backend_init(&prov_state_)) {
  ------------------
  |  Branch (188:9): [True: 0, False: 4.26k]
  ------------------
  189|      0|        throw rnp::rnp_exception(RNP_ERROR_BAD_STATE);
  190|      0|    }
  191|       |    /* Mark SHA-1 data signature insecure since 2019-01-19, as GnuPG does */
  192|  4.26k|    profile.add_rule({FeatureType::Hash,
  193|  4.26k|                      PGP_HASH_SHA1,
  194|  4.26k|                      SecurityLevel::Insecure,
  195|  4.26k|                      1547856000,
  196|  4.26k|                      SecurityAction::VerifyData});
  197|       |    /* Mark SHA-1 key signature insecure since 2024-01-19 by default */
  198|  4.26k|    profile.add_rule({FeatureType::Hash,
  199|  4.26k|                      PGP_HASH_SHA1,
  200|  4.26k|                      SecurityLevel::Insecure,
  201|  4.26k|                      1705629600,
  202|  4.26k|                      SecurityAction::VerifyKey});
  203|       |    /* Mark MD5 insecure since 2012-01-01 */
  204|  4.26k|    profile.add_rule({FeatureType::Hash, PGP_HASH_MD5, SecurityLevel::Insecure, 1325376000});
  205|       |    /* Mark CAST5, 3DES, IDEA, BLOWFISH insecure since 2024-10-01*/
  206|  4.26k|    profile.add_rule({FeatureType::Cipher, PGP_SA_CAST5, SecurityLevel::Insecure, 1727730000});
  207|  4.26k|    profile.add_rule(
  208|  4.26k|      {FeatureType::Cipher, PGP_SA_TRIPLEDES, SecurityLevel::Insecure, 1727730000});
  209|  4.26k|    profile.add_rule({FeatureType::Cipher, PGP_SA_IDEA, SecurityLevel::Insecure, 1727730000});
  210|  4.26k|    profile.add_rule(
  211|  4.26k|      {FeatureType::Cipher, PGP_SA_BLOWFISH, SecurityLevel::Insecure, 1727730000});
  212|  4.26k|#if defined(ENABLE_CRYPTO_REFRESH)
  213|       |    /* Mark RIPEMD insecure since 2024-01-19 by default */
  214|  4.26k|    profile.add_rule(
  215|  4.26k|      {FeatureType::Hash, PGP_HASH_RIPEMD, SecurityLevel::Insecure, 1705629600});
  216|  4.26k|#endif
  217|       |#if defined(RNP_FIPS_MODE)
  218|       |    /*
  219|       |     * FIPS-compliant defaults: mark non-FIPS-approved algorithms as Disabled
  220|       |     * (not merely Insecure) so they cannot be used at all. These rules have
  221|       |     * from = 0, so they apply to objects regardless of creation time. The
  222|       |     * caller may still relax individual rules via rnp_add_security_rule() with
  223|       |     * the RNP_SECURITY_OVERRIDE flag, but the defaults are intentionally
  224|       |     * strict. See docs/security.adoc for the certification boundary.
  225|       |     *
  226|       |     * Note: this enforces rnp's policy on top of OpenSSL's validated module.
  227|       |     * It does not by itself make rnp a FIPS-validated module.
  228|       |     */
  229|       |    /* Non-FIPS symmetric algorithms */
  230|       |    profile.add_rule({FeatureType::Cipher, PGP_SA_TWOFISH, SecurityLevel::Disabled, 0});
  231|       |    profile.add_rule({FeatureType::Cipher, PGP_SA_CAST5, SecurityLevel::Disabled, 0});
  232|       |    profile.add_rule({FeatureType::Cipher, PGP_SA_IDEA, SecurityLevel::Disabled, 0});
  233|       |    profile.add_rule({FeatureType::Cipher, PGP_SA_BLOWFISH, SecurityLevel::Disabled, 0});
  234|       |    profile.add_rule({FeatureType::Cipher, PGP_SA_SM4, SecurityLevel::Disabled, 0});
  235|       |    /* Non-FIPS hash algorithms */
  236|       |    profile.add_rule({FeatureType::Hash, PGP_HASH_MD5, SecurityLevel::Disabled, 0});
  237|       |    profile.add_rule({FeatureType::Hash, PGP_HASH_SHA1, SecurityLevel::Disabled, 0});
  238|       |    profile.add_rule({FeatureType::Hash, PGP_HASH_RIPEMD, SecurityLevel::Disabled, 0});
  239|       |    /* Non-FIPS public-key algorithms. DSA is FIPS-approved but only with
  240|       |     * approved key sizes; that size gating is enforced separately during key
  241|       |     * generation/use, not via a blanket rule here. */
  242|       |    profile.add_rule({FeatureType::PublicKey, PGP_PKA_EDDSA, SecurityLevel::Disabled, 0});
  243|       |    profile.add_rule({FeatureType::PublicKey, PGP_PKA_SM2, SecurityLevel::Disabled, 0});
  244|       |    profile.add_rule({FeatureType::PublicKey, PGP_PKA_ELGAMAL, SecurityLevel::Disabled, 0});
  245|       |    profile.add_rule(
  246|       |      {FeatureType::PublicKey, PGP_PKA_ELGAMAL_ENCRYPT_OR_SIGN, SecurityLevel::Disabled, 0});
  247|       |#endif
  248|  4.26k|}
_ZN3rnp15SecurityContextD2Ev:
  251|  4.26k|{
  252|  4.26k|    rnp::backend_finish(prov_state_);
  253|  4.26k|}
_ZNK3rnp15SecurityContext4timeEv:
  273|    157|{
  274|    157|    return time_ ? time_ : ::time(NULL);
  ------------------
  |  Branch (274:12): [True: 0, False: 157]
  ------------------
  275|    157|}

_ZN3rnp12SecurityRuleC2ENS_11FeatureTypeEiNS_13SecurityLevelEmNS_14SecurityActionE:
   54|  34.0k|        : type(ftype), feature(fval), level(flevel), from(ffrom), override(false),
   55|  34.0k|          action(faction){};

_ZN3rnp10RevocationC2Ev:
  145|    471|    Revocation() : uid(0), code(PGP_REVOCATION_NO_REASON), sigid(){};

_ZN11id_str_pair6lookupEPKS_PKci:
   44|  1.19k|{
   45|  3.58k|    while (pair && pair->str) {
  ------------------
  |  Branch (45:12): [True: 3.58k, False: 0]
  |  Branch (45:20): [True: 3.53k, False: 54]
  ------------------
   46|  3.53k|        if (rnp::str_case_eq(str, pair->str)) {
  ------------------
  |  Branch (46:13): [True: 1.13k, False: 2.39k]
  ------------------
   47|  1.13k|            return pair->id;
   48|  1.13k|        }
   49|  2.39k|        pair++;
   50|  2.39k|    }
   51|     54|    return notfound;
   52|  1.19k|}

_ZN28gnupg_extended_private_key_t5parseEPKcmm:
  232|  4.26k|{
  233|  4.26k|    bool               res = false;
  234|  4.26k|    std::istringstream iss(std::string(r_bytes, r_length));
  235|  4.26k|    try {
  236|  4.26k|        ext_key_input_stream_t g23_is(&iss, depth);
  237|  4.26k|        g23_is.scan(*this);
  238|  4.26k|        res = true;
  239|  4.26k|    } catch (sexp_exception_t &e) {
  240|  2.86k|        RNP_LOG("%s", e.what());
  ------------------
  |  |   84|  2.86k|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|  2.86k|    do {                                                                                 \
  |  |  |  |   77|  2.86k|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 2.86k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|  2.86k|            break;                                                                       \
  |  |  |  |   79|  2.86k|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  241|  2.86k|    }
  242|  4.26k|    return res;
  243|  4.26k|}
_ZN3rnp8KeyStore8load_g10ER12pgp_source_tPKNS_11KeyProviderE:
  935|  4.26k|{
  936|  4.26k|    try {
  937|       |        /* read src to the memory */
  938|  4.26k|        MemorySource memsrc(src);
  939|       |        /* parse secret key: fills material and sec_protection only */
  940|  4.26k|        pgp_key_pkt_t seckey;
  941|  4.26k|        if (!g23_parse_seckey(seckey, (uint8_t *) memsrc.memory(), memsrc.size(), NULL)) {
  ------------------
  |  Branch (941:13): [True: 4.10k, False: 157]
  ------------------
  942|  4.10k|            return false;
  943|  4.10k|        }
  944|       |        /* copy public key fields if any */
  945|    157|        Key key;
  946|    157|        if (key_provider) {
  ------------------
  |  Branch (946:13): [True: 0, False: 157]
  ------------------
  947|      0|            pgp::KeyGrip grip = seckey.material->grip();
  948|      0|            auto         pubkey =
  949|      0|              key_provider->request_key(*KeySearch::create(grip), PGP_OP_MERGE_INFO);
  950|      0|            if (!pubkey) {
  ------------------
  |  Branch (950:17): [True: 0, False: 0]
  ------------------
  951|      0|                return false;
  952|      0|            }
  953|       |
  954|       |            /* public key packet has some more info then the secret part */
  955|      0|            key = Key(*pubkey, true);
  956|      0|            if (!copy_secret_fields(key.pkt(), seckey)) {
  ------------------
  |  Branch (956:17): [True: 0, False: 0]
  ------------------
  957|      0|                return false;
  958|      0|            }
  959|    157|        } else {
  960|    157|            key.set_pkt(std::move(seckey));
  961|    157|        }
  962|       |        /* set rawpkt */
  963|    157|        key.set_rawpkt(
  964|    157|          RawPacket((uint8_t *) memsrc.memory(), memsrc.size(), PGP_PKT_RESERVED));
  965|    157|        key.format = KeyFormat::G10;
  966|    157|        if (!add_key(key)) {
  ------------------
  |  Branch (966:13): [True: 0, False: 157]
  ------------------
  967|      0|            return false;
  968|      0|        }
  969|    157|        return true;
  970|    157|    } catch (const std::exception &e) {
  971|       |        /* LCOV_EXCL_START */
  972|      0|        RNP_LOG("%s", e.what());
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  973|      0|        return false;
  974|       |        /* LCOV_EXCL_END */
  975|      0|    }
  976|  4.26k|}
key_store_g10.cpp:_ZL16g23_parse_seckeyR13pgp_key_pkt_tPKhmPKc16pgp_pubkey_alg_t:
  779|  4.26k|{
  780|  4.26k|    gnupg_extended_private_key_t g23_extended_key;
  781|       |
  782|  4.26k|    if (!g23_extended_key.parse((const char *) data, data_len, SXP_MAX_DEPTH)) {
  ------------------
  |  |   33|  4.26k|#define SXP_MAX_DEPTH 30
  ------------------
  |  Branch (782:9): [True: 2.86k, False: 1.39k]
  ------------------
  783|  2.86k|        RNP_LOG("Failed to parse s-exp.");
  ------------------
  |  |   84|  2.86k|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|  2.86k|    do {                                                                                 \
  |  |  |  |   77|  2.86k|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 2.86k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|  2.86k|            break;                                                                       \
  |  |  |  |   79|  2.86k|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  784|  2.86k|        return false;
  785|  2.86k|    }
  786|       |    // Although the library parses full g23 extended key
  787|       |    // we extract and use g10 part only
  788|  1.39k|    const sexp_list_t &g10_key = g23_extended_key.key;
  789|       |
  790|       |    /* expected format:
  791|       |     *  (<type>
  792|       |     *    (<algo>
  793|       |     *	   (x <mpi>)
  794|       |     *	   (y <mpi>)
  795|       |     *    )
  796|       |     *  )
  797|       |     */
  798|       |
  799|  1.39k|    if (g10_key.size() != 2 || !g10_key.at(0)->is_sexp_string() ||
  ------------------
  |  Branch (799:9): [True: 30, False: 1.36k]
  |  Branch (799:32): [True: 5, False: 1.36k]
  ------------------
  800|  1.36k|        !g10_key.at(1)->is_sexp_list()) {
  ------------------
  |  Branch (800:9): [True: 1, False: 1.36k]
  ------------------
  801|     36|        RNP_LOG("Wrong format, expected: (<type> (...))");
  ------------------
  |  |   84|     36|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|     36|    do {                                                                                 \
  |  |  |  |   77|     36|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 36, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|     36|            break;                                                                       \
  |  |  |  |   79|     36|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  802|     36|        return false;
  803|     36|    }
  804|       |
  805|  1.36k|    bool is_protected = false;
  806|       |
  807|  1.36k|    auto &name = g10_key.sexp_string_at(0)->get_string();
  808|  1.36k|    if (name == "private-key") {
  ------------------
  |  Branch (808:9): [True: 461, False: 901]
  ------------------
  809|    461|        is_protected = false;
  810|    901|    } else if (name == "protected-private-key") {
  ------------------
  |  Branch (810:16): [True: 712, False: 189]
  ------------------
  811|    712|        is_protected = true;
  812|    712|    } else {
  813|    189|        RNP_LOG("Unsupported top-level block: '%.*s'",
  ------------------
  |  |   84|    189|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|    189|    do {                                                                                 \
  |  |  |  |   77|    189|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 189, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|    189|            break;                                                                       \
  |  |  |  |   79|    189|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  814|    189|                (int) name.size(),
  815|    189|                (const char *) name.data());
  816|    189|        return false;
  817|    189|    }
  818|       |
  819|  1.17k|    auto alg_s_exp = g10_key.sexp_list_at(1);
  820|  1.17k|    if (alg_s_exp->size() < 2) {
  ------------------
  |  Branch (820:9): [True: 4, False: 1.16k]
  ------------------
  821|      4|        RNP_LOG("Wrong count of algorithm-level elements: %zu", alg_s_exp->size());
  ------------------
  |  |   84|      4|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      4|    do {                                                                                 \
  |  |  |  |   77|      4|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 4, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      4|            break;                                                                       \
  |  |  |  |   79|      4|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  822|      4|        return false;
  823|      4|    }
  824|       |
  825|  1.16k|    if (!alg_s_exp->at(0)->is_sexp_string()) {
  ------------------
  |  Branch (825:9): [True: 1, False: 1.16k]
  ------------------
  826|      1|        RNP_LOG("Expected block with algorithm name, but has s-exp");
  ------------------
  |  |   84|      1|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      1|    do {                                                                                 \
  |  |  |  |   77|      1|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      1|            break;                                                                       \
  |  |  |  |   79|      1|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  827|      1|        return false;
  828|      1|    }
  829|       |
  830|  1.16k|    bool ret = false;
  831|  1.16k|    auto alg = pubalg;
  832|  1.16k|    if (alg == PGP_PKA_NOTHING) {
  ------------------
  |  Branch (832:9): [True: 1.16k, False: 0]
  ------------------
  833|  1.16k|        auto &alg_bt = alg_s_exp->sexp_string_at(0)->get_string();
  834|  1.16k|        auto  alg_st = (const char *) alg_bt.data();
  835|  1.16k|        alg = static_cast<pgp_pubkey_alg_t>(
  836|  1.16k|          id_str_pair::lookup(g10_alg_aliases, alg_st, PGP_PKA_NOTHING));
  837|  1.16k|        if (alg == PGP_PKA_NOTHING) {
  ------------------
  |  Branch (837:13): [True: 47, False: 1.12k]
  ------------------
  838|     47|            RNP_LOG("Unsupported algorithm: '%.*s'", (int) alg_bt.size(), alg_st);
  ------------------
  |  |   84|     47|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|     47|    do {                                                                                 \
  |  |  |  |   77|     47|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 47, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|     47|            break;                                                                       \
  |  |  |  |   79|     47|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  839|     47|            return false;
  840|     47|        }
  841|       |        /* Parse pubkey only if it was not parsed before */
  842|  1.12k|        if (!parse_pubkey(seckey, alg_s_exp, alg)) {
  ------------------
  |  Branch (842:13): [True: 183, False: 938]
  ------------------
  843|    183|            RNP_LOG("failed to parse pubkey");
  ------------------
  |  |   84|    183|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|    183|    do {                                                                                 \
  |  |  |  |   77|    183|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 183, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|    183|            break;                                                                       \
  |  |  |  |   79|    183|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  844|    183|            goto done;
  845|    183|        }
  846|  1.12k|    }
  847|       |
  848|    938|    if (is_protected) {
  ------------------
  |  Branch (848:9): [True: 707, False: 231]
  ------------------
  849|    707|        if (!parse_protected_seckey(seckey, alg_s_exp, password)) {
  ------------------
  |  Branch (849:13): [True: 695, False: 12]
  ------------------
  850|    695|            goto done;
  851|    695|        }
  852|    707|    } else {
  853|    231|        seckey.sec_protection.s2k.usage = PGP_S2KU_NONE;
  854|    231|        seckey.sec_protection.symm_alg = PGP_SA_PLAINTEXT;
  855|    231|        seckey.sec_protection.s2k.hash_alg = PGP_HASH_UNKNOWN;
  856|    231|        if (!parse_seckey(seckey, alg_s_exp)) {
  ------------------
  |  Branch (856:13): [True: 86, False: 145]
  ------------------
  857|     86|            RNP_LOG("failed to parse seckey");
  ------------------
  |  |   84|     86|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|     86|    do {                                                                                 \
  |  |  |  |   77|     86|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 86, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|     86|            break;                                                                       \
  |  |  |  |   79|     86|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  858|     86|            goto done;
  859|     86|        }
  860|    231|    }
  861|    157|    ret = true;
  862|  1.12k|done:
  863|  1.12k|    if (!ret) {
  ------------------
  |  Branch (863:9): [True: 964, False: 157]
  ------------------
  864|    964|        seckey = pgp_key_pkt_t();
  865|    964|    }
  866|  1.12k|    return ret;
  867|    157|}
key_store_g10.cpp:_ZL12parse_pubkeyR13pgp_key_pkt_tPKN4sexp11sexp_list_tE16pgp_pubkey_alg_t:
  375|  1.12k|{
  376|  1.12k|    pubkey.version = PGP_V4;
  377|  1.12k|    pubkey.alg = alg;
  378|  1.12k|    switch (alg) {
  379|     64|    case PGP_PKA_DSA: {
  ------------------
  |  Branch (379:5): [True: 64, False: 1.05k]
  ------------------
  380|     64|        pgp::dsa::Key dsa;
  381|     64|        if (!read_mpi(s_exp, "p", dsa.p) || !read_mpi(s_exp, "q", dsa.q) ||
  ------------------
  |  Branch (381:13): [True: 6, False: 58]
  |  Branch (381:13): [True: 25, False: 39]
  |  Branch (381:45): [True: 14, False: 44]
  ------------------
  382|     44|            !read_mpi(s_exp, "g", dsa.g) || !read_mpi(s_exp, "y", dsa.y)) {
  ------------------
  |  Branch (382:13): [True: 3, False: 41]
  |  Branch (382:45): [True: 2, False: 39]
  ------------------
  383|     25|            return false;
  384|     25|        }
  385|     39|        pubkey.material = pgp::KeyMaterial::create(dsa);
  386|     39|        break;
  387|     64|    }
  388|    891|    case PGP_PKA_RSA:
  ------------------
  |  Branch (388:5): [True: 891, False: 230]
  ------------------
  389|    891|    case PGP_PKA_RSA_ENCRYPT_ONLY:
  ------------------
  |  Branch (389:5): [True: 0, False: 1.12k]
  ------------------
  390|    891|    case PGP_PKA_RSA_SIGN_ONLY: {
  ------------------
  |  Branch (390:5): [True: 0, False: 1.12k]
  ------------------
  391|    891|        pgp::rsa::Key rsa;
  392|    891|        if (!read_mpi(s_exp, "n", rsa.n) || !read_mpi(s_exp, "e", rsa.e)) {
  ------------------
  |  Branch (392:13): [True: 23, False: 868]
  |  Branch (392:13): [True: 82, False: 809]
  |  Branch (392:45): [True: 59, False: 809]
  ------------------
  393|     82|            return false;
  394|     82|        }
  395|    809|        pubkey.material = pgp::KeyMaterial::create(alg, rsa);
  396|    809|        break;
  397|    891|    }
  398|    131|    case PGP_PKA_ELGAMAL:
  ------------------
  |  Branch (398:5): [True: 131, False: 990]
  ------------------
  399|    131|    case PGP_PKA_ELGAMAL_ENCRYPT_OR_SIGN: {
  ------------------
  |  Branch (399:5): [True: 0, False: 1.12k]
  ------------------
  400|    131|        pgp::eg::Key eg;
  401|    131|        if (!read_mpi(s_exp, "p", eg.p) || !read_mpi(s_exp, "g", eg.g) ||
  ------------------
  |  Branch (401:13): [True: 18, False: 113]
  |  Branch (401:13): [True: 57, False: 74]
  |  Branch (401:44): [True: 32, False: 81]
  ------------------
  402|     81|            !read_mpi(s_exp, "y", eg.y)) {
  ------------------
  |  Branch (402:13): [True: 7, False: 74]
  ------------------
  403|     57|            return false;
  404|     57|        }
  405|     74|        pubkey.material = pgp::KeyMaterial::create(alg, eg);
  406|     74|        break;
  407|    131|    }
  408|     20|    case PGP_PKA_ECDSA:
  ------------------
  |  Branch (408:5): [True: 20, False: 1.10k]
  ------------------
  409|     34|    case PGP_PKA_ECDH:
  ------------------
  |  Branch (409:5): [True: 14, False: 1.10k]
  ------------------
  410|     35|    case PGP_PKA_EDDSA: {
  ------------------
  |  Branch (410:5): [True: 1, False: 1.12k]
  ------------------
  411|     35|        pgp::ec::Key ec{};
  412|     35|        if (!read_curve(s_exp, "curve", ec) || !read_mpi(s_exp, "q", ec.p)) {
  ------------------
  |  Branch (412:13): [True: 18, False: 17]
  |  Branch (412:13): [True: 19, False: 16]
  |  Branch (412:48): [True: 1, False: 16]
  ------------------
  413|     19|            return false;
  414|     19|        }
  415|     16|        if (ec.curve == PGP_CURVE_ED25519) {
  ------------------
  |  Branch (415:13): [True: 4, False: 12]
  ------------------
  416|       |            /* need to adjust it here since 'ecc' key type defaults to ECDSA */
  417|      4|            pubkey.alg = PGP_PKA_EDDSA;
  418|      4|        }
  419|     16|        pubkey.material = pgp::KeyMaterial::create(pubkey.alg, ec);
  420|     16|        break;
  421|     35|    }
  422|      0|    default:
  ------------------
  |  Branch (422:5): [True: 0, False: 1.12k]
  ------------------
  423|      0|        RNP_LOG("Unsupported public key algorithm: %d", (int) alg);
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  424|      0|        return false;
  425|  1.12k|    }
  426|       |
  427|    938|    return true;
  428|  1.12k|}
key_store_g10.cpp:_ZL8read_mpiPKN4sexp11sexp_list_tERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERN3pgp3mpiE:
  290|  2.74k|{
  291|  2.74k|    const sexp_string_t *data = lookup_var_data(list, name);
  292|  2.74k|    if (!data) {
  ------------------
  |  Branch (292:9): [True: 251, False: 2.48k]
  ------------------
  293|    251|        return false;
  294|    251|    }
  295|       |
  296|       |    /* strip leading zero */
  297|  2.48k|    const auto &bytes = data->get_string();
  298|  2.48k|    if ((bytes.size() > 1) && !bytes[0] && (bytes[1] & 0x80)) {
  ------------------
  |  Branch (298:9): [True: 551, False: 1.93k]
  |  Branch (298:31): [True: 220, False: 331]
  |  Branch (298:44): [True: 159, False: 61]
  ------------------
  299|    159|        val.assign(bytes.data() + 1, bytes.size() - 1);
  300|  2.33k|    } else {
  301|  2.33k|        val.assign(bytes.data(), bytes.size());
  302|  2.33k|    }
  303|  2.48k|    return true;
  304|  2.74k|}
key_store_g10.cpp:_ZL15lookup_var_dataPKN4sexp11sexp_list_tERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  274|  2.77k|{
  275|  2.77k|    const sexp_list_t *var = lookup_var(list, name);
  276|  2.77k|    if (!var) {
  ------------------
  |  Branch (276:9): [True: 256, False: 2.51k]
  ------------------
  277|    256|        return NULL;
  278|    256|    }
  279|       |
  280|  2.51k|    if (!var->at(1)->is_sexp_string()) {
  ------------------
  |  Branch (280:9): [True: 6, False: 2.51k]
  ------------------
  281|      6|        RNP_LOG("Expected block value");
  ------------------
  |  |   84|      6|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      6|    do {                                                                                 \
  |  |  |  |   77|      6|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 6, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      6|            break;                                                                       \
  |  |  |  |   79|      6|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  282|      6|        return NULL;
  283|      6|    }
  284|       |
  285|  2.51k|    return var->sexp_string_at(1);
  286|  2.51k|}
key_store_g10.cpp:_ZL10lookup_varPKN4sexp11sexp_list_tERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  247|  3.48k|{
  248|  3.48k|    const sexp_list_t *res = nullptr;
  249|       |    // We are looking for a list element  (condition 1)
  250|       |    // that:
  251|       |    //  -- has at least two SEXP elements (condition 2)
  252|       |    //  -- has a SEXP string at 0 position (condition 3)
  253|       |    //     matching given name            (condition 4)
  254|  3.48k|    auto match = [name](const std::shared_ptr<sexp_object_t> &ptr) {
  255|  3.48k|        bool r = false;
  256|  3.48k|        auto r1 = ptr->sexp_list_view();
  257|  3.48k|        if (r1 && r1->size() >= 2) { // conditions (1) and (2)
  258|  3.48k|            auto r2 = r1->sexp_string_at(0);
  259|  3.48k|            if (r2 && r2 == name) // conditions (3) and (4)
  260|  3.48k|                r = true;
  261|  3.48k|        }
  262|  3.48k|        return r;
  263|  3.48k|    };
  264|  3.48k|    auto r3 = std::find_if(list->begin(), list->end(), std::move(match));
  265|  3.48k|    if (r3 == list->end())
  ------------------
  |  Branch (265:9): [True: 260, False: 3.22k]
  ------------------
  266|  3.48k|        RNP_LOG("Haven't got variable '%s'", name.c_str());
  ------------------
  |  |   84|    260|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|    260|    do {                                                                                 \
  |  |  |  |   77|    260|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 260, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|    260|            break;                                                                       \
  |  |  |  |   79|    260|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  267|  3.22k|    else
  268|  3.22k|        res = (*r3)->sexp_list_view();
  269|  3.48k|    return res;
  270|  3.48k|}
key_store_g10.cpp:_ZZL10lookup_varPKN4sexp11sexp_list_tERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEENK3$_0clERKNS3_10shared_ptrINS_13sexp_object_tEEE:
  254|  27.5k|    auto match = [name](const std::shared_ptr<sexp_object_t> &ptr) {
  255|  27.5k|        bool r = false;
  256|  27.5k|        auto r1 = ptr->sexp_list_view();
  257|  27.5k|        if (r1 && r1->size() >= 2) { // conditions (1) and (2)
  ------------------
  |  Branch (257:13): [True: 16.5k, False: 11.0k]
  |  Branch (257:19): [True: 9.00k, False: 7.58k]
  ------------------
  258|  9.00k|            auto r2 = r1->sexp_string_at(0);
  259|  9.00k|            if (r2 && r2 == name) // conditions (3) and (4)
  ------------------
  |  Branch (259:17): [True: 8.70k, False: 301]
  |  Branch (259:23): [True: 3.22k, False: 5.48k]
  ------------------
  260|  3.22k|                r = true;
  261|  9.00k|        }
  262|  27.5k|        return r;
  263|  27.5k|    };
key_store_g10.cpp:_ZL10read_curvePKN4sexp11sexp_list_tERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERN3pgp2ec3KeyE:
  308|     35|{
  309|     35|    const sexp_string_t *data = lookup_var_data(list, name);
  310|     35|    if (!data) {
  ------------------
  |  Branch (310:9): [True: 11, False: 24]
  ------------------
  311|     11|        return false;
  312|     11|    }
  313|       |
  314|     24|    const auto &bytes = data->get_string();
  315|     24|    pgp_curve_t curve = static_cast<pgp_curve_t>(
  316|     24|      id_str_pair::lookup(g10_curve_aliases, (const char *) bytes.data(), PGP_CURVE_UNKNOWN));
  317|     24|    if (curve != PGP_CURVE_UNKNOWN) {
  ------------------
  |  Branch (317:9): [True: 17, False: 7]
  ------------------
  318|     17|        key.curve = curve;
  319|     17|        return true;
  320|     17|    }
  321|      7|    RNP_LOG("Unknown curve: %.*s", (int) bytes.size(), (const char *) bytes.data());
  ------------------
  |  |   84|      7|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      7|    do {                                                                                 \
  |  |  |  |   77|      7|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 7, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      7|            break;                                                                       \
  |  |  |  |   79|      7|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  322|      7|    return false;
  323|     24|}
key_store_g10.cpp:_ZL22parse_protected_seckeyR13pgp_key_pkt_tPKN4sexp11sexp_list_tEPKc:
  593|    707|{
  594|       |    // find and validate the protected section
  595|    707|    const sexp_list_t *protected_key = lookup_var(list, "protected");
  596|    707|    if (!protected_key) {
  ------------------
  |  Branch (596:9): [True: 4, False: 703]
  ------------------
  597|      4|        RNP_LOG("missing protected section");
  ------------------
  |  |   84|      4|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      4|    do {                                                                                 \
  |  |  |  |   77|      4|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 4, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      4|            break;                                                                       \
  |  |  |  |   79|      4|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  598|      4|        return false;
  599|      4|    }
  600|    703|    if (protected_key->size() != 4 || !protected_key->at(1)->is_sexp_string() ||
  ------------------
  |  Branch (600:9): [True: 20, False: 683]
  |  Branch (600:39): [True: 1, False: 682]
  ------------------
  601|    682|        protected_key->at(2)->is_sexp_string() || !protected_key->at(3)->is_sexp_string()) {
  ------------------
  |  Branch (601:9): [True: 1, False: 681]
  |  Branch (601:51): [True: 1, False: 680]
  ------------------
  602|     23|        RNP_LOG("Wrong protected format, expected: (protected mode (params) "
  ------------------
  |  |   84|     23|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|     23|    do {                                                                                 \
  |  |  |  |   77|     23|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 23, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|     23|            break;                                                                       \
  |  |  |  |   79|     23|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  603|     23|                "encrypted_octet_string)\n");
  604|     23|        return false;
  605|     23|    }
  606|       |
  607|       |    // lookup the protection format
  608|    680|    auto &             fmt_bt = protected_key->sexp_string_at(1)->get_string();
  609|    680|    const format_info *format = parse_format((const char *) fmt_bt.data(), fmt_bt.size());
  610|    680|    if (!format) {
  ------------------
  |  Branch (610:9): [True: 470, False: 210]
  ------------------
  611|    470|        RNP_LOG("Unsupported protected mode: '%.*s'\n",
  ------------------
  |  |   84|    470|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|    470|    do {                                                                                 \
  |  |  |  |   77|    470|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 470, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|    470|            break;                                                                       \
  |  |  |  |   79|    470|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  612|    470|                (int) fmt_bt.size(),
  613|    470|                (const char *) fmt_bt.data());
  614|    470|        return false;
  615|    470|    }
  616|       |
  617|       |    // fill in some fields based on the lookup above
  618|    210|    pgp_key_protection_t &prot = seckey.sec_protection;
  619|    210|    prot.symm_alg = format->cipher;
  620|    210|    prot.cipher_mode = format->cipher_mode;
  621|    210|    prot.s2k.hash_alg = format->hash_alg;
  622|       |
  623|       |    // locate and validate the protection parameters
  624|    210|    auto params = protected_key->sexp_list_at(2);
  625|    210|    if (params->size() != 2 || params->at(0)->is_sexp_string() ||
  ------------------
  |  Branch (625:9): [True: 19, False: 191]
  |  Branch (625:32): [True: 1, False: 190]
  ------------------
  626|    190|        !params->at(1)->is_sexp_string()) {
  ------------------
  |  Branch (626:9): [True: 1, False: 189]
  ------------------
  627|     21|        RNP_LOG("Wrong params format, expected: ((hash salt no_of_iterations) iv)\n");
  ------------------
  |  |   84|     21|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|     21|    do {                                                                                 \
  |  |  |  |   77|     21|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 21, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|     21|            break;                                                                       \
  |  |  |  |   79|     21|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  628|     21|        return false;
  629|     21|    }
  630|       |
  631|       |    // locate and validate the (hash salt no_of_iterations) exp
  632|    189|    auto alg = params->sexp_list_at(0);
  633|    189|    if (alg->size() != 3 || !alg->at(0)->is_sexp_string() || !alg->at(1)->is_sexp_string() ||
  ------------------
  |  Branch (633:9): [True: 17, False: 172]
  |  Branch (633:29): [True: 1, False: 171]
  |  Branch (633:62): [True: 1, False: 170]
  ------------------
  634|    170|        !alg->at(2)->is_sexp_string()) {
  ------------------
  |  Branch (634:9): [True: 1, False: 169]
  ------------------
  635|     20|        RNP_LOG("Wrong params sub-level format, expected: (hash salt no_of_iterations)\n");
  ------------------
  |  |   84|     20|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|     20|    do {                                                                                 \
  |  |  |  |   77|     20|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 20, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|     20|            break;                                                                       \
  |  |  |  |   79|     20|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  636|     20|        return false;
  637|     20|    }
  638|    169|    auto &hash_bt = alg->sexp_string_at(0)->get_string();
  639|    169|    if (hash_bt != "sha1") {
  ------------------
  |  Branch (639:9): [True: 51, False: 118]
  ------------------
  640|     51|        RNP_LOG("Wrong hashing algorithm, should be sha1 but %.*s\n",
  ------------------
  |  |   84|     51|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|     51|    do {                                                                                 \
  |  |  |  |   77|     51|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 51, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|     51|            break;                                                                       \
  |  |  |  |   79|     51|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  641|     51|                (int) hash_bt.size(),
  642|     51|                (const char *) hash_bt.data());
  643|     51|        return false;
  644|     51|    }
  645|       |
  646|       |    // fill in some constant values
  647|    118|    prot.s2k.hash_alg = PGP_HASH_SHA1;
  648|    118|    prot.s2k.usage = PGP_S2KU_ENCRYPTED_AND_HASHED;
  649|    118|    prot.s2k.specifier = PGP_S2KS_ITERATED_AND_SALTED;
  650|       |
  651|       |    // check salt size
  652|    118|    auto &salt_bt = alg->sexp_string_at(1)->get_string();
  653|    118|    if (salt_bt.size() != PGP_SALT_SIZE) {
  ------------------
  |  |   92|    118|#define PGP_SALT_SIZE 8
  ------------------
  |  Branch (653:9): [True: 10, False: 108]
  ------------------
  654|     10|        RNP_LOG("Wrong salt size, should be %d but %d\n", PGP_SALT_SIZE, (int) salt_bt.size());
  ------------------
  |  |   84|     10|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|     10|    do {                                                                                 \
  |  |  |  |   77|     10|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 10, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|     10|            break;                                                                       \
  |  |  |  |   79|     10|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  655|     10|        return false;
  656|     10|    }
  657|       |
  658|       |    // salt
  659|    108|    memcpy(prot.s2k.salt, salt_bt.data(), salt_bt.size());
  660|       |    // s2k iterations
  661|    108|    auto iter = alg->sexp_string_at(2);
  662|    108|    prot.s2k.iterations = iter->as_unsigned();
  663|    108|    if (prot.s2k.iterations == UINT_MAX) {
  ------------------
  |  Branch (663:9): [True: 3, False: 105]
  ------------------
  664|      3|        RNP_LOG("Wrong numbers of iteration, %.*s\n",
  ------------------
  |  |   84|      3|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      3|    do {                                                                                 \
  |  |  |  |   77|      3|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      3|            break;                                                                       \
  |  |  |  |   79|      3|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  665|      3|                (int) iter->get_string().size(),
  666|      3|                (const char *) iter->get_string().data());
  667|      3|        return false;
  668|      3|    }
  669|       |
  670|       |    // iv
  671|    105|    auto &iv_bt = params->sexp_string_at(1)->get_string();
  672|    105|    if (iv_bt.size() != format->iv_size) {
  ------------------
  |  Branch (672:9): [True: 93, False: 12]
  ------------------
  673|     93|        RNP_LOG("Wrong nonce size, should be %zu but %zu\n", format->iv_size, iv_bt.size());
  ------------------
  |  |   84|     93|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|     93|    do {                                                                                 \
  |  |  |  |   77|     93|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 93, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|     93|            break;                                                                       \
  |  |  |  |   79|     93|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  674|     93|        return false;
  675|     93|    }
  676|     12|    memcpy(prot.iv, iv_bt.data(), iv_bt.size());
  677|       |
  678|       |    // we're all done if no password was provided (decryption not requested)
  679|     12|    if (!password) {
  ------------------
  |  Branch (679:9): [True: 12, False: 0]
  ------------------
  680|     12|        seckey.material->clear_secret();
  681|     12|        return true;
  682|     12|    }
  683|       |
  684|       |    // password was provided, so decrypt
  685|      0|    auto &       enc_bt = protected_key->sexp_string_at(3)->get_string();
  686|      0|    gnupg_sexp_t decrypted_s_exp;
  687|       |
  688|       |    // Build associated data (AD) that is not included in the ciphertext but that should be
  689|       |    // authenticated. gnupg builds AD as follows  (file 'protect.c' do_encryption/do_decryption
  690|       |    // functions)
  691|       |    //  -- "protected-private-key" section content
  692|       |    //  -- less "protected" subsection
  693|       |    //  -- serialized in canonical format
  694|      0|    std::string associated_data;
  695|      0|    if (format->with_associated_data) {
  ------------------
  |  Branch (695:9): [True: 0, False: 0]
  ------------------
  696|      0|        std::ostringstream   oss(std::ios_base::binary);
  697|      0|        sexp_output_stream_t os(&oss);
  698|      0|        os.var_put_char('(');
  699|      0|        for_each(list->begin(), list->end(), [&](const std::shared_ptr<sexp_object_t> &obj) {
  700|      0|            if (obj->sexp_list_view() != protected_key)
  701|      0|                obj->print_canonical(&os);
  702|      0|        });
  703|      0|        os.var_put_char(')');
  704|      0|        associated_data = oss.str();
  705|      0|    }
  706|       |
  707|      0|    if (!decrypt_protected_section(
  ------------------
  |  Branch (707:9): [True: 0, False: 0]
  ------------------
  708|      0|          enc_bt,
  709|      0|          seckey,
  710|      0|          password,
  711|      0|          decrypted_s_exp,
  712|      0|          format->with_associated_data ? (uint8_t *) associated_data.data() : nullptr,
  ------------------
  |  Branch (712:11): [True: 0, False: 0]
  ------------------
  713|      0|          format->with_associated_data ? associated_data.length() : 0)) {
  ------------------
  |  Branch (713:11): [True: 0, False: 0]
  ------------------
  714|      0|        return false;
  715|      0|    }
  716|       |    // see if we have a protected-at section
  717|      0|    char protected_at[G10_PROTECTED_AT_SIZE] = {0};
  718|      0|    auto protected_at_data = lookup_var_data(list, "protected-at");
  719|      0|    if (protected_at_data) {
  ------------------
  |  Branch (719:9): [True: 0, False: 0]
  ------------------
  720|      0|        if (protected_at_data->get_string().size() != G10_PROTECTED_AT_SIZE) {
  ------------------
  |  |   54|      0|#define G10_PROTECTED_AT_SIZE 15
  ------------------
  |  Branch (720:13): [True: 0, False: 0]
  ------------------
  721|      0|            RNP_LOG("protected-at has wrong length: %zu, expected, %d\n",
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  722|      0|                    protected_at_data->get_string().size(),
  723|      0|                    G10_PROTECTED_AT_SIZE);
  724|      0|            return false;
  725|      0|        }
  726|      0|        memcpy(protected_at,
  727|      0|               protected_at_data->get_string().data(),
  728|      0|               protected_at_data->get_string().size());
  729|      0|    }
  730|       |    // parse MPIs
  731|      0|    if (!parse_seckey(seckey, decrypted_s_exp.sexp_list_at(0))) {
  ------------------
  |  Branch (731:9): [True: 0, False: 0]
  ------------------
  732|      0|        RNP_LOG("failed to parse seckey");
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  733|      0|        return false;
  734|      0|    }
  735|       |    // check hash, if present
  736|      0|    if (decrypted_s_exp.size() > 1) {
  ------------------
  |  Branch (736:9): [True: 0, False: 0]
  ------------------
  737|      0|        if (decrypted_s_exp.at(1)->is_sexp_string()) {
  ------------------
  |  Branch (737:13): [True: 0, False: 0]
  ------------------
  738|      0|            RNP_LOG("Wrong hash block type.");
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  739|      0|            return false;
  740|      0|        }
  741|      0|        auto sub_el = decrypted_s_exp.sexp_list_at(1);
  742|      0|        if (sub_el->size() < 3 || !sub_el->at(0)->is_sexp_string() ||
  ------------------
  |  Branch (742:13): [True: 0, False: 0]
  |  Branch (742:35): [True: 0, False: 0]
  ------------------
  743|      0|            !sub_el->at(1)->is_sexp_string() || !sub_el->at(2)->is_sexp_string()) {
  ------------------
  |  Branch (743:13): [True: 0, False: 0]
  |  Branch (743:49): [True: 0, False: 0]
  ------------------
  744|      0|            RNP_LOG("Wrong hash block structure.");
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  745|      0|            return false;
  746|      0|        }
  747|       |
  748|      0|        auto &hkey = sub_el->sexp_string_at(0)->get_string();
  749|      0|        if (hkey != "hash") {
  ------------------
  |  Branch (749:13): [True: 0, False: 0]
  ------------------
  750|      0|            RNP_LOG("Has got wrong hash block at encrypted key data.");
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  751|      0|            return false;
  752|      0|        }
  753|      0|        auto &halg = sub_el->sexp_string_at(1)->get_string();
  754|      0|        if (halg != "sha1") {
  ------------------
  |  Branch (754:13): [True: 0, False: 0]
  ------------------
  755|      0|            RNP_LOG("Supported only sha1 hash at encrypted private key.");
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  756|      0|            return false;
  757|      0|        }
  758|      0|        uint8_t checkhash[G10_SHA1_HASH_SIZE];
  759|      0|        if (!g10_calculated_hash(seckey, protected_at, checkhash)) {
  ------------------
  |  Branch (759:13): [True: 0, False: 0]
  ------------------
  760|      0|            RNP_LOG("failed to calculate hash");
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  761|      0|            return false;
  762|      0|        }
  763|      0|        auto &hval = sub_el->sexp_string_at(2)->get_string();
  764|      0|        if (hval.size() != G10_SHA1_HASH_SIZE ||
  ------------------
  |  |   52|      0|#define G10_SHA1_HASH_SIZE 20
  ------------------
  |  Branch (764:13): [True: 0, False: 0]
  ------------------
  765|      0|            memcmp(checkhash, hval.data(), G10_SHA1_HASH_SIZE)) {
  ------------------
  |  |   52|      0|#define G10_SHA1_HASH_SIZE 20
  ------------------
  |  Branch (765:13): [True: 0, False: 0]
  ------------------
  766|      0|            RNP_LOG("Incorrect hash at encrypted private key.");
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  767|      0|            return false;
  768|      0|        }
  769|      0|    }
  770|      0|    return true;
  771|      0|}
key_store_g10.cpp:_ZL12parse_formatPKcm:
  174|    680|{
  175|  2.50k|    for (size_t i = 0; i < ARRAY_SIZE(formats); i++) {
  ------------------
  |  |   34|  2.50k|#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
  ------------------
  |  Branch (175:24): [True: 2.03k, False: 470]
  ------------------
  176|  2.03k|        if (strlen(formats[i].g10_type) == format_len &&
  ------------------
  |  Branch (176:13): [True: 643, False: 1.38k]
  ------------------
  177|    643|            !strncmp(formats[i].g10_type, format, format_len)) {
  ------------------
  |  Branch (177:13): [True: 210, False: 433]
  ------------------
  178|    210|            return &formats[i];
  179|    210|        }
  180|  2.03k|    }
  181|    470|    return NULL;
  182|    680|}
key_store_g10.cpp:_ZL12parse_seckeyR13pgp_key_pkt_tPKN4sexp11sexp_list_tE:
  432|    231|{
  433|    231|    switch (seckey.alg) {
  434|     34|    case PGP_PKA_DSA: {
  ------------------
  |  Branch (434:5): [True: 34, False: 197]
  ------------------
  435|     34|        pgp::mpi x;
  436|     34|        auto     key = dynamic_cast<pgp::DSAKeyMaterial *>(seckey.material.get());
  437|     34|        if (!key || !read_mpi(s_exp, "x", x)) {
  ------------------
  |  Branch (437:13): [True: 0, False: 34]
  |  Branch (437:13): [True: 3, False: 31]
  |  Branch (437:21): [True: 3, False: 31]
  ------------------
  438|      3|            return false;
  439|      3|        }
  440|     31|        key->set_secret(x);
  441|     31|        x.forget();
  442|     31|        return true;
  443|     34|    }
  444|    112|    case PGP_PKA_RSA:
  ------------------
  |  Branch (444:5): [True: 112, False: 119]
  ------------------
  445|    112|    case PGP_PKA_RSA_ENCRYPT_ONLY:
  ------------------
  |  Branch (445:5): [True: 0, False: 231]
  ------------------
  446|    112|    case PGP_PKA_RSA_SIGN_ONLY: {
  ------------------
  |  Branch (446:5): [True: 0, False: 231]
  ------------------
  447|    112|        pgp::mpi d, p, q, u;
  448|    112|        auto     key = dynamic_cast<pgp::RSAKeyMaterial *>(seckey.material.get());
  449|    112|        if (!key || !read_mpi(s_exp, "d", d) || !read_mpi(s_exp, "p", p) ||
  ------------------
  |  Branch (449:13): [True: 0, False: 112]
  |  Branch (449:13): [True: 70, False: 42]
  |  Branch (449:21): [True: 33, False: 79]
  |  Branch (449:49): [True: 15, False: 64]
  ------------------
  450|     70|            !read_mpi(s_exp, "q", q) || !read_mpi(s_exp, "u", u)) {
  ------------------
  |  Branch (450:13): [True: 6, False: 58]
  |  Branch (450:41): [True: 16, False: 42]
  ------------------
  451|     70|            return false;
  452|     70|        }
  453|     42|        key->set_secret(d, p, q, u);
  454|     42|        d.forget();
  455|     42|        p.forget();
  456|     42|        q.forget();
  457|     42|        u.forget();
  458|     42|        return true;
  459|    112|    }
  460|     71|    case PGP_PKA_ELGAMAL:
  ------------------
  |  Branch (460:5): [True: 71, False: 160]
  ------------------
  461|     71|    case PGP_PKA_ELGAMAL_ENCRYPT_OR_SIGN: {
  ------------------
  |  Branch (461:5): [True: 0, False: 231]
  ------------------
  462|     71|        pgp::mpi x;
  463|     71|        auto     key = dynamic_cast<pgp::EGKeyMaterial *>(seckey.material.get());
  464|     71|        if (!key || !read_mpi(s_exp, "x", x)) {
  ------------------
  |  Branch (464:13): [True: 0, False: 71]
  |  Branch (464:13): [True: 9, False: 62]
  |  Branch (464:21): [True: 9, False: 62]
  ------------------
  465|      9|            return false;
  466|      9|        }
  467|     62|        key->set_secret(x);
  468|     62|        x.forget();
  469|     62|        return true;
  470|     71|    }
  471|      3|    case PGP_PKA_ECDSA:
  ------------------
  |  Branch (471:5): [True: 3, False: 228]
  ------------------
  472|     11|    case PGP_PKA_ECDH:
  ------------------
  |  Branch (472:5): [True: 8, False: 223]
  ------------------
  473|     14|    case PGP_PKA_EDDSA: {
  ------------------
  |  Branch (473:5): [True: 3, False: 228]
  ------------------
  474|     14|        pgp::mpi x;
  475|     14|        auto     key = dynamic_cast<pgp::ECKeyMaterial *>(seckey.material.get());
  476|     14|        if (!key || !read_mpi(s_exp, "d", x)) {
  ------------------
  |  Branch (476:13): [True: 0, False: 14]
  |  Branch (476:13): [True: 4, False: 10]
  |  Branch (476:21): [True: 4, False: 10]
  ------------------
  477|      4|            return false;
  478|      4|        }
  479|     10|        key->set_secret(x);
  480|     10|        x.forget();
  481|     10|        return true;
  482|     14|    }
  483|      0|    default:
  ------------------
  |  Branch (483:5): [True: 0, False: 231]
  ------------------
  484|      0|        RNP_LOG("Unsupported public key algorithm: %d", (int) seckey.alg);
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  485|      0|        return false;
  486|    231|    }
  487|    231|}

_ZN3rnp8KeyStore5clearEv:
  209|  4.26k|{
  210|  4.26k|    keybyfp.clear();
  211|  4.26k|    keys.clear();
  212|  4.26k|    blobs.clear();
  213|  4.26k|}
_ZN3rnp8KeyStore20refresh_subkey_gripsERNS_3KeyE:
  223|    157|{
  224|    157|    if (key.is_subkey()) {
  ------------------
  |  Branch (224:9): [True: 0, False: 157]
  ------------------
  225|      0|        RNP_LOG("wrong argument");
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  226|      0|        return false;
  227|      0|    }
  228|       |
  229|    157|    for (auto &skey : keys) {
  ------------------
  |  Branch (229:21): [True: 157, False: 157]
  ------------------
  230|    157|        bool found = false;
  231|       |
  232|       |        /* if we have primary_grip then we also added to subkey_grips */
  233|    157|        if (!skey.is_subkey() || skey.has_primary_fp()) {
  ------------------
  |  Branch (233:13): [True: 157, False: 0]
  |  Branch (233:34): [True: 0, False: 0]
  ------------------
  234|    157|            continue;
  235|    157|        }
  236|       |
  237|      0|        for (size_t i = 0; i < skey.sig_count(); i++) {
  ------------------
  |  Branch (237:28): [True: 0, False: 0]
  ------------------
  238|      0|            auto &subsig = skey.get_sig(i);
  239|       |
  240|      0|            if (subsig.sig.type() != PGP_SIG_SUBKEY) {
  ------------------
  |  Branch (240:17): [True: 0, False: 0]
  ------------------
  241|      0|                continue;
  242|      0|            }
  243|      0|            if (subsig.sig.has_keyfp()) {
  ------------------
  |  Branch (243:17): [True: 0, False: 0]
  ------------------
  244|       |                /* Version mismatch: do not use this signature's key id. A matching
  245|       |                 * version with different fingerprint bytes still falls through, as before. */
  246|      0|                if (!subsig.sig.issuer_fp_version_matches()) {
  ------------------
  |  Branch (246:21): [True: 0, False: 0]
  ------------------
  247|      0|                    continue;
  248|      0|                }
  249|      0|                if (key.fp() == subsig.sig.keyfp()) {
  ------------------
  |  Branch (249:21): [True: 0, False: 0]
  ------------------
  250|      0|                    found = true;
  251|      0|                    break;
  252|      0|                }
  253|      0|            }
  254|      0|            if (subsig.sig.has_keyid() && (key.keyid() == subsig.sig.keyid())) {
  ------------------
  |  Branch (254:17): [True: 0, False: 0]
  |  Branch (254:17): [True: 0, False: 0]
  |  Branch (254:43): [True: 0, False: 0]
  ------------------
  255|      0|                found = true;
  256|      0|                break;
  257|      0|            }
  258|      0|        }
  259|       |
  260|      0|        if (found) {
  ------------------
  |  Branch (260:13): [True: 0, False: 0]
  ------------------
  261|      0|            try {
  262|      0|                key.link_subkey_fp(skey);
  263|      0|            } catch (const std::exception &e) {
  264|       |                /* LCOV_EXCL_START */
  265|      0|                RNP_LOG("%s", e.what());
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  266|      0|                return false;
  267|       |                /* LCOV_EXCL_END */
  268|      0|            }
  269|      0|        }
  270|      0|    }
  271|       |
  272|    157|    return true;
  273|    157|}
_ZN3rnp8KeyStore7add_keyERNS_3KeyE:
  339|    157|{
  340|    157|    assert(srckey.type() && srckey.version());
  341|    157|    auto *added_key = get_key(srckey.fp());
  342|       |    /* we cannot merge G10 keys - so just return it */
  343|    157|    if (added_key && (srckey.format == KeyFormat::G10)) {
  ------------------
  |  Branch (343:9): [True: 0, False: 157]
  |  Branch (343:22): [True: 0, False: 0]
  ------------------
  344|      0|        return added_key;
  345|      0|    }
  346|       |    /* different processing for subkeys */
  347|    157|    if (srckey.is_subkey()) {
  ------------------
  |  Branch (347:9): [True: 0, False: 157]
  ------------------
  348|      0|        return add_subkey(srckey, added_key);
  349|      0|    }
  350|       |
  351|    157|    if (added_key) {
  ------------------
  |  Branch (351:9): [True: 0, False: 157]
  ------------------
  352|      0|        if (!added_key->merge(srckey)) {
  ------------------
  |  Branch (352:13): [True: 0, False: 0]
  ------------------
  353|      0|            RNP_LOG_KEY("failed to merge key %s", &srckey);
  ------------------
  |  |   87|      0|    do {                                                                                \
  |  |   88|      0|        if (!(key)) {                                                                   \
  |  |  ------------------
  |  |  |  Branch (88:13): [True: 0, False: 0]
  |  |  ------------------
  |  |   89|      0|            RNP_LOG(msg, "(null)");                                                     \
  |  |  ------------------
  |  |  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   90|      0|            break;                                                                      \
  |  |   91|      0|        }                                                                               \
  |  |   92|      0|        auto keyid = (key)->keyid();                                                    \
  |  |   93|      0|        auto idhex = bin_to_hex(keyid.data(), keyid.size(), rnp::HexFormat::Lowercase); \
  |  |   94|      0|        RNP_LOG(msg, idhex.c_str());                                                    \
  |  |  ------------------
  |  |  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   95|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (95:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  354|      0|            return NULL;
  355|      0|        }
  356|    157|    } else {
  357|    157|        try {
  358|    157|            keys.emplace_back();
  359|    157|            added_key = &keys.back();
  360|    157|            keybyfp[srckey.fp()] = std::prev(keys.end());
  361|    157|            *added_key = Key(srckey);
  362|       |            /* primary key may be added after subkeys, so let's handle this case correctly */
  363|    157|            if (!refresh_subkey_grips(*added_key)) {
  ------------------
  |  Branch (363:17): [True: 0, False: 157]
  ------------------
  364|      0|                RNP_LOG_KEY("failed to refresh subkey grips for %s", added_key);
  ------------------
  |  |   87|      0|    do {                                                                                \
  |  |   88|      0|        if (!(key)) {                                                                   \
  |  |  ------------------
  |  |  |  Branch (88:13): [True: 0, False: 0]
  |  |  ------------------
  |  |   89|      0|            RNP_LOG(msg, "(null)");                                                     \
  |  |  ------------------
  |  |  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   90|      0|            break;                                                                      \
  |  |   91|      0|        }                                                                               \
  |  |   92|      0|        auto keyid = (key)->keyid();                                                    \
  |  |   93|      0|        auto idhex = bin_to_hex(keyid.data(), keyid.size(), rnp::HexFormat::Lowercase); \
  |  |   94|      0|        RNP_LOG(msg, idhex.c_str());                                                    \
  |  |  ------------------
  |  |  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   95|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (95:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  365|      0|            }
  366|    157|        } catch (const std::exception &e) {
  367|       |            /* LCOV_EXCL_START */
  368|      0|            RNP_LOG_KEY("key %s copying failed", &srckey);
  ------------------
  |  |   87|      0|    do {                                                                                \
  |  |   88|      0|        if (!(key)) {                                                                   \
  |  |  ------------------
  |  |  |  Branch (88:13): [True: 0, False: 0]
  |  |  ------------------
  |  |   89|      0|            RNP_LOG(msg, "(null)");                                                     \
  |  |  ------------------
  |  |  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   90|      0|            break;                                                                      \
  |  |   91|      0|        }                                                                               \
  |  |   92|      0|        auto keyid = (key)->keyid();                                                    \
  |  |   93|      0|        auto idhex = bin_to_hex(keyid.data(), keyid.size(), rnp::HexFormat::Lowercase); \
  |  |   94|      0|        RNP_LOG(msg, idhex.c_str());                                                    \
  |  |  ------------------
  |  |  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   95|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (95:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  369|      0|            RNP_LOG("%s", e.what());
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  370|      0|            if (added_key) {
  ------------------
  |  Branch (370:17): [True: 0, False: 0]
  ------------------
  371|      0|                keys.pop_back();
  372|      0|                keybyfp.erase(srckey.fp());
  373|      0|            }
  374|      0|            return NULL;
  375|       |            /* LCOV_EXCL_END */
  376|      0|        }
  377|    157|    }
  378|       |
  379|       |    /* validate all added keys if not disabled or already validated */
  380|    157|    if (!disable_validation && !added_key->validated()) {
  ------------------
  |  Branch (380:9): [True: 157, False: 0]
  |  Branch (380:32): [True: 157, False: 0]
  ------------------
  381|    157|        added_key->revalidate(*this);
  382|    157|    } else if (!added_key->refresh_data(secctx)) {
  ------------------
  |  Branch (382:16): [True: 0, False: 0]
  ------------------
  383|      0|        RNP_LOG_KEY("Failed to refresh key %s data", &srckey);
  ------------------
  |  |   87|      0|    do {                                                                                \
  |  |   88|      0|        if (!(key)) {                                                                   \
  |  |  ------------------
  |  |  |  Branch (88:13): [True: 0, False: 0]
  |  |  ------------------
  |  |   89|      0|            RNP_LOG(msg, "(null)");                                                     \
  |  |  ------------------
  |  |  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   90|      0|            break;                                                                      \
  |  |   91|      0|        }                                                                               \
  |  |   92|      0|        auto keyid = (key)->keyid();                                                    \
  |  |   93|      0|        auto idhex = bin_to_hex(keyid.data(), keyid.size(), rnp::HexFormat::Lowercase); \
  |  |   94|      0|        RNP_LOG(msg, idhex.c_str());                                                    \
  |  |  ------------------
  |  |  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   95|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (95:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  384|      0|    }
  385|       |    /* Revalidate non-self revocations for all keys in keyring, as added_key key could be a
  386|       |     * revoker. Should not be time-consuming as `validate_desig_revokes()` has early exit. */
  387|    157|    for (auto &key : keys) {
  ------------------
  |  Branch (387:20): [True: 157, False: 157]
  ------------------
  388|    157|        if (&key == added_key) {
  ------------------
  |  Branch (388:13): [True: 157, False: 0]
  ------------------
  389|    157|            continue;
  390|    157|        }
  391|      0|        if (key.validate_desig_revokes(*this)) {
  ------------------
  |  Branch (391:13): [True: 0, False: 0]
  ------------------
  392|      0|            key.revalidate(*this);
  393|      0|        }
  394|      0|    }
  395|    157|    return added_key;
  396|    157|}
_ZN3rnp8KeyStore7get_keyERKN3pgp11FingerprintE:
  623|    157|{
  624|    157|    auto it = keybyfp.find(fpr);
  625|    157|    if (it == keybyfp.end()) {
  ------------------
  |  Branch (625:9): [True: 157, False: 0]
  ------------------
  626|    157|        return nullptr;
  627|    157|    }
  628|      0|    return &*it->second;
  629|    157|}
_ZN3rnp8KeyStoreD2Ev:
  736|  4.26k|{
  737|  4.26k|    clear();
  738|  4.26k|}

_ZN12pgp_source_t4readEPvmPm:
   57|  7.81k|{
   58|  7.81k|    size_t left = len;
   59|  7.81k|    size_t read;
   60|  7.81k|    bool   readahead = cache ? cache->readahead : false;
  ------------------
  |  Branch (60:24): [True: 7.81k, False: 0]
  ------------------
   61|       |
   62|  7.81k|    if (error_) {
  ------------------
  |  Branch (62:9): [True: 0, False: 7.81k]
  ------------------
   63|      0|        return false;
   64|      0|    }
   65|       |
   66|  7.81k|    if (eof_ || (len == 0)) {
  ------------------
  |  Branch (66:9): [True: 0, False: 7.81k]
  |  Branch (66:17): [True: 0, False: 7.81k]
  ------------------
   67|      0|        *readres = 0;
   68|      0|        return true;
   69|      0|    }
   70|       |
   71|       |    // Do not read more then available if source size is known
   72|  7.81k|    if (knownsize && (readb + len > size)) {
  ------------------
  |  Branch (72:9): [True: 7.81k, False: 0]
  |  Branch (72:22): [True: 4.22k, False: 3.58k]
  ------------------
   73|  4.22k|        len = size - readb;
   74|  4.22k|        left = len;
   75|  4.22k|        readahead = false;
   76|  4.22k|    }
   77|       |
   78|       |    // Check whether we have cache and there is data inside
   79|  7.81k|    if (cache && (cache->len > cache->pos)) {
  ------------------
  |  Branch (79:9): [True: 7.81k, False: 0]
  |  Branch (79:18): [True: 0, False: 7.81k]
  ------------------
   80|      0|        read = cache->len - cache->pos;
   81|      0|        if (read >= len) {
  ------------------
  |  Branch (81:13): [True: 0, False: 0]
  ------------------
   82|      0|            memcpy(buf, &cache->buf[cache->pos], len);
   83|      0|            cache->pos += len;
   84|      0|            goto finish;
   85|      0|        } else {
   86|      0|            memcpy(buf, &cache->buf[cache->pos], read);
   87|      0|            cache->pos += read;
   88|      0|            buf = (uint8_t *) buf + read;
   89|      0|            left = len - read;
   90|      0|        }
   91|      0|    }
   92|       |
   93|       |    // If we got here then we have empty cache or no cache at all
   94|  12.0k|    while (left > 0) {
  ------------------
  |  Branch (94:12): [True: 7.81k, False: 4.22k]
  ------------------
   95|  7.81k|        if (left > sizeof(cache->buf) || !readahead || !cache) {
  ------------------
  |  Branch (95:13): [True: 0, False: 7.81k]
  |  Branch (95:42): [True: 4.22k, False: 3.58k]
  |  Branch (95:56): [True: 0, False: 3.58k]
  ------------------
   96|       |            // If there is no cache or chunk is larger then read directly
   97|  4.22k|            if (!raw_read(this, buf, left, &read)) {
  ------------------
  |  Branch (97:17): [True: 0, False: 4.22k]
  ------------------
   98|      0|                error_ = 1;
   99|      0|                return false;
  100|      0|            }
  101|  4.22k|            if (!read) {
  ------------------
  |  Branch (101:17): [True: 0, False: 4.22k]
  ------------------
  102|      0|                eof_ = true;
  103|      0|                len = len - left;
  104|      0|                goto finish;
  105|      0|            }
  106|  4.22k|            left -= read;
  107|  4.22k|            buf = (uint8_t *) buf + read;
  108|  4.22k|        } else {
  109|       |            // Try to fill the cache to avoid small reads
  110|  3.58k|            if (!raw_read(this, &cache->buf[0], sizeof(cache->buf), &read)) {
  ------------------
  |  Branch (110:17): [True: 0, False: 3.58k]
  ------------------
  111|      0|                error_ = true;
  112|      0|                return false;
  113|      0|            }
  114|  3.58k|            if (!read) {
  ------------------
  |  Branch (114:17): [True: 0, False: 3.58k]
  ------------------
  115|      0|                eof_ = true;
  116|      0|                len = len - left;
  117|      0|                goto finish;
  118|  3.58k|            } else if (read < left) {
  ------------------
  |  Branch (118:24): [True: 0, False: 3.58k]
  ------------------
  119|      0|                memcpy(buf, &cache->buf[0], read);
  120|      0|                left -= read;
  121|      0|                buf = (uint8_t *) buf + read;
  122|  3.58k|            } else {
  123|  3.58k|                memcpy(buf, &cache->buf[0], left);
  124|  3.58k|                cache->pos = left;
  125|  3.58k|                cache->len = read;
  126|  3.58k|                goto finish;
  127|  3.58k|            }
  128|  3.58k|        }
  129|  7.81k|    }
  130|       |
  131|  7.81k|finish:
  132|  7.81k|    readb += len;
  133|  7.81k|    if (knownsize && (readb == size)) {
  ------------------
  |  Branch (133:9): [True: 7.81k, False: 0]
  |  Branch (133:22): [True: 4.26k, False: 3.55k]
  ------------------
  134|  4.26k|        eof_ = true;
  135|  4.26k|    }
  136|  7.81k|    *readres = len;
  137|  7.81k|    return true;
  138|  7.81k|}
_ZN12pgp_source_t5closeEv:
  281|  8.52k|{
  282|  8.52k|    if (raw_close) {
  ------------------
  |  Branch (282:9): [True: 8.52k, False: 0]
  ------------------
  283|  8.52k|        raw_close(this);
  284|  8.52k|    }
  285|       |
  286|  8.52k|    if (cache) {
  ------------------
  |  Branch (286:9): [True: 8.52k, False: 0]
  ------------------
  287|  8.52k|        free(cache);
  288|       |        cache = NULL;
  289|  8.52k|    }
  290|  8.52k|}
_Z15init_src_commonP12pgp_source_tm:
  369|  8.52k|{
  370|  8.52k|    memset(src, 0, sizeof(*src));
  371|  8.52k|    src->cache = (pgp_source_cache_t *) calloc(1, sizeof(*src->cache));
  372|  8.52k|    if (!src->cache) {
  ------------------
  |  Branch (372:9): [True: 0, False: 8.52k]
  ------------------
  373|      0|        RNP_LOG("cache allocation failed");
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  374|      0|        return false;
  375|      0|    }
  376|  8.52k|    src->cache->readahead = true;
  377|  8.52k|    if (!paramsize) {
  ------------------
  |  Branch (377:9): [True: 0, False: 8.52k]
  ------------------
  378|      0|        return true;
  379|      0|    }
  380|  8.52k|    src->param = calloc(1, paramsize);
  381|  8.52k|    if (!src->param) {
  ------------------
  |  Branch (381:9): [True: 0, False: 8.52k]
  ------------------
  382|      0|        RNP_LOG("param allocation failed");
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  383|      0|        free(src->cache);
  384|      0|        src->cache = NULL;
  385|      0|        return false;
  386|      0|    }
  387|  8.52k|    return true;
  388|  8.52k|}
_Z12init_mem_srcP12pgp_source_tPKvmb:
  546|  8.52k|{
  547|  8.52k|    if (!mem && len) {
  ------------------
  |  Branch (547:9): [True: 0, False: 8.52k]
  |  Branch (547:17): [True: 0, False: 0]
  ------------------
  548|      0|        return RNP_ERROR_NULL_POINTER;
  549|      0|    }
  550|       |    /* this is actually double buffering, but then src_peek will fail */
  551|  8.52k|    if (!init_src_common(src, sizeof(pgp_source_mem_param_t))) {
  ------------------
  |  Branch (551:9): [True: 0, False: 8.52k]
  ------------------
  552|      0|        return RNP_ERROR_OUT_OF_MEMORY;
  553|      0|    }
  554|       |
  555|  8.52k|    pgp_source_mem_param_t *param = (pgp_source_mem_param_t *) src->param;
  556|  8.52k|    param->memory = mem;
  557|  8.52k|    param->len = len;
  558|  8.52k|    param->pos = 0;
  559|  8.52k|    param->free = free;
  560|  8.52k|    src->raw_read = mem_src_read;
  561|  8.52k|    src->raw_close = mem_src_close;
  562|  8.52k|    src->raw_finish = NULL;
  563|  8.52k|    src->size = len;
  564|  8.52k|    src->knownsize = 1;
  565|  8.52k|    src->type = PGP_STREAM_MEMORY;
  566|       |
  567|  8.52k|    return RNP_SUCCESS;
  568|  8.52k|}
_Z12read_mem_srcP12pgp_source_tS0_:
  588|  4.26k|{
  589|  4.26k|    pgp_dest_t   dst;
  590|  4.26k|    rnp_result_t ret = RNP_ERROR_GENERIC;
  591|  4.26k|    size_t       sz = 0;
  592|       |
  593|  4.26k|    if ((ret = init_mem_dest(&dst, NULL, 0))) {
  ------------------
  |  Branch (593:9): [True: 0, False: 4.26k]
  ------------------
  594|      0|        return ret;
  595|      0|    }
  596|       |
  597|  4.26k|    if ((ret = dst_write_src(readsrc, &dst))) {
  ------------------
  |  Branch (597:9): [True: 0, False: 4.26k]
  ------------------
  598|      0|        goto done;
  599|      0|    }
  600|       |
  601|  4.26k|    sz = dst.writeb;
  602|  4.26k|    ret = init_mem_src(src, mem_dest_own_memory(&dst), sz, true);
  603|  4.26k|done:
  604|  4.26k|    dst_close(&dst, true);
  605|  4.26k|    return ret;
  606|  4.26k|}
_Z18mem_src_get_memoryP12pgp_source_tb:
  610|  4.41k|{
  611|  4.41k|    if (src->type != PGP_STREAM_MEMORY) {
  ------------------
  |  Branch (611:9): [True: 0, False: 4.41k]
  ------------------
  612|      0|        RNP_LOG("wrong function call");
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  613|      0|        return NULL;
  614|      0|    }
  615|       |
  616|  4.41k|    if (!src->param) {
  ------------------
  |  Branch (616:9): [True: 0, False: 4.41k]
  ------------------
  617|      0|        return NULL;
  618|      0|    }
  619|       |
  620|  4.41k|    pgp_source_mem_param_t *param = (pgp_source_mem_param_t *) src->param;
  621|  4.41k|    if (own) {
  ------------------
  |  Branch (621:9): [True: 0, False: 4.41k]
  ------------------
  622|      0|        param->free = false;
  623|      0|    }
  624|  4.41k|    return param->memory;
  625|  4.41k|}
_Z15init_dst_commonP10pgp_dest_tm:
  629|  4.26k|{
  630|  4.26k|    try {
  631|  4.26k|        *dst = pgp_dest_t();
  632|  4.26k|    } catch (const std::exception &e) {
  633|      0|        return false; // LCOV_EXCL_LINE
  634|      0|    }
  635|  4.26k|    if (!paramsize) {
  ------------------
  |  Branch (635:9): [True: 0, False: 4.26k]
  ------------------
  636|      0|        return true;
  637|      0|    }
  638|       |    /* allocate param */
  639|  4.26k|    dst->param = calloc(1, paramsize);
  640|  4.26k|    if (!dst->param) {
  ------------------
  |  Branch (640:9): [True: 0, False: 4.26k]
  ------------------
  641|       |        /* LCOV_EXCL_START */
  642|      0|        RNP_LOG("allocation failed");
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  643|      0|        return false;
  644|       |        /* LCOV_EXCL_END */
  645|      0|    }
  646|  4.26k|    return true;
  647|  4.26k|}
_Z9dst_writeP10pgp_dest_tPKvm:
  651|  7.81k|{
  652|       |    /* we call write function only if all previous calls succeeded */
  653|  7.81k|    if ((len > 0) && (dst->write) && (dst->werr == RNP_SUCCESS)) {
  ------------------
  |  Branch (653:9): [True: 7.81k, False: 0]
  |  Branch (653:22): [True: 7.81k, False: 0]
  |  Branch (653:38): [True: 7.81k, False: 0]
  ------------------
  654|       |        /* if cache non-empty and len will overflow it then fill it and write out */
  655|  7.81k|        if ((dst->clen > 0) && (dst->clen + len > dst->cache.size())) {
  ------------------
  |  Branch (655:13): [True: 0, False: 7.81k]
  |  Branch (655:32): [True: 0, False: 0]
  ------------------
  656|      0|            memcpy(dst->cache.data() + dst->clen, buf, dst->cache.size() - dst->clen);
  657|      0|            buf = (uint8_t *) buf + dst->cache.size() - dst->clen;
  658|      0|            len -= dst->cache.size() - dst->clen;
  659|      0|            dst->werr = dst->write(dst, dst->cache.data(), dst->cache.size());
  660|      0|            dst->writeb += dst->cache.size();
  661|      0|            dst->clen = 0;
  662|      0|            if (dst->werr != RNP_SUCCESS) {
  ------------------
  |  Branch (662:17): [True: 0, False: 0]
  ------------------
  663|      0|                return;
  664|      0|            }
  665|      0|        }
  666|       |
  667|       |        /* here everything will fit into the cache or cache is empty */
  668|  7.81k|        if (dst->no_cache || (len > dst->cache.size())) {
  ------------------
  |  Branch (668:13): [True: 7.81k, False: 0]
  |  Branch (668:30): [True: 0, False: 0]
  ------------------
  669|  7.81k|            dst->werr = dst->write(dst, buf, len);
  670|  7.81k|            if (!dst->werr) {
  ------------------
  |  Branch (670:17): [True: 7.81k, False: 0]
  ------------------
  671|  7.81k|                dst->writeb += len;
  672|  7.81k|            }
  673|  7.81k|        } else {
  674|      0|            memcpy(dst->cache.data() + dst->clen, buf, len);
  675|      0|            dst->clen += len;
  676|      0|        }
  677|  7.81k|    }
  678|  7.81k|}
_Z9dst_flushP10pgp_dest_t:
  706|  8.52k|{
  707|  8.52k|    if ((dst->clen > 0) && (dst->write) && (dst->werr == RNP_SUCCESS)) {
  ------------------
  |  Branch (707:9): [True: 0, False: 8.52k]
  |  Branch (707:28): [True: 0, False: 0]
  |  Branch (707:44): [True: 0, False: 0]
  ------------------
  708|      0|        dst->werr = dst->write(dst, dst->cache.data(), dst->clen);
  709|      0|        dst->writeb += dst->clen;
  710|      0|        dst->clen = 0;
  711|      0|    }
  712|  8.52k|}
_Z10dst_finishP10pgp_dest_t:
  716|  4.26k|{
  717|  4.26k|    rnp_result_t res = RNP_SUCCESS;
  718|       |
  719|  4.26k|    if (!dst->finished) {
  ------------------
  |  Branch (719:9): [True: 4.26k, False: 0]
  ------------------
  720|       |        /* flush write cache in the dst */
  721|  4.26k|        dst_flush(dst);
  722|  4.26k|        res = dst->werr;
  723|       |        /* do not run the finish callback (e.g. renaming of the temporary
  724|       |         * output file over the target one) if the data was not written
  725|       |         * in full, otherwise a truncated output would replace it */
  726|  4.26k|        if (dst->finish && !res) {
  ------------------
  |  Branch (726:13): [True: 0, False: 4.26k]
  |  Branch (726:28): [True: 0, False: 0]
  ------------------
  727|      0|            res = dst->finish(dst);
  728|      0|        }
  729|  4.26k|        dst->finished = true;
  730|  4.26k|    }
  731|       |
  732|  4.26k|    return res;
  733|  4.26k|}
_Z9dst_closeP10pgp_dest_tb:
  737|  4.26k|{
  738|  4.26k|    if (!discard && !dst->finished) {
  ------------------
  |  Branch (738:9): [True: 0, False: 4.26k]
  |  Branch (738:21): [True: 0, False: 0]
  ------------------
  739|      0|        dst_finish(dst);
  740|      0|    }
  741|       |
  742|  4.26k|    if (dst->close) {
  ------------------
  |  Branch (742:9): [True: 4.26k, False: 0]
  ------------------
  743|  4.26k|        dst->close(dst, discard);
  744|  4.26k|    }
  745|  4.26k|}
_Z13init_mem_destP10pgp_dest_tPvj:
 1057|  4.26k|{
 1058|  4.26k|    pgp_dest_mem_param_t *param;
 1059|       |
 1060|  4.26k|    if (!init_dst_common(dst, sizeof(*param))) {
  ------------------
  |  Branch (1060:9): [True: 0, False: 4.26k]
  ------------------
 1061|      0|        return RNP_ERROR_OUT_OF_MEMORY;
 1062|      0|    }
 1063|       |
 1064|  4.26k|    param = (pgp_dest_mem_param_t *) dst->param;
 1065|       |
 1066|  4.26k|    param->maxalloc = len;
 1067|  4.26k|    param->allocated = mem ? len : 0;
  ------------------
  |  Branch (1067:24): [True: 0, False: 4.26k]
  ------------------
 1068|  4.26k|    param->memory = mem;
 1069|  4.26k|    param->free = !mem;
 1070|  4.26k|    param->secure = false;
 1071|       |
 1072|  4.26k|    dst->write = mem_dst_write;
 1073|  4.26k|    dst->close = mem_dst_close;
 1074|  4.26k|    dst->type = PGP_STREAM_MEMORY;
 1075|  4.26k|    dst->werr = RNP_SUCCESS;
 1076|  4.26k|    dst->no_cache = true;
 1077|       |
 1078|  4.26k|    return RNP_SUCCESS;
 1079|  4.26k|}
_Z19mem_dest_own_memoryP10pgp_dest_t:
 1114|  4.26k|{
 1115|  4.26k|    if (dst->type != PGP_STREAM_MEMORY) {
  ------------------
  |  Branch (1115:9): [True: 0, False: 4.26k]
  ------------------
 1116|      0|        RNP_LOG("wrong function call");
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1117|      0|        return NULL;
 1118|      0|    }
 1119|       |
 1120|  4.26k|    pgp_dest_mem_param_t *param = (pgp_dest_mem_param_t *) dst->param;
 1121|       |
 1122|  4.26k|    if (!param) {
  ------------------
  |  Branch (1122:9): [True: 0, False: 4.26k]
  ------------------
 1123|      0|        RNP_LOG("null param");
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1124|      0|        return NULL;
 1125|      0|    }
 1126|       |
 1127|  4.26k|    dst_finish(dst);
 1128|       |
 1129|  4.26k|    if (param->free) {
  ------------------
  |  Branch (1129:9): [True: 4.26k, False: 0]
  ------------------
 1130|  4.26k|        if (!dst->writeb) {
  ------------------
  |  Branch (1130:13): [True: 0, False: 4.26k]
  ------------------
 1131|      0|            free(param->memory);
 1132|      0|            param->memory = NULL;
 1133|      0|            return param->memory;
 1134|      0|        }
 1135|       |        /* it may be larger then required - let's truncate */
 1136|  4.26k|        void *newalloc = realloc(param->memory, dst->writeb);
 1137|  4.26k|        if (!newalloc) {
  ------------------
  |  Branch (1137:13): [True: 0, False: 4.26k]
  ------------------
 1138|      0|            return NULL;
 1139|      0|        }
 1140|  4.26k|        param->memory = newalloc;
 1141|  4.26k|        param->allocated = dst->writeb;
 1142|  4.26k|        param->free = false;
 1143|  4.26k|        return param->memory;
 1144|  4.26k|    }
 1145|       |
 1146|       |    /* in this case we should copy the memory */
 1147|      0|    void *res = malloc(dst->writeb);
 1148|      0|    if (res) {
  ------------------
  |  Branch (1148:9): [True: 0, False: 0]
  ------------------
 1149|      0|        memcpy(res, param->memory, dst->writeb);
 1150|      0|    }
 1151|      0|    return res;
 1152|  4.26k|}
_Z13dst_write_srcP12pgp_source_tP10pgp_dest_tm:
 1196|  4.26k|{
 1197|  4.26k|    const size_t bufsize = PGP_INPUT_CACHE_SIZE;
  ------------------
  |  |   35|  4.26k|#define PGP_INPUT_CACHE_SIZE 32768
  ------------------
 1198|  4.26k|    uint8_t *    readbuf = (uint8_t *) malloc(bufsize);
 1199|  4.26k|    if (!readbuf) {
  ------------------
  |  Branch (1199:9): [True: 0, False: 4.26k]
  ------------------
 1200|      0|        return RNP_ERROR_OUT_OF_MEMORY;
 1201|      0|    }
 1202|  4.26k|    rnp_result_t res = RNP_SUCCESS;
 1203|  4.26k|    try {
 1204|  4.26k|        size_t   read;
 1205|  4.26k|        uint64_t totalread = 0;
 1206|       |
 1207|  12.0k|        while (!src->eof_) {
  ------------------
  |  Branch (1207:16): [True: 7.81k, False: 4.26k]
  ------------------
 1208|  7.81k|            if (!src->read(readbuf, bufsize, &read)) {
  ------------------
  |  Branch (1208:17): [True: 0, False: 7.81k]
  ------------------
 1209|      0|                res = RNP_ERROR_GENERIC;
 1210|      0|                break;
 1211|      0|            }
 1212|  7.81k|            if (!read) {
  ------------------
  |  Branch (1212:17): [True: 0, False: 7.81k]
  ------------------
 1213|      0|                continue;
 1214|      0|            }
 1215|  7.81k|            totalread += read;
 1216|  7.81k|            if (limit && totalread > limit) {
  ------------------
  |  Branch (1216:17): [True: 0, False: 7.81k]
  |  Branch (1216:26): [True: 0, False: 0]
  ------------------
 1217|      0|                res = RNP_ERROR_GENERIC;
 1218|      0|                break;
 1219|      0|            }
 1220|  7.81k|            if (dst) {
  ------------------
  |  Branch (1220:17): [True: 7.81k, False: 0]
  ------------------
 1221|  7.81k|                dst_write(dst, readbuf, read);
 1222|  7.81k|                if (dst->werr) {
  ------------------
  |  Branch (1222:21): [True: 0, False: 7.81k]
  ------------------
 1223|      0|                    RNP_LOG("failed to output data");
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1224|      0|                    res = RNP_ERROR_WRITE;
 1225|      0|                    break;
 1226|      0|                }
 1227|  7.81k|            }
 1228|  7.81k|        }
 1229|  4.26k|    } catch (...) {
 1230|      0|        free(readbuf);
 1231|      0|        throw;
 1232|      0|    }
 1233|  4.26k|    free(readbuf);
 1234|  4.26k|    if (res || !dst) {
  ------------------
  |  Branch (1234:9): [True: 0, False: 4.26k]
  |  Branch (1234:16): [True: 0, False: 4.26k]
  ------------------
 1235|      0|        return res;
 1236|      0|    }
 1237|  4.26k|    dst_flush(dst);
 1238|  4.26k|    return dst->werr;
 1239|  4.26k|}
stream-common.cpp:_ZL12mem_src_readP12pgp_source_tPvmPm:
  516|  7.81k|{
  517|  7.81k|    pgp_source_mem_param_t *param = (pgp_source_mem_param_t *) src->param;
  518|  7.81k|    if (!param) {
  ------------------
  |  Branch (518:9): [True: 0, False: 7.81k]
  ------------------
  519|      0|        return false;
  520|      0|    }
  521|       |
  522|  7.81k|    if (len > param->len - param->pos) {
  ------------------
  |  Branch (522:9): [True: 0, False: 7.81k]
  ------------------
  523|      0|        len = param->len - param->pos;
  524|      0|    }
  525|  7.81k|    memcpy(buf, (uint8_t *) param->memory + param->pos, len);
  526|  7.81k|    param->pos += len;
  527|  7.81k|    *read = len;
  528|  7.81k|    return true;
  529|  7.81k|}
stream-common.cpp:_ZL13mem_src_closeP12pgp_source_t:
  533|  8.52k|{
  534|  8.52k|    pgp_source_mem_param_t *param = (pgp_source_mem_param_t *) src->param;
  535|  8.52k|    if (param) {
  ------------------
  |  Branch (535:9): [True: 8.52k, False: 0]
  ------------------
  536|  8.52k|        if (param->free) {
  ------------------
  |  Branch (536:13): [True: 4.26k, False: 4.26k]
  ------------------
  537|  4.26k|            free((void *) param->memory);
  538|  4.26k|        }
  539|  8.52k|        free(src->param);
  540|       |        src->param = NULL;
  541|  8.52k|    }
  542|  8.52k|}
stream-common.cpp:_ZL13mem_dst_writeP10pgp_dest_tPKvm:
  994|  7.81k|{
  995|  7.81k|    pgp_dest_mem_param_t *param = (pgp_dest_mem_param_t *) dst->param;
  996|  7.81k|    if (!param) {
  ------------------
  |  Branch (996:9): [True: 0, False: 7.81k]
  ------------------
  997|      0|        return RNP_ERROR_BAD_PARAMETERS;
  998|      0|    }
  999|       |
 1000|       |    /* checking whether we need to realloc or discard extra bytes */
 1001|  7.81k|    if (param->discard_overflow && (dst->writeb >= param->allocated)) {
  ------------------
  |  Branch (1001:9): [True: 0, False: 7.81k]
  |  Branch (1001:36): [True: 0, False: 0]
  ------------------
 1002|      0|        return RNP_SUCCESS;
 1003|      0|    }
 1004|  7.81k|    if (param->discard_overflow && (dst->writeb + len > param->allocated)) {
  ------------------
  |  Branch (1004:9): [True: 0, False: 7.81k]
  |  Branch (1004:36): [True: 0, False: 0]
  ------------------
 1005|      0|        len = param->allocated - dst->writeb;
 1006|      0|    }
 1007|       |
 1008|  7.81k|    if (dst->writeb + len > param->allocated) {
  ------------------
  |  Branch (1008:9): [True: 4.88k, False: 2.93k]
  ------------------
 1009|  4.88k|        if ((param->maxalloc > 0) && (dst->writeb + len > param->maxalloc)) {
  ------------------
  |  Branch (1009:13): [True: 0, False: 4.88k]
  |  Branch (1009:38): [True: 0, False: 0]
  ------------------
 1010|      0|            RNP_LOG("attempt to alloc more then allowed");
  ------------------
  |  |   84|      0|#define RNP_LOG(...) RNP_LOG_FD(stderr, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   76|      0|    do {                                                                                 \
  |  |  |  |   77|      0|        if (!rnp_log_switch())                                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   78|      0|            break;                                                                       \
  |  |  |  |   79|      0|        (void) fprintf((fd), "[%s() %s:%d] ", __func__, __SOURCE_PATH_FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      0|#define __SOURCE_PATH_FILE__ (__FILE__)
  |  |  |  |  ------------------
  |  |  |  |   80|      0|        (void) fprintf((fd), __VA_ARGS__);                                               \
  |  |  |  |   81|      0|        (void) fprintf((fd), "\n");                                                      \
  |  |  |  |   82|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (82:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1011|      0|            return RNP_ERROR_OUT_OF_MEMORY;
 1012|      0|        }
 1013|       |
 1014|       |        /* round up to the page boundary and do it exponentially */
 1015|  4.88k|        size_t alloc = ((dst->writeb + len) * 2 + 4095) / 4096 * 4096;
 1016|  4.88k|        if ((param->maxalloc > 0) && (alloc > param->maxalloc)) {
  ------------------
  |  Branch (1016:13): [True: 0, False: 4.88k]
  |  Branch (1016:38): [True: 0, False: 0]
  ------------------
 1017|      0|            alloc = param->maxalloc;
 1018|      0|        }
 1019|       |
 1020|  4.88k|        void *newalloc = param->secure ? calloc(1, alloc) : realloc(param->memory, alloc);
  ------------------
  |  Branch (1020:26): [True: 0, False: 4.88k]
  ------------------
 1021|  4.88k|        if (!newalloc) {
  ------------------
  |  Branch (1021:13): [True: 0, False: 4.88k]
  ------------------
 1022|      0|            return RNP_ERROR_OUT_OF_MEMORY;
 1023|      0|        }
 1024|  4.88k|        if (param->secure && param->memory) {
  ------------------
  |  Branch (1024:13): [True: 0, False: 4.88k]
  |  Branch (1024:30): [True: 0, False: 0]
  ------------------
 1025|      0|            memcpy(newalloc, param->memory, dst->writeb);
 1026|      0|            secure_clear(param->memory, dst->writeb);
 1027|      0|            free(param->memory);
 1028|      0|        }
 1029|  4.88k|        param->memory = newalloc;
 1030|  4.88k|        param->allocated = alloc;
 1031|  4.88k|    }
 1032|       |
 1033|  7.81k|    memcpy((uint8_t *) param->memory + dst->writeb, buf, len);
 1034|  7.81k|    return RNP_SUCCESS;
 1035|  7.81k|}
stream-common.cpp:_ZL13mem_dst_closeP10pgp_dest_tb:
 1039|  4.26k|{
 1040|  4.26k|    pgp_dest_mem_param_t *param = (pgp_dest_mem_param_t *) dst->param;
 1041|  4.26k|    if (!param) {
  ------------------
  |  Branch (1041:9): [True: 0, False: 4.26k]
  ------------------
 1042|      0|        return;
 1043|      0|    }
 1044|       |
 1045|  4.26k|    if (param->free) {
  ------------------
  |  Branch (1045:9): [True: 0, False: 4.26k]
  ------------------
 1046|      0|        if (param->secure) {
  ------------------
  |  Branch (1046:13): [True: 0, False: 0]
  ------------------
 1047|      0|            secure_clear(param->memory, param->allocated);
 1048|      0|        }
 1049|      0|        free(param->memory);
 1050|      0|    }
 1051|  4.26k|    free(param);
 1052|       |    dst->param = NULL;
 1053|  4.26k|}

_ZN3rnp6SourceC2Ev:
  404|  4.26k|    Source() : src_({})
  405|  4.26k|    {
  406|  4.26k|    }
_ZN3rnp6SourceD2Ev:
  409|  4.26k|    {
  410|  4.26k|        src_.close();
  411|  4.26k|    }
_ZN3rnp6Source3srcEv:
  415|  4.41k|    {
  416|  4.41k|        return src_;
  417|  4.41k|    }
_ZN3rnp6Source4sizeEv:
  421|  4.41k|    {
  422|  4.41k|        return src().size;
  423|  4.41k|    }
_ZN3rnp12MemorySourceC2ER12pgp_source_t:
  473|  4.26k|    MemorySource(pgp_source_t &src) : Source()
  474|  4.26k|    {
  475|  4.26k|        auto res = read_mem_src(&src_, &src);
  476|  4.26k|        if (res) {
  ------------------
  |  Branch (476:13): [True: 0, False: 4.26k]
  ------------------
  477|      0|            throw rnp::rnp_exception(res);
  478|      0|        }
  479|  4.26k|    }
_ZN3rnp12MemorySource6memoryEb:
  483|  4.41k|    {
  484|  4.41k|        return mem_src_get_memory(&src_, own);
  485|  4.41k|    }
_ZN10pgp_dest_tC2Ev:
  259|  8.52k|    pgp_dest_t() = default;
_ZN10pgp_dest_taSEOS_:
  262|  4.26k|    pgp_dest_t &operator=(pgp_dest_t &&) = default;

_ZN13pgp_key_pkt_taSEOS_:
 1038|  1.12k|{
 1039|  1.12k|    if (this == &src) {
  ------------------
  |  Branch (1039:9): [True: 0, False: 1.12k]
  ------------------
 1040|      0|        return *this;
 1041|      0|    }
 1042|  1.12k|    tag = src.tag;
 1043|  1.12k|    version = src.version;
 1044|  1.12k|    creation_time = src.creation_time;
 1045|  1.12k|    alg = src.alg;
 1046|  1.12k|    v3_days = src.v3_days;
 1047|  1.12k|    pub_data = std::move(src.pub_data);
 1048|  1.12k|    material = std::move(src.material);
 1049|  1.12k|    secure_clear(sec_data.data(), sec_data.size());
 1050|  1.12k|    sec_data = std::move(src.sec_data);
 1051|  1.12k|    sec_protection = src.sec_protection;
 1052|  1.12k|    return *this;
 1053|  1.12k|}
_ZN13pgp_key_pkt_taSERKS_:
 1057|    314|{
 1058|    314|    if (this == &src) {
  ------------------
  |  Branch (1058:9): [True: 0, False: 314]
  ------------------
 1059|      0|        return *this;
 1060|      0|    }
 1061|    314|    tag = src.tag;
 1062|    314|    version = src.version;
 1063|    314|    creation_time = src.creation_time;
 1064|    314|    alg = src.alg;
 1065|    314|    v3_days = src.v3_days;
 1066|    314|    pub_data = src.pub_data;
 1067|    314|    material = src.material ? src.material->clone() : nullptr;
  ------------------
  |  Branch (1067:16): [True: 314, False: 0]
  ------------------
 1068|    314|    secure_clear(sec_data.data(), sec_data.size());
 1069|    314|    sec_data = std::move(src.sec_data);
 1070|    314|    sec_protection = src.sec_protection;
 1071|    314|    return *this;
 1072|    314|}
_ZN13pgp_key_pkt_tD2Ev:
 1075|  5.69k|{
 1076|  5.69k|    secure_clear(sec_data.data(), sec_data.size());
 1077|  5.69k|}

_ZN13pgp_key_pkt_tC2Ev:
   59|  5.69k|        : tag(PGP_PKT_RESERVED), version(PGP_VUNKNOWN), creation_time(0), alg(PGP_PKA_NOTHING),
   60|  5.69k|          v3_days(0), v5_pub_len(0), material(nullptr), sec_protection({}), v5_s2k_len(0),
   61|  5.69k|          v5_sec_len(0){};

_Z13is_subkey_pkti:
  415|    785|{
  416|    785|    return (tag == PGP_PKT_PUBLIC_SUBKEY) || (tag == PGP_PKT_SECRET_SUBKEY);
  ------------------
  |  Branch (416:12): [True: 0, False: 785]
  |  Branch (416:46): [True: 0, False: 785]
  ------------------
  417|    785|}
_Z18is_primary_key_pkti:
  421|    157|{
  422|    157|    return (tag == PGP_PKT_PUBLIC_KEY) || (tag == PGP_PKT_SECRET_KEY);
  ------------------
  |  Branch (422:12): [True: 0, False: 157]
  |  Branch (422:43): [True: 0, False: 157]
  ------------------
  423|    157|}

_ZN14ext_key_format22ext_key_input_stream_tC2EPNSt3__113basic_istreamIcNS1_11char_traitsIcEEEEm:
   89|  4.26k|        : sexp_input_stream_t(i, md), is_scanning_value(false), has_key(false)
   90|  4.26k|    {
   91|  4.26k|    }
_ZNK14ext_key_format22extended_private_key_t7ci_lessclERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
   44|   200k|        {
   45|   200k|            return std::lexicographical_compare(
   46|   200k|              s1.begin(), s1.end(), s2.begin(), s2.end(), [](char a, char b) {
   47|   200k|                  return std::tolower(a) < std::tolower(b);
   48|   200k|              });
   49|   200k|        }
_ZN14ext_key_format22extended_private_key_t7iequalsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_:
   54|  21.8k|    {
   55|  21.8k|        size_t sz = a.size();
   56|  21.8k|        if (b.size() != sz)
  ------------------
  |  Branch (56:13): [True: 19.2k, False: 2.59k]
  ------------------
   57|  19.2k|            return false;
   58|  4.53k|        for (size_t i = 0; i < sz; ++i)
  ------------------
  |  Branch (58:28): [True: 4.47k, False: 60]
  ------------------
   59|  4.47k|            if (tolower(a[i]) != tolower(b[i]))
  ------------------
  |  Branch (59:17): [True: 2.53k, False: 1.94k]
  ------------------
   60|  2.53k|                return false;
   61|     60|        return true;
   62|  2.59k|    }
_ZN14ext_key_format22ext_key_input_stream_t15is_newline_charEi:
   76|  26.2M|    static bool is_newline_char(int c) { return c == '\r' || c == '\n'; };
  ------------------
  |  Branch (76:49): [True: 7.03k, False: 26.2M]
  |  Branch (76:62): [True: 45.7k, False: 26.1M]
  ------------------
_ZN14ext_key_format22ext_key_input_stream_t11is_namecharEi:
   77|  2.94M|    static bool is_namechar(int c) { return ((c >= 0 && c <= 255) && namechar[c]); }
  ------------------
  |  Branch (77:47): [True: 2.94M, False: 0]
  |  Branch (77:57): [True: 2.94M, False: 0]
  |  Branch (77:70): [True: 2.94M, False: 31]
  ------------------
_ZZNK14ext_key_format22extended_private_key_t7ci_lessclERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_ENKUlccE_clEcc:
   46|  1.46M|              s1.begin(), s1.end(), s2.begin(), s2.end(), [](char a, char b) {
   47|  1.46M|                  return std::tolower(a) < std::tolower(b);
   48|  1.46M|              });

_ZN4sexp16sexp_exception_tC2ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS0_8severityEiPKc:
   53|  2.86k|        : position{error_position}, level{error_level},
   54|  2.86k|          message{format(prefix, std::move(error_message), error_level, error_position)} {};
_ZN4sexp16sexp_exception_t11shall_throwENS0_8severityE:
   61|  10.7k|    static bool shall_throw(severity level) { return level == error || verbosity != error; };
  ------------------
  |  Branch (61:54): [True: 2.86k, False: 7.86k]
  |  Branch (61:72): [True: 0, False: 7.86k]
  ------------------
_ZN4sexp16sexp_exception_t14is_interactiveEv:
   66|  7.86k|    static bool         is_interactive(void) { return interactive; };

_ZN4sexp20sexp_simple_string_tC2Ev:
  192|  5.88M|    sexp_simple_string_t(void) = default;
_ZN4sexp20sexp_simple_string_t6appendEi:
  196|  95.3M|    {
  197|  95.3M|        (*this) += (octet_t)(c & 0xFF);
  198|  95.3M|        return *this;
  199|  95.3M|    }
_ZNSt3__111char_traitsIhE4copyEPhPKhm:
   98|  37.1k|    {
   99|  37.1k|        return static_cast<char_type *>(memcpy(__s1, __s2, __n));
  100|  37.1k|    }
_ZNSt3__111char_traitsIhE6assignERhRKh:
   65|   190M|    static void assign(char_type &__c1, const char_type &__c2) noexcept { __c1 = __c2; }
_ZN4sexp13sexp_string_t10set_stringERKNS_20sexp_simple_string_tE:
  314|  1.96M|    {
  315|  1.96M|        return data_string = ss;
  316|  1.96M|    }
_ZN4sexp13sexp_object_tD2Ev:
  253|  3.67M|    virtual ~sexp_object_t(){};
_ZNK4sexp13sexp_string_t10get_stringEv:
  312|  6.11k|    const sexp_simple_string_t &get_string(void) const noexcept { return data_string; }
_ZNK4sexp20sexp_simple_string_teqEPKc:
  221|  10.9k|    {
  222|  10.9k|        return length() == std::strlen(right) && std::memcmp(data(), right, length()) == 0;
  ------------------
  |  Branch (222:16): [True: 7.75k, False: 3.21k]
  |  Branch (222:50): [True: 4.39k, False: 3.36k]
  ------------------
  223|  10.9k|    }
_ZN4sexpeqEPKNS_13sexp_string_tERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  342|  8.70k|{
  343|  8.70k|    return *left == right.c_str();
  344|  8.70k|}
_ZNK4sexp20sexp_simple_string_tneEPKc:
  226|    169|    {
  227|    169|        return length() != std::strlen(right) || std::memcmp(data(), right, length()) != 0;
  ------------------
  |  Branch (227:16): [True: 36, False: 133]
  |  Branch (227:50): [True: 15, False: 118]
  ------------------
  228|    169|    }
_ZNK4sexp11sexp_list_t12sexp_list_atEm:
  368|  1.57k|    {
  369|  1.57k|        return pos < size() ? (*at(pos)).sexp_list_view() : nullptr;
  ------------------
  |  Branch (369:16): [True: 1.57k, False: 0]
  ------------------
  370|  1.57k|    }
_ZN4sexp11sexp_list_tD2Ev:
  358|  1.71M|    virtual ~sexp_list_t() {}
_ZN4sexp11sexp_list_t14sexp_list_viewEv:
  364|  21.3k|    virtual sexp_list_t *sexp_list_view(void) noexcept { return this; }
_ZN4sexp13sexp_object_t16sexp_string_viewEv:
  260|    301|    virtual sexp_string_t *sexp_string_view(void) noexcept { return nullptr; }
_ZNK4sexp11sexp_list_t12is_sexp_listEv:
  365|  1.36k|    virtual bool         is_sexp_list(void) const noexcept { return true; }
_ZNK4sexp13sexp_object_t14is_sexp_stringEv:
  262|    889|    virtual bool           is_sexp_string(void) const noexcept { return false; }
_ZNK4sexp11sexp_list_t14sexp_string_atEm:
  372|  15.2k|    {
  373|  15.2k|        return pos < size() ? (*at(pos)).sexp_string_view() : nullptr;
  ------------------
  |  Branch (373:16): [True: 15.2k, False: 0]
  ------------------
  374|  15.2k|    }
_ZN4sexp13sexp_string_tC2Ev:
  308|  1.96M|    sexp_string_t(void) : with_presentation_hint(false) {}
_ZN4sexp16sexp_char_defs_t14is_white_spaceEi:
  148|  17.5M|    {
  149|  17.5M|        return c >= 0 && c <= 255 && std::isspace((char) c, c_locale);
  ------------------
  |  Branch (149:16): [True: 17.5M, False: 1.89k]
  |  Branch (149:26): [True: 17.5M, False: 0]
  |  Branch (149:38): [True: 7.27k, False: 17.4M]
  ------------------
  150|  17.5M|    };
_ZN4sexp16sexp_char_defs_t12is_dec_digitEi:
  152|  3.10M|    {
  153|  3.10M|        return c >= 0 && c <= 255 && std::isdigit((char) c, c_locale);
  ------------------
  |  Branch (153:16): [True: 3.10M, False: 534]
  |  Branch (153:26): [True: 3.10M, False: 0]
  |  Branch (153:38): [True: 1.14M, False: 1.96M]
  ------------------
  154|  3.10M|    };
_ZN4sexp16sexp_char_defs_t12is_hex_digitEi:
  156|  2.82M|    {
  157|  2.82M|        return c >= 0 && c <= 255 && std::isxdigit((char) c, c_locale);
  ------------------
  |  Branch (157:16): [True: 2.82M, False: 9]
  |  Branch (157:26): [True: 2.82M, False: 0]
  |  Branch (157:38): [True: 2.82M, False: 58]
  ------------------
  158|  2.82M|    };
_ZN4sexp16sexp_char_defs_t15is_base64_digitEi:
  159|  1.81k|    static bool is_base64_digit(int c) { return c >= 0 && c <= 255 && base64digit[c]; };
  ------------------
  |  Branch (159:49): [True: 1.81k, False: 0]
  |  Branch (159:59): [True: 1.81k, False: 0]
  |  Branch (159:71): [True: 1.79k, False: 20]
  ------------------
_ZN4sexp16sexp_char_defs_t13is_token_charEi:
  160|  15.6M|    static bool is_token_char(int c) { return c >= 0 && c <= 255 && tokenchar[c]; };
  ------------------
  |  Branch (160:47): [True: 15.6M, False: 659]
  |  Branch (160:57): [True: 15.6M, False: 0]
  |  Branch (160:69): [True: 13.9M, False: 1.66M]
  ------------------
_ZN4sexp16sexp_char_defs_t8is_alphaEi:
  162|  21.9k|    {
  163|  21.9k|        return c >= 0 && c <= 255 && std::isalpha((char) c, c_locale);
  ------------------
  |  Branch (163:16): [True: 21.9k, False: 0]
  |  Branch (163:26): [True: 21.9k, False: 0]
  |  Branch (163:38): [True: 21.9k, False: 45]
  ------------------
  164|  21.9k|    };
_ZN4sexp16sexp_char_defs_t8decvalueEi:
  167|   558k|    static unsigned char decvalue(int c) { return (c >= 0 && c <= 255) ? values[c][0] : 0; };
  ------------------
  |  Branch (167:52): [True: 558k, False: 0]
  |  Branch (167:62): [True: 558k, False: 0]
  ------------------
_ZN4sexp16sexp_char_defs_t8hexvalueEi:
  169|  2.82M|    static unsigned char hexvalue(int c) { return (c >= 0 && c <= 255) ? values[c][1] : 0; };
  ------------------
  |  Branch (169:52): [True: 2.82M, False: 0]
  |  Branch (169:62): [True: 2.82M, False: 0]
  ------------------
_ZN4sexp16sexp_char_defs_t11base64valueEi:
  172|  1.79k|    {
  173|  1.79k|        return (c >= 0 && c <= 255) ? values[c][2] : 0;
  ------------------
  |  Branch (173:17): [True: 1.79k, False: 0]
  |  Branch (173:27): [True: 1.79k, False: 0]
  ------------------
  174|  1.79k|    };
_ZNK4sexp20sexp_simple_string_t11as_unsignedEv:
  231|    108|    {
  232|    108|        return empty() ? std::numeric_limits<uint32_t>::max() :
  ------------------
  |  Branch (232:16): [True: 1, False: 107]
  ------------------
  233|    108|                         (unsigned) atoi(reinterpret_cast<const char *>(c_str()));
  234|    108|    }
_ZN4sexp13sexp_object_t14sexp_list_viewEv:
  259|  11.0k|    virtual sexp_list_t *  sexp_list_view(void) noexcept { return nullptr; }
_ZNK4sexp13sexp_object_t12is_sexp_listEv:
  261|      1|    virtual bool           is_sexp_list(void) const noexcept { return false; }
_ZN4sexp13sexp_string_t21set_presentation_hintERKNS_20sexp_simple_string_tE:
  322|    764|    {
  323|    764|        with_presentation_hint = true;
  324|    764|        return presentation_hint = ph;
  325|    764|    }
_ZN4sexp13sexp_string_t16sexp_string_viewEv:
  331|  14.9k|    virtual sexp_string_t *sexp_string_view(void) noexcept { return this; }
_ZNK4sexp13sexp_string_t14is_sexp_stringEv:
  332|  7.10k|    virtual bool           is_sexp_string(void) const noexcept { return true; }
_ZNK4sexp13sexp_string_teqEPKc:
  334|  8.70k|    virtual bool operator==(const char *right) const noexcept { return data_string == right; }
_ZNK4sexp13sexp_string_t11as_unsignedEv:
  338|    108|    virtual unsigned as_unsigned() const noexcept { return data_string.as_unsigned(); }
_ZN4sexp19sexp_input_stream_t13get_byte_sizeEv:
  426|  6.86k|    uint32_t                       get_byte_size(void) { return byte_size; }
_ZNK4sexp19sexp_input_stream_t13get_next_charEv:
  442|  9.03M|    int get_next_char(void) const { return next_char; }
_ZN4sexp19sexp_input_stream_t13set_next_charEi:
  443|  3.59k|    int set_next_char(int c) { return next_char = c; }

_ZN14ext_key_format13ext_key_errorEN4sexp16sexp_exception_t8severityEPKcmmi:
   32|    669|{
   33|    669|    char                       tmp[256];
   34|    669|    sexp_exception_t::severity l = (sexp_exception_t::severity) level;
   35|    669|    snprintf(tmp, sizeof(tmp) / sizeof(tmp[0]), msg, c1, c2);
   36|    669|    if (sexp_exception_t::shall_throw(l))
  ------------------
  |  Branch (36:9): [True: 669, False: 0]
  ------------------
   37|    669|        throw sexp_exception_t(tmp, l, pos, "EXTENDED KEY FORMAT");
   38|      0|    if (sexp_exception_t::is_interactive()) {
  ------------------
  |  Branch (38:9): [True: 0, False: 0]
  ------------------
   39|      0|        std::cout.flush() << std::endl
   40|      0|                          << "*** "
   41|      0|                          << sexp_exception_t::format("EXTENDED KEY FORMAT", tmp, l, pos)
   42|      0|                          << " ***" << std::endl;
   43|      0|    }
   44|      0|}
_ZN14ext_key_format22ext_key_input_stream_t9skip_lineEv:
  139|    324|{
  140|    324|    int c;
  141|  3.13k|    do {
  142|  3.13k|        c = input_file->get();
  143|  3.13k|    } while (!is_newline_char(c) && c != EOF);
  ------------------
  |  Branch (143:14): [True: 2.83k, False: 300]
  |  Branch (143:37): [True: 2.80k, False: 24]
  ------------------
  144|    324|    return c;
  145|    324|}
_ZN14ext_key_format22ext_key_input_stream_t9read_charEv:
  151|   114M|{
  152|   114M|    int lookahead_1 = input_file->get();
  153|   114M|    count++;
  154|   114M|    if (is_scanning_value && is_newline_char(lookahead_1)) {
  ------------------
  |  Branch (154:9): [True: 12.7M, False: 101M]
  |  Branch (154:30): [True: 30.7k, False: 12.6M]
  ------------------
  155|  31.5k|        while (true) {
  ------------------
  |  Branch (155:16): [True: 31.5k, Folded]
  ------------------
  156|  31.5k|            int lookahead_2 = input_file->peek();
  157|  31.5k|            if (lookahead_1 == '\r' && lookahead_2 == '\n') {
  ------------------
  |  Branch (157:17): [True: 6.05k, False: 25.4k]
  |  Branch (157:40): [True: 2.90k, False: 3.15k]
  ------------------
  158|  2.90k|                lookahead_1 = input_file->get();
  159|  2.90k|                count++;
  160|  2.90k|                lookahead_2 = input_file->peek();
  161|  2.90k|            }
  162|  31.5k|            if (lookahead_2 == ' ') {
  ------------------
  |  Branch (162:17): [True: 1.35k, False: 30.1k]
  ------------------
  163|  1.35k|                input_file->get();
  164|  1.35k|                count++;
  165|  1.35k|                lookahead_2 = input_file->peek();
  166|  1.35k|                if (lookahead_2 == '#') {
  ------------------
  |  Branch (166:21): [True: 324, False: 1.02k]
  ------------------
  167|    324|                    lookahead_1 = skip_line();
  168|    324|                    continue;
  169|    324|                }
  170|  1.02k|                if (is_newline_char(lookahead_2)) {
  ------------------
  |  Branch (170:21): [True: 489, False: 539]
  ------------------
  171|    489|                    lookahead_1 = lookahead_2;
  172|    489|                    continue;
  173|    489|                }
  174|    539|                lookahead_1 = input_file->get();
  175|    539|                count++;
  176|    539|            }
  177|  30.7k|            return lookahead_1;
  178|  31.5k|        }
  179|  30.7k|    }
  180|   114M|    return lookahead_1;
  181|   114M|}
_ZN14ext_key_format22ext_key_input_stream_t9scan_nameEi:
  192|  21.9k|{
  193|  21.9k|    std::string name;
  194|  21.9k|    if (!is_alpha(c)) {
  ------------------
  |  Branch (194:9): [True: 45, False: 21.9k]
  ------------------
  195|     45|        ext_key_error(sexp_exception_t::error,
  196|     45|                      isprint(next_char) ?
  ------------------
  |  Branch (196:23): [True: 43, False: 2]
  ------------------
  197|     43|                        "unexpected character '%c' (0x%x) found starting a name field" :
  198|     45|                        "unexpected character '0x%x' found starting a name field",
  199|     45|                      c,
  200|     45|                      c,
  201|     45|                      count);
  202|  21.9k|    } else {
  203|  21.9k|        name += (char) c;
  204|  21.9k|        c = read_char();
  205|  2.97M|        while (c != ':') {
  ------------------
  |  Branch (205:16): [True: 2.94M, False: 21.9k]
  ------------------
  206|  2.94M|            if (c == EOF) {
  ------------------
  |  Branch (206:17): [True: 32, False: 2.94M]
  ------------------
  207|     32|                ext_key_error(sexp_exception_t::error, "unexpected end of file", 0, 0, count);
  208|     32|            }
  209|  2.94M|            if (is_newline_char(c)) {
  ------------------
  |  Branch (209:17): [True: 4, False: 2.94M]
  ------------------
  210|      4|                ext_key_error(sexp_exception_t::error, "unexpected end of line", 0, 0, count);
  211|      4|            }
  212|  2.94M|            if (!is_namechar(c)) {
  ------------------
  |  Branch (212:17): [True: 31, False: 2.94M]
  ------------------
  213|     31|                ext_key_error(sexp_exception_t::error,
  214|     31|                              isprint(next_char) ?
  ------------------
  |  Branch (214:31): [True: 30, False: 1]
  ------------------
  215|     30|                                "unexpected character '%c' (0x%x) found in a name field" :
  216|     31|                                "unexpected character '0x%x' found in a name field",
  217|     31|                              c,
  218|     31|                              c,
  219|     31|                              count);
  220|     31|            }
  221|  2.94M|            name += (int) c;
  222|  2.94M|            c = read_char();
  223|  2.94M|        }
  224|  21.9k|    }
  225|  21.9k|    return name;
  226|  21.9k|}
_ZN14ext_key_format22ext_key_input_stream_t10scan_valueEv:
  236|  21.7k|{
  237|  21.7k|    std::string value;
  238|  21.7k|    int         c;
  239|  23.2k|    do {
  240|  23.2k|        c = read_char();
  241|  23.2k|    } while (is_white_space(c));
  ------------------
  |  Branch (241:14): [True: 1.42k, False: 21.7k]
  ------------------
  242|  10.5M|    while (c != EOF && !is_newline_char(c)) {
  ------------------
  |  Branch (242:12): [True: 10.5M, False: 536]
  |  Branch (242:24): [True: 10.5M, False: 21.2k]
  ------------------
  243|  10.5M|        value += c;
  244|  10.5M|        c = read_char();
  245|  10.5M|    }
  246|  21.7k|    return value;
  247|  21.7k|}
_ZN14ext_key_format22ext_key_input_stream_t4scanERNS_22extended_private_key_tE:
  256|  4.26k|{
  257|  4.26k|    set_byte_size(8);
  258|  4.26k|    int c = read_char();
  259|  4.26k|    if (c == '(') {
  ------------------
  |  Branch (259:9): [True: 3.53k, False: 724]
  ------------------
  260|  3.53k|        set_next_char(c);
  261|  3.53k|        res.key.parse(this);
  262|  3.53k|        has_key = true;
  263|  3.53k|    } else {
  264|  22.6k|        while (c != EOF) {
  ------------------
  |  Branch (264:16): [True: 21.9k, False: 724]
  ------------------
  265|       |            // Comparison of names is done case insensitively
  266|  21.9k|            std::string name = scan_name(c);
  267|       |            // The name “Key” is special in that it is mandatory and must occur only once.
  268|       |            // The associated value holds the actual S-expression with the cryptographic key.
  269|       |            // The S-expression is formatted using the ‘Advanced Format’
  270|       |            // (GCRYSEXP_FMT_ADVANCED) that avoids non-printable characters so that the file
  271|       |            // can be easily inspected and edited.
  272|  21.9k|            is_scanning_value = true;
  273|  21.9k|            if (extended_private_key_t::iequals(name, "key")) {
  ------------------
  |  Branch (273:17): [True: 60, False: 21.9k]
  ------------------
  274|     60|                if (has_key) {
  ------------------
  |  Branch (274:21): [True: 1, False: 59]
  ------------------
  275|      1|                    ext_key_error(sexp_exception_t::error,
  276|      1|                                  "'key' field must occur only once",
  277|      1|                                  0,
  278|      1|                                  0,
  279|      1|                                  count);
  280|      1|                }
  281|    329|                do {
  282|    329|                    c = read_char();
  283|    329|                } while (is_white_space(c));
  ------------------
  |  Branch (283:26): [True: 269, False: 60]
  ------------------
  284|     60|                set_next_char(c);
  285|     60|                res.key.parse(this);
  286|     60|                has_key = true;
  287|  21.9k|            } else {
  288|  21.9k|                std::string value = scan_value();
  289|  21.9k|                res.fields.insert(std::pair<std::string, std::string>{name, value});
  290|  21.9k|            }
  291|  21.9k|            c = read_char();
  292|  21.9k|            is_scanning_value = false;
  293|  21.9k|        }
  294|    724|    }
  295|  4.26k|    if (!has_key) {
  ------------------
  |  Branch (295:9): [True: 556, False: 3.70k]
  ------------------
  296|    556|        ext_key_error(sexp_exception_t::error, "missing mandatory 'key' field", 0, 0, count);
  297|    556|    }
  298|  4.26k|}

_ZN4sexp18sexp_depth_managerC2Em:
   29|  4.26k|{
   30|  4.26k|    reset_depth(m_depth);
   31|  4.26k|}
_ZN4sexp18sexp_depth_manager11reset_depthEm:
   33|  8.52k|{
   34|  8.52k|    depth = 0;
   35|  8.52k|    max_depth = m_depth;
   36|  8.52k|}
_ZN4sexp18sexp_depth_manager14increase_depthEi:
   38|  1.70M|{
   39|  1.70M|    if (max_depth != 0 && ++depth > max_depth)
  ------------------
  |  Branch (39:9): [True: 1.70M, False: 0]
  |  Branch (39:27): [True: 9, False: 1.70M]
  ------------------
   40|      9|        sexp_error(sexp_exception_t::error,
   41|      9|                   "Maximum allowed SEXP list depth (%u) is exceeded",
   42|      9|                   max_depth,
   43|      9|                   0,
   44|      9|                   count);
   45|  1.70M|}
_ZN4sexp18sexp_depth_manager14decrease_depthEv:
   47|  1.70M|{
   48|  1.70M|    depth--;
   49|  1.70M|}

_ZN4sexp16sexp_exception_t6formatENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES7_NS0_8severityEi:
   35|  2.86k|{
   36|  2.86k|    std::string r = prf + (level == error ? " ERROR: " : " WARNING: ") + message;
  ------------------
  |  Branch (36:28): [True: 2.86k, False: 0]
  ------------------
   37|  2.86k|    if (position >= 0)
  ------------------
  |  Branch (37:9): [True: 2.86k, False: 0]
  ------------------
   38|  2.86k|        r += " at position " + std::to_string(position);
   39|  2.86k|    return r;
   40|  2.86k|};
_ZN4sexp10sexp_errorENS_16sexp_exception_t8severityEPKcmmi:
   44|  10.0k|{
   45|  10.0k|    char                       tmp[256];
   46|  10.0k|    sexp_exception_t::severity l = (sexp_exception_t::severity) level;
   47|  10.0k|    snprintf(tmp, sizeof(tmp) / sizeof(tmp[0]), msg, c1, c2);
   48|  10.0k|    if (sexp_exception_t::shall_throw(l))
  ------------------
  |  Branch (48:9): [True: 2.19k, False: 7.86k]
  ------------------
   49|  2.19k|        throw sexp_exception_t(tmp, l, pos);
   50|  7.86k|    if (sexp_exception_t::is_interactive()) {
  ------------------
  |  Branch (50:9): [True: 0, False: 7.86k]
  ------------------
   51|      0|        std::cout.flush() << std::endl
   52|      0|                          << "*** " << sexp_exception_t::format("SEXP", tmp, l, pos) << " ***"
   53|      0|                          << std::endl;
   54|      0|    }
   55|  7.86k|}

_ZN4sexp19sexp_input_stream_tC2EPNSt3__113basic_istreamIcNS1_11char_traitsIcEEEEm:
   39|  4.26k|{
   40|  4.26k|    set_input(i, m_depth);
   41|  4.26k|}
_ZN4sexp19sexp_input_stream_t9set_inputEPNSt3__113basic_istreamIcNS1_11char_traitsIcEEEEm:
   48|  4.26k|{
   49|  4.26k|    input_file = i;
   50|  4.26k|    byte_size = 8;
   51|  4.26k|    next_char = ' ';
   52|  4.26k|    bits = 0;
   53|  4.26k|    n_bits = 0;
   54|  4.26k|    count = -1;
   55|  4.26k|    reset_depth(m_depth);
   56|  4.26k|    return this;
   57|  4.26k|}
_ZN4sexp19sexp_input_stream_t13set_byte_sizeEj:
   63|  17.8k|{
   64|  17.8k|    byte_size = newByteSize;
   65|  17.8k|    n_bits = 0;
   66|  17.8k|    bits = 0;
   67|  17.8k|    return this;
   68|  17.8k|}
_ZN4sexp19sexp_input_stream_t8get_charEv:
   86|  99.6M|{
   87|  99.6M|    int c;
   88|  99.6M|    if (next_char == EOF) {
  ------------------
  |  Branch (88:9): [True: 0, False: 99.6M]
  ------------------
   89|      0|        byte_size = 8;
   90|      0|        return this;
   91|      0|    }
   92|       |
   93|   101M|    while (true) {
  ------------------
  |  Branch (93:12): [True: 101M, Folded]
  ------------------
   94|   101M|        c = next_char = read_char();
   95|   101M|        if (c == EOF)
  ------------------
  |  Branch (95:13): [True: 3.13k, False: 101M]
  ------------------
   96|  3.13k|            return this;
   97|   101M|        if ((byte_size == 6 && (c == '|' || c == '}')) || (byte_size == 4 && (c == '#'))) {
  ------------------
  |  Branch (97:14): [True: 6.90k, False: 101M]
  |  Branch (97:33): [True: 3.58k, False: 3.31k]
  |  Branch (97:45): [True: 935, False: 2.38k]
  |  Branch (97:60): [True: 2.82M, False: 98.2M]
  |  Branch (97:78): [True: 2.15k, False: 2.82M]
  ------------------
   98|       |            // end of region reached; return terminating character, after checking for
   99|       |            // unused bits
  100|  6.67k|            if (n_bits > 0 && (((1 << n_bits) - 1) & bits) != 0) {
  ------------------
  |  Branch (100:17): [True: 738, False: 5.93k]
  |  Branch (100:31): [True: 541, False: 197]
  ------------------
  101|    541|                sexp_error(sexp_exception_t::warning,
  102|    541|                           "%d-bit region ended with %d unused bits left-over",
  103|    541|                           byte_size,
  104|    541|                           n_bits,
  105|    541|                           count);
  106|    541|            }
  107|  6.67k|            return set_byte_size(8);
  108|   101M|        } else if (byte_size != 8 && is_white_space(c))
  ------------------
  |  Branch (108:20): [True: 2.82M, False: 98.2M]
  |  Branch (108:38): [True: 224, False: 2.82M]
  ------------------
  109|    224|            ; /* ignore white space in hex and base64 regions */
  110|   101M|        else if (byte_size == 6 && c == '=')
  ------------------
  |  Branch (110:18): [True: 2.19k, False: 101M]
  |  Branch (110:36): [True: 380, False: 1.81k]
  ------------------
  111|    380|            ; /* ignore equals signs in base64 regions */
  112|   101M|        else if (byte_size == 8) {
  ------------------
  |  Branch (112:18): [True: 98.2M, False: 2.82M]
  ------------------
  113|  98.2M|            return this;
  114|  98.2M|        } else if (byte_size < 8) {
  ------------------
  |  Branch (114:20): [True: 2.82M, False: 0]
  ------------------
  115|  2.82M|            bits = bits << byte_size;
  116|  2.82M|            n_bits += byte_size;
  117|  2.82M|            if (byte_size == 6 && is_base64_digit(c))
  ------------------
  |  Branch (117:17): [True: 1.81k, False: 2.82M]
  |  Branch (117:35): [True: 1.79k, False: 20]
  ------------------
  118|  1.79k|                bits = bits | base64value(c);
  119|  2.82M|            else if (byte_size == 4 && is_hex_digit(c))
  ------------------
  |  Branch (119:22): [True: 2.82M, False: 20]
  |  Branch (119:40): [True: 2.82M, False: 27]
  ------------------
  120|  2.82M|                bits = bits | hexvalue(c);
  121|     47|            else {
  122|     47|                sexp_error(sexp_exception_t::error,
  123|     47|                           "character '%c' found in %u-bit coding region",
  124|     47|                           next_char,
  125|     47|                           byte_size,
  126|     47|                           count);
  127|     47|            }
  128|  2.82M|            if (n_bits >= 8) {
  ------------------
  |  Branch (128:17): [True: 1.41M, False: 1.41M]
  ------------------
  129|  1.41M|                next_char = (bits >> (n_bits - 8)) & 0xFF;
  130|  1.41M|                n_bits -= 8;
  131|  1.41M|                return this;
  132|  1.41M|            }
  133|  2.82M|        }
  134|   101M|    }
  135|  99.6M|}
_ZN4sexp19sexp_input_stream_t16skip_white_spaceEv:
  142|  14.6M|{
  143|  14.6M|    while (is_white_space(next_char))
  ------------------
  |  Branch (143:12): [True: 5.36k, False: 14.6M]
  ------------------
  144|  5.36k|        get_char();
  145|  14.6M|    return this;
  146|  14.6M|}
_ZN4sexp19sexp_input_stream_t9skip_charEi:
  154|  3.74M|{
  155|  3.74M|    if (next_char != c)
  ------------------
  |  Branch (155:9): [True: 318, False: 3.74M]
  ------------------
  156|    318|        sexp_error(sexp_exception_t::error,
  157|    318|                   "character '%c' found where '%c' was expected",
  158|    318|                   next_char,
  159|    318|                   c,
  160|    318|                   count);
  161|  3.74M|    return get_char();
  162|  3.74M|}
_ZN4sexp19sexp_input_stream_t10scan_tokenERNS_20sexp_simple_string_tE:
  169|  1.65M|{
  170|  1.65M|    skip_white_space();
  171|  13.6M|    while (is_token_char(next_char)) {
  ------------------
  |  Branch (171:12): [True: 12.0M, False: 1.65M]
  ------------------
  172|  12.0M|        ss.append(next_char);
  173|  12.0M|        get_char();
  174|  12.0M|    }
  175|  1.65M|}
_ZN4sexp19sexp_input_stream_t19scan_decimal_stringEv:
  200|   293k|{
  201|   293k|    uint32_t value = 0;
  202|   293k|    uint32_t i = 0;
  203|   852k|    while (is_dec_digit(next_char)) {
  ------------------
  |  Branch (203:12): [True: 558k, False: 293k]
  ------------------
  204|   558k|        value = value * 10 + decvalue(next_char);
  205|   558k|        get_char();
  206|   558k|        if (i++ > 8)
  ------------------
  |  Branch (206:13): [True: 1, False: 558k]
  ------------------
  207|      1|            sexp_error(sexp_exception_t::error, "Decimal number is too long", 0, 0, count);
  208|   558k|    }
  209|   293k|    return value;
  210|   293k|}
_ZN4sexp19sexp_input_stream_t20scan_verbatim_stringERNS_20sexp_simple_string_tEj:
  217|   291k|{
  218|   291k|    skip_white_space()->skip_char(':');
  219|       |
  220|       |    // Some length is specified always, this is ensured by the caller's logic
  221|   291k|    assert(length != std::numeric_limits<uint32_t>::max());
  222|       |    // We should not handle too large strings
  223|   291k|    if (length > 1024 * 1024) {
  ------------------
  |  Branch (223:9): [True: 9, False: 291k]
  ------------------
  224|      9|        sexp_error(sexp_exception_t::error, "Too long verbatim string: %zu", length, 0, count);
  225|      9|    }
  226|  3.28M|    for (uint32_t i = 0; i < length; i++) {
  ------------------
  |  Branch (226:26): [True: 2.99M, False: 291k]
  ------------------
  227|  2.99M|        if (next_char == EOF) {
  ------------------
  |  Branch (227:13): [True: 106, False: 2.99M]
  ------------------
  228|    106|            sexp_error(
  229|    106|              sexp_exception_t::error, "EOF while reading verbatim string", 0, 0, count);
  230|    106|        }
  231|  2.99M|        ss.append(next_char);
  232|  2.99M|        get_char();
  233|  2.99M|    }
  234|   291k|}
_ZN4sexp19sexp_input_stream_t18scan_quoted_stringERNS_20sexp_simple_string_tEj:
  243|  11.3k|{
  244|  11.3k|    skip_char('"');
  245|  58.9M|    while (ss.length() <= length) {
  ------------------
  |  Branch (245:12): [True: 58.9M, False: 1.16k]
  ------------------
  246|  58.9M|        if (next_char == '\"') {
  ------------------
  |  Branch (246:13): [True: 10.0k, False: 58.9M]
  ------------------
  247|  10.0k|            if (length == std::numeric_limits<uint32_t>::max() || (ss.length() == length)) {
  ------------------
  |  Branch (247:17): [True: 9.64k, False: 418]
  |  Branch (247:67): [True: 387, False: 31]
  ------------------
  248|  10.0k|                skip_char('\"');
  249|  10.0k|                return;
  250|  10.0k|            } else
  251|     31|                sexp_error(sexp_exception_t::error,
  252|     31|                           "Declared length was %d, but quoted string ended too early",
  253|     31|                           (int) length,
  254|     31|                           0,
  255|     31|                           count);
  256|  58.9M|        } else if (next_char == '\\') /* handle escape sequence */
  ------------------
  |  Branch (256:20): [True: 31.0k, False: 58.9M]
  ------------------
  257|  31.0k|        {
  258|  31.0k|            get_char();
  259|  31.0k|            switch (next_char) {
  260|  2.21k|            case 'b':
  ------------------
  |  Branch (260:13): [True: 2.21k, False: 28.8k]
  ------------------
  261|  2.21k|                ss.append('\b');
  262|  2.21k|                break;
  263|  2.01k|            case 't':
  ------------------
  |  Branch (263:13): [True: 2.01k, False: 29.0k]
  ------------------
  264|  2.01k|                ss.append('\t');
  265|  2.01k|                break;
  266|  4.82k|            case 'v':
  ------------------
  |  Branch (266:13): [True: 4.82k, False: 26.2k]
  ------------------
  267|  4.82k|                ss.append('\v');
  268|  4.82k|                break;
  269|  1.25k|            case 'n':
  ------------------
  |  Branch (269:13): [True: 1.25k, False: 29.8k]
  ------------------
  270|  1.25k|                ss.append('\n');
  271|  1.25k|                break;
  272|  1.11k|            case 'f':
  ------------------
  |  Branch (272:13): [True: 1.11k, False: 29.9k]
  ------------------
  273|  1.11k|                ss.append('\f');
  274|  1.11k|                break;
  275|  2.98k|            case 'r':
  ------------------
  |  Branch (275:13): [True: 2.98k, False: 28.0k]
  ------------------
  276|  2.98k|                ss.append('\r');
  277|  2.98k|                break;
  278|  1.58k|            case '\"':
  ------------------
  |  Branch (278:13): [True: 1.58k, False: 29.4k]
  ------------------
  279|  1.58k|                ss.append('\"');
  280|  1.58k|                break;
  281|  1.57k|            case '\'':
  ------------------
  |  Branch (281:13): [True: 1.57k, False: 29.5k]
  ------------------
  282|  1.57k|                ss.append('\'');
  283|  1.57k|                break;
  284|  5.22k|            case '\\':
  ------------------
  |  Branch (284:13): [True: 5.22k, False: 25.8k]
  ------------------
  285|  5.22k|                ss.append('\\');
  286|  5.22k|                break;
  287|  1.30k|            case 'x': /* hexadecimal number */
  ------------------
  |  Branch (287:13): [True: 1.30k, False: 29.7k]
  ------------------
  288|  1.30k|            {
  289|  1.30k|                int j, val;
  290|  1.30k|                val = 0;
  291|  1.30k|                get_char();
  292|  3.89k|                for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (292:29): [True: 2.58k, False: 1.30k]
  ------------------
  293|  2.58k|                    if (is_hex_digit(next_char)) {
  ------------------
  |  Branch (293:25): [True: 2.54k, False: 40]
  ------------------
  294|  2.54k|                        val = ((val << 4) | hexvalue(next_char));
  295|  2.54k|                        if (j < 1) {
  ------------------
  |  Branch (295:29): [True: 1.28k, False: 1.26k]
  ------------------
  296|  1.28k|                            get_char();
  297|  1.28k|                        }
  298|  2.54k|                    } else
  299|     40|                        sexp_error(sexp_exception_t::error,
  300|     40|                                   "Hex character \x5cx%x... too short",
  301|     40|                                   val,
  302|     40|                                   0,
  303|     40|                                   count);
  304|  2.58k|                }
  305|  1.30k|                ss.append(val);
  306|  1.30k|            } break;
  307|  1.24k|            case '\n':      /* ignore backslash line feed */
  ------------------
  |  Branch (307:13): [True: 1.24k, False: 29.8k]
  ------------------
  308|  1.24k|                get_char(); /* also ignore following carriage-return if present */
  309|  1.24k|                if (next_char != '\r')
  ------------------
  |  Branch (309:21): [True: 1.04k, False: 200]
  ------------------
  310|  1.04k|                    continue;
  311|    200|                break;
  312|    912|            case '\r':      /* ignore backslash carriage-return */
  ------------------
  |  Branch (312:13): [True: 912, False: 30.1k]
  ------------------
  313|    912|                get_char(); /* also ignore following linefeed if present */
  314|    912|                if (next_char != '\n')
  ------------------
  |  Branch (314:21): [True: 471, False: 441]
  ------------------
  315|    471|                    continue;
  316|    441|                break;
  317|    978|            case '0':
  ------------------
  |  Branch (317:13): [True: 978, False: 30.0k]
  ------------------
  318|  3.30k|            case '1':
  ------------------
  |  Branch (318:13): [True: 2.32k, False: 28.7k]
  ------------------
  319|  3.98k|            case '2':
  ------------------
  |  Branch (319:13): [True: 679, False: 30.3k]
  ------------------
  320|  4.78k|            case '3':
  ------------------
  |  Branch (320:13): [True: 798, False: 30.2k]
  ------------------
  321|  4.78k|            case '4':
  ------------------
  |  Branch (321:13): [True: 6, False: 31.0k]
  ------------------
  322|  4.79k|            case '5':
  ------------------
  |  Branch (322:13): [True: 6, False: 31.0k]
  ------------------
  323|  4.79k|            case '6':
  ------------------
  |  Branch (323:13): [True: 2, False: 31.0k]
  ------------------
  324|  4.79k|            case '7': { /* octal number */
  ------------------
  |  Branch (324:13): [True: 2, False: 31.0k]
  ------------------
  325|  4.79k|                int j, val;
  326|  4.79k|                val = 0;
  327|  19.1k|                for (j = 0; j < 3; j++) {
  ------------------
  |  Branch (327:29): [True: 14.3k, False: 4.79k]
  ------------------
  328|  14.3k|                    if (next_char >= '0' && next_char <= '7') {
  ------------------
  |  Branch (328:25): [True: 14.2k, False: 56]
  |  Branch (328:45): [True: 14.2k, False: 20]
  ------------------
  329|  14.2k|                        val = ((val << 3) | (next_char - '0'));
  330|  14.2k|                        if (j < 2)
  ------------------
  |  Branch (330:29): [True: 9.53k, False: 4.72k]
  ------------------
  331|  9.53k|                            get_char();
  332|  14.2k|                    } else
  333|     76|                        sexp_error(sexp_exception_t::error,
  334|     76|                                   "Octal character \\%o... too short",
  335|     76|                                   val,
  336|     76|                                   0,
  337|     76|                                   count);
  338|  14.3k|                }
  339|  4.79k|                if (val > 255)
  ------------------
  |  Branch (339:21): [True: 3, False: 4.79k]
  ------------------
  340|      3|                    sexp_error(sexp_exception_t::error,
  341|      3|                               "Octal character \\%o... too big",
  342|      3|                               val,
  343|      3|                               0,
  344|      3|                               count);
  345|  4.79k|                ss.append(val);
  346|  4.79k|            } break;
  347|     37|            default:
  ------------------
  |  Branch (347:13): [True: 37, False: 31.0k]
  ------------------
  348|     37|                sexp_error(sexp_exception_t::error,
  349|     37|                           "Unknown escape sequence \\%c",
  350|     37|                           next_char,
  351|     37|                           0,
  352|     37|                           count);
  353|  31.0k|            }
  354|  31.0k|        } /* end of handling escape sequence */
  355|  58.9M|        else if (next_char == EOF) {
  ------------------
  |  Branch (355:18): [True: 893, False: 58.9M]
  ------------------
  356|    893|            sexp_error(sexp_exception_t::error, "unexpected end of file", 0, 0, count);
  357|  58.9M|        } else {
  358|  58.9M|            ss.append(next_char);
  359|  58.9M|        }
  360|  58.9M|        get_char();
  361|  58.9M|    } /* end of main while loop */
  362|  11.3k|}
_ZN4sexp19sexp_input_stream_t23scan_hexadecimal_stringERNS_20sexp_simple_string_tEj:
  371|  2.26k|{
  372|  2.26k|    set_byte_size(4)->skip_char('#');
  373|  1.41M|    while (next_char != EOF && (next_char != '#' || get_byte_size() == 4)) {
  ------------------
  |  Branch (373:12): [True: 1.41M, False: 114]
  |  Branch (373:33): [True: 1.41M, False: 2.81k]
  |  Branch (373:53): [True: 658, False: 2.15k]
  ------------------
  374|  1.41M|        ss.append(next_char);
  375|  1.41M|        get_char();
  376|  1.41M|    }
  377|  2.26k|    skip_char('#');
  378|  2.26k|    if (ss.length() != length && length != std::numeric_limits<uint32_t>::max())
  ------------------
  |  Branch (378:9): [True: 1.95k, False: 310]
  |  Branch (378:34): [True: 457, False: 1.50k]
  ------------------
  379|    457|        sexp_error(sexp_exception_t::warning,
  380|    457|                   "Hex string has length %d different than declared length %d",
  381|    457|                   ss.length(),
  382|    457|                   length,
  383|    457|                   count);
  384|  2.26k|}
_ZN4sexp19sexp_input_stream_t18scan_base64_stringERNS_20sexp_simple_string_tEj:
  393|  3.89k|{
  394|  3.89k|    set_byte_size(6)->skip_char('|');
  395|  19.8M|    while (next_char != EOF && (next_char != '|' || get_byte_size() == 6)) {
  ------------------
  |  Branch (395:12): [True: 19.8M, False: 140]
  |  Branch (395:33): [True: 19.8M, False: 4.04k]
  |  Branch (395:53): [True: 292, False: 3.75k]
  ------------------
  396|  19.8M|        ss.append(next_char);
  397|  19.8M|        get_char();
  398|  19.8M|    }
  399|  3.89k|    skip_char('|');
  400|  3.89k|    if (ss.length() != length && length != std::numeric_limits<uint32_t>::max())
  ------------------
  |  Branch (400:9): [True: 3.56k, False: 334]
  |  Branch (400:34): [True: 747, False: 2.81k]
  ------------------
  401|    747|        sexp_error(sexp_exception_t::warning,
  402|    747|                   "Base64 string has length %d different than declared length %d",
  403|    747|                   ss.length(),
  404|    747|                   length,
  405|    747|                   count);
  406|  3.89k|}
_ZN4sexp19sexp_input_stream_t18scan_simple_stringEv:
  415|  1.96M|{
  416|  1.96M|    int                  length;
  417|  1.96M|    sexp_simple_string_t ss;
  418|  1.96M|    skip_white_space();
  419|       |    /* Note that it is important in the following code to test for token-ness
  420|       |     * before checking the other cases, so that a token may begin with ":",
  421|       |     * which would otherwise be treated as a verbatim string missing a length.
  422|       |     */
  423|  1.96M|    if (is_token_char(next_char) && !is_dec_digit(next_char)) {
  ------------------
  |  Branch (423:9): [True: 1.94M, False: 15.8k]
  |  Branch (423:37): [True: 1.65M, False: 293k]
  ------------------
  424|  1.65M|        scan_token(ss);
  425|  1.65M|    } else {
  426|   309k|        length = is_dec_digit(next_char) ? scan_decimal_string() :
  ------------------
  |  Branch (426:18): [True: 293k, False: 15.8k]
  ------------------
  427|   309k|                                           std::numeric_limits<uint32_t>::max();
  428|       |
  429|   309k|        switch (next_char) {
  430|  11.3k|        case '\"':
  ------------------
  |  Branch (430:9): [True: 11.3k, False: 298k]
  ------------------
  431|  11.3k|            scan_quoted_string(ss, length);
  432|  11.3k|            break;
  433|  2.26k|        case '#':
  ------------------
  |  Branch (433:9): [True: 2.26k, False: 307k]
  ------------------
  434|  2.26k|            scan_hexadecimal_string(ss, length);
  435|  2.26k|            break;
  436|  3.89k|        case '|':
  ------------------
  |  Branch (436:9): [True: 3.89k, False: 305k]
  ------------------
  437|  3.89k|            scan_base64_string(ss, length);
  438|  3.89k|            break;
  439|   291k|        case ':':
  ------------------
  |  Branch (439:9): [True: 291k, False: 18.1k]
  ------------------
  440|       |            // ':' is 'tokenchar', so some length shall be defined
  441|   291k|            scan_verbatim_string(ss, length);
  442|   291k|            break;
  443|    624|        default: {
  ------------------
  |  Branch (443:9): [True: 624, False: 308k]
  ------------------
  444|    624|            const char *const msg = (next_char == EOF) ? "unexpected end of file" :
  ------------------
  |  Branch (444:37): [True: 534, False: 90]
  ------------------
  445|    624|                                    isprint(next_char) ? "illegal character '%c' (0x%x)" :
  ------------------
  |  Branch (445:37): [True: 30, False: 60]
  ------------------
  446|     90|                                                         "illegal character 0x%x";
  447|    624|            sexp_error(sexp_exception_t::error, msg, next_char, next_char, count);
  448|    624|        }
  449|   309k|        }
  450|   309k|    }
  451|       |
  452|  1.96M|    if (ss.length() == 0)
  ------------------
  |  Branch (452:9): [True: 6.11k, False: 1.95M]
  ------------------
  453|  6.11k|        sexp_error(sexp_exception_t::warning, "Simple string has zero length", 0, 0, count);
  454|  1.96M|    return ss;
  455|  1.96M|}
_ZN4sexp19sexp_input_stream_t11scan_stringEv:
  462|  1.96M|{
  463|  1.96M|    auto s = std::make_shared<sexp_string_t>();
  464|  1.96M|    ;
  465|  1.96M|    s->parse(this);
  466|  1.96M|    return s;
  467|  1.96M|}
_ZN4sexp19sexp_input_stream_t9scan_listEv:
  474|  1.70M|{
  475|  1.70M|    auto list = std::make_shared<sexp_list_t>();
  476|  1.70M|    list->parse(this);
  477|  1.70M|    return list;
  478|  1.70M|}
_ZN4sexp19sexp_input_stream_t11scan_objectEv:
  485|  3.66M|{
  486|  3.66M|    std::shared_ptr<sexp_object_t> object;
  487|  3.66M|    skip_white_space();
  488|  3.66M|    if (next_char == '{' && byte_size != 6) {
  ------------------
  |  Branch (488:9): [True: 748, False: 3.66M]
  |  Branch (488:29): [True: 745, False: 3]
  ------------------
  489|    745|        set_byte_size(6)->skip_char('{');
  490|    745|        object = scan_object();
  491|    745|        skip_char('}');
  492|  3.66M|    } else {
  493|  3.66M|        if (next_char == '(')
  ------------------
  |  Branch (493:13): [True: 1.70M, False: 1.96M]
  ------------------
  494|  1.70M|            object = scan_list();
  495|  1.96M|        else
  496|  1.96M|            object = scan_string();
  497|  3.66M|    }
  498|  3.66M|    return object;
  499|  3.66M|}
_ZN4sexp19sexp_input_stream_t9open_listEv:
  505|  1.70M|{
  506|  1.70M|    skip_char('(');
  507|       |    // gcc 4.8.5 generates wrong code in case of chaining like
  508|       |    //           skip_char('(')->increase_depth(count)
  509|  1.70M|    increase_depth(count);
  510|  1.70M|    return this;
  511|  1.70M|}
_ZN4sexp19sexp_input_stream_t10close_listEv:
  516|  1.70M|{
  517|  1.70M|    skip_char(')');
  518|  1.70M|    decrease_depth();
  519|  1.70M|    return this;
  520|  1.70M|}

_ZN4sexp13sexp_string_t5parseEPNS_19sexp_input_stream_tE:
   39|  1.96M|{
   40|  1.96M|    if (sis->get_next_char() == '[') { /* scan presentation hint */
  ------------------
  |  Branch (40:9): [True: 780, False: 1.96M]
  ------------------
   41|    780|        sis->skip_char('[');
   42|    780|        set_presentation_hint(sis->scan_simple_string());
   43|    780|        sis->skip_white_space()->skip_char(']')->skip_white_space();
   44|    780|    }
   45|  1.96M|    set_string(sis->scan_simple_string());
   46|  1.96M|}
_ZN4sexp11sexp_list_t5parseEPNS_19sexp_input_stream_tE:
   98|  1.70M|{
   99|  1.70M|    sis->open_list()->skip_white_space();
  100|  1.70M|    if (sis->get_next_char() == ')') {
  ------------------
  |  Branch (100:9): [True: 1.69M, False: 11.6k]
  ------------------
  101|  1.69M|        ;
  102|  1.69M|    } else {
  103|  11.6k|        push_back(sis->scan_object());
  104|  11.6k|    }
  105|       |
  106|  5.36M|    while (true) {
  ------------------
  |  Branch (106:12): [True: 5.36M, Folded]
  ------------------
  107|  5.36M|        sis->skip_white_space();
  108|  5.36M|        if (sis->get_next_char() == ')') { /* we just grabbed last element of list */
  ------------------
  |  Branch (108:13): [True: 1.70M, False: 3.65M]
  ------------------
  109|  1.70M|            sis->close_list();
  110|  1.70M|            return;
  111|       |
  112|  3.65M|        } else {
  113|  3.65M|            push_back(sis->scan_object());
  114|  3.65M|        }
  115|  5.36M|    }
  116|  1.70M|}

