diff --git a/src/lib/pbkdf/pgp_s2k/pgp_s2k.cpp b/src/lib/pbkdf/pgp_s2k/pgp_s2k.cpp index d04fb47b36a..8bcf9239fcc 100644 --- a/src/lib/pbkdf/pgp_s2k/pgp_s2k.cpp +++ b/src/lib/pbkdf/pgp_s2k/pgp_s2k.cpp @@ -61,7 +61,7 @@ uint8_t RFC4880_encode_count(size_t desired_iterations) if(desired_iterations >= OPENPGP_S2K_ITERS[255]) return 255; - auto i = std::upper_bound(OPENPGP_S2K_ITERS, OPENPGP_S2K_ITERS + 256, desired_iterations); + auto i = std::lower_bound(OPENPGP_S2K_ITERS, OPENPGP_S2K_ITERS + 256, desired_iterations); return static_cast(i - OPENPGP_S2K_ITERS); }