*bool SignatureVerify(void const* data, uint16_t datalen, void const* key, uint16_t keylen, void const* phash, uint16_t hashlen) * 这个函数式从中间层传了三个个参数过来: * 1.第一个是签名前的原始数据 * 2.第二个是签名的公钥(public key) * 3.第三是已签名的数据 * *{ * dataLen = 0, * data = {}, * pubKeyLen = 0, * pubKey = {}, * signatureLen = 0, * signature = {} * } */
| 885 | * } |
| 886 | */ |
| 887 | int32_t ExVerifySignatureFunc(lua_State *L) { |
| 888 | vector<std::shared_ptr<vector<uint8_t> > > retdata; |
| 889 | |
| 890 | if (!GetDataTableVerifySignature(L, retdata) || retdata.size() != 3 || retdata.at(1).get()->size() != 33) { |
| 891 | return RetFalse(string(__FUNCTION__) + "para err !"); |
| 892 | } |
| 893 | vector<uint8_t> &data = *retdata.at(0); |
| 894 | vector<uint8_t> &pubKey = *retdata.at(1); |
| 895 | vector<uint8_t> &signature = *retdata.at(2); |
| 896 | |
| 897 | LUA_BurnFuncData(L, FUEL_CALL_VerifySignature, data.size(), 32, FUEL_DATA32_VerifySignature, BURN_VER_R2); |
| 898 | |
| 899 | CPubKey pk(pubKey.begin(), pubKey.end()); |
| 900 | |
| 901 | uint256 dataHash = Hash(data.begin(), data.end()); |
| 902 | |
| 903 | bool rlt = VerifySignature(dataHash, signature, pk); |
| 904 | if (!rlt) { |
| 905 | LogPrint(BCLog::INFO, "ExVerifySignatureFunc call VerifySignature verify signature failed!\n"); |
| 906 | } |
| 907 | |
| 908 | return RetRstBooleanToLua(L, rlt); |
| 909 | } |
| 910 | |
| 911 | int32_t ExGetTxContractFunc(lua_State *L) { |
| 912 | vector<std::shared_ptr<vector<uint8_t>>> retdata; |
nothing calls this directly
no test coverage detected