Merge branch 'release/next-vere' into na-release/candidate

* release/next-vere:
  vere/aes_siv: check claimed length for all key sizes
  vere: fix -Z refcounts
  vere: remove -o in favor of manual -X
  vere: clean up refcounts, debug printf
  vere: replace -O with more generic -Z
  vere: add -O for exporting keyfile
  jael: add %vile scry endpoint for current keyfile
  vere/aes_siv: check claimed length
This commit is contained in:
Joe Bryan 2020-12-03 15:25:08 -08:00
commit 9da45fd5fa
6 changed files with 41 additions and 27 deletions

View File

@ -1118,6 +1118,11 @@
[~ ~]
::
[~ ~ %noun !>(u.r)]
::
%vile
=* life lyf.own.pki.lex
=/ =seed [our life (~(got by jaw.own.pki.lex) life) ~]
[~ ~ %atom !>((jam seed))]
::
%deed
?. ?=([@ @ ~] tyl) [~ ~]

View File

@ -74,7 +74,6 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.abo = c3n;
u3_Host.ops_u.dem = c3n;
u3_Host.ops_u.dry = c3n;
u3_Host.ops_u.exp = c3n;
u3_Host.ops_u.gab = c3n;
u3_Host.ops_u.git = c3n;
@ -93,11 +92,12 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.tex = c3n;
u3_Host.ops_u.tra = c3n;
u3_Host.ops_u.veb = c3n;
u3_Host.ops_u.puf_c = "jam";
u3_Host.ops_u.hap_w = 50000;
u3_Host.ops_u.kno_w = DefaultKernel;
while ( -1 != (ch_i=getopt(argc, argv,
"X:Y:G:J:B:K:A:H:I:C:w:u:e:F:k:n:p:r:i:LljacdgoqstvxPDRS")) )
"X:Y:G:J:B:K:A:H:I:C:w:u:e:F:k:n:p:r:i:Z:LljacdgqstvxPDRS")) )
{
switch ( ch_i ) {
case 'X': {
@ -108,6 +108,10 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.puk_c = strdup(optarg);
break;
}
case 'Z': {
u3_Host.ops_u.puf_c = strdup(optarg);
break;
}
case 'J': {
u3_Host.ops_u.lit_c = strdup(optarg);
break;
@ -199,7 +203,6 @@ _main_getopt(c3_i argc, c3_c** argv)
case 'c': { u3_Host.ops_u.nuu = c3y; break; }
case 'd': { u3_Host.ops_u.dem = c3y; break; }
case 'g': { u3_Host.ops_u.gab = c3y; break; }
case 'o': { u3_Host.ops_u.exp = c3y; break; }
case 'P': { u3_Host.ops_u.pro = c3y; break; }
case 'D': { u3_Host.ops_u.dry = c3y; break; }
case 'q': { u3_Host.ops_u.qui = c3y; break; }
@ -409,7 +412,6 @@ u3_ve_usage(c3_i argc, c3_c** argv)
"-K stage Start at Hoon kernel version stage\n",
"-k keys Private key file\n",
"-L local networking only\n",
"-o export pier state\n",
"-P Profiling\n",
"-p ames_port Set the ames port to bind to\n",
"-q Quiet\n",
@ -421,9 +423,10 @@ u3_ve_usage(c3_i argc, c3_c** argv)
"-u url URL from which to download pill\n",
"-v Verbose\n",
"-w name Boot as ~name\n",
"-X path Scry, jam to file, then exit\n"
"-X path Scry, write to file, then exit\n"
"-x Exit immediately\n",
"-Y file Optional name of jamfile (for -X and -o)\n"
"-Y file Optional name of file (for -X and -o)\n"
"-Z format Optional file format ('jam', or aura, for -X)\n"
"\n",
"Development Usage:\n",
" To create a development ship, use a fakezod:\n",

View File

@ -592,7 +592,9 @@
# define c3__is c3_s2('i','s')
# define c3__item c3_s4('i','t','e','m')
# define c3__ix c3_s2('i','x')
# define c3__j c3_s1('j')
# define c3__jack c3_s4('j','a','c','k')
# define c3__jam c3_s3('j','a','m')
# define c3__jamx c3_s4('j','a','m','x')
# define c3__jamz c3_s4('j','a','m','z')
# define c3__jato c3_s4('j','a','t','o')

View File

@ -266,7 +266,6 @@
c3_c* dns_c; // -H, ames bootstrap domain
c3_c* jin_c; // -I, inject raw event
c3_c* imp_c; // -i, import pier state
c3_o exp; // -o, export pier state
c3_w hap_w; // -C, cap memo cache
c3_c* lit_c; // -J, ivory (fastboot) kernel
c3_o tra; // -j, json trace
@ -289,6 +288,7 @@
c3_o tex; // -x, exit after loading
c3_c* pek_c; // -X, scry path (/vc/desk/path)
c3_c* puk_c; // -Y, scry result filename
c3_c* puf_c; // -Z, scry result format
} u3_opts;
/* u3_host: entire host.

View File

@ -104,6 +104,10 @@ static u3_noun _siv_de(c3_y* key_y,
return u3_none;
}
if ( c3y == u3qa_gth(u3r_met(3, txt), len) ) {
return u3_none;
}
while (u3_nul != ads) {
c3_w ad_w = u3r_met(3, u3h(ads));
c3_y* ad_y = u3a_malloc(ad_w);
@ -327,7 +331,7 @@ u3qea_sivc_de(u3_atom key,
u3_atom txt)
{
c3_y key_y[64];
if (u3r_met(3, key) > 64) {
if ( u3r_met(3, key) > 64 ) {
return u3_none;
}

View File

@ -475,6 +475,23 @@ _pier_on_scry_done(void* ptr_v, u3_noun nun)
else {
u3l_log("pier: scry succeeded\n");
// serialize as desired
//
u3_atom out;
c3_c* ext_c;
{
u3_atom puf = u3i_string(u3_Host.ops_u.puf_c);
if ( c3y == u3r_sing(c3__jam, puf) ) {
out = u3qe_jam(res);
ext_c = "jam";
}
else {
out = u3dc("scot", u3k(puf), u3k(res));
ext_c = "txt";
}
u3z(puf);
}
c3_c* pac_c = u3_Host.ops_u.puk_c;
if (!pac_c) {
pac_c = u3_Host.ops_u.pek_c;
@ -494,9 +511,9 @@ _pier_on_scry_done(void* ptr_v, u3_noun nun)
}
c3_c fil_c[2048];
snprintf(fil_c, 2048, "%s/.urb/put/%s.jam", pir_u->pax_c, pac_c+1);
snprintf(fil_c, 2048, "%s/.urb/put/%s.%s", pir_u->pax_c, pac_c+1, ext_c);
u3_walk_save(fil_c, 0, u3qe_jam(res), pir_u->pax_c, pad);
u3_walk_save(fil_c, 0, out, pir_u->pax_c, pad);
u3l_log("pier: scry in %s\n", fil_c);
}
@ -589,23 +606,6 @@ _pier_work_init(u3_pier* pir_u)
}
u3z(pex);
}
else if ( _(u3_Host.ops_u.exp) ) {
u3_noun pex = u3do("stab", u3i_string("/gx/lens/export-all/noun"));
u3_noun car;
u3_noun dek;
u3_noun pax;
u3r_trel(pex, &car, &dek, &pax);
if (!u3_Host.ops_u.puk_c) {
u3_Host.ops_u.puk_c = strdup("/archive");
}
// run the requested scry, jam to disk, then exit
//
u3l_log("pier: scry\n");
u3_pier_peek_last(pir_u, u3_nul, u3k(car), u3k(dek), u3k(pax),
pir_u, _pier_on_scry_done);
u3z(pex);
}
else {
// initialize i/o drivers
//