consensus: guard against openssl's new strict DER checks
consensus: guard against openssl's new strict DER checks

New versions of OpenSSL will reject non-canonical DER signatures. However,
it'll happily decode them. Decode then re-encode before verification in order
to ensure that it is properly consumed.

Github-Pull: #5634
Rebased-From: 488ed32f2ada1d1dd108fc245d025c4d5f252783

nmarley/dash,ColossusCoinXT/ColossusCoinXT,biblepay/biblepay,48thct2jtnf/P,Darknet-Crypto/Darknet,aburan28/elements,nmarley/dash,dev1972/Satellitecoin,ticclassic/ic,ptschip/bitcoinxt,ArgonToken/ArgonToken,OmniLayer/omnicore,cerebrus29301/crowncoin,tropa/axecoin,Petr-Economissa/gvidon,48thct2jtnf/P,ticclassic/ic,pinkevich/dash,rdqw/sscoin,capitalDIGI/DIGI-v-0-10-4,joulecoin/joulecoin,alejandromgk/Lunar,ivansib/sibcoin,PIVX-Project/PIVX,mockcoin/mockcoin,coinkeeper/2015-06-22_18-52_viacoin,ionomy/ion,ivansib/sib16,DynamicCoinOrg/DMC,terracoin/terracoin,inkvisit/sarmacoins,capitalDIGI/litecoin,ticclassic/ic,MonetaryUnit/MUE-Src,coinkeeper/2015-06-22_18-52_viacoin,Thracky/monkeycoin,mycointest/owncoin,Thracky/monkeycoin,RibbitFROG/ribbitcoin,pascalguru/florincoin,schinzelh/dash,koharjidan/litecoin,genavarov/lamacoin,ptschip/bitcoinxt,koharjidan/litecoin,NunoEdgarGub1/elements,biblepay/biblepay,ColossusCoinXT/ColossusCoinXT,capitalDIGI/DIGI-v-0-10-4,jmgilbert2/energi,presstab/PIVX,Electronic-Gulden-Foundation/egulden,jmgilbert2/energi,lakepay/lake,sipa/elements,keesdewit82/LasVegasCoin,BlockchainTechLLC/3dcoin,inkvisit/sarmacoins,koharjidan/litecoin,genavarov/brcoin,jtimon/elements,antcheck/antcoin,mycointest/owncoin,okinc/bitcoin,jtimon/elements,worldbit/worldbit,alejandromgk/Lunar,presstab/PIVX,PandaPayProject/PandaPay,genavarov/brcoin,mycointest/owncoin,CoinProjects/AmsterdamCoin-v4,freelion93/mtucicoin,GwangJin/gwangmoney-core,ivansib/sibcoin,schinzelh/dash,octocoin-project/octocoin,inkvisit/sarmacoins,mikehearn/bitcoinxt,droark/elements,KibiCoin/kibicoin,RyanLucchese/energi,Kenwhite23/litecoin,antcheck/antcoin,willwray/dash,mapineda/litecoin,putinclassic/putic,inkvisit/sarmacoins,NunoEdgarGub1/elements,LIMXTEC/DMDv3,crowning-/dash,ArgonToken/ArgonToken,crowning-/dash,crowning-/dash,puticcoin/putic,ediston/energi,xawksow/GroestlCoin,alejandromgk/Lunar,Kenwhite23/litecoin,truthcoin/blocksize-market,npccoin/npccoin,antcheck/antcoin,joulecoin/joulecoin,axelxod/braincoin,worldbit/worldbit,ivansib/sibcoin,capitalDIGI/litecoin,MazaCoin/maza,MazaCoin/mazacoin-new,thelazier/dash,KibiCoin/kibicoin,genavarov/brcoin,pstratem/elements,RyanLucchese/energi,gwillen/elements,slingcoin/sling-market,ivansib/sib16,Rav3nPL/doubloons-0.10,pstratem/elements,mapineda/litecoin,mockcoin/mockcoin,kleetus/bitcoinxt,pelorusjack/BlockDX,zottejos/merelcoin,lakepay/lake,HeliumGas/helium,Mrs-X/Darknet,pstratem/elements,keesdewit82/LasVegasCoin,upgradeadvice/MUE-Src,Vsync-project/Vsync,capitalDIGI/DIGI-v-0-10-4,kleetus/bitcoinxt,CoinProjects/AmsterdamCoin-v4,presstab/PIVX,Thracky/monkeycoin,OstlerDev/florincoin,RibbitFROG/ribbitcoin,alejandromgk/Lunar,48thct2jtnf/P,LIMXTEC/DMDv3,ivansib/sib16,Mrs-X/PIVX,fussl/elements,willwray/dash,m0gliE/fastcoin-cli,capitalDIGI/DIGI-v-0-10-4,axelxod/braincoin,oklink-dev/bitcoin,mockcoin/mockcoin,apoelstra/elements,freelion93/mtucicoin,Mrs-X/PIVX,Mrs-X/Darknet,biblepay/biblepay,tropa/axecoin,Mrs-X/PIVX,mapineda/litecoin,truthcoin/blocksize-market,MonetaryUnit/MUE-Src,aspirecoin/aspire,aspirecoin/aspire,grumpydevelop/singularity,ivansib/sibcoin,pelorusjack/BlockDX,PIVX-Project/PIVX,OmniLayer/omnicore,Mrs-X/Darknet,PandaPayProject/PandaPay,my-first/octocoin,upgradeadvice/MUE-Src,genavarov/ladacoin,tropa/axecoin,LIMXTEC/DMDv3,ivansib/sib16,jtimon/elements,ingresscoin/ingresscoin,rdqw/sscoin,Darknet-Crypto/Darknet,okinc/bitcoin,terracoin/terracoin,MazaCoin/mazacoin-new,droark/elements,midnight-miner/LasVegasCoin,dashpay/dash,mikehearn/bitcoinxt,pascalguru/florincoin,mikehearn/bitcoinxt,florincoin/florincoin,coinkeeper/2015-06-22_18-52_viacoin,Petr-Economissa/gvidon,BlockchainTechLLC/3dcoin,okinc/bitcoin,oklink-dev/bitcoin,genavarov/lamacoin,ptschip/bitcoinxt,KibiCoin/kibicoin,putinclassic/putic,ingresscoin/ingresscoin,pelorusjack/BlockDX,diggcoin/diggcoin,Vsync-project/Vsync,MazaCoin/mazacoin-new,apoelstra/elements,dashpay/dash,GwangJin/gwangmoney-core,Vsync-project/Vsync,benzmuircroft/REWIRE.io,ingresscoin/ingresscoin,ticclassic/ic,Thracky/monkeycoin,xuyangcn/opalcoin,jmgilbert2/energi,Kenwhite23/litecoin,coinkeeper/2015-06-22_18-52_viacoin,crowning-/dash,MazaCoin/maza,m0gliE/fastcoin-cli,lakepay/lake,Mrs-X/PIVX,fullcoins/fullcoin,MazaCoin/maza,Mrs-X/Darknet,dev1972/Satellitecoin,midnight-miner/LasVegasCoin,Vsync-project/Vsync,fussl/elements,midnight-miner/LasVegasCoin,koharjidan/litecoin,m0gliE/fastcoin-cli,ColossusCoinXT/ColossusCoinXT,projectinterzone/ITZ,coinkeeper/2015-06-22_18-52_viacoin,florincoin/florincoin,ahmedbodi/test2,npccoin/npccoin,OstlerDev/florincoin,MonetaryUnit/MUE-Src,truthcoin/blocksize-market,pelorusjack/BlockDX,ticclassic/ic,sipa/elements,pinkevich/dash,npccoin/npccoin,PandaPayProject/PandaPay,octocoin-project/octocoin,Mrs-X/PIVX,NunoEdgarGub1/elements,genavarov/ladacoin,thelazier/dash,Darknet-Crypto/Darknet,ivansib/sib16,dashpay/dash,putinclassic/putic,DMDcoin/Diamond,droark/elements,benzmuircroft/REWIRE.io,fullcoins/fullcoin,zottejos/merelcoin,my-first/octocoin,dev1972/Satellitecoin,pascalguru/florincoin,PIVX-Project/PIVX,DMDcoin/Diamond,slingcoin/sling-market,putinclassic/putic,PIVX-Project/PIVX,rdqw/sscoin,Electronic-Gulden-Foundation/egulden,aspirecoin/aspire,ArgonToken/ArgonToken,pinkevich/dash,DynamicCoinOrg/DMC,BlockchainTechLLC/3dcoin,octocoin-project/octocoin,fullcoins/fullcoin,droark/elements,fussl/elements,octocoin-project/octocoin,presstab/PIVX,my-first/octocoin,Kenwhite23/litecoin,sipa/elements,ColossusCoinXT/ColossusCoinXT,GwangJin/gwangmoney-core,OstlerDev/florincoin,schinzelh/dash,cerebrus29301/crowncoin,dmrtsvetkov/flowercoin,florincoin/florincoin,benzmuircroft/REWIRE.io,OstlerDev/florincoin,nmarley/dash,oklink-dev/bitcoin,CoinProjects/AmsterdamCoin-v4,ediston/energi,UdjinM6/dash,my-first/octocoin,CoinProjects/AmsterdamCoin-v4,kleetus/bitcoinxt,Bloom-Project/Bloom,dev1972/Satellitecoin,grumpydevelop/singularity,upgradeadvice/MUE-Src,alejandromgk/Lunar,terracoin/terracoin,gwillen/elements,UdjinM6/dash,ionomy/ion,cerebrus29301/crowncoin,tropa/axecoin,DMDcoin/Diamond,keesdewit82/LasVegasCoin,MonetaryUnit/MUE-Src,cerebrus29301/crowncoin,presstab/PIVX,zottejos/merelcoin,inkvisit/sarmacoins,pstratem/elements,ionomy/ion,dmrtsvetkov/flowercoin,freelion93/mtucicoin,lakepay/lake,DMDcoin/Diamond,aspirecoin/aspire,apoelstra/elements,sipa/elements,koharjidan/litecoin,joulecoin/joulecoin,PIVX-Project/PIVX,MazaCoin/maza,UdjinM6/dash,nmarley/dash,antcheck/antcoin,droark/elements,sipa/elements,jmgilbert2/energi,slingcoin/sling-market,UdjinM6/dash,NunoEdgarGub1/elements,MonetaryUnit/MUE-Src,freelion93/mtucicoin,Mrs-X/Darknet,schinzelh/dash,HeliumGas/helium,gwillen/elements,Bloom-Project/Bloom,Bloom-Project/Bloom,mikehearn/bitcoinxt,genavarov/ladacoin,biblepay/biblepay,grumpydevelop/singularity,jtimon/elements,midnight-miner/LasVegasCoin,worldbit/worldbit,mycointest/owncoin,apoelstra/elements,axelxod/braincoin,rsdevgun16e/energi,terracoin/terracoin,PIVX-Project/PIVX,Rav3nPL/doubloons-0.10,Electronic-Gulden-Foundation/egulden,ptschip/bitcoinxt,ingresscoin/ingresscoin,HeliumGas/helium,aspirecoin/aspire,slingcoin/sling-market,Petr-Economissa/gvidon,antcheck/antcoin,jmgilbert2/energi,pinkevich/dash,ArgonToken/ArgonToken,MazaCoin/mazacoin-new,worldbit/worldbit,pstratem/elements,my-first/octocoin,florincoin/florincoin,MazaCoin/mazacoin-new,KibiCoin/kibicoin,DynamicCoinOrg/DMC,ticclassic/ic,HeliumGas/helium,MazaCoin/mazacoin-new,okinc/bitcoin,crowning-/dash,kleetus/bitcoinxt,dev1972/Satellitecoin,terracoin/terracoin,upgradeadvice/MUE-Src,dashpay/dash,xawksow/GroestlCoin,m0gliE/fastcoin-cli,benzmuircroft/REWIRE.io,genavarov/ladacoin,Darknet-Crypto/Darknet,nmarley/dash,biblepay/biblepay,truthcoin/blocksize-market,willwray/dash,Petr-Economissa/gvidon,Electronic-Gulden-Foundation/egulden,puticcoin/putic,pelorusjack/BlockDX,Vsync-project/Vsync,thelazier/dash,ingresscoin/ingresscoin,PIVX-Project/PIVX,schinzelh/dash,PandaPayProject/PandaPay,freelion93/mtucicoin,Rav3nPL/doubloons-0.10,puticcoin/putic,presstab/PIVX,Mrs-X/PIVX,gwillen/elements,MazaCoin/maza,Rav3nPL/doubloons-0.10,mikehearn/bitcoinxt,DynamicCoinOrg/DMC,crowning-/dash,zottejos/merelcoin,ionomy/ion,benzmuircroft/REWIRE.io,PIVX-Project/PIVX,kleetus/bitcoinxt,Kenwhite23/litecoin,rsdevgun16e/energi,rdqw/sscoin,Rav3nPL/doubloons-0.10,HeliumGas/helium,joulecoin/joulecoin,OmniLayer/omnicore,mikehearn/bitcoinxt,MonetaryUnit/MUE-Src,octocoin-project/octocoin,florincoin/florincoin,48thct2jtnf/P,nmarley/dash,coinkeeper/2015-06-22_18-52_viacoin,upgradeadvice/MUE-Src,KibiCoin/kibicoin,Kenwhite23/litecoin,mockcoin/mockcoin,PIVX-Project/PIVX,okinc/bitcoin,rdqw/sscoin,ptschip/bitcoinxt,aburan28/elements,aburan28/elements,aburan28/elements,gwillen/elements,xawksow/GroestlCoin,oklink-dev/bitcoin,dmrtsvetkov/flowercoin,ediston/energi,Mrs-X/Darknet,puticcoin/putic,puticcoin/putic,genavarov/lamacoin,ArgonToken/ArgonToken,ColossusCoinXT/ColossusCoinXT,genavarov/brcoin,tropa/axecoin,LIMXTEC/DMDv3,HeliumGas/helium,BlockchainTechLLC/3dcoin,diggcoin/diggcoin,OstlerDev/florincoin,projectinterzone/ITZ,pascalguru/florincoin,thelazier/dash,Petr-Economissa/gvidon,truthcoin/blocksize-market,diggcoin/diggcoin,ivansib/sibcoin,sipa/elements,RyanLucchese/energi,lakepay/lake,diggcoin/diggcoin,xuyangcn/opalcoin,rsdevgun16e/energi,NunoEdgarGub1/elements,slingcoin/sling-market,koharjidan/litecoin,fullcoins/fullcoin,truthcoin/blocksize-market,joulecoin/joulecoin,rsdevgun16e/energi,capitalDIGI/litecoin,jmgilbert2/energi,mockcoin/mockcoin,xawksow/GroestlCoin,putinclassic/putic,ionomy/ion,my-first/octocoin,ahmedbodi/test2,mycointest/owncoin,slingcoin/sling-market,RibbitFROG/ribbitcoin,diggcoin/diggcoin,xuyangcn/opalcoin,axelxod/braincoin,willwray/dash,oklink-dev/bitcoin,rsdevgun16e/energi,Electronic-Gulden-Foundation/egulden,ahmedbodi/test2,OmniLayer/omnicore,GwangJin/gwangmoney-core,terracoin/terracoin,keesdewit82/LasVegasCoin,m0gliE/fastcoin-cli,ahmedbodi/test2,projectinterzone/ITZ,RibbitFROG/ribbitcoin,oklink-dev/bitcoin,RyanLucchese/energi,pascalguru/florincoin,jtimon/elements,DynamicCoinOrg/DMC,Electronic-Gulden-Foundation/egulden,genavarov/brcoin,jtimon/elements,mockcoin/mockcoin,aburan28/elements,rdqw/sscoin,DMDcoin/Diamond,genavarov/ladacoin,Vsync-project/Vsync,fussl/elements,LIMXTEC/DMDv3,capitalDIGI/litecoin,DynamicCoinOrg/DMC,midnight-miner/LasVegasCoin,willwray/dash,worldbit/worldbit,nmarley/dash,ahmedbodi/test2,schinzelh/dash,genavarov/ladacoin,biblepay/biblepay,worldbit/worldbit,KibiCoin/kibicoin,antcheck/antcoin,axelxod/braincoin,Bloom-Project/Bloom,DMDcoin/Diamond,RyanLucchese/energi,ediston/energi,PandaPayProject/PandaPay,upgradeadvice/MUE-Src,puticcoin/putic,pstratem/elements,npccoin/npccoin,capitalDIGI/DIGI-v-0-10-4,grumpydevelop/singularity,MazaCoin/maza,Rav3nPL/doubloons-0.10,m0gliE/fastcoin-cli,mapineda/litecoin,keesdewit82/LasVegasCoin,axelxod/braincoin,biblepay/biblepay,mapineda/litecoin,supcoin/supcoin,supcoin/supcoin,fussl/elements,ivansib/sibcoin,dmrtsvetkov/flowercoin,biblepay/biblepay,ionomy/ion,apoelstra/elements,droark/elements,Darknet-Crypto/Darknet,OstlerDev/florincoin,ediston/energi,aspirecoin/aspire,putinclassic/putic,okinc/bitcoin,octocoin-project/octocoin,xawksow/GroestlCoin,xuyangcn/opalcoin,OmniLayer/omnicore,pelorusjack/BlockDX,RibbitFROG/ribbitcoin,supcoin/supcoin,genavarov/lamacoin,UdjinM6/dash,fussl/elements,PandaPayProject/PandaPay,thelazier/dash,inkvisit/sarmacoins,grumpydevelop/singularity,Petr-Economissa/gvidon,cerebrus29301/crowncoin,pinkevich/dash,OmniLayer/omnicore,dmrtsvetkov/flowercoin,48thct2jtnf/P,capitalDIGI/litecoin,dev1972/Satellitecoin,cerebrus29301/crowncoin,freelion93/mtucicoin,apoelstra/elements,dashpay/dash,pinkevich/dash,benzmuircroft/REWIRE.io,rsdevgun16e/energi,Thracky/monkeycoin,ptschip/bitcoinxt,Bloom-Project/Bloom,zottejos/merelcoin,RyanLucchese/energi,Darknet-Crypto/Darknet,npccoin/npccoin,dmrtsvetkov/flowercoin,ediston/energi,genavarov/lamacoin,diggcoin/diggcoin,pascalguru/florincoin,48thct2jtnf/P,RibbitFROG/ribbitcoin,xuyangcn/opalcoin,CoinProjects/AmsterdamCoin-v4,midnight-miner/LasVegasCoin,florincoin/florincoin,kleetus/bitcoinxt,BlockchainTechLLC/3dcoin,projectinterzone/ITZ,ingresscoin/ingresscoin,aburan28/elements,willwray/dash,projectinterzone/ITZ,alejandromgk/Lunar,capitalDIGI/litecoin,tropa/axecoin,fullcoins/fullcoin,ArgonToken/ArgonToken,NunoEdgarGub1/elements,ahmedbodi/test2,lakepay/lake,genavarov/brcoin,capitalDIGI/DIGI-v-0-10-4,CoinProjects/AmsterdamCoin-v4,xawksow/GroestlCoin,mycointest/owncoin,ivansib/sib16,gwillen/elements,LIMXTEC/DMDv3,Thracky/monkeycoin,Bloom-Project/Bloom,zottejos/merelcoin,grumpydevelop/singularity,xuyangcn/opalcoin,genavarov/lamacoin,fullcoins/fullcoin,npccoin/npccoin,supcoin/supcoin,BlockchainTechLLC/3dcoin,ColossusCoinXT/ColossusCoinXT,keesdewit82/LasVegasCoin,joulecoin/joulecoin,mapineda/litecoin,supcoin/supcoin,supcoin/supcoin