EOSIO / eos

An open source smart contract platform
https://developers.eos.io/manuals/eos
MIT License
11.27k stars 3.76k forks source link

Port BIP62 Canonical Signatures from Steem #4299

Open abitmore opened 6 years ago

abitmore commented 6 years ago

https://github.com/steemit/steem/pull/2500

tarassh commented 6 years ago
    bool public_key::is_canonical( const compact_signature& c ) {
        return !(c.data[1] & 0x80)
               && !(c.data[1] == 0 && !(c.data[2] & 0x80))
               && !(c.data[33] & 0x80)
               && !(c.data[33] == 0 && !(c.data[34] & 0x80));
    }

I haven't seen any definition that says that this is the way to check if a signature is canonical.

do
        {
            FC_ASSERT( secp256k1_ecdsa_sign_compact( detail::_get_context(), (unsigned char*) digest.data(), (unsigned char*) result.begin() + 1, (unsigned char*) my->_key.data(), extended_nonce_function, &counter, &recid ));
        } while( require_canonical && !public_key::is_canonical( result ) );

Signature generation implementation is kinda weird. So existing implementation is blocking 3rd application development.