Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
0cf3a2d
gw/secp: add priv-to-pub jets
Dec 11, 2024
ad533b2
Add point tweak, compressed points
cyclomancer Jan 14, 2025
61d6fa7
king: use struct u3_ship
Mar 25, 2025
0b274a3
mesa: move u3_peer and per_map to mesa.h
Mar 25, 2025
b06961e
mesa: move sun state into u3_mesa, extract into ames/stun
Mar 25, 2025
3fbb67d
disk: change who_d -> who_u
Mar 25, 2025
cd2dabe
ames: remove u3_lane
Mar 27, 2025
78a00cd
ames: bugfixes
Mar 27, 2025
3ccf6f4
ames: more bug fixes
Mar 27, 2025
b82a7de
ames: move ames to subdriver
Mar 29, 2025
bfde35d
zif/ames-reform: driver hax improvement
Mar 29, 2025
47cf475
ames: shared peer state between ames and mesa, dns in peer state
Apr 2, 2025
a5e562a
ames: fully qualified domains
Apr 2, 2025
ee32953
ames: no longer a linked io driver
Apr 3, 2025
eb3efee
ames: natpmp into subdriver
Apr 3, 2025
af82ef5
ames: cleanup
Apr 3, 2025
3a72007
ames: fix _ames_cmp_turfs and add %fief effect
Apr 4, 2025
4f13232
ames: non-czar turfs should come with port
Apr 4, 2025
64c43d1
Merge remote-tracking branch 'origin/develop' into zif/ames-reform-merge
Apr 5, 2025
ca38887
ames: lamp fixes
Apr 6, 2025
bad6e92
ames: fix _realise_lane for indirect atoms
Apr 7, 2025
a6921af
ames: more comet fixes
Apr 7, 2025
36a823b
mesa: c3n initialize lam_o
Apr 7, 2025
bf313ed
ames: fix uv_close cleanup for mesa, set lam_o on %fief
Apr 8, 2025
2f473a6
ames: refcount packet buffers
Apr 9, 2025
782b742
ames: update lanes on hear callbacks, auto: add u3_ovum_exit news
Apr 9, 2025
391f0b4
mesa: move gauge to peer struct
Apr 9, 2025
58ee752
mesa: fix local networking
Apr 11, 2025
31bf1cb
mesa: always fetch lanes and sponsors in _meet_peer
Apr 13, 2025
9bce352
mesa: fix fetching saxo and lane state
Apr 14, 2025
67dea08
ames: fix forward lane discovery
Apr 20, 2025
373166e
Merge branch 'gw/secp' into ames-reform-proper
tinnus-napbus Sep 3, 2025
256e137
Merge remote-tracking branch 'origin/develop' into nov/suite-c
Sep 10, 2025
101bcc8
otw to fake comets
Oct 9, 2025
08e8e3a
gw: fake comets
tinnus-napbus Oct 10, 2025
053f8ca
Merge branch 'develop' into tinnus-suite-c-merge
tinnus-napbus Oct 26, 2025
1b0ba58
gw: fix merge errors
tinnus-napbus Oct 29, 2025
0f25529
Merge branch 'develop' into tinnus-suite-c-merge
tinnus-napbus Oct 30, 2025
31acef0
gw: add --jael-sources
tinnus-napbus Nov 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ext/urcrypt/build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
.hash = "N-V-__8AAJ4DSwC7aDpt90TmGPWKAI6q4-titwp4M0zsZ2vY",
},
.urcrypt = .{
.url = "https://github.com/urbit/urcrypt/archive/465aad6262f2710f76f75adfe74effb5751c5ab3.tar.gz",
.hash = "N-V-__8AAL3OSQDA9xQasK60FkxcKuQoSANeWy_f9SxmxX1X",
.path = "../../../urcrypt",
//.url = "https://github.com/urbit/urcrypt/archive/465aad6262f2710f76f75adfe74effb5751c5ab3.tar.gz",
//.hash = "N-V-__8AAL3OSQDA9xQasK60FkxcKuQoSANeWy_f9SxmxX1X",
},
},
.paths = .{
Expand Down
1 change: 1 addition & 0 deletions pkg/c3/motes.h
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@
# define c3__fent c3_s4('f','e','n','t')
# define c3__ferd c3_s4('f','e','r','d')
# define c3__fhex c3_s4('f','h','e','x')
# define c3__fief c3_s4('f','i','e','f')
# define c3__file c3_s4('f','i','l','e')
# define c3__film c3_s4('f','i','l','m')
# define c3__find c3_s4('f','i','n','d')
Expand Down
22 changes: 14 additions & 8 deletions pkg/noun/jets.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,23 +893,29 @@ _cj_kick_z(u3_noun cor, u3j_core* cop_u, u3j_harm* ham_u, u3_atom axe)
u3z(cor);
return pro;
}
ham_u->liv = c3n;
//ham_u->liv = c3n;
ame = _cj_soft(cor, axe);
ham_u->liv = c3y;
//ham_u->liv = c3y;

if ( c3n == u3r_sing(ame, pro) ) {
u3l_log("test: %s %s: mismatch: good %x, bad %x",
//u3l_log("test: %s %s: mismatch: good %x, bad %x",
// cop_u->cos_c,
// (!strcmp(".2", ham_u->fcs_c)) ? "$" : ham_u->fcs_c,
// u3r_mug(ame),
// u3r_mug(pro));
//ham_u->liv = c3n;
u3l_log("test: %s %s: mismatch",
cop_u->cos_c,
(!strcmp(".2", ham_u->fcs_c)) ? "$" : ham_u->fcs_c,
u3r_mug(ame),
u3r_mug(pro));
ham_u->liv = c3n;
(!strcmp(".2", ham_u->fcs_c)) ? "$" : ham_u->fcs_c
);
u3m_p("good", ame);
u3m_p("baad", pro);

return u3m_bail(c3__fail);
}
else {

#if 0
#if 1
u3l_log("test: %s %s",
cop_u->cos_c,
(!strcmp(".2", ham_u->fcs_c)) ? "$" : ham_u->fcs_c);
Expand Down
6 changes: 6 additions & 0 deletions pkg/noun/jets/137/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ static u3j_core _137_hex_scr_d[] =
static u3j_harm _137_hex_secp_secp256k1_make_a[] = {{".2", u3we_make, c3y}, {}};
static u3j_harm _137_hex_secp_secp256k1_sign_a[] = {{".2", u3we_sign, c3y}, {}};
static u3j_harm _137_hex_secp_secp256k1_reco_a[] = {{".2", u3we_reco, c3y}, {}};
static u3j_harm _137_hex_secp_secp256k1_priv_to_pub_a[] = {{".2", u3we_priv_to_pub, c3n}, {}};
static u3j_harm _137_hex_secp_secp256k1_tweak_sec_a[] = {{".2", u3we_tweak_sec, c3n}, {}};
static u3j_harm _137_hex_secp_secp256k1_tweak_pub_a[] = {{".2", u3we_tweak_pub, c3n}, {}};

static u3j_harm _137_hex_secp_secp256k1_schnorr_sosi_a[] =
{{".2", u3we_sosi}, {}};
Expand All @@ -233,6 +236,9 @@ static u3j_core _137_hex_secp_secp256k1_d[] =
{ { "make", 7, _137_hex_secp_secp256k1_make_a, 0, no_hashes },
{ "sign", 7, _137_hex_secp_secp256k1_sign_a, 0, no_hashes },
{ "reco", 7, _137_hex_secp_secp256k1_reco_a, 0, no_hashes },
{ "priv-to-pub", 7, _137_hex_secp_secp256k1_priv_to_pub_a, 0, no_hashes },
{ "tweak-sec", 7, _137_hex_secp_secp256k1_tweak_sec_a, 0, no_hashes },
{ "tweak-pub", 7, _137_hex_secp_secp256k1_tweak_pub_a, 0, no_hashes },
{ "schnorr", 7, 0,
_137_hex_secp_secp256k1_schnorr_d,
no_hashes },
Expand Down
103 changes: 103 additions & 0 deletions pkg/noun/jets/e/secp.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,106 @@ u3we_sove(u3_noun cor)
return _cqes_sove(pub, mes, sig);
}
}

static u3_atom
_cqes_tweak_sec(u3_atom sek, u3_atom tek) {
c3_y scalar[32], tweak[32];

if (0 != u3r_bytes_fit(32, scalar, sek)) {
return u3m_bail(c3__exit);
}

if (0 != u3r_bytes_fit(32, tweak, tek)) {
return u3m_bail(c3__exit);
}

if (0 != urcrypt_secp_scalar_tweak_add(sec_u, scalar, tweak)) {
return u3m_bail(c3__exit);
}

return u3i_bytes(32, scalar);
}

u3_noun
u3we_tweak_sec(u3_noun cor)
{
u3_noun sek, tek;

if ( (c3n == u3r_mean(cor,
u3x_sam_2, &sek,
u3x_sam_3, &tek,
0)) ||
(c3n == u3ud(sek)) ||
(c3n == u3ud(tek))) {
return u3m_bail(c3__exit);
}
else {
return _cqes_tweak_sec(sek, tek);
}
}

static u3_atom
_cqes_tweak_pub(u3_atom pub, u3_atom tek) {
c3_y cmp_point[33], tweak[32];

if (0 != u3r_bytes_fit(33, cmp_point, pub)) {
return u3m_bail(c3__exit);
}

if (0 != u3r_bytes_fit(32, tweak, tek)) {
return u3m_bail(c3__exit);
}

if (0 != urcrypt_secp_cmp_point_tweak_add(sec_u, cmp_point, tweak)) {
return u3m_bail(c3__exit);
}

return u3i_bytes(33, cmp_point);
}

u3_noun
u3we_tweak_pub(u3_noun cor)
{
u3_noun pub, tek;

if ( (c3n == u3r_mean(cor,
u3x_sam_2, &pub,
u3x_sam_3, &tek,
0)) ||
(c3n == u3ud(pub)) ||
(c3n == u3ud(tek))) {
return u3m_bail(c3__exit);
}
else {
return _cqes_tweak_pub(pub, tek);
}
}

static u3_noun
_cqes_priv_to_pub(u3_atom sek) {
c3_y scalar[32], cmp_point[33];

if (0 != u3r_bytes_fit(32, scalar, sek)) {
return u3m_bail(c3__exit);
}

if (0 != urcrypt_secp_cmp_point_from_scalar(sec_u, scalar, cmp_point)) {
return u3m_bail(c3__exit);
}

return u3i_bytes(33, cmp_point);
}

u3_noun
u3we_priv_to_pub(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 _cqes_priv_to_pub(a);
}
}
4 changes: 4 additions & 0 deletions pkg/noun/jets/w.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@
u3_noun u3we_sosi(u3_noun);
u3_noun u3we_sove(u3_noun);

u3_noun u3we_priv_to_pub(u3_noun);
u3_noun u3we_tweak_sec(u3_noun);
u3_noun u3we_tweak_pub(u3_noun);

u3_noun u3we_en_base16(u3_noun);
u3_noun u3we_de_base16(u3_noun);

Expand Down
1 change: 1 addition & 0 deletions pkg/noun/noun.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "log.h"
#include "nock.h"
#include "retrieve.h"
#include "ship.h"
#include "trace.h"
#include "urth.h"
#include "xtract.h"
Expand Down
72 changes: 25 additions & 47 deletions pkg/noun/ship.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,33 @@
#include "vortex.h"
#include "ship.h"

static inline void
_s_chub_to_bytes(c3_y byt_y[8], c3_d num_d)
{
byt_y[0] = num_d & 0xff;
byt_y[1] = (num_d >> 8) & 0xff;
byt_y[2] = (num_d >> 16) & 0xff;
byt_y[3] = (num_d >> 24) & 0xff;
byt_y[4] = (num_d >> 32) & 0xff;
byt_y[5] = (num_d >> 40) & 0xff;
byt_y[6] = (num_d >> 48) & 0xff;
byt_y[7] = (num_d >> 56) & 0xff;
}

static inline c3_d
_s_bytes_to_chub(c3_y byt_y[8])
{
return (c3_d)byt_y[0]
| (c3_d)byt_y[1] << 8
| (c3_d)byt_y[2] << 16
| (c3_d)byt_y[3] << 24
| (c3_d)byt_y[4] << 32
| (c3_d)byt_y[5] << 40
| (c3_d)byt_y[6] << 48
| (c3_d)byt_y[7] << 56;
}

void
u3_ship_to_bytes(u3_ship who_u, c3_y len_y, c3_y* buf_y)
{
c3_y sip_y[16] = {0};

_s_chub_to_bytes(sip_y, who_u[0]);
_s_chub_to_bytes(sip_y + 8, who_u[1]);
c3_etch_chub(sip_y, who_u.hed_d);
c3_etch_chub(sip_y + 8, who_u.tel_d);

memcpy(buf_y, sip_y, c3_min(16, len_y));
}

void
u3_ship_of_bytes(u3_ship who_u, c3_y len_y, c3_y* buf_y)
u3_ship
u3_ship_of_bytes(c3_y len_y, c3_y* buf_y)
{
u3_ship who_u;
c3_y sip_y[16] = {0};
memcpy(sip_y, buf_y, c3_min(16, len_y));

who_u[0] = _s_bytes_to_chub(sip_y);
who_u[1] = _s_bytes_to_chub(sip_y + 8);
who_u.hed_d = c3_sift_chub(sip_y);
who_u.tel_d = c3_sift_chub(sip_y + 8);
return who_u;
}

u3_atom
u3_ship_to_noun(u3_ship who_u)
{
return u3i_chubs(2, who_u);
return u3i_chubs(2, &who_u.hed_d);
}

c3_c*
Expand All @@ -67,43 +43,45 @@ u3_ship_to_string(u3_ship who_u)
return who_c;
}

void
u3_ship_of_noun(u3_ship who_u, u3_noun who)
u3_ship
u3_ship_of_noun(u3_noun who)
{
u3r_chubs(0, 2, who_u, who);
u3_ship who_u;
u3r_chubs(0, 2, &who_u.hed_d, who);
return who_u;
}

c3_o
u3_ships_equal(u3_ship sip_u, u3_ship sap_u)
{
return __((sip_u[0] == sap_u[0]) && (sip_u[1] == sap_u[1]));
return __((sip_u.hed_d == sap_u.hed_d) && (sip_u.tel_d == sap_u.tel_d));
}

void
u3_ship_copy(u3_ship des_u, u3_ship src_u)
{
des_u[0] = src_u[0];
des_u[1] = src_u[1];
des_u.hed_d = src_u.hed_d;
des_u.tel_d = src_u.tel_d;
}

c3_l
u3_ship_rank(u3_ship who_u)
{
if ( who_u[1] ) return c3__pawn;
else if ( who_u[0] >> 32 ) return c3__earl;
else if ( who_u[0] >> 16 ) return c3__duke;
else if ( who_u[0] >> 8 ) return c3__king;
if ( who_u.tel_d ) return c3__pawn;
else if ( who_u.hed_d >> 32 ) return c3__earl;
else if ( who_u.hed_d >> 16 ) return c3__duke;
else if ( who_u.hed_d >> 8 ) return c3__king;
else return c3__czar;
}

c3_y
u3_ship_czar(u3_ship who_u) { return who_u[0] & 0xFF; }
u3_ship_czar(u3_ship who_u) { return who_u.hed_d & 0xFF; }

c3_s
u3_ship_king(u3_ship who_u) { return who_u[0] & 0xffff; }
u3_ship_king(u3_ship who_u) { return who_u.hed_d & 0xffff; }

c3_w
u3_ship_duke(u3_ship who_u) { return who_u[0] & 0xffffffff; }
u3_ship_duke(u3_ship who_u) { return who_u.hed_d & 0xffffffff; }

c3_d
u3_ship_earl(u3_ship who_u) { return who_u[0]; }
u3_ship_earl(u3_ship who_u) { return who_u.hed_d; }
18 changes: 9 additions & 9 deletions pkg/noun/ship.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@
#include "c3/c3.h"
#include "types.h"

typedef c3_d u3_ship[2];
typedef struct _u3_ship {
c3_d hed_d;
c3_d tel_d;
} u3_ship;

void
u3_ship_to_bytes(c3_d sip_d[2], c3_y len_y, c3_y* buf_y);
u3_ship_to_bytes(u3_ship who_u, c3_y len_y, c3_y* buf_y);

void
u3_ship_of_bytes(u3_ship who_u, c3_y len_y, c3_y* buf_y);
u3_ship
u3_ship_of_bytes(c3_y len_y, c3_y* buf_y);

u3_atom
u3_ship_to_noun(u3_ship who_u);

void
u3_ship_of_noun(u3_ship who_u, u3_noun who);
u3_ship
u3_ship_of_noun(u3_noun who);

c3_c*
u3_ship_to_string(u3_ship who_u);
Expand All @@ -27,9 +30,6 @@ u3_ships_equal(u3_ship sip_u, u3_ship sap_u);
c3_l
u3_ship_rank(u3_ship who_u);

void
u3_ship_copy(u3_ship des_u, u3_ship src_u);

/**
* Returns a ship's galaxy byte prefix.
*/
Expand Down
2 changes: 1 addition & 1 deletion pkg/vere/auto.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ u3_auto_exit(u3_auto* car_u)

while ( egg_u ) {
xen_u = egg_u->nex_u;
_auto_news(egg_u, u3_ovum_exit);
u3_ovum_free(egg_u);
egg_u = xen_u;
}
Expand Down Expand Up @@ -489,7 +490,6 @@ u3_auto_init(u3_pier* pir_u)
car_u = _auto_link(u3_conn_io_init(pir_u), pir_u, car_u);
car_u = _auto_link(u3_lick_io_init(pir_u), pir_u, car_u);
car_u = _auto_link(u3_mesa_io_init(pir_u), pir_u, car_u);
car_u = _auto_link(u3_ames_io_init(pir_u), pir_u, car_u);
car_u = _auto_link(u3_http_io_init(pir_u), pir_u, car_u);
car_u = _auto_link(u3_cttp_io_init(pir_u), pir_u, car_u);
car_u = _auto_link(u3_unix_io_init(pir_u), pir_u, car_u);
Expand Down
4 changes: 3 additions & 1 deletion pkg/vere/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,10 @@ const c_source_files = [_][]const u8{
"db/lmdb.c",
"disk.c",
"foil.c",
"io/ames.c",
"io/ames/ames.c",
"io/ames/stun.c",
"io/ames/lamp.c",
"io/ames/nat.c",
"io/behn.c",
"io/conn.c",
"io/cttp.c",
Expand Down
Loading
Loading