The ProxySQL admin SQLite3 extension CACHING_SHA2_PASSWORD() previously
always emitted hashes with 5000 rounds (hardcoded "\$A\$005\$" prefix and
"\$5\$rounds=5000\$" crypt salt). MySQL's caching_sha2_password_digest_rounds
is configurable from 5000 to 4095000 in steps of 1000, so a backend that
uses any non-default value produces hashes the extension cannot reproduce —
breaking the byte-for-byte hash equivalence test in
test_sqlite3_pass_exts-t on e.g. the mysql95 backend where rounds=10000.
Extend the SQLite function to accept an optional third integer argument
carrying the desired rounds value:
CACHING_SHA2_PASSWORD(pass) -> random salt, 5000 rounds
CACHING_SHA2_PASSWORD(pass, salt) -> given salt, 5000 rounds
CACHING_SHA2_PASSWORD(pass, salt, rounds) -> given salt, given rounds
rounds is validated: integer, multiple of 1000, in [5000, 4095000] —
matching MySQL's caching_sha2_password_digest_rounds bounds. The
"\$5\$rounds=<N>\$" salt prefix and "\$A\$<RRR>\$" hash prefix are now
built at runtime from the resolved value, with <RRR> emitted as 3-char
zero-padded uppercase hex of (rounds/1000) per MySQL's
sql/auth/sha2_password.cc::digest_round_separator().
Update test_sqlite3_pass_exts-t to parse the rounds field from the
MySQL-generated hash (chars 3..5 of \$A\$<RRR>\$..., base-16, ×1000)
and pass it to CACHING_SHA2_PASSWORD() — so the hash-equivalence
assertion matches any backend rounds. Update the INV_INPUTS fixture:
3-arg is now valid, so reject 4-arg ("wrong number"), reject 3-arg
with non-integer rounds ("Invalid argument type"), reject out-of-range
or non-multiple-of-1000 rounds ("Invalid rounds: ...").
Verified against mysql95 backend (rounds=10000): test_sqlite3_pass_exts-t
passes 2117/2117, test_auth_methods-t passes 10774/10774 (previously
failing with 50+122 not-ok respectively before the base-16 parse fix in
MySQL_Protocol.cpp).