Compare commits

...

1 Commits

Author SHA1 Message Date
Ulf Wiger
54dc140629 Add opcodes for ML-DSA verify functions
All checks were successful
Gajumaru Bytecode Tests / tests (push) Successful in -3m51s
2026-01-29 18:17:06 +01:00
3 changed files with 11 additions and 7 deletions

View File

@ -1,9 +1,5 @@
{"1.2.0",
[{<<"gmserialization">>,
{git,"https://git.qpq.swiss/QPQ-AG/gmserialization.git",
{ref,"9d2ecc00d32ea295309563e54a81636ecb597e96"}},
0},
{<<"base58">>,
[{<<"base58">>,
{git,"https://git.qpq.swiss/QPQ-AG/erl-base58.git",
{ref,"e6aa62eeae3d4388311401f06e4b939bf4e94b9c"}},
1},
@ -12,7 +8,11 @@
{git,"https://git.qpq.swiss/QPQ-AG/enacl.git",
{ref,"4eb7ec70084ba7c87b1af8797c4c4e90c84f95a2"}},
1},
{<<"getopt">>,{pkg,<<"getopt">>,<<"1.0.1">>},0}]}.
{<<"getopt">>,{pkg,<<"getopt">>,<<"1.0.1">>},0},
{<<"gmserialization">>,
{git,"https://git.qpq.swiss/QPQ-AG/gmserialization.git",
{ref,"9d2ecc00d32ea295309563e54a81636ecb597e96"}},
0}]}.
[
{pkg_hash,[
{<<"eblake2">>, <<"EC8AD20E438AAB3F2E8D5D118C366A0754219195F8A0F536587440F8F9BCF2EF">>},

View File

@ -247,6 +247,10 @@ ops_defs() ->
, { 'INT_TO_BYTES', 16#b4, false, true, true, ?GAS(10), [a, a, a], int_to_bytes, {integer, integer}, bytes, "Arg0 := turn integer Arg1 into a byte array (big endian) length Arg2 (truncating if not fit)."}
, { 'STR_TO_BYTES', 16#b5, false, true, true, ?GAS(10), [a, a], str_to_bytes, {integer}, bytes, "Arg0 := turn string Arg1 into the corresponding byte array."}
, { 'NETWORK_ID', 16#b6, false, true, true, ?GAS(10), [a], network_id, {}, string, "Arg0 := The network_id of the chain."}
%% Gas estimates based on simple verify benchmarks: ed25519 (?GAS(1300)): 41µs, mldsa44: 75µs, mldsa65: 113µs, mldsa87: 179µs
, { 'VERIFY_SIG_MLDSA44', 16#b7, false, true, true, ?GAS(2340), [a,a,a,a], verify_sig_mldsa44, {bytes, bytes, bytes}, boolean, "Arg0 := verify_sig_mldsa44(Hash, Pubkey, Signature)"}
, { 'VERIFY_SIG_MLDSA65', 16#b8, false, true, true, ?GAS(3640), [a,a,a,a], verify_sig_mldsa65, {bytes, bytes, bytes}, boolean, "Arg0 := verify_sig_mldsa65(Hash, Pubkey, Signature)"}
, { 'VERIFY_SIG_MLDSA87', 16#b9, false, true, true, ?GAS(5720), [a,a,a,a], verify_sig_mldsa87, {bytes, bytes, bytes}, boolean, "Arg0 := verify_sig_mldsa87(Hash, Pubkey, Signature)"}
, { 'DBG_LOC', 16#f0, false, true, true, ?GAS(0), [a, a], dbg_loc, {string, integer}, none, "Debug Op: Execution location. Args = {file_name, line_num}" }
, { 'DBG_DEF', 16#f1, false, true, true, ?GAS(0), [a, a], dbg_def, {string, any}, none, "Debug Op: Define a variable. Args = {var_name, register}" }

View File

@ -13,7 +13,7 @@ all() ->
roundtrip_identy(_Cfg) ->
CodeDir = code:lib_dir(gmbytecode, test),
FileName = filename:join(CodeDir, "asm_code/identity.gmsm"),
FileName = filename:join(CodeDir, "asm_code/identity.aesm"),
Code = gmb_asm:file(FileName, []),
ct:log("Code ~p:~n~s~n", [FileName, gmb_disassemble:format(Code, fun io:format/2)]),
ok.