Browse Source

Plan 9 from Bell Labs 2005-09-18

David du Colombier 15 years ago
parent
commit
92b5873ce9

+ 2 - 2
acme/mail/src/mail.c

@@ -151,7 +151,7 @@ threadmain(int argc, char *argv[])
 	s = estrstrdup(maildir, "ctl");
 	mbox.ctlfd = open(s, ORDWR|OCEXEC);
 	if(mbox.ctlfd < 0)
-		error("can't open %s: %r\n", s);
+		error("can't open %s: %r", s);
 
 	fsname = estrdup(name);
 	if(newdir && argc > 0){
@@ -163,7 +163,7 @@ threadmain(int argc, char *argv[])
 			err[0] = '\0';
 			errstr(err, sizeof err);
 			if(strstr(err, "mbox name in use") == nil)
-				error("can't create directory %s for mail: %s\n", name, err);
+				error("can't create directory %s for mail: %s", name, err);
 			free(fsname);
 			fsname = emalloc(strlen(name)+10);
 			sprint(fsname, "%s-%d", name, i);

+ 1 - 1
acme/mail/src/mesg.c

@@ -533,7 +533,7 @@ mesgdel(Message *mbox, Message *m)
 	Message *n, *next;
 
 	if(m->opened)
-		error("internal error: deleted message still open in mesgdel\n");
+		error("internal error: deleted message still open in mesgdel");
 	/* delete subparts */
 	for(n=m->head; n!=nil; n=next){
 		next = n->next;

+ 25 - 11
dist/replica/_plan9.db

@@ -1,8 +1,8 @@
 386 - 20000000775 sys sys 1010957353 0
 386/9load - 775 sys sys 1112757508 215872
-386/9loaddebug - 775 sys sys 1124856571 310547
+386/9loaddebug - 775 sys sys 1126926546 310558
 386/9loadlite - 775 sys sys 1112757508 135244
-386/9loadlitedebug - 775 sys sys 1121398844 198794
+386/9loadlitedebug - 775 sys sys 1126926546 198805
 386/9pc - 775 sys sys 1125835513 1838424
 386/9pc.gz - 664 sys sys 1126005796 645747
 386/9pccpu - 775 sys sys 1125835516 1492680
@@ -83,7 +83,7 @@
 386/bin/aux/LOCK - 775 sys sys 1115950037 59908
 386/bin/aux/X509gen - 775 sys sys 1048341826 129186
 386/bin/aux/accupoint - 775 sys sys 1115950037 40059
-386/bin/aux/acidleak - 775 sys sys 1125345953 69424
+386/bin/aux/acidleak - 775 sys sys 1126926426 69436
 386/bin/aux/antiword - 775 sys sys 1070288096 511478
 386/bin/aux/apm - 775 sys sys 1124939597 174208
 386/bin/aux/astarld - 775 sys sys 1125345953 64683
@@ -692,8 +692,8 @@ acme/mail/readme - 664 sys sys 1084385076 2795
 acme/mail/src - 20000000775 sys sys 1015364010 0
 acme/mail/src/dat.h - 664 sys sys 1033936953 3857
 acme/mail/src/html.c - 664 sys sys 1058463659 1348
-acme/mail/src/mail.c - 664 sys sys 1114697672 11259
-acme/mail/src/mesg.c - 664 sys sys 1114697672 26292
+acme/mail/src/mail.c - 664 sys sys 1126971419 11255
+acme/mail/src/mesg.c - 664 sys sys 1126971419 26290
 acme/mail/src/mkfile - 664 sys sys 1114697575 342
 acme/mail/src/reply.c - 664 sys sys 1112270143 11373
 acme/mail/src/util.c - 664 sys sys 1022112164 1391
@@ -7562,7 +7562,7 @@ sys/man/3/srv - 664 sys sys 958419690 1470
 sys/man/3/ssl - 664 sys sys 1018386776 3413
 sys/man/3/tls - 664 sys sys 1045501496 7018
 sys/man/3/uart - 664 sys sys 1102093395 1710
-sys/man/3/usb - 664 sys sys 1116424546 6826
+sys/man/3/usb - 664 sys sys 1126971427 6960
 sys/man/3/vga - 664 sys sys 1020356225 4827
 sys/man/4 - 20000000775 sys sys 1018581459 0
 sys/man/4/0intro - 664 sys sys 944959699 472
@@ -14805,8 +14805,8 @@ sys/src/libsec/port/sha1pickle.c - 664 sys sys 988225292 717
 sys/src/libsec/port/smallprimes.c - 664 sys sys 984710525 6851
 sys/src/libsec/port/smallprimetest.c - 664 sys sys 984710525 70640
 sys/src/libsec/port/thumb.c - 664 sys sys 1019832052 1891
-sys/src/libsec/port/tlshand.c - 664 sys sys 1125314677 54860
-sys/src/libsec/port/x509.c - 664 sys sys 1063853597 50342
+sys/src/libsec/port/tlshand.c - 664 sys sys 1126971523 54895
+sys/src/libsec/port/x509.c - 664 sys sys 1126971568 50653
 sys/src/libsec/power - 20000000775 sys sys 984710502 0
 sys/src/libsec/power/mkfile - 664 sys sys 1032061453 139
 sys/src/libstdio - 20000000775 sys sys 984710098 0
@@ -14963,6 +14963,20 @@ usr/glenda/lib/profile - 664 glenda glenda 1105128663 890
 usr/glenda/readme.acme - 664 glenda glenda 1019860628 4753
 usr/glenda/readme.rio - 664 glenda glenda 1019860628 6370
 usr/glenda/tmp - 20000000775 glenda glenda 1018802620 0
-386/9loaddebug - 775 sys sys 1126926546 310558
-386/9loadlitedebug - 775 sys sys 1126926546 198805
-386/bin/aux/acidleak - 775 sys sys 1126926426 69436
+386/bin/hget - 775 sys sys 1127012952 232667
+386/bin/vncs - 775 sys sys 1127012957 471908
+386/bin/vncv - 775 sys sys 1127012958 518730
+386/bin/ftpfs - 775 sys sys 1127012951 272234
+386/bin/webfs - 775 sys sys 1127012959 349999
+386/bin/auth/asn12rsa - 775 sys sys 1127012950 119856
+386/bin/auth/rsa2csr - 775 sys sys 1127012950 179931
+386/bin/auth/rsa2x509 - 775 sys sys 1127012951 183692
+386/bin/ip/httpd/httpd - 775 sys sys 1127012952 291029
+386/bin/tlsclient - 775 sys sys 1127012953 197885
+386/bin/tlssrv - 775 sys sys 1127012953 198123
+386/bin/upas/fs - 775 sys sys 1127012954 333054
+386/bin/upas/pop3 - 775 sys sys 1127012955 260589
+386/bin/upas/smtp - 775 sys sys 1127012955 274558
+386/bin/upas/smtpd - 775 sys sys 1127012956 329607
+386/lib/libsec.a - 664 sys sys 1127012961 645922
+acme/bin/386/Mail - 775 sys sys 1127012960 179106

+ 22 - 22
dist/replica/plan9.db

@@ -44,7 +44,7 @@
 386/bin/astro - 775 sys sys 1119496641 138819
 386/bin/auth - 20000000775 sys sys 1016920815 0
 386/bin/auth/aescbc - 775 sys sys 1125345944 140726
-386/bin/auth/asn12rsa - 775 sys sys 1115950027 119644
+386/bin/auth/asn12rsa - 775 sys sys 1127012950 119856
 386/bin/auth/authsrv - 775 sys sys 1125345945 165454
 386/bin/auth/changeuser - 775 sys sys 1125345945 97017
 386/bin/auth/convkeys - 775 sys sys 1117249742 87396
@@ -64,10 +64,10 @@
 386/bin/auth/pemdecode - 775 sys sys 1115950032 61457
 386/bin/auth/pemencode - 775 sys sys 1115950032 59851
 386/bin/auth/printnetkey - 775 sys sys 1115950032 40474
-386/bin/auth/rsa2csr - 775 sys sys 1125345948 179719
+386/bin/auth/rsa2csr - 775 sys sys 1127012950 179931
 386/bin/auth/rsa2pub - 775 sys sys 1125345948 143339
 386/bin/auth/rsa2ssh - 775 sys sys 1125345949 138720
-386/bin/auth/rsa2x509 - 775 sys sys 1125345949 183480
+386/bin/auth/rsa2x509 - 775 sys sys 1127012951 183692
 386/bin/auth/rsafill - 775 sys sys 1125345950 143407
 386/bin/auth/rsagen - 775 sys sys 1115950034 153041
 386/bin/auth/secretpem - 775 sys sys 1045537944 118526
@@ -243,7 +243,7 @@
 386/bin/fs/v10fs - 775 sys sys 1125345975 94562
 386/bin/fs/v6fs - 775 sys sys 1125345975 94480
 386/bin/fs/zipfs - 775 sys sys 1125345976 109079
-386/bin/ftpfs - 775 sys sys 1125345977 271972
+386/bin/ftpfs - 775 sys sys 1127012951 272234
 386/bin/games - 20000000775 sys sys 1096298711 0
 386/bin/games/4s - 775 sys sys 1120619353 177844
 386/bin/games/5s - 775 sys sys 1120619353 180356
@@ -266,7 +266,7 @@
 386/bin/gview - 775 sys sys 1123384234 238204
 386/bin/gzip - 775 sys sys 1125345979 84753
 386/bin/hayes - 775 sys sys 1115950078 64556
-386/bin/hget - 775 sys sys 1125345980 232405
+386/bin/hget - 775 sys sys 1127012952 232667
 386/bin/history - 775 sys sys 1116903733 75357
 386/bin/hoc - 775 sys sys 1125345980 99866
 386/bin/html2ms - 775 sys sys 1125345981 66086
@@ -285,7 +285,7 @@
 386/bin/ip/gping - 775 sys sys 1116126318 182819
 386/bin/ip/hogports - 775 sys sys 1118632064 42883
 386/bin/ip/httpd - 20000000775 sys sys 1016920846 0
-386/bin/ip/httpd/httpd - 775 sys sys 1125345984 290767
+386/bin/ip/httpd/httpd - 775 sys sys 1127012952 291029
 386/bin/ip/httpd/imagemap - 775 sys sys 1125345985 114776
 386/bin/ip/httpd/man2html - 775 sys sys 1125345985 123063
 386/bin/ip/httpd/netlib_find - 775 sys sys 1125345986 115621
@@ -420,8 +420,8 @@
 386/bin/telnet - 775 sys sys 1125346017 80355
 386/bin/test - 775 sys sys 1115950119 69853
 386/bin/time - 775 sys sys 1115950119 61386
-386/bin/tlsclient - 775 sys sys 1125346018 197623
-386/bin/tlssrv - 775 sys sys 1125346019 197861
+386/bin/tlsclient - 775 sys sys 1127012953 197885
+386/bin/tlssrv - 775 sys sys 1127012953 198123
 386/bin/togif - 775 sys sys 1125346019 189757
 386/bin/toico - 775 sys sys 1125346020 123515
 386/bin/topng - 775 sys sys 1125346020 138319
@@ -445,7 +445,7 @@
 386/bin/upas/bayes - 775 sys sys 1064598344 70530
 386/bin/upas/deliver - 775 sys sys 1125346025 100057
 386/bin/upas/filter - 775 sys sys 1125346025 147600
-386/bin/upas/fs - 775 sys sys 1125346026 332792
+386/bin/upas/fs - 775 sys sys 1127012954 333054
 386/bin/upas/isspam - 775 sys sys 1064598349 38
 386/bin/upas/list - 775 sys sys 1125346026 82767
 386/bin/upas/marshal - 775 sys sys 1125346027 132895
@@ -455,14 +455,14 @@
 386/bin/upas/msgcat - 775 sys sys 1064598353 38
 386/bin/upas/msgtok - 775 sys sys 1064598354 75149
 386/bin/upas/nedmail - 775 sys sys 1125346029 156582
-386/bin/upas/pop3 - 775 sys sys 1125346029 260327
+386/bin/upas/pop3 - 775 sys sys 1127012955 260589
 386/bin/upas/qer - 775 sys sys 1125346030 100118
 386/bin/upas/ratfs - 775 sys sys 1125346030 111349
 386/bin/upas/runq - 775 sys sys 1125346030 113769
 386/bin/upas/scanmail - 775 sys sys 1125346031 129036
 386/bin/upas/send - 775 sys sys 1125346032 191814
-386/bin/upas/smtp - 775 sys sys 1125346032 274296
-386/bin/upas/smtpd - 775 sys sys 1125346033 329345
+386/bin/upas/smtp - 775 sys sys 1127012955 274558
+386/bin/upas/smtpd - 775 sys sys 1127012956 329607
 386/bin/upas/spam - 775 sys sys 1064598366 36
 386/bin/upas/testscan - 775 sys sys 1125346034 83659
 386/bin/upas/token - 775 sys sys 1115950132 77554
@@ -495,13 +495,13 @@
 386/bin/venti/verifyarena - 775 sys sys 1115950139 104270
 386/bin/venti/wrarena - 775 sys sys 1115950140 176179
 386/bin/venti/write - 775 sys sys 1115950140 102499
-386/bin/vncs - 775 sys sys 1125346035 471646
-386/bin/vncv - 775 sys sys 1125346037 518468
+386/bin/vncs - 775 sys sys 1127012957 471908
+386/bin/vncv - 775 sys sys 1127012958 518730
 386/bin/vt - 775 sys sys 1125346038 173655
 386/bin/vtdump - 775 sys sys 1125346038 159458
 386/bin/wc - 775 sys sys 1115950143 41156
 386/bin/webcookies - 775 sys sys 1125346039 161625
-386/bin/webfs - 775 sys sys 1125346039 349737
+386/bin/webfs - 775 sys sys 1127012959 349999
 386/bin/webfsget - 775 sys sys 1115950144 39143
 386/bin/wikifs - 775 sys sys 1125889831 202134
 386/bin/winwatch - 775 sys sys 1115950145 154555
@@ -559,7 +559,7 @@
 386/lib/libplumb.a - 664 sys sys 1115950157 18876
 386/lib/libregexp.a - 664 sys sys 1115950157 37464
 386/lib/libscribble.a - 664 sys sys 1116815422 107282
-386/lib/libsec.a - 664 sys sys 1125346046 645236
+386/lib/libsec.a - 664 sys sys 1127012961 645922
 386/lib/libstdio.a - 664 sys sys 1115950159 126206
 386/lib/libsunrpc.a - 664 sys sys 1115950160 355994
 386/lib/libthread.a - 664 sys sys 1115950160 71162
@@ -618,7 +618,7 @@ acme/acid/Acid - 775 sys sys 1015011246 86
 acme/acid/guide - 444 sys sys 1015011246 68
 acme/bin - 20000000775 sys sys 1017457907 0
 acme/bin/386 - 20000000775 sys sys 1015011570 0
-acme/bin/386/Mail - 775 sys sys 1125346043 179106
+acme/bin/386/Mail - 775 sys sys 1127012960 179106
 acme/bin/386/News - 775 sys sys 1125346044 128804
 acme/bin/386/Wiki - 775 sys sys 1125346044 127380
 acme/bin/386/acd - 775 sys sys 1032232412 137068
@@ -692,8 +692,8 @@ acme/mail/readme - 664 sys sys 1084385076 2795
 acme/mail/src - 20000000775 sys sys 1015364010 0
 acme/mail/src/dat.h - 664 sys sys 1033936953 3857
 acme/mail/src/html.c - 664 sys sys 1058463659 1348
-acme/mail/src/mail.c - 664 sys sys 1114697672 11259
-acme/mail/src/mesg.c - 664 sys sys 1114697672 26292
+acme/mail/src/mail.c - 664 sys sys 1126971419 11255
+acme/mail/src/mesg.c - 664 sys sys 1126971419 26290
 acme/mail/src/mkfile - 664 sys sys 1114697575 342
 acme/mail/src/reply.c - 664 sys sys 1112270143 11373
 acme/mail/src/util.c - 664 sys sys 1022112164 1391
@@ -7562,7 +7562,7 @@ sys/man/3/srv - 664 sys sys 958419690 1470
 sys/man/3/ssl - 664 sys sys 1018386776 3413
 sys/man/3/tls - 664 sys sys 1045501496 7018
 sys/man/3/uart - 664 sys sys 1102093395 1710
-sys/man/3/usb - 664 sys sys 1116424546 6826
+sys/man/3/usb - 664 sys sys 1126971427 6960
 sys/man/3/vga - 664 sys sys 1020356225 4827
 sys/man/4 - 20000000775 sys sys 1018581459 0
 sys/man/4/0intro - 664 sys sys 944959699 472
@@ -14805,8 +14805,8 @@ sys/src/libsec/port/sha1pickle.c - 664 sys sys 988225292 717
 sys/src/libsec/port/smallprimes.c - 664 sys sys 984710525 6851
 sys/src/libsec/port/smallprimetest.c - 664 sys sys 984710525 70640
 sys/src/libsec/port/thumb.c - 664 sys sys 1019832052 1891
-sys/src/libsec/port/tlshand.c - 664 sys sys 1125314677 54860
-sys/src/libsec/port/x509.c - 664 sys sys 1063853597 50342
+sys/src/libsec/port/tlshand.c - 664 sys sys 1126971523 54895
+sys/src/libsec/port/x509.c - 664 sys sys 1126971568 50653
 sys/src/libsec/power - 20000000775 sys sys 984710502 0
 sys/src/libsec/power/mkfile - 664 sys sys 1032061453 139
 sys/src/libstdio - 20000000775 sys sys 984710098 0

+ 22 - 0
dist/replica/plan9.log

@@ -21297,3 +21297,25 @@
 1126927817 0 c 386/9loaddebug - 775 sys sys 1126926546 310558
 1126927817 1 c 386/9loadlitedebug - 775 sys sys 1126926546 198805
 1126927817 2 c 386/bin/aux/acidleak - 775 sys sys 1126926426 69436
+1126972827 0 c acme/mail/src/mail.c - 664 sys sys 1126971419 11255
+1126972827 1 c acme/mail/src/mesg.c - 664 sys sys 1126971419 26290
+1126972827 2 c sys/man/3/usb - 664 sys sys 1126971427 6960
+1126972827 3 c sys/src/libsec/port/tlshand.c - 664 sys sys 1126971523 54895
+1126972827 4 c sys/src/libsec/port/x509.c - 664 sys sys 1126971568 50653
+1127014238 0 c 386/bin/hget - 775 sys sys 1127012952 232667
+1127014238 1 c 386/bin/vncs - 775 sys sys 1127012957 471908
+1127014238 2 c 386/bin/vncv - 775 sys sys 1127012958 518730
+1127014238 3 c 386/bin/ftpfs - 775 sys sys 1127012951 272234
+1127014238 4 c 386/bin/webfs - 775 sys sys 1127012959 349999
+1127014238 5 c 386/bin/auth/asn12rsa - 775 sys sys 1127012950 119856
+1127014238 6 c 386/bin/auth/rsa2csr - 775 sys sys 1127012950 179931
+1127014238 7 c 386/bin/auth/rsa2x509 - 775 sys sys 1127012951 183692
+1127014238 8 c 386/bin/ip/httpd/httpd - 775 sys sys 1127012952 291029
+1127014238 9 c 386/bin/tlsclient - 775 sys sys 1127012953 197885
+1127014238 10 c 386/bin/tlssrv - 775 sys sys 1127012953 198123
+1127014238 11 c 386/bin/upas/fs - 775 sys sys 1127012954 333054
+1127014238 12 c 386/bin/upas/pop3 - 775 sys sys 1127012955 260589
+1127014238 13 c 386/bin/upas/smtp - 775 sys sys 1127012955 274558
+1127014238 14 c 386/bin/upas/smtpd - 775 sys sys 1127012956 329607
+1127014238 15 c 386/lib/libsec.a - 664 sys sys 1127012961 645922
+1127014238 16 c acme/bin/386/Mail - 775 sys sys 1127012960 179106

+ 3 - 0
sys/man/3/usb

@@ -201,6 +201,9 @@ on the endpoint file.  See also
 .SH FILES
 .TF "#U/usb n /*/status"
 .TP
+.BI #U/usb n /port
+USB port status file; for each port, space separated: port number, hexadecimal port status, port status string
+.TP
 .BI #U/usb n /*/status
 USB device status file; class/subclass/proto, vendor-id and product-id are found in line one
 .TP

+ 3 - 0
sys/src/libsec/port/tlshand.c

@@ -2068,9 +2068,12 @@ mptobytes(mpint* big)
 	uchar *a;
 	Bytes* ans;
 
+	a = nil;
 	n = (mpsignif(big)+7)/8;
 	m = mptobe(big, nil, n, &a);
 	ans = makebytes(a, m);
+	if(a != nil)
+		free(a);
 	return ans;
 }
 

+ 43 - 14
sys/src/libsec/port/x509.c

@@ -1459,21 +1459,21 @@ freevalfields(Value* v)
 		freeints(v->u.objidval);
 		break;
 	case VString:
-		if (v->u.stringval)
+		if(v->u.stringval)
 			free(v->u.stringval);
 		break;
 	case VSeq:
 		el = v->u.seqval;
 		for(l = el; l != nil; l = l->tl)
 			freevalfields(&l->hd.val);
-		if (el)
+		if(el)
 			freeelist(el);
 		break;
 	case VSet:
 		el = v->u.setval;
 		for(l = el; l != nil; l = l->tl)
 			freevalfields(&l->hd.val);
-		if (el)
+		if(el)
 			freeelist(el);
 		break;
 	}
@@ -1598,7 +1598,7 @@ static DigestFun digestalg[NUMALGS+1] = { md5, md5, md5, md5, sha1, md5, nil };
 static void
 freecert(CertX509* c)
 {
-	if (!c) return;
+	if(!c) return;
 	if(c->issuer != nil)
 		free(c->issuer);
 	if(c->validity_start != nil)
@@ -1609,6 +1609,7 @@ freecert(CertX509* c)
 		free(c->subject);
 	freebytes(c->publickey);
 	freebytes(c->signature);
+	free(c);
 }
 
 /*
@@ -1831,15 +1832,18 @@ static RSApub*
 decode_rsapubkey(Bytes* a)
 {
 	Elem e;
-	Elist *el;
+	Elist *el, *l;
 	mpint *mp;
 	RSApub* key;
 
+	l = nil;
 	key = rsapuballoc();
 	if(decode(a->data, a->len, &e) != ASN_OK)
 		goto errret;
 	if(!is_seq(&e, &el) || elistlen(el) != 2)
 		goto errret;
+	
+	l = el;
 
 	key->n = mp = asn1mpint(&el->hd);
 	if(mp == nil)
@@ -1849,8 +1853,13 @@ decode_rsapubkey(Bytes* a)
 	key->ek = mp = asn1mpint(&el->hd);
 	if(mp == nil)
 		goto errret;
+
+	if(l != nil)
+		freeelist(l);
 	return key;
 errret:
+	if(l != nil)
+		freeelist(l);
 	rsapubfree(key);
 	return nil;
 }
@@ -2003,7 +2012,10 @@ digest_certinfo(Bytes *cert, DigestFun digestfun, uchar *digest)
 	   p+length < p)
 		return;
 	info = p;
-	if(ber_decode(&p, pend, &elem) != ASN_OK || elem.tag.num != SEQUENCE)
+	if(ber_decode(&p, pend, &elem) != ASN_OK)
+		return;
+	freevalfields(&elem.val);
+	if(elem.tag.num != SEQUENCE)
 		return;
 	infolen = p - info;
 	(*digestfun)(info, infolen, digest, nil);
@@ -2019,6 +2031,10 @@ verify_signature(Bytes* signature, RSApub *pk, uchar *edigest, Elem **psigalg)
 	int buflen;
 	mpint *pkcs1;
 	int nlen;
+	char *err;
+
+	err = nil;
+	pkcs1buf = nil;
 
 	/* one less than the byte length of the modulus */
 	nlen = (mpsignif(pk->n)-1)/8;
@@ -2029,22 +2045,35 @@ verify_signature(Bytes* signature, RSApub *pk, uchar *edigest, Elem **psigalg)
 	pkcs1buf = nil;
 	buflen = mptobe(pkcs1, nil, 0, &pkcs1buf);
 	buf = pkcs1buf;
-	if(buflen != nlen || buf[0] != 1)
-		return "expected 1";
+	if(buflen != nlen || buf[0] != 1) {
+		err = "expected 1";
+		goto end;
+	}
 	buf++;
 	while(buf[0] == 0xff)
 		buf++;
-	if(buf[0] != 0)
-		return "expected 0";
+	if(buf[0] != 0) {
+		err = "expected 0";
+		goto end;
+	}
 	buf++;
 	buflen -= buf-pkcs1buf;
 	if(decode(buf, buflen, &e) != ASN_OK || !is_seq(&e, &el) || elistlen(el) != 2 ||
-			!is_octetstring(&el->tl->hd, &digest))
-		return "signature parse error";
+			!is_octetstring(&el->tl->hd, &digest)) {
+		err = "signature parse error";
+		goto end;
+	}
 	*psigalg = &el->hd;
 	if(memcmp(digest->data, edigest, digest->len) == 0)
-		return nil;
-	return "digests did not match";
+		goto end;
+	err = "digests did not match";
+
+end:
+	if(pkcs1 != nil)
+		mpfree(pkcs1);
+	if(pkcs1buf != nil)
+		free(pkcs1buf);
+	return err;
 }
 	
 RSApub*