From 7c0acf7dfbfa8f1df603456828d76a1620a657c1 Mon Sep 17 00:00:00 2001 From: ziffee Date: Mon, 2 Dec 2024 19:23:16 +0700 Subject: [PATCH 1/9] zif/ed-luck: add luck:ed, sign-raw:ed, sign-octs-raw:ed --- ext/urcrypt/build.zig.zon | 4 +- pkg/noun/build.zig | 1 + pkg/noun/jets/137/tree.c | 10 +++- pkg/noun/jets/e/ed_luck.c | 37 +++++++++++++ pkg/noun/jets/e/ed_sign.c | 113 ++++++++++++++++++++++++++++++++------ pkg/noun/jets/w.h | 3 + 6 files changed, 147 insertions(+), 21 deletions(-) create mode 100644 pkg/noun/jets/e/ed_luck.c diff --git a/ext/urcrypt/build.zig.zon b/ext/urcrypt/build.zig.zon index 9de2a9ad72..4cea9a2722 100644 --- a/ext/urcrypt/build.zig.zon +++ b/ext/urcrypt/build.zig.zon @@ -14,8 +14,8 @@ .hash = "1220bb683a6df744e618f58a008eaae3eb62b70a78334cec676bd82b1b9e8e944eeb", }, .urcrypt = .{ - .url = "https://github.com/urbit/urcrypt/archive/e77a0998809f7552c455cf7bf8c1b68c141cce18.tar.gz", - .hash = "12202efcf40dcfed9a9b59bba4743cfd0c31364a6d7504724bd4d643b474ff69245b", + .url = "https://github.com/urbit/urcrypt/archive/0e1ccd5d80531d11013b255b529a3a0e91985d08.tar.gz", + .hash = "122029a2c9ad5eeefb6ee757765d599aafcacbf9a70ce586c1771a3a6171ee3265e1", }, }, .paths = .{ diff --git a/pkg/noun/build.zig b/pkg/noun/build.zig index 1c816ea7f8..a6785c4ef3 100644 --- a/pkg/noun/build.zig +++ b/pkg/noun/build.zig @@ -274,6 +274,7 @@ const c_source_files = [_][]const u8{ "jets/e/ed_add_scalarmult_scalarmult_base.c", "jets/e/ed_point_add.c", "jets/e/ed_puck.c", + "jets/e/ed_luck.c", "jets/e/ed_scalarmult.c", "jets/e/ed_scalarmult_base.c", "jets/e/ed_shar.c", diff --git a/pkg/noun/jets/137/tree.c b/pkg/noun/jets/137/tree.c index fec03edf1f..85ab0fc2aa 100644 --- a/pkg/noun/jets/137/tree.c +++ b/pkg/noun/jets/137/tree.c @@ -113,7 +113,11 @@ static u3j_core _137_hex__crc_d[] = {{"crc32", 7, _137_hex__crc32_a, 0, no_hashe static u3j_harm _137_hex_coed__ed_puck_a[] = {{".2", u3wee_puck}, {}}; +static u3j_harm _137_hex_coed__ed_luck_a[] = {{".2", u3wee_luck}, {}}; +static u3j_harm _137_hex_coed__ed_sign_a[] = {{".2", u3wee_sign}, {}}; +static u3j_harm _137_hex_coed__ed_sign_raw_a[] = {{".2", u3wee_sign_raw}, {}}; static u3j_harm _137_hex_coed__ed_sign_octs_a[] = {{".2", u3wee_sign_octs}, {}}; +static u3j_harm _137_hex_coed__ed_sign_octs_raw_a[] = {{".2", u3wee_sign_octs_raw}, {}}; static u3j_harm _137_hex_coed__ed_veri_octs_a[] = {{".2", u3wee_veri_octs}, {}}; static u3j_harm _137_hex_coed__ed_shar_a[] = {{".2", u3wee_shar}, {}}; @@ -133,8 +137,12 @@ static u3j_harm _137_hex_coed__ed_add_double_scalarmult_a[] = {{".2", u3wee_add_double_scalarmult}, {}}; static u3j_core _137_hex_coed__ed_d[] = - { { "sign-octs", 7, _137_hex_coed__ed_sign_octs_a, 0, no_hashes }, + { { "sign", 7, _137_hex_coed__ed_sign_a, 0, no_hashes }, + { "sign-raw", 7, _137_hex_coed__ed_sign_raw_a, 0, no_hashes }, + { "sign-octs", 7, _137_hex_coed__ed_sign_octs_a, 0, no_hashes }, + { "sign-octs-raw", 7, _137_hex_coed__ed_sign_octs_raw_a, 0, no_hashes }, { "puck", 7, _137_hex_coed__ed_puck_a, 0, no_hashes }, + { "luck", 7, _137_hex_coed__ed_luck_a, 0, no_hashes }, { "veri-octs", 7, _137_hex_coed__ed_veri_octs_a, 0, no_hashes }, { "shar", 7, _137_hex_coed__ed_shar_a, 0, no_hashes }, { "point-add", 7, _137_hex_coed__ed_point_add_a, 0, 0 }, diff --git a/pkg/noun/jets/e/ed_luck.c b/pkg/noun/jets/e/ed_luck.c new file mode 100644 index 0000000000..c21889ee63 --- /dev/null +++ b/pkg/noun/jets/e/ed_luck.c @@ -0,0 +1,37 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + static u3_atom + _cqee_luck(u3_atom sed) + { + c3_y sed_y[32]; + + if ( 0 != u3r_bytes_fit(32, sed_y, sed) ) { + // hoon explicitly crashes on mis-size + return u3m_bail(c3__exit); + } + else { + c3_y pub_y[32]; + c3_y sec_y[64]; + urcrypt_ed_luck(sed_y, pub_y, sec_y); + return u3nc(u3i_bytes(32, pub_y), u3i_bytes(64, sec_y)); + } + } + + u3_noun + u3wee_luck(u3_noun cor) + { + u3_noun a = u3r_at(u3x_sam, cor); + + if ( (u3_none == a) || (c3n == u3ud(a)) ) { + return u3m_bail(c3__exit); + } + else { + return _cqee_luck(a); + } + } diff --git a/pkg/noun/jets/e/ed_sign.c b/pkg/noun/jets/e/ed_sign.c index 0cde84ec71..8e7421f402 100644 --- a/pkg/noun/jets/e/ed_sign.c +++ b/pkg/noun/jets/e/ed_sign.c @@ -9,12 +9,12 @@ #include static u3_atom - _cqee_sign_octs(u3_noun len, u3_noun dat, u3_noun key) + _cqee_sign_octs(u3_noun len, u3_noun dat, u3_noun sed) { - c3_y key_y[32]; + c3_y sed_y[32]; c3_w len_w; - if ( 0 != u3r_bytes_fit(32, key_y, key) ) { - // hoon calls suck, which calls puck, which crashes + if ( 0 != u3r_bytes_fit(32, sed_y, sed) ) { + // hoon calls suck, which calls luck, which crashes return u3m_bail(c3__exit); } else if ( !u3r_word_fit(&len_w, len) ) { @@ -23,7 +23,7 @@ else { c3_y sig_y[64]; c3_y* dat_y = u3r_bytes_alloc(0, len_w, dat); - urcrypt_ed_sign(dat_y, len_w, key_y, sig_y); + urcrypt_ed_sign(dat_y, len_w, sed_y, sig_y); u3a_free(dat_y); return u3i_bytes(64, sig_y); } @@ -32,33 +32,71 @@ u3_noun u3wee_sign_octs(u3_noun cor) { - u3_noun msg, key; + u3_noun msg, sed; + u3_noun len, dat; + if ( c3n == u3r_mean(cor, u3x_sam_2, &msg, u3x_sam_3, &sed, 0) || + c3n == u3r_cell(msg, &len, &dat) ) { + return u3m_bail(c3__fail); + } else { + return _cqee_sign_octs(len, dat, sed); + } + } + + static u3_atom + _cqee_sign_octs_raw(u3_noun len, u3_noun dat, u3_noun pub, u3_noun sek) + { + c3_y pub_y[32], sek_y[64]; + c3_w len_w; + if ( 0 != u3r_bytes_fit(32, pub_y, pub) ) { + // hoon calls suck, which calls luck, which crashes + return u3m_bail(c3__exit); + } + if ( 0 != u3r_bytes_fit(64, sek_y, sek) ) { + // hoon calls suck, which calls luck, which crashes + return u3m_bail(c3__exit); + } + else if ( !u3r_word_fit(&len_w, len) ) { + return u3m_bail(c3__fail); + } + else { + c3_y sig_y[64]; + c3_y* dat_y = u3r_bytes_alloc(0, len_w, dat); + urcrypt_ed_sign_raw(dat_y, len_w, pub_y, sek_y, sig_y); + u3a_free(dat_y); + return u3i_bytes(64, sig_y); + } + } + + u3_noun + u3wee_sign_octs_raw(u3_noun cor) + { + u3_noun msg, pub, sek; u3_noun len, dat; - if ( c3n == u3r_mean(cor, u3x_sam_2, &msg, u3x_sam_3, &key, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &msg, u3x_sam_6, &pub, u3x_sam_7, &sek, 0) || c3n == u3r_cell(msg, &len, &dat) ) { return u3m_bail(c3__fail); } else { - return _cqee_sign_octs(len, dat, key); + return _cqee_sign_octs_raw(len, dat, pub, sek); } } static u3_atom - _cqee_sign(u3_noun a, - u3_noun b) + _cqee_sign(u3_noun msg, + u3_noun sed) { c3_y sed_y[32]; - if ( 0 != u3r_bytes_fit(32, sed_y, b) ) { - // hoon calls suck, which calls puck, which crashes + if ( 0 != u3r_bytes_fit(32, sed_y, sed) ) { + // hoon calls suck, which calls luck, which crashes return u3m_bail(c3__exit); } else { c3_y sig_y[64]; c3_w met_w; - c3_y* mes_y = u3r_bytes_all(&met_w, a); + c3_y* msg_y = u3r_bytes_all(&met_w, msg); - urcrypt_ed_sign(mes_y, met_w, sed_y, sig_y); - u3a_free(mes_y); + urcrypt_ed_sign(msg_y, met_w, sed_y, sig_y); + u3a_free(msg_y); return u3i_bytes(64, sig_y); } @@ -67,11 +105,50 @@ u3_noun u3wee_sign(u3_noun cor) { - u3_noun a, b; + u3_noun msg, sed; + if ( c3n == u3r_mean(cor, + u3x_sam_2, &msg, u3x_sam_3, &sed, 0) ) { + return u3m_bail(c3__fail); + } else { + return _cqee_sign(msg, sed); + } + } + + static u3_atom + _cqee_sign_raw(u3_noun msg, + u3_noun pub, + u3_noun sek) + { + c3_y pub_y[32], sek_y[64]; + + if ( 0 != u3r_bytes_fit(32, pub_y, pub) ) { + // hoon calls suck, which calls luck, which crashes + return u3m_bail(c3__exit); + } + if ( 0 != u3r_bytes_fit(64, sek_y, sek) ) { + // hoon calls suck, which calls luck, which crashes + return u3m_bail(c3__exit); + } + else { + c3_y sig_y[64]; + c3_w met_w; + c3_y* msg_y = u3r_bytes_all(&met_w, msg); + + urcrypt_ed_sign_raw(msg_y, met_w, pub_y, sek_y, sig_y); + u3a_free(msg_y); + + return u3i_bytes(64, sig_y); + } + } + + u3_noun + u3wee_sign_raw(u3_noun cor) + { + u3_noun msg, pub, sek; if ( c3n == u3r_mean(cor, - u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + u3x_sam_2, &msg, u3x_sam_6, &pub, u3x_sam_7, &sek, 0) ) { return u3m_bail(c3__fail); } else { - return _cqee_sign(a, b); + return _cqee_sign_raw(msg, pub, sek); } } diff --git a/pkg/noun/jets/w.h b/pkg/noun/jets/w.h index 78494314fe..f025c3b527 100644 --- a/pkg/noun/jets/w.h +++ b/pkg/noun/jets/w.h @@ -194,9 +194,12 @@ u3_noun u3weo_raw(u3_noun); u3_noun u3wee_puck(u3_noun); + u3_noun u3wee_luck(u3_noun); u3_noun u3wee_sign(u3_noun); + u3_noun u3wee_sign_raw(u3_noun); u3_noun u3wee_veri(u3_noun); u3_noun u3wee_sign_octs(u3_noun); + u3_noun u3wee_sign_octs_raw(u3_noun); u3_noun u3wee_veri_octs(u3_noun); u3_noun u3wee_shar(u3_noun); u3_noun u3wee_point_add(u3_noun); From 381901482c756e89b213077dec975211f02e5f8f Mon Sep 17 00:00:00 2001 From: ziffee Date: Mon, 2 Dec 2024 19:30:33 +0700 Subject: [PATCH 2/9] zif/ed-reform: add jets for scad:ed, scas:ed, scap:ed --- ext/urcrypt/build.zig.zon | 4 +- pkg/noun/build.zig | 1 + pkg/noun/jets/137/tree.c | 7 +++ pkg/noun/jets/e/ed_scad.c | 117 ++++++++++++++++++++++++++++++++++++++ pkg/noun/jets/w.h | 4 ++ 5 files changed, 131 insertions(+), 2 deletions(-) create mode 100644 pkg/noun/jets/e/ed_scad.c diff --git a/ext/urcrypt/build.zig.zon b/ext/urcrypt/build.zig.zon index 4cea9a2722..396ca83376 100644 --- a/ext/urcrypt/build.zig.zon +++ b/ext/urcrypt/build.zig.zon @@ -14,8 +14,8 @@ .hash = "1220bb683a6df744e618f58a008eaae3eb62b70a78334cec676bd82b1b9e8e944eeb", }, .urcrypt = .{ - .url = "https://github.com/urbit/urcrypt/archive/0e1ccd5d80531d11013b255b529a3a0e91985d08.tar.gz", - .hash = "122029a2c9ad5eeefb6ee757765d599aafcacbf9a70ce586c1771a3a6171ee3265e1", + .url = "https://github.com/urbit/urcrypt/archive/9599acb4e12002ddb1c39591bb9477621f848470.tar.gz", + .hash = "12203c3694e5871a0a6b70cef76cc0fab15a8eb1dabbb4d1fe14f454a738db41a53f", }, }, .paths = .{ diff --git a/pkg/noun/build.zig b/pkg/noun/build.zig index a6785c4ef3..276d29a2d4 100644 --- a/pkg/noun/build.zig +++ b/pkg/noun/build.zig @@ -273,6 +273,7 @@ const c_source_files = [_][]const u8{ "jets/e/ed_add_double_scalarmult.c", "jets/e/ed_add_scalarmult_scalarmult_base.c", "jets/e/ed_point_add.c", + "jets/e/ed_scad.c", "jets/e/ed_puck.c", "jets/e/ed_luck.c", "jets/e/ed_scalarmult.c", diff --git a/pkg/noun/jets/137/tree.c b/pkg/noun/jets/137/tree.c index 85ab0fc2aa..9b8b4c95c8 100644 --- a/pkg/noun/jets/137/tree.c +++ b/pkg/noun/jets/137/tree.c @@ -112,6 +112,10 @@ static u3j_harm _137_hex__crc32_a[] = {{".2", u3we_crc32}, {}}; static u3j_core _137_hex__crc_d[] = {{"crc32", 7, _137_hex__crc32_a, 0, no_hashes }, {}}; +static u3j_harm _137_hex_coed__ed_scad_a[] = {{".2", u3wee_scad}, {}}; +static u3j_harm _137_hex_coed__ed_scas_a[] = {{".2", u3wee_scas}, {}}; +static u3j_harm _137_hex_coed__ed_scap_a[] = {{".2", u3wee_scap}, {}}; + static u3j_harm _137_hex_coed__ed_puck_a[] = {{".2", u3wee_puck}, {}}; static u3j_harm _137_hex_coed__ed_luck_a[] = {{".2", u3wee_luck}, {}}; static u3j_harm _137_hex_coed__ed_sign_a[] = {{".2", u3wee_sign}, {}}; @@ -143,6 +147,9 @@ static u3j_core _137_hex_coed__ed_d[] = { "sign-octs-raw", 7, _137_hex_coed__ed_sign_octs_raw_a, 0, no_hashes }, { "puck", 7, _137_hex_coed__ed_puck_a, 0, no_hashes }, { "luck", 7, _137_hex_coed__ed_luck_a, 0, no_hashes }, + { "scad", 7, _137_hex_coed__ed_scad_a, 0, no_hashes }, + { "scas", 7, _137_hex_coed__ed_scas_a, 0, no_hashes }, + { "scap", 7, _137_hex_coed__ed_scap_a, 0, no_hashes }, { "veri-octs", 7, _137_hex_coed__ed_veri_octs_a, 0, no_hashes }, { "shar", 7, _137_hex_coed__ed_shar_a, 0, no_hashes }, { "point-add", 7, _137_hex_coed__ed_point_add_a, 0, 0 }, diff --git a/pkg/noun/jets/e/ed_scad.c b/pkg/noun/jets/e/ed_scad.c new file mode 100644 index 0000000000..81735d6e30 --- /dev/null +++ b/pkg/noun/jets/e/ed_scad.c @@ -0,0 +1,117 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + static u3_atom + _cqee_scad(u3_atom pub, u3_atom sek, u3_atom sca) + { + c3_y pub_y[32]; + c3_y sek_y[64]; + c3_y sca_y[32]; + + if ( 0 != u3r_bytes_fit(32, pub_y, pub) ) { + // hoon explicitly crashes on mis-size + return u3m_bail(c3__exit); + } + if ( 0 != u3r_bytes_fit(64, sek_y, sek) ) { + // hoon explicitly crashes on mis-size + return u3m_bail(c3__exit); + } + if ( 0 != u3r_bytes_fit(32, sca_y, sca) ) { + // hoon explicitly crashes on mis-size + return u3m_bail(c3__exit); + } + else { + urcrypt_ed_add_scalar_public_private(pub_y, sek_y, sca_y); + return u3nc(u3i_bytes(32, pub_y), u3i_bytes(64, sek_y)); + } + } + + u3_noun + u3wee_scad(u3_noun cor) + { + u3_noun pub, sek, sca; + if ( c3n == u3r_mean(cor, + u3x_sam_2, &pub, + u3x_sam_6, &sek, + u3x_sam_7, &sca, 0) ) { + return u3m_bail(c3__exit); + } + else { + return _cqee_scad(pub, sek, sca); + } + } + + static u3_atom + _cqee_scas(u3_atom sek, u3_atom sca) + { + c3_y sek_y[64]; + c3_y sca_y[32]; + + if ( 0 != u3r_bytes_fit(64, sek_y, sek) ) { + // hoon explicitly crashes on mis-size + return u3m_bail(c3__exit); + } + if ( 0 != u3r_bytes_fit(32, sca_y, sca) ) { + // hoon explicitly crashes on mis-size + return u3m_bail(c3__exit); + } + else { + urcrypt_ed_add_scalar_private(sek_y, sca_y); + return u3i_bytes(64, sek_y); + } + } + + u3_noun + u3wee_scas(u3_noun cor) + { + u3_noun sek, sca; + if ( c3n == u3r_mean(cor, + u3x_sam_2, &sek, + u3x_sam_3, &sca, 0) ) { + return u3m_bail(c3__exit); + } + else { + return _cqee_scas(sek, sca); + } + } + + static u3_atom + _cqee_scap(u3_atom pub, u3_atom sca) + { + c3_y pub_y[32]; + c3_y sca_y[32]; + + if ( 0 != u3r_bytes_fit(32, pub_y, pub) ) { + // hoon explicitly crashes on mis-size + return u3m_bail(c3__exit); + } + if ( 0 != u3r_bytes_fit(32, sca_y, sca) ) { + // hoon explicitly crashes on mis-size + return u3m_bail(c3__exit); + } + else { + urcrypt_ed_add_scalar_public(pub_y, sca_y); + return u3i_bytes(32, pub_y); + } + } + + u3_noun + u3wee_scap(u3_noun cor) + { + u3_noun pub, sca; + if ( c3n == u3r_mean(cor, + u3x_sam_2, &pub, + u3x_sam_3, &sca, 0) ) { + return u3m_bail(c3__exit); + } + else { + return _cqee_scap(pub, sca); + } + } + + diff --git a/pkg/noun/jets/w.h b/pkg/noun/jets/w.h index f025c3b527..e84c3c8912 100644 --- a/pkg/noun/jets/w.h +++ b/pkg/noun/jets/w.h @@ -193,6 +193,10 @@ u3_noun u3weo_raw(u3_noun); + u3_noun u3wee_scad(u3_noun); + u3_noun u3wee_scas(u3_noun); + u3_noun u3wee_scap(u3_noun); + u3_noun u3wee_puck(u3_noun); u3_noun u3wee_luck(u3_noun); u3_noun u3wee_sign(u3_noun); From d272b6ef6ab8b8d5cac2dc906f52a273ad345433 Mon Sep 17 00:00:00 2001 From: ziffee Date: Sat, 7 Dec 2024 05:20:25 +0700 Subject: [PATCH 3/9] zif/ed-reform: clean up ed jet mismatches --- ext/urcrypt/build.zig.zon | 4 +- pkg/noun/build.zig | 3 ++ pkg/noun/jets/137/tree.c | 14 +++++++ pkg/noun/jets/e/ed_add_double_scalarmult.c | 3 +- pkg/noun/jets/e/ed_point_neg.c | 37 +++++++++++++++++ pkg/noun/jets/e/ed_recs.c | 48 ++++++++++++++++++++++ pkg/noun/jets/e/ed_scad.c | 19 ++++++--- pkg/noun/jets/e/ed_scalarmult.c | 27 ++++++++---- pkg/noun/jets/e/ed_scalarmult_base.c | 21 +++++++--- pkg/noun/jets/e/ed_sign.c | 22 ++++++++-- pkg/noun/jets/e/ed_smac.c | 44 ++++++++++++++++++++ pkg/noun/jets/e/ed_veri.c | 13 ++++-- pkg/noun/jets/q.h | 2 + pkg/noun/jets/w.h | 3 ++ 14 files changed, 231 insertions(+), 29 deletions(-) create mode 100644 pkg/noun/jets/e/ed_point_neg.c create mode 100644 pkg/noun/jets/e/ed_recs.c create mode 100644 pkg/noun/jets/e/ed_smac.c diff --git a/ext/urcrypt/build.zig.zon b/ext/urcrypt/build.zig.zon index 396ca83376..d620cbe198 100644 --- a/ext/urcrypt/build.zig.zon +++ b/ext/urcrypt/build.zig.zon @@ -14,8 +14,8 @@ .hash = "1220bb683a6df744e618f58a008eaae3eb62b70a78334cec676bd82b1b9e8e944eeb", }, .urcrypt = .{ - .url = "https://github.com/urbit/urcrypt/archive/9599acb4e12002ddb1c39591bb9477621f848470.tar.gz", - .hash = "12203c3694e5871a0a6b70cef76cc0fab15a8eb1dabbb4d1fe14f454a738db41a53f", + .url = "https://github.com/urbit/urcrypt/archive/a2fce2dc89f41b92c5968d0f1957a32ad2bc1b18.tar.gz", + .hash = "12202d26b62e20533073012985d869607c88a5718f71e7be6b459ba1508e251dfdbd", }, }, .paths = .{ diff --git a/pkg/noun/build.zig b/pkg/noun/build.zig index 276d29a2d4..73d6d79e1e 100644 --- a/pkg/noun/build.zig +++ b/pkg/noun/build.zig @@ -273,7 +273,10 @@ const c_source_files = [_][]const u8{ "jets/e/ed_add_double_scalarmult.c", "jets/e/ed_add_scalarmult_scalarmult_base.c", "jets/e/ed_point_add.c", + "jets/e/ed_point_neg.c", "jets/e/ed_scad.c", + "jets/e/ed_recs.c", + "jets/e/ed_smac.c", "jets/e/ed_puck.c", "jets/e/ed_luck.c", "jets/e/ed_scalarmult.c", diff --git a/pkg/noun/jets/137/tree.c b/pkg/noun/jets/137/tree.c index 9b8b4c95c8..be2f4f76d0 100644 --- a/pkg/noun/jets/137/tree.c +++ b/pkg/noun/jets/137/tree.c @@ -123,8 +123,18 @@ static u3j_harm _137_hex_coed__ed_sign_raw_a[] = {{".2", u3wee_sign_raw}, {}}; static u3j_harm _137_hex_coed__ed_sign_octs_a[] = {{".2", u3wee_sign_octs}, {}}; static u3j_harm _137_hex_coed__ed_sign_octs_raw_a[] = {{".2", u3wee_sign_octs_raw}, {}}; static u3j_harm _137_hex_coed__ed_veri_octs_a[] = {{".2", u3wee_veri_octs}, {}}; +static u3j_harm _137_hex_coed__ed_veri_a[] = {{".2", u3wee_veri}, {}}; static u3j_harm _137_hex_coed__ed_shar_a[] = {{".2", u3wee_shar}, {}}; +static u3j_harm _137_hex_coed__ed_smac_a[] = + {{".2", u3wee_smac}, {}}; + +static u3j_harm _137_hex_coed__ed_recs_a[] = + {{".2", u3wee_recs}, {}}; + +static u3j_harm _137_hex_coed__ed_point_neg_a[] = + {{".2", u3wee_point_neg}, {}}; + static u3j_harm _137_hex_coed__ed_point_add_a[] = {{".2", u3wee_point_add}, {}}; @@ -151,8 +161,12 @@ static u3j_core _137_hex_coed__ed_d[] = { "scas", 7, _137_hex_coed__ed_scas_a, 0, no_hashes }, { "scap", 7, _137_hex_coed__ed_scap_a, 0, no_hashes }, { "veri-octs", 7, _137_hex_coed__ed_veri_octs_a, 0, no_hashes }, + { "veri", 7, _137_hex_coed__ed_veri_a, 0, no_hashes }, { "shar", 7, _137_hex_coed__ed_shar_a, 0, no_hashes }, { "point-add", 7, _137_hex_coed__ed_point_add_a, 0, 0 }, + { "point-neg", 7, _137_hex_coed__ed_point_neg_a, 0, 0 }, + { "recs", 7, _137_hex_coed__ed_recs_a, 0, 0 }, + { "smac", 7, _137_hex_coed__ed_smac_a, 0, 0 }, { "scalarmult", 7, _137_hex_coed__ed_scalarmult_a, 0, no_hashes }, { "scalarmult-base", 7, _137_hex_coed__ed_scalarmult_base_a, 0, diff --git a/pkg/noun/jets/e/ed_add_double_scalarmult.c b/pkg/noun/jets/e/ed_add_double_scalarmult.c index b37f3e00e7..68c99f6b1e 100644 --- a/pkg/noun/jets/e/ed_add_double_scalarmult.c +++ b/pkg/noun/jets/e/ed_add_double_scalarmult.c @@ -37,7 +37,8 @@ u3x_sam_15, &d, 0)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) || - (c3n == u3ud(c)) ) + (c3n == u3ud(c)) || + (c3n == u3ud(d)) ) { return u3m_bail(c3__exit); } else { diff --git a/pkg/noun/jets/e/ed_point_neg.c b/pkg/noun/jets/e/ed_point_neg.c new file mode 100644 index 0000000000..15ae38eca9 --- /dev/null +++ b/pkg/noun/jets/e/ed_point_neg.c @@ -0,0 +1,37 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + + static u3_atom + _cqee_point_neg(u3_atom a) + { + c3_y a_y[32]; + + if ( (0 != u3r_bytes_fit(32, a_y, a)) || + (0 != urcrypt_ed_point_neg(a_y)) ) { + return u3_none; + } + else { + return u3i_bytes(32, a_y); + } + } + + u3_noun + u3wee_point_neg(u3_noun cor) + { + + u3_noun a; + + if ( (u3_none == (a = u3r_at(u3x_sam, cor))) || + (c3n == u3ud(a)) ) + { + return u3m_bail(c3__exit); + } else { + return u3l_punt("point-neg", _cqee_point_neg(a)); + } + } diff --git a/pkg/noun/jets/e/ed_recs.c b/pkg/noun/jets/e/ed_recs.c new file mode 100644 index 0000000000..1520e0559a --- /dev/null +++ b/pkg/noun/jets/e/ed_recs.c @@ -0,0 +1,48 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + // `@ux`(rev 3 32 l:ed:crypto) + static c3_y _cqee_l_prime[] = { + 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, + 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + }; + + u3_atom + u3qee_recs(u3_atom a) + { + c3_w met_w = u3r_met(3, a); + + if ( 64 < met_w ) { + u3_atom l_prime = u3i_bytes(32, _cqee_l_prime); + u3_atom pro = u3qa_mod(a, l_prime); + u3z(l_prime); + return pro; + } + + c3_y a_y[64], out_y[32]; + + u3r_bytes(0, 64, a_y, a); + urcrypt_ed_scalar_reduce(a_y); + return u3i_bytes(32, out_y); + } + + u3_noun + u3wee_recs(u3_noun cor) + { + u3_noun a; + + if ( (u3_none == (a = u3r_at(u3x_sam, cor))) || + (c3n == u3ud(a)) ) + { + return u3m_bail(c3__exit); + } else { + return u3qee_recs(a); + } + } diff --git a/pkg/noun/jets/e/ed_scad.c b/pkg/noun/jets/e/ed_scad.c index 81735d6e30..af95563424 100644 --- a/pkg/noun/jets/e/ed_scad.c +++ b/pkg/noun/jets/e/ed_scad.c @@ -35,10 +35,13 @@ u3wee_scad(u3_noun cor) { u3_noun pub, sek, sca; - if ( c3n == u3r_mean(cor, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &pub, u3x_sam_6, &sek, - u3x_sam_7, &sca, 0) ) { + u3x_sam_7, &sca, 0)) || + (c3n == u3ud(pub)) || + (c3n == u3ud(sek)) || + (c3n == u3ud(sca)) ) { return u3m_bail(c3__exit); } else { @@ -70,9 +73,11 @@ u3wee_scas(u3_noun cor) { u3_noun sek, sca; - if ( c3n == u3r_mean(cor, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &sek, - u3x_sam_3, &sca, 0) ) { + u3x_sam_3, &sca, 0)) || + (c3n == u3ud(sek)) || + (c3n == u3ud(sca)) ) { return u3m_bail(c3__exit); } else { @@ -104,9 +109,11 @@ u3wee_scap(u3_noun cor) { u3_noun pub, sca; - if ( c3n == u3r_mean(cor, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &pub, - u3x_sam_3, &sca, 0) ) { + u3x_sam_3, &sca, 0)) || + (c3n == u3ud(pub)) || + (c3n == u3ud(sca)) ) { return u3m_bail(c3__exit); } else { diff --git a/pkg/noun/jets/e/ed_scalarmult.c b/pkg/noun/jets/e/ed_scalarmult.c index 9cc3f77481..041bbb48b4 100644 --- a/pkg/noun/jets/e/ed_scalarmult.c +++ b/pkg/noun/jets/e/ed_scalarmult.c @@ -10,13 +10,26 @@ _cqee_scalarmult(u3_atom a, u3_atom b) { - c3_y a_y[32], b_y[32], out_y[32]; + c3_y b_y[32]; + if (0 != u3r_bytes_fit(32, b_y, b)) { + return u3m_bail(c3__exit); + } + + c3_w met_w = u3r_met(3, a); + // scalarmult expects a_y[31] <= 127 + if ( (32 < met_w) || + ( (32 == met_w) && + (127 < u3r_byte(a, 31)) ) + ) { + a = u3qee_recs(a); + } + + c3_y a_y[32], out_y[32]; + u3r_bytes(0, 32, a_y, a); - if ( (0 != u3r_bytes_fit(32, a_y, a)) || - (0 != u3r_bytes_fit(32, b_y, b)) || - (0 != urcrypt_ed_scalarmult(a_y, b_y, out_y)) ) { - // hoon does not check size of inputs - return u3_none; + if ( (0 != urcrypt_ed_scalarmult(a_y, b_y, out_y)) ) { + // at this point, will only fail if b is bad point + return u3m_bail(c3__exit); } else { return u3i_bytes(32, out_y); @@ -35,6 +48,6 @@ { return u3m_bail(c3__exit); } else { - return u3l_punt("scalarmult", _cqee_scalarmult(a, b)); + return _cqee_scalarmult(a, b); } } diff --git a/pkg/noun/jets/e/ed_scalarmult_base.c b/pkg/noun/jets/e/ed_scalarmult_base.c index e000515156..2b66e6f1ba 100644 --- a/pkg/noun/jets/e/ed_scalarmult_base.c +++ b/pkg/noun/jets/e/ed_scalarmult_base.c @@ -9,14 +9,23 @@ static u3_atom _cqee_scalarmult_base(u3_atom a) { - c3_y a_y[32]; + c3_w met_w = u3r_met(3, a); + // scalarmult_base expects a_y[31] <= 127 + if ( (32 < met_w) || + ( (32 == met_w) && + (127 < u3r_byte(a, 31)) ) + ) { + a = u3qee_recs(a); + } + + c3_y a_y[32], out_y[32]; + u3r_bytes(0, 32, a_y, a); - if ( 0 != u3r_bytes_fit(32, a_y, a) ) { - return u3_none; + if ( (0 != u3r_bytes_fit(32, a_y, a)) || + (0 != urcrypt_ed_scalarmult_base(a_y, out_y)) ) { + return u3m_bail(c3__exit); } else { - c3_y out_y[32]; - urcrypt_ed_scalarmult_base(a_y, out_y); return u3i_bytes(32, out_y); } } @@ -30,6 +39,6 @@ return u3m_bail(c3__exit); } else { - return u3l_punt("scalarmult-base", _cqee_scalarmult_base(a)); + return _cqee_scalarmult_base(a); } } diff --git a/pkg/noun/jets/e/ed_sign.c b/pkg/noun/jets/e/ed_sign.c index 8e7421f402..ca8e9579f0 100644 --- a/pkg/noun/jets/e/ed_sign.c +++ b/pkg/noun/jets/e/ed_sign.c @@ -35,7 +35,11 @@ u3_noun msg, sed; u3_noun len, dat; if ( c3n == u3r_mean(cor, u3x_sam_2, &msg, u3x_sam_3, &sed, 0) || - c3n == u3r_cell(msg, &len, &dat) ) { + c3n == u3r_cell(msg, &len, &dat) || + c3n == u3ud(msg) || + c3n == u3ud(sed) || + c3n == u3ud(len) || + c3n == u3ud(dat) ) { return u3m_bail(c3__fail); } else { return _cqee_sign_octs(len, dat, sed); @@ -73,7 +77,12 @@ u3_noun msg, pub, sek; u3_noun len, dat; if ( c3n == u3r_mean(cor, u3x_sam_2, &msg, u3x_sam_6, &pub, u3x_sam_7, &sek, 0) || - c3n == u3r_cell(msg, &len, &dat) ) { + c3n == u3r_cell(msg, &len, &dat) || + c3n == u3ud(msg) || + c3n == u3ud(pub) || + c3n == u3ud(sek) || + c3n == u3ud(len) || + c3n == u3ud(dat) ) { return u3m_bail(c3__fail); } else { return _cqee_sign_octs_raw(len, dat, pub, sek); @@ -107,7 +116,9 @@ { u3_noun msg, sed; if ( c3n == u3r_mean(cor, - u3x_sam_2, &msg, u3x_sam_3, &sed, 0) ) { + u3x_sam_2, &msg, u3x_sam_3, &sed, 0) || + c3n == u3ud(msg) || + c3n == u3ud(sed) ) { return u3m_bail(c3__fail); } else { return _cqee_sign(msg, sed); @@ -146,7 +157,10 @@ { u3_noun msg, pub, sek; if ( c3n == u3r_mean(cor, - u3x_sam_2, &msg, u3x_sam_6, &pub, u3x_sam_7, &sek, 0) ) { + u3x_sam_2, &msg, u3x_sam_6, &pub, u3x_sam_7, &sek, 0) || + c3n == u3ud(msg) || + c3n == u3ud(pub) || + c3n == u3ud(sek) ) { return u3m_bail(c3__fail); } else { return _cqee_sign_raw(msg, pub, sek); diff --git a/pkg/noun/jets/e/ed_smac.c b/pkg/noun/jets/e/ed_smac.c new file mode 100644 index 0000000000..df82d89518 --- /dev/null +++ b/pkg/noun/jets/e/ed_smac.c @@ -0,0 +1,44 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + static u3_atom + _cqee_smac(u3_atom a, + u3_atom b, + u3_atom c) + { + c3_y a_y[32], b_y[32], c_y[32], out_y[32]; + + if ( (0 != u3r_bytes_fit(32, a_y, a)) || + (0 != u3r_bytes_fit(32, b_y, b)) || + (0 != u3r_bytes_fit(32, c_y, c)) ) { + // hoon does not check size of inputs + return u3_none; + } + else { + urcrypt_ed_scalar_muladd(a_y, b_y, c_y, out_y); + return u3i_bytes(32, out_y); + } + } + + u3_noun + u3wee_smac(u3_noun cor) + { + u3_noun a, b, c; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, + u3x_sam_6, &b, + u3x_sam_7, &c, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) || + (c3n == u3ud(c)) ) + { + return u3m_bail(c3__exit); + } else { + return u3l_punt("smac", _cqee_smac(a, b, c)); + } + } diff --git a/pkg/noun/jets/e/ed_veri.c b/pkg/noun/jets/e/ed_veri.c index 82649fb939..1440073332 100644 --- a/pkg/noun/jets/e/ed_veri.c +++ b/pkg/noun/jets/e/ed_veri.c @@ -37,7 +37,11 @@ if ( c3n == u3r_mean(cor, u3x_sam_2, &sig, u3x_sam_6, &msg, u3x_sam_7, &pub, 0) || - c3n == u3r_cell(msg, &len, &dat) ){ + c3n == u3r_cell(msg, &len, &dat) || + (c3n == u3ud(sig)) || + (c3n == u3ud(pub)) || + (c3n == u3ud(len)) || + (c3n == u3ud(dat)) ) { return u3m_bail(c3__fail); } else { return u3l_punt("veri-octs", _cqee_veri_octs(sig, len, dat, pub)); @@ -70,9 +74,12 @@ u3wee_veri(u3_noun cor) { u3_noun a, b, c; - if ( c3n == u3r_mean(cor, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, - u3x_sam_7, &c, 0) ) { + u3x_sam_7, &c, 0)) || + (c3n == u3ud(a)) || + (c3n == u3ud(b)) || + (c3n == u3ud(c)) ) { return u3m_bail(c3__fail); } else { return u3l_punt("veri", _cqee_veri(a, b, c)); diff --git a/pkg/noun/jets/q.h b/pkg/noun/jets/q.h index a12d4766a8..5160058a9d 100644 --- a/pkg/noun/jets/q.h +++ b/pkg/noun/jets/q.h @@ -157,6 +157,8 @@ u3_noun u3qea_de(u3_atom, u3_atom); u3_noun u3qea_en(u3_atom, u3_atom); + u3_noun u3qee_recs(u3_atom); + u3_atom u3qe_fein_ob(u3_atom pyn); u3_atom u3qe_fynd_ob(u3_atom pyn); diff --git a/pkg/noun/jets/w.h b/pkg/noun/jets/w.h index e84c3c8912..4f5f9a5913 100644 --- a/pkg/noun/jets/w.h +++ b/pkg/noun/jets/w.h @@ -206,6 +206,9 @@ u3_noun u3wee_sign_octs_raw(u3_noun); u3_noun u3wee_veri_octs(u3_noun); u3_noun u3wee_shar(u3_noun); + u3_noun u3wee_recs(u3_noun); + u3_noun u3wee_smac(u3_noun); + u3_noun u3wee_point_neg(u3_noun); u3_noun u3wee_point_add(u3_noun); u3_noun u3wee_scalarmult(u3_noun); u3_noun u3wee_scalarmult_base(u3_noun); From e94afeafd2ac3a8c60867c9ed1fcbb5dd862c3ab Mon Sep 17 00:00:00 2001 From: ziffee Date: Sun, 8 Dec 2024 03:00:02 +0700 Subject: [PATCH 4/9] zif/ed-reform: fix urcrypt build.zig.zon --- ext/urcrypt/build.zig.zon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/urcrypt/build.zig.zon b/ext/urcrypt/build.zig.zon index d620cbe198..ed4185da66 100644 --- a/ext/urcrypt/build.zig.zon +++ b/ext/urcrypt/build.zig.zon @@ -15,7 +15,7 @@ }, .urcrypt = .{ .url = "https://github.com/urbit/urcrypt/archive/a2fce2dc89f41b92c5968d0f1957a32ad2bc1b18.tar.gz", - .hash = "12202d26b62e20533073012985d869607c88a5718f71e7be6b459ba1508e251dfdbd", + .hash = "1220d3f0c818e51987892b7d3eb9cd5ccde1f72f41288a715100ab5b9f5db85ddb71", }, }, .paths = .{ From 65372bc3f728faee4731646991af2b7d0ad6c530 Mon Sep 17 00:00:00 2001 From: ziffee Date: Sun, 8 Dec 2024 18:34:59 +0700 Subject: [PATCH 5/9] zif/ed-reform: further jet cleanup, add slar:ed --- ext/urcrypt/build.zig.zon | 4 +- pkg/noun/jets/137/tree.c | 2 + pkg/noun/jets/e/ed_add_double_scalarmult.c | 48 ++++++++++++++----- .../e/ed_add_scalarmult_scalarmult_base.c | 39 +++++++++++---- pkg/noun/jets/e/ed_point_add.c | 2 +- pkg/noun/jets/e/ed_point_neg.c | 2 +- pkg/noun/jets/e/ed_recs.c | 4 +- pkg/noun/jets/e/ed_scalarmult.c | 11 +++-- pkg/noun/jets/e/ed_scalarmult_base.c | 13 ++--- pkg/noun/jets/e/ed_shar.c | 47 +++++++++++++++--- pkg/noun/jets/e/ed_sign.c | 2 - pkg/noun/jets/e/ed_smac.c | 47 ++++++++++++++---- pkg/noun/jets/e/ed_veri.c | 10 ++-- pkg/noun/jets/w.h | 1 + 14 files changed, 172 insertions(+), 60 deletions(-) diff --git a/ext/urcrypt/build.zig.zon b/ext/urcrypt/build.zig.zon index ed4185da66..0f66f662ac 100644 --- a/ext/urcrypt/build.zig.zon +++ b/ext/urcrypt/build.zig.zon @@ -14,8 +14,8 @@ .hash = "1220bb683a6df744e618f58a008eaae3eb62b70a78334cec676bd82b1b9e8e944eeb", }, .urcrypt = .{ - .url = "https://github.com/urbit/urcrypt/archive/a2fce2dc89f41b92c5968d0f1957a32ad2bc1b18.tar.gz", - .hash = "1220d3f0c818e51987892b7d3eb9cd5ccde1f72f41288a715100ab5b9f5db85ddb71", + .url = "https://github.com/urbit/urcrypt/archive/18d840f517722dd2236207c31dd53935b2c39bf3.tar.gz", + .hash = "1220afb7b4434ef269210822ff84d79c566411f578f80400e23742d9363fca2d05a9", }, }, .paths = .{ diff --git a/pkg/noun/jets/137/tree.c b/pkg/noun/jets/137/tree.c index be2f4f76d0..760f84e593 100644 --- a/pkg/noun/jets/137/tree.c +++ b/pkg/noun/jets/137/tree.c @@ -125,6 +125,7 @@ static u3j_harm _137_hex_coed__ed_sign_octs_raw_a[] = {{".2", u3wee_sign_octs_ra static u3j_harm _137_hex_coed__ed_veri_octs_a[] = {{".2", u3wee_veri_octs}, {}}; static u3j_harm _137_hex_coed__ed_veri_a[] = {{".2", u3wee_veri}, {}}; static u3j_harm _137_hex_coed__ed_shar_a[] = {{".2", u3wee_shar}, {}}; +static u3j_harm _137_hex_coed__ed_slar_a[] = {{".2", u3wee_slar}, {}}; static u3j_harm _137_hex_coed__ed_smac_a[] = {{".2", u3wee_smac}, {}}; @@ -163,6 +164,7 @@ static u3j_core _137_hex_coed__ed_d[] = { "veri-octs", 7, _137_hex_coed__ed_veri_octs_a, 0, no_hashes }, { "veri", 7, _137_hex_coed__ed_veri_a, 0, no_hashes }, { "shar", 7, _137_hex_coed__ed_shar_a, 0, no_hashes }, + { "slar", 7, _137_hex_coed__ed_slar_a, 0, no_hashes }, { "point-add", 7, _137_hex_coed__ed_point_add_a, 0, 0 }, { "point-neg", 7, _137_hex_coed__ed_point_neg_a, 0, 0 }, { "recs", 7, _137_hex_coed__ed_recs_a, 0, 0 }, diff --git a/pkg/noun/jets/e/ed_add_double_scalarmult.c b/pkg/noun/jets/e/ed_add_double_scalarmult.c index 68c99f6b1e..02c85884e2 100644 --- a/pkg/noun/jets/e/ed_add_double_scalarmult.c +++ b/pkg/noun/jets/e/ed_add_double_scalarmult.c @@ -8,18 +8,43 @@ static u3_atom _cqee_add_double_scalarmult(u3_atom a, + u3_atom a_point, u3_atom b, - u3_atom c, - u3_atom d) + u3_atom b_point) { - c3_y a_y[32], b_y[32], c_y[32], d_y[32], out_y[32]; - - if ( (0 != u3r_bytes_fit(32, a_y, a)) || - (0 != u3r_bytes_fit(32, b_y, b)) || - (0 != u3r_bytes_fit(32, c_y, c)) || - (0 != u3r_bytes_fit(32, d_y, d)) || - (0 != urcrypt_ed_add_double_scalarmult(a_y, b_y, c_y, d_y, out_y)) ) { - return u3_none; + c3_y a_y[32], a_point_y[32], + b_y[32], b_point_y[32], + out_y[32]; + c3_w met_w; + + met_w = u3r_met(3, a); + if ( (32 < met_w) || + ( (32 == met_w) && + (127 < u3r_byte(a, 31)) ) + ) { + u3_noun a_recs = u3qee_recs(a); + u3r_bytes(0, 32, a_y, a_recs); + u3z(a_recs); + } else { + u3r_bytes(0, 32, a_y, a); + } + + met_w = u3r_met(3, b); + if ( (32 < met_w) || + ( (32 == met_w) && + (127 < u3r_byte(b, 31)) ) + ) { + u3_noun b_recs = u3qee_recs(b); + u3r_bytes(0, 32, b_y, b_recs); + u3z(b_recs); + } else { + u3r_bytes(0, 32, b_y, b); + } + + if ( (0 != u3r_bytes_fit(32, a_point_y, a_point)) || + (0 != u3r_bytes_fit(32, b_point_y, b_point)) || + (0 != urcrypt_ed_add_double_scalarmult(a_y, a_point_y, b_y, b_point_y, out_y)) ) { + return u3m_bail(c3__exit); } else { return u3i_bytes(32, out_y); @@ -42,7 +67,6 @@ { return u3m_bail(c3__exit); } else { - return u3l_punt("add-double-scalarmult", - _cqee_add_double_scalarmult(a, b, c, d)); + return _cqee_add_double_scalarmult(a, b, c, d); } } diff --git a/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c b/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c index 6ec27bfaeb..1c25f53d97 100644 --- a/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c +++ b/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c @@ -8,16 +8,39 @@ static u3_atom _cqee_add_scalarmult_scalarmult_base(u3_atom a, - u3_atom b, - u3_atom c) + u3_atom a_point, + u3_atom b) { - c3_y a_y[32], b_y[32], c_y[32], out_y[32]; + c3_y a_y[32], a_point_y[32], b_y[32], out_y[32]; + c3_w met_w; - if ( (0 != u3r_bytes_fit(32, a_y, a)) || - (0 != u3r_bytes_fit(32, b_y, b)) || - (0 != u3r_bytes_fit(32, c_y, c)) || - (0 != urcrypt_ed_add_scalarmult_scalarmult_base(a_y, b_y, c_y, out_y)) ) { - return u3_none; + met_w = u3r_met(3, a); + if ( (32 < met_w) || + ( (32 == met_w) && + (127 < u3r_byte(a, 31)) ) + ) { + u3_noun a_recs = u3qee_recs(a); + u3r_bytes(0, 32, a_y, a_recs); + u3z(a_recs); + } else { + u3r_bytes(0, 32, a_y, a); + } + + met_w = u3r_met(3, b); + if ( (32 < met_w) || + ( (32 == met_w) && + (127 < u3r_byte(b, 31)) ) + ) { + u3_noun b_recs = u3qee_recs(b); + u3r_bytes(0, 32, b_y, b_recs); + u3z(b_recs); + } else { + u3r_bytes(0, 32, b_y, b); + } + + if ( (0 != u3r_bytes_fit(32, a_point_y, a_point)) || + (0 != urcrypt_ed_add_scalarmult_scalarmult_base(a_y, a_point_y, b_y, out_y)) ) { + return u3m_bail(c3__exit); } else { return u3i_bytes(32, out_y); diff --git a/pkg/noun/jets/e/ed_point_add.c b/pkg/noun/jets/e/ed_point_add.c index 20ce3041ef..f097f15102 100644 --- a/pkg/noun/jets/e/ed_point_add.c +++ b/pkg/noun/jets/e/ed_point_add.c @@ -35,6 +35,6 @@ { return u3m_bail(c3__exit); } else { - return u3l_punt("point-add", _cqee_point_add(a, b)); + return _cqee_point_add(a, b); } } diff --git a/pkg/noun/jets/e/ed_point_neg.c b/pkg/noun/jets/e/ed_point_neg.c index 15ae38eca9..5f0cacc0c0 100644 --- a/pkg/noun/jets/e/ed_point_neg.c +++ b/pkg/noun/jets/e/ed_point_neg.c @@ -32,6 +32,6 @@ { return u3m_bail(c3__exit); } else { - return u3l_punt("point-neg", _cqee_point_neg(a)); + return _cqee_point_neg(a); } } diff --git a/pkg/noun/jets/e/ed_recs.c b/pkg/noun/jets/e/ed_recs.c index 1520e0559a..bdcf2249cc 100644 --- a/pkg/noun/jets/e/ed_recs.c +++ b/pkg/noun/jets/e/ed_recs.c @@ -26,11 +26,11 @@ return pro; } - c3_y a_y[64], out_y[32]; + c3_y a_y[64]; u3r_bytes(0, 64, a_y, a); urcrypt_ed_scalar_reduce(a_y); - return u3i_bytes(32, out_y); + return u3i_bytes(32, a_y); } u3_noun diff --git a/pkg/noun/jets/e/ed_scalarmult.c b/pkg/noun/jets/e/ed_scalarmult.c index 041bbb48b4..22714eee79 100644 --- a/pkg/noun/jets/e/ed_scalarmult.c +++ b/pkg/noun/jets/e/ed_scalarmult.c @@ -10,7 +10,7 @@ _cqee_scalarmult(u3_atom a, u3_atom b) { - c3_y b_y[32]; + c3_y a_y[32], b_y[32], out_y[32]; if (0 != u3r_bytes_fit(32, b_y, b)) { return u3m_bail(c3__exit); } @@ -21,12 +21,13 @@ ( (32 == met_w) && (127 < u3r_byte(a, 31)) ) ) { - a = u3qee_recs(a); + u3_noun a_recs = u3qee_recs(a); + u3r_bytes(0, 32, a_y, a_recs); + u3z(a_recs); + } else { + u3r_bytes(0, 32, a_y, a); } - c3_y a_y[32], out_y[32]; - u3r_bytes(0, 32, a_y, a); - if ( (0 != urcrypt_ed_scalarmult(a_y, b_y, out_y)) ) { // at this point, will only fail if b is bad point return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/e/ed_scalarmult_base.c b/pkg/noun/jets/e/ed_scalarmult_base.c index 2b66e6f1ba..6242b331af 100644 --- a/pkg/noun/jets/e/ed_scalarmult_base.c +++ b/pkg/noun/jets/e/ed_scalarmult_base.c @@ -9,20 +9,21 @@ static u3_atom _cqee_scalarmult_base(u3_atom a) { + c3_y a_y[32], out_y[32]; c3_w met_w = u3r_met(3, a); // scalarmult_base expects a_y[31] <= 127 if ( (32 < met_w) || ( (32 == met_w) && (127 < u3r_byte(a, 31)) ) ) { - a = u3qee_recs(a); + u3_noun a_recs = u3qee_recs(a); + u3r_bytes(0, 32, a_y, a_recs); + u3z(a_recs); + } else { + u3r_bytes(0, 32, a_y, a); } - c3_y a_y[32], out_y[32]; - u3r_bytes(0, 32, a_y, a); - - if ( (0 != u3r_bytes_fit(32, a_y, a)) || - (0 != urcrypt_ed_scalarmult_base(a_y, out_y)) ) { + if (0 != urcrypt_ed_scalarmult_base(a_y, out_y)) { return u3m_bail(c3__exit); } else { diff --git a/pkg/noun/jets/e/ed_shar.c b/pkg/noun/jets/e/ed_shar.c index 30f3920c8b..becff5909a 100644 --- a/pkg/noun/jets/e/ed_shar.c +++ b/pkg/noun/jets/e/ed_shar.c @@ -7,27 +7,62 @@ #include "urcrypt.h" static u3_atom - _cqee_shar(u3_atom pub, u3_atom sek) + _cqee_shar(u3_atom pub, u3_atom sed) { - c3_y pub_y[32], sek_y[32]; + c3_y pub_y[32], sed_y[32]; if ( 0 != u3r_bytes_fit(32, pub_y, pub) ) { // pub is not size checked in the hoon return u3_none; } - else if ( 0 != u3r_bytes_fit(32, sek_y, sek) ) { - // sek explicitly bails through suck + else if ( 0 != u3r_bytes_fit(32, sed_y, sed) ) { + // sed explicitly bails through suck return u3m_bail(c3__exit); } else { c3_y shr_y[32]; - urcrypt_ed_shar(pub_y, sek_y, shr_y); + urcrypt_ed_shar(pub_y, sed_y, shr_y); return u3i_bytes(32, shr_y); } } u3_noun u3wee_shar(u3_noun cor) + { + u3_noun pub, sed; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &pub, u3x_sam_3, &sed, 0)) || + (c3n == u3ud(pub)) || + (c3n == u3ud(sed)) ) + { + return u3m_bail(c3__exit); + } else { + return u3l_punt("shar", _cqee_shar(pub, sed)); + } + } + + static u3_atom + _cqee_slar(u3_atom pub, u3_atom sek) + { + c3_y pub_y[32], sek_y[64]; + + if ( 0 != u3r_bytes_fit(32, pub_y, pub) ) { + // pub is not size checked in the hoon + return u3_none; + } + else if ( 0 != u3r_bytes_fit(64, sek_y, sek) ) { + // sek explicitly bails through suck + return u3m_bail(c3__exit); + } + else { + c3_y shr_y[32]; + urcrypt_ed_slar(pub_y, sek_y, shr_y); + return u3i_bytes(32, shr_y); + } + } + + u3_noun + u3wee_slar(u3_noun cor) { u3_noun pub, sek; @@ -37,6 +72,6 @@ { return u3m_bail(c3__exit); } else { - return u3l_punt("shar", _cqee_shar(pub, sek)); + return u3l_punt("slar", _cqee_slar(pub, sek)); } } diff --git a/pkg/noun/jets/e/ed_sign.c b/pkg/noun/jets/e/ed_sign.c index ca8e9579f0..dc5b75bdeb 100644 --- a/pkg/noun/jets/e/ed_sign.c +++ b/pkg/noun/jets/e/ed_sign.c @@ -36,7 +36,6 @@ u3_noun len, dat; if ( c3n == u3r_mean(cor, u3x_sam_2, &msg, u3x_sam_3, &sed, 0) || c3n == u3r_cell(msg, &len, &dat) || - c3n == u3ud(msg) || c3n == u3ud(sed) || c3n == u3ud(len) || c3n == u3ud(dat) ) { @@ -78,7 +77,6 @@ u3_noun len, dat; if ( c3n == u3r_mean(cor, u3x_sam_2, &msg, u3x_sam_6, &pub, u3x_sam_7, &sek, 0) || c3n == u3r_cell(msg, &len, &dat) || - c3n == u3ud(msg) || c3n == u3ud(pub) || c3n == u3ud(sek) || c3n == u3ud(len) || diff --git a/pkg/noun/jets/e/ed_smac.c b/pkg/noun/jets/e/ed_smac.c index df82d89518..9e2229d5dc 100644 --- a/pkg/noun/jets/e/ed_smac.c +++ b/pkg/noun/jets/e/ed_smac.c @@ -12,17 +12,46 @@ u3_atom c) { c3_y a_y[32], b_y[32], c_y[32], out_y[32]; + c3_w met_w; - if ( (0 != u3r_bytes_fit(32, a_y, a)) || - (0 != u3r_bytes_fit(32, b_y, b)) || - (0 != u3r_bytes_fit(32, c_y, c)) ) { - // hoon does not check size of inputs - return u3_none; + met_w = u3r_met(3, a); + if ( (32 < met_w) || + ( (32 == met_w) && + (127 < u3r_byte(a, 31)) ) + ) { + u3_noun a_recs = u3qee_recs(a); + u3r_bytes(0, 32, a_y, a_recs); + u3z(a_recs); + } else { + u3r_bytes(0, 32, a_y, a); } - else { - urcrypt_ed_scalar_muladd(a_y, b_y, c_y, out_y); - return u3i_bytes(32, out_y); + + met_w = u3r_met(3, b); + if ( (32 < met_w) || + ( (32 == met_w) && + (127 < u3r_byte(b, 31)) ) + ) { + u3_noun b_recs = u3qee_recs(b); + u3r_bytes(0, 32, b_y, b_recs); + u3z(b_recs); + } else { + u3r_bytes(0, 32, b_y, b); } + + met_w = u3r_met(3, c); + if ( (32 < met_w) || + ( (32 == met_w) && + (127 < u3r_byte(c, 31)) ) + ) { + u3_noun c_recs = u3qee_recs(c); + u3r_bytes(0, 32, c_y, c_recs); + u3z(c_recs); + } else { + u3r_bytes(0, 32, c_y, c); + } + + urcrypt_ed_scalar_muladd(a_y, b_y, c_y, out_y); + return u3i_bytes(32, out_y); } u3_noun @@ -39,6 +68,6 @@ { return u3m_bail(c3__exit); } else { - return u3l_punt("smac", _cqee_smac(a, b, c)); + return _cqee_smac(a, b, c); } } diff --git a/pkg/noun/jets/e/ed_veri.c b/pkg/noun/jets/e/ed_veri.c index 1440073332..6d7b7502f8 100644 --- a/pkg/noun/jets/e/ed_veri.c +++ b/pkg/noun/jets/e/ed_veri.c @@ -17,8 +17,7 @@ if ( (0 != u3r_bytes_fit(64, sig_y, sig)) || (0 != u3r_bytes_fit(32, pub_y, pub)) || !u3r_word_fit(&len_w, len) ) { - // hoon checks sizes, but weirdly and without crashes - return u3_none; + return c3n; } else { c3_y* dat_y = u3r_bytes_alloc(0, len_w, dat); @@ -44,7 +43,7 @@ (c3n == u3ud(dat)) ) { return u3m_bail(c3__fail); } else { - return u3l_punt("veri-octs", _cqee_veri_octs(sig, len, dat, pub)); + return _cqee_veri_octs(sig, len, dat, pub); } } @@ -57,8 +56,7 @@ if ( (0 != u3r_bytes_fit(64, sig_y, s)) || (0 != u3r_bytes_fit(32, pub_y, pk)) ) { - // hoon checks sizes, but weirdly and without crashes - return u3_none; + return c3n; } else { c3_w met_w; @@ -82,6 +80,6 @@ (c3n == u3ud(c)) ) { return u3m_bail(c3__fail); } else { - return u3l_punt("veri", _cqee_veri(a, b, c)); + return _cqee_veri(a, b, c); } } diff --git a/pkg/noun/jets/w.h b/pkg/noun/jets/w.h index 4f5f9a5913..340ecf2bad 100644 --- a/pkg/noun/jets/w.h +++ b/pkg/noun/jets/w.h @@ -206,6 +206,7 @@ u3_noun u3wee_sign_octs_raw(u3_noun); u3_noun u3wee_veri_octs(u3_noun); u3_noun u3wee_shar(u3_noun); + u3_noun u3wee_slar(u3_noun); u3_noun u3wee_recs(u3_noun); u3_noun u3wee_smac(u3_noun); u3_noun u3wee_point_neg(u3_noun); From cc50192499f1e1c8d2a25be7f1bccb3721b3a778 Mon Sep 17 00:00:00 2001 From: ziffee Date: Sun, 8 Dec 2024 19:45:45 +0700 Subject: [PATCH 6/9] zif/ed-reform: doh, fix u3r_byte call sites --- pkg/noun/jets/e/ed_add_double_scalarmult.c | 4 ++-- pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c | 4 ++-- pkg/noun/jets/e/ed_scalarmult.c | 2 +- pkg/noun/jets/e/ed_scalarmult_base.c | 2 +- pkg/noun/jets/e/ed_smac.c | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/noun/jets/e/ed_add_double_scalarmult.c b/pkg/noun/jets/e/ed_add_double_scalarmult.c index 02c85884e2..65129197cd 100644 --- a/pkg/noun/jets/e/ed_add_double_scalarmult.c +++ b/pkg/noun/jets/e/ed_add_double_scalarmult.c @@ -20,7 +20,7 @@ met_w = u3r_met(3, a); if ( (32 < met_w) || ( (32 == met_w) && - (127 < u3r_byte(a, 31)) ) + (127 < u3r_byte(31, a)) ) ) { u3_noun a_recs = u3qee_recs(a); u3r_bytes(0, 32, a_y, a_recs); @@ -32,7 +32,7 @@ met_w = u3r_met(3, b); if ( (32 < met_w) || ( (32 == met_w) && - (127 < u3r_byte(b, 31)) ) + (127 < u3r_byte(31, b)) ) ) { u3_noun b_recs = u3qee_recs(b); u3r_bytes(0, 32, b_y, b_recs); diff --git a/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c b/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c index 1c25f53d97..ed71a803e1 100644 --- a/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c +++ b/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c @@ -17,7 +17,7 @@ met_w = u3r_met(3, a); if ( (32 < met_w) || ( (32 == met_w) && - (127 < u3r_byte(a, 31)) ) + (127 < u3r_byte(31, a)) ) ) { u3_noun a_recs = u3qee_recs(a); u3r_bytes(0, 32, a_y, a_recs); @@ -29,7 +29,7 @@ met_w = u3r_met(3, b); if ( (32 < met_w) || ( (32 == met_w) && - (127 < u3r_byte(b, 31)) ) + (127 < u3r_byte(31, b)) ) ) { u3_noun b_recs = u3qee_recs(b); u3r_bytes(0, 32, b_y, b_recs); diff --git a/pkg/noun/jets/e/ed_scalarmult.c b/pkg/noun/jets/e/ed_scalarmult.c index 22714eee79..8585c29623 100644 --- a/pkg/noun/jets/e/ed_scalarmult.c +++ b/pkg/noun/jets/e/ed_scalarmult.c @@ -19,7 +19,7 @@ // scalarmult expects a_y[31] <= 127 if ( (32 < met_w) || ( (32 == met_w) && - (127 < u3r_byte(a, 31)) ) + (127 < u3r_byte(31, a)) ) ) { u3_noun a_recs = u3qee_recs(a); u3r_bytes(0, 32, a_y, a_recs); diff --git a/pkg/noun/jets/e/ed_scalarmult_base.c b/pkg/noun/jets/e/ed_scalarmult_base.c index 6242b331af..923ed1f629 100644 --- a/pkg/noun/jets/e/ed_scalarmult_base.c +++ b/pkg/noun/jets/e/ed_scalarmult_base.c @@ -14,7 +14,7 @@ // scalarmult_base expects a_y[31] <= 127 if ( (32 < met_w) || ( (32 == met_w) && - (127 < u3r_byte(a, 31)) ) + (127 < u3r_byte(31, a)) ) ) { u3_noun a_recs = u3qee_recs(a); u3r_bytes(0, 32, a_y, a_recs); diff --git a/pkg/noun/jets/e/ed_smac.c b/pkg/noun/jets/e/ed_smac.c index 9e2229d5dc..ce0ffac0d6 100644 --- a/pkg/noun/jets/e/ed_smac.c +++ b/pkg/noun/jets/e/ed_smac.c @@ -17,7 +17,7 @@ met_w = u3r_met(3, a); if ( (32 < met_w) || ( (32 == met_w) && - (127 < u3r_byte(a, 31)) ) + (127 < u3r_byte(31, a)) ) ) { u3_noun a_recs = u3qee_recs(a); u3r_bytes(0, 32, a_y, a_recs); @@ -29,7 +29,7 @@ met_w = u3r_met(3, b); if ( (32 < met_w) || ( (32 == met_w) && - (127 < u3r_byte(b, 31)) ) + (127 < u3r_byte(31, b)) ) ) { u3_noun b_recs = u3qee_recs(b); u3r_bytes(0, 32, b_y, b_recs); @@ -41,7 +41,7 @@ met_w = u3r_met(3, c); if ( (32 < met_w) || ( (32 == met_w) && - (127 < u3r_byte(c, 31)) ) + (127 < u3r_byte(31, c)) ) ) { u3_noun c_recs = u3qee_recs(c); u3r_bytes(0, 32, c_y, c_recs); From f151884fa6e35324b7bb0c5908553148aa4b2aec Mon Sep 17 00:00:00 2001 From: ziffee Date: Sun, 8 Dec 2024 19:55:48 +0700 Subject: [PATCH 7/9] zif/ed-reform: bump urcrypt --- ext/urcrypt/build.zig.zon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/urcrypt/build.zig.zon b/ext/urcrypt/build.zig.zon index 0f66f662ac..9166603e29 100644 --- a/ext/urcrypt/build.zig.zon +++ b/ext/urcrypt/build.zig.zon @@ -14,8 +14,8 @@ .hash = "1220bb683a6df744e618f58a008eaae3eb62b70a78334cec676bd82b1b9e8e944eeb", }, .urcrypt = .{ - .url = "https://github.com/urbit/urcrypt/archive/18d840f517722dd2236207c31dd53935b2c39bf3.tar.gz", - .hash = "1220afb7b4434ef269210822ff84d79c566411f578f80400e23742d9363fca2d05a9", + .url = "https://github.com/urbit/urcrypt/archive/6b72173150a7ee22d000c558b29bd7d5ec48342d.tar.gz", + .hash = "1220ce482cde985c6229499ffe8385c3455670249afed3cba90a641fec7970f988cc", }, }, .paths = .{ From 43d8d88e6b0e2b2337cb2d03b5ba7bd845de50f4 Mon Sep 17 00:00:00 2001 From: ziffee Date: Wed, 11 Dec 2024 22:52:56 +0700 Subject: [PATCH 8/9] zif/ed-reform: remove punts, clean up bails --- pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c | 3 +-- pkg/noun/jets/e/ed_point_add.c | 2 +- pkg/noun/jets/e/ed_point_neg.c | 2 +- pkg/noun/jets/e/ed_scalarmult_base.c | 1 + pkg/noun/jets/e/ed_shar.c | 13 +++++-------- pkg/noun/jets/e/ed_sign.c | 12 ++++++------ 6 files changed, 15 insertions(+), 18 deletions(-) diff --git a/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c b/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c index ed71a803e1..39eda5392b 100644 --- a/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c +++ b/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c @@ -61,7 +61,6 @@ { return u3m_bail(c3__exit); } else { - return u3l_punt("add-scalarmult-scalarmult-base", - _cqee_add_scalarmult_scalarmult_base(a, b, c)); + return _cqee_add_scalarmult_scalarmult_base(a, b, c); } } diff --git a/pkg/noun/jets/e/ed_point_add.c b/pkg/noun/jets/e/ed_point_add.c index f097f15102..70fe563c20 100644 --- a/pkg/noun/jets/e/ed_point_add.c +++ b/pkg/noun/jets/e/ed_point_add.c @@ -16,7 +16,7 @@ if ( (0 != u3r_bytes_fit(32, a_y, a)) || (0 != u3r_bytes_fit(32, b_y, b)) || (0 != urcrypt_ed_point_add(a_y, b_y, out_y)) ) { - return u3_none; + return u3m_bail(c3__exit); } else { return u3i_bytes(32, out_y); diff --git a/pkg/noun/jets/e/ed_point_neg.c b/pkg/noun/jets/e/ed_point_neg.c index 5f0cacc0c0..5a1a5bd237 100644 --- a/pkg/noun/jets/e/ed_point_neg.c +++ b/pkg/noun/jets/e/ed_point_neg.c @@ -14,7 +14,7 @@ if ( (0 != u3r_bytes_fit(32, a_y, a)) || (0 != urcrypt_ed_point_neg(a_y)) ) { - return u3_none; + return u3m_bail(c3__exit); } else { return u3i_bytes(32, a_y); diff --git a/pkg/noun/jets/e/ed_scalarmult_base.c b/pkg/noun/jets/e/ed_scalarmult_base.c index 923ed1f629..61935846f2 100644 --- a/pkg/noun/jets/e/ed_scalarmult_base.c +++ b/pkg/noun/jets/e/ed_scalarmult_base.c @@ -24,6 +24,7 @@ } if (0 != urcrypt_ed_scalarmult_base(a_y, out_y)) { + // should be unreachable, as scalar already reduced return u3m_bail(c3__exit); } else { diff --git a/pkg/noun/jets/e/ed_shar.c b/pkg/noun/jets/e/ed_shar.c index becff5909a..ed293f777a 100644 --- a/pkg/noun/jets/e/ed_shar.c +++ b/pkg/noun/jets/e/ed_shar.c @@ -12,11 +12,10 @@ c3_y pub_y[32], sed_y[32]; if ( 0 != u3r_bytes_fit(32, pub_y, pub) ) { - // pub is not size checked in the hoon - return u3_none; + return u3m_bail(c3__exit); } else if ( 0 != u3r_bytes_fit(32, sed_y, sed) ) { - // sed explicitly bails through suck + // hoon calls luck, which crashes return u3m_bail(c3__exit); } else { @@ -37,7 +36,7 @@ { return u3m_bail(c3__exit); } else { - return u3l_punt("shar", _cqee_shar(pub, sed)); + return _cqee_shar(pub, sed); } } @@ -47,11 +46,9 @@ c3_y pub_y[32], sek_y[64]; if ( 0 != u3r_bytes_fit(32, pub_y, pub) ) { - // pub is not size checked in the hoon - return u3_none; + return u3m_bail(c3__exit); } else if ( 0 != u3r_bytes_fit(64, sek_y, sek) ) { - // sek explicitly bails through suck return u3m_bail(c3__exit); } else { @@ -72,6 +69,6 @@ { return u3m_bail(c3__exit); } else { - return u3l_punt("slar", _cqee_slar(pub, sek)); + return _cqee_slar(pub, sek); } } diff --git a/pkg/noun/jets/e/ed_sign.c b/pkg/noun/jets/e/ed_sign.c index dc5b75bdeb..cd1797d4dd 100644 --- a/pkg/noun/jets/e/ed_sign.c +++ b/pkg/noun/jets/e/ed_sign.c @@ -14,7 +14,7 @@ c3_y sed_y[32]; c3_w len_w; if ( 0 != u3r_bytes_fit(32, sed_y, sed) ) { - // hoon calls suck, which calls luck, which crashes + // hoon calls luck, which crashes return u3m_bail(c3__exit); } else if ( !u3r_word_fit(&len_w, len) ) { @@ -51,11 +51,11 @@ c3_y pub_y[32], sek_y[64]; c3_w len_w; if ( 0 != u3r_bytes_fit(32, pub_y, pub) ) { - // hoon calls suck, which calls luck, which crashes + // hoon asserts size return u3m_bail(c3__exit); } if ( 0 != u3r_bytes_fit(64, sek_y, sek) ) { - // hoon calls suck, which calls luck, which crashes + // hoon asserts size return u3m_bail(c3__exit); } else if ( !u3r_word_fit(&len_w, len) ) { @@ -94,7 +94,7 @@ c3_y sed_y[32]; if ( 0 != u3r_bytes_fit(32, sed_y, sed) ) { - // hoon calls suck, which calls luck, which crashes + // hoon calls luck, which crashes return u3m_bail(c3__exit); } else { @@ -131,11 +131,11 @@ c3_y pub_y[32], sek_y[64]; if ( 0 != u3r_bytes_fit(32, pub_y, pub) ) { - // hoon calls suck, which calls luck, which crashes + // hoon asserts size return u3m_bail(c3__exit); } if ( 0 != u3r_bytes_fit(64, sek_y, sek) ) { - // hoon calls suck, which calls luck, which crashes + // hoon asserts size return u3m_bail(c3__exit); } else { From 42b84a189fe37aa495acb15d8da09c471d83f8ef Mon Sep 17 00:00:00 2001 From: ziffee Date: Thu, 12 Dec 2024 04:17:52 +0700 Subject: [PATCH 9/9] zif/ed-reform: bump urcrypt --- ext/urcrypt/build.zig.zon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/urcrypt/build.zig.zon b/ext/urcrypt/build.zig.zon index 9166603e29..a7866adde4 100644 --- a/ext/urcrypt/build.zig.zon +++ b/ext/urcrypt/build.zig.zon @@ -14,8 +14,8 @@ .hash = "1220bb683a6df744e618f58a008eaae3eb62b70a78334cec676bd82b1b9e8e944eeb", }, .urcrypt = .{ - .url = "https://github.com/urbit/urcrypt/archive/6b72173150a7ee22d000c558b29bd7d5ec48342d.tar.gz", - .hash = "1220ce482cde985c6229499ffe8385c3455670249afed3cba90a641fec7970f988cc", + .url = "https://github.com/urbit/urcrypt/archive/465aad6262f2710f76f75adfe74effb5751c5ab3.tar.gz", + .hash = "1220c0f7141ab0aeb4164c5c2ae42848035e5b2fdff52c66c57d5744e3e3751e12c8", }, }, .paths = .{