This is based on the description of the fix by Stepan: https://medium.com/cryptoadvance/hardware-wallets-can-be-hacked-but-this-is-fine-a6156bbd199
The protocol wording and functions are copied/adapted from Jonas Nick’s PRs which do the same for BIP-Schnorr:
1. Add secp256k1_ecdsa_anti_nonce_sidechan_client_commit to return the curve point committing to the signing client nonce.
This is a convenience function and can technically be emulated by calling secp256k1_ecdsa_sign() and reconstructing the curve point from the signature r/s values.
2.
secp256k1_ecdsa_sign_nonce_tweak_add, which is the same as secp256k1_ecdsa_sign_nonce, but with an additional optional tweak parameter to add to the nonce.
The nicer way to do this is to redefine secp256k1_nonce_function
to
have a tweak param, but this would break API compatiblity. The way it
is implemented is fully backwards compatible.