Problem: The public nonce callback accepts UINT_MAX, but nonce_function_rfc6979_impl never returns for that attempt.
Its i <= counter loop wraps after the final candidate and starts again.
Fix: Generate the candidate before checking whether it is the requested attempt.
This preserves the result for every unsigned int attempt, including UINT_MAX, and exits before the index can wrap.