From: maht <maht-9fans@maht0x0r.net>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: [9fans] [limbo] I tried keyring, but it was the wrong number
Date: Thu, 30 Jul 2009 13:54:58 +0100 [thread overview]
Message-ID: <4A719822.2050703@maht0x0r.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 742 bytes --]
Hi, sorry for this cross posting, I posted it to inferno yesterday but
I'm not getting through (non of my mail is, must work that out)
I've been trying to sign some data with a generated secret using the
attached Limbo. Afaik the secret is ok, it passed checkSK in keyring.c
I got as far as here with the debugging, I don't know how to work out
which function is being called
/usr/local/inferno-os/libinterp/keyring.c:999
c->signa = (*sa->vec->sign)(b, sk->key);
running :
% sign_test < secret
[$Keyring] Broken: "mpdiv: divide by zero"
sh: 5 "$Keyring":mpdiv: divide by zero
; stack 5
unknown fn() Module $Keyring PC 1445847206
unknown fn() Module ./sign_test.dis PC 42
externalexec() sh.b:919.2, 30
[-- Attachment #2: secret --]
[-- Type: text/plain, Size: 1019 bytes --]
rsa
maht
l7w4uJyl+UlC6y4cG/tGYaKRcb5ep1igRvlfumxj3aEBDHu1vKZsmMmHzHGCQZl1B9MlAdY+paCoNqP+In1nCcYdn9S9zIBACz9TLXIk9xGCKKhvPw5rlgSwPOEKVcK7O/kvMhZUOPKm+Woefgx9HaenWX2CqzUr56j8kFyZcN1Ax5/zMzzE4d26mHipGOZdWtmjIad8/vYQW9dlOE1U5JCKVQzlyrclzTdYzZ76oVHaDtojjLU8gtOzRxLWmARbU7++QORvgYEOyv+e86fi9iWQlvGsK9FxMci/t+utKlymG4ZE2Cc5+pv0BDp/1Zmd63i8nyyikW/g8EuGBiLyA78l0DcuucOvtSBHc+0tdpZ9/MooNI/p3hMWrBUqPnodwQidQ1cSw+hZaPAMZlE8ipwnhk6SZErRa/+0ZRAfPAvPsxo/hbvfFbK0yG9OqR/4FhVpF+hihn1sSdIdKL11t7lH7x2u0uiSLRn7FH9KuQhflrbfUKeNIAFATzEYyiRZONh4/DG0Hw3PqVTbQXG771p7yDLP4oE5DJmXVZT6JpOWjPUZ/mUeVLCSiuK9EXCAFG0uCjzeWFMnEvPITyiRmp7g2+y4NdO4XgiRr09kmnTkTLXTah9WeF5P7D4HXZsmPiB0S9e+oywmF3DhnWHbgPCK9g+8cYjHziF6HsJ4lsU=
AAAAHQ==
eFd8bxsih+qn1QFCbnfWt12ffYVT5dOH8atL7CD/wW4JqMwLuO3sMo4t6MP0jE2RyGmql4abndexjHBoc6FAEJRMde9YvKxWGpNTn6EmJQ3i0Mw062O2bicHXGvcDw0zZIfV+5YffJ0jUw2K8TYK9DWEubvRkJzt2wpwCJAPw3Gu9plW86vISTREipSpbAYmus/rT6glV3O0ssVQRyLZZdO9KPiS8Dj6q5XTq+gEkZkxWzo/gUBKeWobbVWPtlu7MMQ1yYkI/Md1qdOPuGqrLSaez/125PWOvY2POZea/kl66bEcHjDEDWE0Sflu
[-- Attachment #3: sign_test.b --]
[-- Type: text/plain, Size: 1447 bytes --]
implement Sign;
include "sys.m";
sys: Sys;
sprint: import sys;
include "draw.m";
include "keyring.m";
keyring: Keyring;
DigestState, PK: import keyring;
Sign: module {
init: fn(nil: ref Draw->Context, args: list of string);
};
Metafilesizemax: con 8*1024;
hash := "sha1";
# usage: sign_test [hashname] < secretkey
init(nil: ref Draw->Context, argv: list of string)
{
sys = load Sys Sys->PATH;
keyring = load Keyring Keyring->PATH;
if(len argv > 1)
hash = hd tl argv;
(skd, err) := readstdin(Metafilesizemax);
if(err != nil) {
} else {
sk := keyring->strtosk(string skd);
if(sk == nil) {
warn("malformed secret key");
} else {
bytes := array of byte "some data";
dstate := keyring->sha1(bytes, len bytes, nil, nil);
if(dstate == nil) {
warn("failed to make digest");
} else {
exp := 1258801674; # long time in the future
cert := keyring->sign(sk, exp, dstate, hash);
if(cert == nil)
warn("did not make certificate");
else
sys->print("%s", keyring->certtostr(cert));
}
}
}
}
readstdin(maxsize: int): (array of byte, string)
{
n := sys->readn(sys->fildes(0), d := array[maxsize] of byte, len d);
if(n < 0)
return (nil, sprint("read stdin %r"));
if(n == len d)
return (nil, sprint("file stdin too large"));
return (d[:n], nil);
}
warn(s: string)
{
sys->fprint(sys->fildes(2), "%s\n", s);
}
next reply other threads:[~2009-07-30 12:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-30 12:54 maht [this message]
2009-07-30 13:46 ` Charles Forsyth
2009-07-30 13:47 ` Charles Forsyth
2009-07-30 16:35 ` Charles Forsyth
2009-08-11 14:55 ` matt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A719822.2050703@maht0x0r.net \
--to=maht-9fans@maht0x0r.net \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).