Repository navigation
Conversation
| } | ||
|
|
||
| return std::initializer_list<std::pair<string, mixed>>{{string{"name", 4}, string{name.value().data(), static_cast<string::size_type>(name.value().size())}}, | ||
| {string{"subject", 7}, subject.val()}, |
There was a problem hiding this comment.
No need to create these strings every time the function is called. We can create them in advance in CryptoImageState or OpenSSLImageState
| std::pair{MD2, hash_algorithm_traits{MD2_HASHED_SIZE, HashAlgorithm::MD2}}, | ||
| std::pair{MD4, hash_algorithm_traits{MD4_HASHED_SIZE, HashAlgorithm::MD4}}}}; | ||
|
|
||
| std::ranges::sort(arr, std::less{}, &std::pair<std::string_view, hash_algorithm_traits>::first); |
There was a problem hiding this comment.
nit: std::addressof instead of raw & operator
There was a problem hiding this comment.
But in this case we take pointer to function, not object. We can not use std::addressof here.
| return c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r'; | ||
| } | ||
|
|
||
| inline constexpr char to_lower_ascii(char c) noexcept { |
There was a problem hiding this comment.
nit: tolower_ascii to look like std::tolower
| const auto key{load_public_key(public_key)}; | ||
| if (!key) [[unlikely]] { | ||
| kphp::log::warning("failed to verify signature"); | ||
| return -1; |
There was a problem hiding this comment.
We must preserve kPHP's behavior: return 0
| #include <optional> | ||
| #include <ranges> | ||
| #include <span> | ||
| #include <string> |
| k2::CipherAlgorithm algo; | ||
| }; | ||
|
|
||
| constexpr auto CIPHER_ALGORITHMS{[] { |
There was a problem hiding this comment.
Let's better use constinit const here to guarantee we won't have non-compile time computations
There was a problem hiding this comment.
But evaluation for constexpr variable at compile time is guaranteed.
No description provided.