MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / ExVerifySignatureFunc

Function ExVerifySignatureFunc

src/vm/luavm/lmylib.cpp:887–909  ·  view source on GitHub ↗

*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 = {} * } */

Source from the content-addressed store, hash-verified

885 * }
886 */
887int32_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
911int32_t ExGetTxContractFunc(lua_State *L) {
912 vector<std::shared_ptr<vector<uint8_t>>> retdata;

Callers

nothing calls this directly

Calls 10

RetFalseFunction · 0.85
VerifySignatureFunction · 0.85
RetRstBooleanToLuaFunction · 0.85
atMethod · 0.80
HashFunction · 0.50
sizeMethod · 0.45
getMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected