[inferno-npe] 8 new revisions pushed by extrudedaluminiu on 2010-02-03 21:30 GMT

2 views
Skip to first unread message

infer...@googlecode.com

unread,
Feb 3, 2010, 4:31:17 PM2/3/10
to inferno-n...@googlegroups.com
8 new revisions:

Revision: 32b2499252
Author: for...@vitanuova.com
Date: Wed Jan 20 08:10:53 2010
Log: 20100120-1610
http://code.google.com/p/inferno-npe/source/detail?r=32b2499252

Revision: eb1c2f3836
Author: for...@vitanuova.com
Date: Tue Feb 2 09:06:56 2010
Log: 20100202-1706
http://code.google.com/p/inferno-npe/source/detail?r=eb1c2f3836

Revision: 3ee014627b
Author: for...@vitanuova.com
Date: Wed Feb 3 06:42:08 2010
Log: 20100203-1442
http://code.google.com/p/inferno-npe/source/detail?r=3ee014627b

Revision: 908f7eb9bc
Author: for...@vitanuova.com
Date: Wed Feb 3 06:45:41 2010
Log: 20100203-1445
http://code.google.com/p/inferno-npe/source/detail?r=908f7eb9bc

Revision: b7c4c7d521
Author: for...@vitanuova.com
Date: Wed Feb 3 12:48:47 2010
Log: 20100203-2048
http://code.google.com/p/inferno-npe/source/detail?r=b7c4c7d521

Revision: 35187c55a1
Author: for...@vitanuova.com
Date: Wed Feb 3 12:50:07 2010
Log: 20100203-2050
http://code.google.com/p/inferno-npe/source/detail?r=35187c55a1

Revision: b034f80f9d
Author: Venkatesh Srinivas <m...@acm.jhu.edu>
Date: Wed Feb 3 13:28:15 2010
Log: Merge with inferno-os 20100203....
http://code.google.com/p/inferno-npe/source/detail?r=b034f80f9d

Revision: dc2a5109fb
Author: Venkatesh Srinivas <m...@acm.jhu.edu>
Date: Wed Feb 3 13:29:43 2010
Log: Add uvlong to DragonFly BSD lib9.h.
http://code.google.com/p/inferno-npe/source/detail?r=dc2a5109fb

==============================================================================
Revision: 32b2499252
Author: for...@vitanuova.com
Date: Wed Jan 20 08:10:53 2010
Log: 20100120-1610
http://code.google.com/p/inferno-npe/source/detail?r=32b2499252

Modified:
/Linux/386/bin/mkext
/MacOSX/386/bin/data2c
/MacOSX/386/bin/iyacc
/MacOSX/386/bin/mk
/MacOSX/386/bin/mkext

=======================================
--- /Linux/386/bin/mkext Fri Dec 22 16:30:12 2006
+++ /Linux/386/bin/mkext Fri Dec 22 16:30:12 2006
Binary file, no diff available.
=======================================
--- /MacOSX/386/bin/data2c Sat Dec 30 13:29:14 2006
+++ /MacOSX/386/bin/data2c Sat Dec 30 13:29:14 2006
Binary file, no diff available.
=======================================
--- /MacOSX/386/bin/iyacc Wed Jul 23 12:40:37 2008
+++ /MacOSX/386/bin/iyacc Wed Jul 23 12:40:37 2008
Binary file, no diff available.
=======================================
--- /MacOSX/386/bin/mk Sat Dec 30 13:29:14 2006
+++ /MacOSX/386/bin/mk Sat Dec 30 13:29:14 2006
Binary file, no diff available.
=======================================
--- /MacOSX/386/bin/mkext Sat Dec 30 13:29:14 2006
+++ /MacOSX/386/bin/mkext Sat Dec 30 13:29:14 2006
Binary file, no diff available.

==============================================================================
Revision: eb1c2f3836
Author: for...@vitanuova.com
Date: Tue Feb 2 09:06:56 2010
Log: 20100202-1706
http://code.google.com/p/inferno-npe/source/detail?r=eb1c2f3836

Modified:
/include/version.h
/man/5/0intro
/man/5/attach
/man/5/error
/man/5/flush
/man/5/open
/man/5/read
/man/5/stat
/man/5/version

=======================================
--- /include/version.h Thu Jan 14 22:33:20 2010
+++ /include/version.h Tue Feb 2 09:06:56 2010
@@ -1,1 +1,1 @@
-#define VERSION "Fourth Edition (20100115)"
+#define VERSION "Fourth Edition (20100202)"
=======================================
--- /man/5/0intro Thu Feb 19 05:36:18 2009
+++ /man/5/0intro Tue Feb 2 09:06:56 2010
@@ -1,11 +1,25 @@
.TH INTRO 5
.SH NAME
-intro \- introduction to the Inferno File Protocol, Styx
+intro \- introduction to the Plan 9 File Protocol 9P in Inferno
.SH SYNOPSIS
.B #include <lib9.h>
.br
.B #include <styx.h>
.SH DESCRIPTION
+Inferno uses the Plan 9 protocol 9P to make resources visible as file
hierarchies.
+There have been two versions of 9P, the most recent being 9P2000.
+Inferno originally used its own protocol called
+.IR Styx ,
+which was a simplified version of the first 9P protocol.
+When 9P was subsequently revised as 9P2000, Inferno adopted that, but
still using the name
+.IR Styx .
+To reduce confusion and to emphasise that Inferno and Plan 9 use the same
protocol,
+the name
+.I Styx
+is being replaced by 9P.
+References to `Styx' remain in the programs and documentation,
+but will eventually be eliminated.
+.PP
An Inferno
.I server
is an agent that provides one or more hierarchical file systems
@@ -56,12 +70,11 @@
and responses transmitted on the connection to the appropriate service.
.PP
The
-.IR "Inferno File Protocol" ,
-Styx, is used for messages between
+.IR "Plan 9 File Protocol" ,
+9P, is used for messages between
.I clients
and
.IR servers .
-The current version of Styx is identical to Plan 9's 9P2000.
A client transmits
.I requests
.RI ( T-messages )
@@ -90,17 +103,17 @@
with the text itself stored as a UTF-8
encoded sequence of Unicode characters (see
.IR utf (6)).
-Text strings in Styx messages are not
+Text strings in 9P messages are not
.SM NUL\c
-terminated:
.I n
counts the bytes of UTF-8 data, which include no final zero byte.
The
.SM NUL
-character is illegal in all text strings in Styx, and is therefore
+character is illegal in all text strings in 9P, and is therefore
excluded from file names, user names, and so on.
.PP
-Each Styx message begins with a four-byte size field
+Each 9P message begins with a four-byte size field
specifying the length in bytes of the complete message including
the four bytes of the size field itself.
The next byte is the message type, one of the constants
@@ -397,7 +410,7 @@
.B read
and
.B write
-messages to exchange authentication information not defined explicitly by
the protocol.
+messages to exchange authentication information not defined explicitly by
9P.
Once the authentication protocol is complete, the
.B afid
is presented in the
@@ -524,11 +537,11 @@
message should be truncated if necessary, since the string is only
advisory and in some sense arbitrary.
.PP
-Most programs do not see the Styx protocol directly; instead calls to
library
+Most programs do not see the 9P protocol directly; instead calls to library
routines that access files are
translated by the mount driver,
.IR mnt (3),
-into Styx messages.
+into 9P messages.
.SH DIRECTORIES
Directories are created by
.B create
@@ -613,8 +626,10 @@
.BR QTDIR ,
.BR QTAPPEND ,
.BR QTEXCL ,
-and (skipping one bit)
-.BR QTAUTH .
+(skipping one bit)
+.BR QTAUTH ,
+and
+.BR QTTMP .
The name
.BR QTFILE ,
defined to be zero,
=======================================
--- /man/5/attach Thu Feb 19 05:36:18 2009
+++ /man/5/attach Tue Feb 2 09:06:56 2010
@@ -102,7 +102,7 @@
and
.B write
messages in the usual way) to execute an authentication protocol.
-That protocol's definition is not part of Styx itself.
+That protocol's definition is not part of 9P itself.
.PP
Once the protocol is complete, the same
.I afid
=======================================
--- /man/5/error Fri Dec 22 12:52:35 2006
+++ /man/5/error Tue Feb 2 09:06:56 2010
@@ -20,6 +20,6 @@
that would accompany a successful call; its tag is that
of the failing request.
.PP
-By convention, clients may truncate error messages after 128 bytes,
-defined as the constant
-.BR Sys->ERRMAX .
+By convention, clients may truncate error messages after
+.B Sys->ERRMAX-1
+bytes.
=======================================
--- /man/5/flush Fri Dec 22 12:52:35 2006
+++ /man/5/flush Tue Feb 2 09:06:56 2010
@@ -24,7 +24,7 @@
.B flush
depends on messages arriving in order.
.PP
-The server must answer the
+The server should answer the
.B flush
message immediately.
If it recognizes
@@ -46,6 +46,29 @@
.B Rerror
message.
.PP
+The server may respond to the pending request before
+responding to the
+.BR Tflush .
+It is possible for a client to send multiple
+.B Tflush
+messages for a particular pending request. Each
+subsequent
+.B Tflush
+must contain as
+.I oldtag
+the tag of the pending request (not a previous
+.BR Tflush ).
+Should multiple
+.BR Tflush es
+be received for a pending request, they must be answered in
+order. An
+.B Rflush
+for any of the multiple
+.BR Tflush es
+implies an answer for all previous ones. Therefore, should
+a server receive a request and then multiple flushes for that
+request, it need respond only to the last flush.
+.PP
When the client sends a
.BR Tflush ,
it must wait to receive the corresponding
@@ -75,4 +98,4 @@
.BR Tflush ,
and flushing an invalid tag.
.SH SEE ALSO
-.IR sys-read (2).
+.IR sys-read (2)
=======================================
--- /man/5/open Fri Dec 22 12:52:35 2006
+++ /man/5/open Tue Feb 2 09:06:56 2010
@@ -202,7 +202,7 @@
may be zero.
If it is not, it is the maximum number of bytes that are guaranteed to
be read from or written to the file without breaking the I/O transfer
-into multiple Styx messages; see
+into multiple 9P messages; see
.IR read (5).
.SH ENTRY POINTS
.I Open
=======================================
--- /man/5/read Thu Feb 19 05:36:18 2009
+++ /man/5/read Tue Feb 2 09:06:56 2010
@@ -97,7 +97,7 @@
It is usually an error
if this is not the same as requested.
.PP
-Because Styx implementations may limit the size of individual
+Because 9P implementations may limit the size of individual
messages,
more than one message may be produced by a single
.I read
=======================================
--- /man/5/stat Fri Dec 22 12:52:35 2006
+++ /man/5/stat Tue Feb 2 09:06:56 2010
@@ -262,7 +262,7 @@
.PP
Note that since the
.B stat
-information is sent as a Styx variable-length datum, it is limited to a
maximum of
+information is sent as a 9P variable-length datum, it is limited to a
maximum of
65535 bytes.
.SH ENTRY POINTS
.B Stat
@@ -305,5 +305,5 @@
.IR dev [4]...,''
where
.I n
-is the value returned by
+is the length of the array returned by
.BR Styx->packdir .
=======================================
--- /man/5/version Fri Dec 22 12:52:35 2006
+++ /man/5/version Tue Feb 2 09:06:56 2010
@@ -20,7 +20,7 @@
request negotiates the protocol version and message size
to be used on the connection and initializes the connection for I/O.
.B Tversion
-must be the first message sent on the Styx connection,
+must be the first message sent on the 9P connection,
and the client cannot issue any further requests until it has received the
.B Rversion
reply.
@@ -37,8 +37,8 @@
The client suggests a maximum message size,
.BR msize ,
that is the maximum length, in bytes,
-it will ever generate or expect to receive in a single Styx message.
-This count includes all Styx protocol data, starting from the
+it will ever generate or expect to receive in a single 9P message.
+This count includes all 9P protocol data, starting from the
.B size
field and extending through the message,
but excludes enveloping transport protocols.

==============================================================================
Revision: 3ee014627b
Author: for...@vitanuova.com
Date: Wed Feb 3 06:42:08 2010
Log: 20100203-1442
http://code.google.com/p/inferno-npe/source/detail?r=3ee014627b

Modified:
/include/version.h
/man/1/emu

=======================================
--- /include/version.h Tue Feb 2 09:06:56 2010
+++ /include/version.h Wed Feb 3 06:42:08 2010
@@ -1,1 +1,1 @@
-#define VERSION "Fourth Edition (20100202)"
+#define VERSION "Fourth Edition (20100203)"
=======================================
--- /man/1/emu Tue Jul 28 09:44:25 2009
+++ /man/1/emu Wed Feb 3 06:42:08 2010
@@ -1,33 +1,30 @@
.TH EMU 1E
.SH NAME
-emu \- Inferno emulator
+emu \- Inferno emulator (hosted Inferno)
.SH SYNOPSIS
.B emu
[
-.BI \-g Xsize x Ysize
+.BI \-g " Xsize x Ysize"
]
[
-.BR \-c [0-9]
+.BI \-c n
]
[
.BI -d " daemon"
]
-[
-.BR \-m [0-9]
-]
.RB [ \-s ]
[
-.BI \-p pool = maxsize
+.BI \-p " pool=maxsize"
]
[
-.BI \-f font
+.BI \-f " font"
]
[
-.BI \-r rootpath
+.BI \-r " rootpath"
]
.RB [ \-7 ]
[
-.RB \-C channel
+.RB \-C " channel"
]
[
.RB \-S
@@ -41,7 +38,8 @@
]
.SH DESCRIPTION
.I Emu
-provides the Inferno emulation environment.
+provides the Inferno emulation environment,
+otherwise known as `hosted Inferno'.
The emulator runs as an application under the
machine's native operating system, and
provides system services and a Dis virtual machine for Inferno
applications.
@@ -167,10 +165,18 @@
to configure the normal (default) 8-bit Inferno colour map.
.TP
.B \-C channel
-Use the given channel for the display if possible. For example, k8 gives
-8 bit greyscale. See
+Use the given
+.I channel
+for the display, if possible.
+See
.IR image (6)
for the full range of channel descriptors.
+For example,
+.B k8
+gives 8 bit greyscale, and
+.B x8r8g8b8
+gives 24 bit colour on a PC.
+The set of channels supported is platform-dependent.
.TP
.B \-S
Force stylus input behaviour for Tk mouse events:

==============================================================================
Revision: 908f7eb9bc
Author: for...@vitanuova.com
Date: Wed Feb 3 06:45:41 2010
Log: 20100203-1445
http://code.google.com/p/inferno-npe/source/detail?r=908f7eb9bc

Modified:
/CHANGES
/appl/lib/cfg.b
/dis/lib/cfg.dis

=======================================
--- /CHANGES Thu Jan 14 22:58:37 2010
+++ /CHANGES Wed Feb 3 06:45:41 2010
@@ -1,3 +1,5 @@
+20100203
+ appl/lib/cfg.b treat \r as white space (issue 69, 70)
20100115
appl/cmd/tarfs.b man/4/tarfs changes to permission handling from mechiel
[issue 220]
appl/spree/mkfile add explicit -I$ROOT/module [issue 209, powerman]
=======================================
--- /appl/lib/cfg.b Fri Dec 22 09:07:39 2006
+++ /appl/lib/cfg.b Wed Feb 3 06:45:41 2010
@@ -80,7 +80,7 @@
continue;
'#' =>
break loop;
- ' ' or '\t' or '\n' =>
+ ' ' or '\t' or '\n' or '\r' =>
if (word == nil)
continue;
if (lastword != nil) {
=======================================
--- /dis/lib/cfg.dis Fri Dec 22 12:52:35 2006
+++ /dis/lib/cfg.dis Wed Feb 3 06:45:41 2010
Binary file, no diff available.

==============================================================================
Revision: b7c4c7d521
Author: for...@vitanuova.com
Date: Wed Feb 3 12:48:47 2010
Log: 20100203-2048
http://code.google.com/p/inferno-npe/source/detail?r=b7c4c7d521

Modified:
/CHANGES
/FreeBSD/386/include/lib9.h
/Irix/mips/include/lib9.h
/Linux/386/include/lib9.h
/Linux/arm/include/lib9.h
/Linux/power/include/lib9.h
/Linux/spim/include/lib9.h
/MacOSX/386/include/lib9.h
/MacOSX/power/include/lib9.h
/NetBSD/386/include/lib9.h
/Nt/386/include/lib9.h
/OpenBSD/386/include/lib9.h
/include/libsec.h
/libinterp/keyring.c
/libinterp/keyring.h
/libinterp/runt.h
/module/keyring.m

=======================================
--- /CHANGES Wed Feb 3 06:45:41 2010
+++ /CHANGES Wed Feb 3 12:48:47 2010
@@ -1,5 +1,8 @@
20100203
appl/lib/cfg.b treat \r as white space (issue 69, 70)
+ add u64int to lib9.h files that needed it
+ add sha2.c sha256block.c sha512block.c to libsec/port and include/libsec.h
+ add new sha functions to module/keyring.m and libinterp/keyring.c
20100115
appl/cmd/tarfs.b man/4/tarfs changes to permission handling from mechiel
[issue 220]
appl/spree/mkfile add explicit -I$ROOT/module [issue 209, powerman]
=======================================
--- /FreeBSD/386/include/lib9.h Mon Jun 9 02:36:43 2008
+++ /FreeBSD/386/include/lib9.h Wed Feb 3 12:48:47 2010
@@ -43,6 +43,8 @@
typedef long long int vlong;
typedef unsigned long long int uvlong;
typedef unsigned int u32int;
+typedef uvlong u64int;
+
typedef unsigned int mpdigit; /* for /sys/include/mp.h */
typedef unsigned short u16int;
typedef unsigned char u8int;
=======================================
--- /Irix/mips/include/lib9.h Mon Jun 9 02:36:43 2008
+++ /Irix/mips/include/lib9.h Wed Feb 3 12:48:47 2010
@@ -29,6 +29,8 @@
typedef long long int vlong;
typedef unsigned long long int uvlong;
typedef unsigned int u32int;
+typedef uvlong u64int;
+
typedef unsigned int mpdigit; /* for /sys/include/mp.h */
typedef unsigned short u16int;
typedef unsigned char u8int;
=======================================
--- /Linux/386/include/lib9.h Mon Jun 9 02:36:43 2008
+++ /Linux/386/include/lib9.h Wed Feb 3 12:48:47 2010
@@ -41,6 +41,8 @@
typedef long long int vlong;
typedef unsigned long long int uvlong;
typedef unsigned int u32int;
+typedef uvlong u64int;
+
typedef unsigned int mpdigit; /* for /sys/include/mp.h */
typedef unsigned short u16int;
typedef unsigned char u8int;
=======================================
--- /Linux/arm/include/lib9.h Mon Jun 9 02:36:43 2008
+++ /Linux/arm/include/lib9.h Wed Feb 3 12:48:47 2010
@@ -41,6 +41,8 @@
typedef long long int vlong;
typedef unsigned long long int uvlong;
typedef unsigned int u32int;
+typedef uvlong u64int;
+
typedef unsigned int mpdigit; /* for /sys/include/mp.h */
typedef unsigned short u16int;
typedef unsigned char u8int;
=======================================
--- /Linux/power/include/lib9.h Fri Jun 12 11:47:59 2009
+++ /Linux/power/include/lib9.h Wed Feb 3 12:48:47 2010
@@ -42,6 +42,8 @@
typedef long long int vlong;
typedef unsigned long long int uvlong;
typedef unsigned int u32int;
+typedef uvlong u64int;
+
typedef unsigned int mpdigit; /* for /sys/include/mp.h */
typedef unsigned short u16int;
typedef unsigned char u8int;
=======================================
--- /Linux/spim/include/lib9.h Wed Apr 1 15:54:06 2009
+++ /Linux/spim/include/lib9.h Wed Feb 3 12:48:47 2010
@@ -46,6 +46,8 @@
typedef long long int vlong;
typedef unsigned long long int uvlong;
typedef unsigned int u32int;
+typedef uvlong u64int;
+
typedef unsigned int mpdigit; /* for /sys/include/mp.h */
typedef unsigned short u16int;
typedef unsigned char u8int;
=======================================
--- /MacOSX/386/include/lib9.h Mon Jun 9 02:36:43 2008
+++ /MacOSX/386/include/lib9.h Wed Feb 3 12:48:47 2010
@@ -36,6 +36,8 @@
typedef unsigned long long uvlong;
typedef ushort Rune;
typedef unsigned int u32int;
+typedef uvlong u64int;
+
typedef unsigned int mpdigit; /* for /sys/include/mp.h */
typedef unsigned short u16int;
typedef unsigned char u8int;
=======================================
--- /MacOSX/power/include/lib9.h Mon Jun 9 02:36:43 2008
+++ /MacOSX/power/include/lib9.h Wed Feb 3 12:48:47 2010
@@ -36,6 +36,8 @@
typedef unsigned long long uvlong;
typedef ushort Rune;
typedef unsigned int u32int;
+typedef uvlong u64int;
+
typedef unsigned int mpdigit; /* for /sys/include/mp.h */
typedef unsigned short u16int;
typedef unsigned char u8int;
=======================================
--- /NetBSD/386/include/lib9.h Mon Jun 9 02:36:43 2008
+++ /NetBSD/386/include/lib9.h Wed Feb 3 12:48:47 2010
@@ -45,6 +45,8 @@
typedef uint8_t u8int;
typedef uint16_t u16int;
typedef uint32_t u32int;
+typedef uvlong u64int;
+
typedef uintptr_t uintptr;

typedef unsigned short Rune;
=======================================
--- /Nt/386/include/lib9.h Mon Jun 9 02:36:43 2008
+++ /Nt/386/include/lib9.h Wed Feb 3 12:48:47 2010
@@ -49,6 +49,8 @@
typedef __int64 vlong;
typedef unsigned __int64 uvlong;
typedef unsigned int u32int;
+typedef uvlong u64int;
+
typedef unsigned int mpdigit; /* for /sys/include/mp.h */
typedef unsigned short u16int;
typedef unsigned char u8int;
=======================================
--- /OpenBSD/386/include/lib9.h Mon Jun 9 02:36:43 2008
+++ /OpenBSD/386/include/lib9.h Wed Feb 3 12:48:47 2010
@@ -43,6 +43,8 @@
typedef long long int vlong;
typedef unsigned long long int uvlong;
typedef unsigned int u32int;
+typedef uvlong u64int;
+
typedef unsigned int mpdigit; /* for /sys/include/mp.h */
typedef unsigned short u16int;
typedef unsigned char u8int;
=======================================
--- /include/libsec.h Fri Dec 22 09:07:39 2006
+++ /include/libsec.h Wed Feb 3 12:48:47 2010
@@ -138,18 +138,33 @@

enum
{
- SHA1dlen= 20, /* SHA digest length */
- MD4dlen= 16, /* MD4 digest length */
- MD5dlen= 16 /* MD5 digest length */
+ /* digest lengths */
+ SHA1dlen= 20,
+ MD4dlen= 16,
+ MD5dlen= 16,
+
+ SHA224dlen= 28,
+ SHA256dlen= 32,
+
+ SHA384dlen= 48,
+ SHA512dlen= 64,
+
+ /* block sizes */
+ SHA256bsize= 64,
+ SHA512bsize= 128,
+ Digestbsize= 128, /* maximum */
};

typedef struct DigestState DigestState;
struct DigestState
{
- uvlong len;
+ u64int len;
u32int state[5];
- uchar buf[128];
+ uchar buf[Digestbsize];
int blen;
+ u64int nb128[2];
+ u64int h64[8];
+ u32int h32[8];
char malloced;
char seeded;
};
@@ -157,10 +172,16 @@
typedef struct DigestState SHA1state;
typedef struct DigestState MD5state;
typedef struct DigestState MD4state;
+typedef struct DigestState SHA256state;
+typedef struct DigestState SHA512state;

DigestState* md4(uchar*, ulong, uchar*, DigestState*);
DigestState* md5(uchar*, ulong, uchar*, DigestState*);
DigestState* sha1(uchar*, ulong, uchar*, DigestState*);
+DigestState* sha224(uchar*, ulong, uchar*, DigestState*);
+DigestState* sha256(uchar*, ulong, uchar*, DigestState*);
+DigestState* sha384(uchar*, ulong, uchar*, DigestState*);
+DigestState* sha512(uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_md5(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_sha1(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
char* md5pickle(MD5state*);
=======================================
--- /libinterp/keyring.c Wed Aug 5 11:53:49 2009
+++ /libinterp/keyring.c Wed Feb 3 12:48:47 2010
@@ -1261,6 +1261,62 @@

*f->ret = keyring_digest_x(f->buf, f->n, f->digest, SHA1dlen, f->state,
sha1);
}
+
+void
+Keyring_sha224(void *fp)
+{
+ F_Keyring_sha224 *f;
+ void *r;
+
+ f = fp;
+ r = *f->ret;
+ *f->ret = H;
+ destroy(r);
+
+ *f->ret = keyring_digest_x(f->buf, f->n, f->digest, SHA224dlen, f->state,
sha224);
+}
+
+void
+Keyring_sha256(void *fp)
+{
+ F_Keyring_sha256 *f;
+ void *r;
+
+ f = fp;
+ r = *f->ret;
+ *f->ret = H;
+ destroy(r);
+
+ *f->ret = keyring_digest_x(f->buf, f->n, f->digest, SHA256dlen, f->state,
sha256);
+}
+
+void
+Keyring_sha384(void *fp)
+{
+ F_Keyring_sha384 *f;
+ void *r;
+
+ f = fp;
+ r = *f->ret;
+ *f->ret = H;
+ destroy(r);
+
+ *f->ret = keyring_digest_x(f->buf, f->n, f->digest, SHA384dlen, f->state,
sha384);
+}
+
+void
+Keyring_sha512(void *fp)
+{
+ F_Keyring_sha512 *f;
+ void *r;
+
+ f = fp;
+ r = *f->ret;
+ *f->ret = H;
+ destroy(r);
+
+ *f->ret = keyring_digest_x(f->buf, f->n, f->digest, SHA512dlen, f->state,
sha512);
+}

void
Keyring_md5(void *fp)
=======================================
--- /libinterp/keyring.h Tue Jan 15 17:19:38 2008
+++ /libinterp/keyring.h Wed Feb 3 12:48:47 2010
@@ -68,6 +68,10 @@
"senderrmsg",0xd2526222,Keyring_senderrmsg,40,2,{0x0,0xc0,},
"sendmsg",0x7cfef557,Keyring_sendmsg,48,2,{0x0,0xc0,},
"sha1",0x7656377,Keyring_sha1,48,2,{0x0,0xb0,},
+ "sha224",0x7656377,Keyring_sha224,48,2,{0x0,0xb0,},
+ "sha256",0x7656377,Keyring_sha256,48,2,{0x0,0xb0,},
+ "sha384",0x7656377,Keyring_sha384,48,2,{0x0,0xb0,},
+ "sha512",0x7656377,Keyring_sha512,48,2,{0x0,0xb0,},
"IPint.shl",0xc7b0bc01,IPint_shl,40,2,{0x0,0x80,},
"IPint.shr",0xc7b0bc01,IPint_shr,40,2,{0x0,0x80,},
"sign",0xdacb7a7e,Keyring_sign,48,2,{0x0,0xb0,},
@@ -92,4 +96,4 @@
"IPint.xor",0xa47c1b24,IPint_xor,40,2,{0x0,0xc0,},
0
};
-#define Keyringmodlen 90
+#define Keyringmodlen 94
=======================================
--- /libinterp/runt.h Tue Jan 15 17:19:38 2008
+++ /libinterp/runt.h Wed Feb 3 12:48:47 2010
@@ -3821,6 +3821,54 @@
void Keyring_sha1(void*);
typedef struct F_Keyring_sha1 F_Keyring_sha1;
struct F_Keyring_sha1
+{
+ WORD regs[NREG-1];
+ Keyring_DigestState** ret;
+ uchar temps[12];
+ Array* buf;
+ WORD n;
+ Array* digest;
+ Keyring_DigestState* state;
+};
+void Keyring_sha224(void*);
+typedef struct F_Keyring_sha224 F_Keyring_sha224;
+struct F_Keyring_sha224
+{
+ WORD regs[NREG-1];
+ Keyring_DigestState** ret;
+ uchar temps[12];
+ Array* buf;
+ WORD n;
+ Array* digest;
+ Keyring_DigestState* state;
+};
+void Keyring_sha256(void*);
+typedef struct F_Keyring_sha256 F_Keyring_sha256;
+struct F_Keyring_sha256
+{
+ WORD regs[NREG-1];
+ Keyring_DigestState** ret;
+ uchar temps[12];
+ Array* buf;
+ WORD n;
+ Array* digest;
+ Keyring_DigestState* state;
+};
+void Keyring_sha384(void*);
+typedef struct F_Keyring_sha384 F_Keyring_sha384;
+struct F_Keyring_sha384
+{
+ WORD regs[NREG-1];
+ Keyring_DigestState** ret;
+ uchar temps[12];
+ Array* buf;
+ WORD n;
+ Array* digest;
+ Keyring_DigestState* state;
+};
+void Keyring_sha512(void*);
+typedef struct F_Keyring_sha512 F_Keyring_sha512;
+struct F_Keyring_sha512
{
WORD regs[NREG-1];
Keyring_DigestState** ret;
@@ -4054,6 +4102,10 @@
};
#define Keyring_PATH "$Keyring"
#define Keyring_SHA1dlen 20
+#define Keyring_SHA224dlen 28
+#define Keyring_SHA256dlen 32
+#define Keyring_SHA384dlen 48
+#define Keyring_SHA512dlen 64
#define Keyring_MD5dlen 16
#define Keyring_MD4dlen 16
#define Keyring_Encrypt 0
=======================================
--- /module/keyring.m Tue Jan 15 17:19:38 2008
+++ /module/keyring.m Wed Feb 3 12:48:47 2010
@@ -175,19 +175,31 @@
sktopk: fn (sk: ref SK): ref PK;

# digests
- sha1: fn(buf: array of byte, n: int, digest: array of byte, state: ref
DigestState):
- ref DigestState;
md4: fn(buf: array of byte, n: int, digest: array of byte, state: ref
DigestState):
ref DigestState;
md5: fn(buf: array of byte, n: int, digest: array of byte, state: ref
DigestState):
ref DigestState;
+ sha1: fn(buf: array of byte, n: int, digest: array of byte, state: ref
DigestState):
+ ref DigestState;
+ sha224: fn(buf: array of byte, n: int, digest: array of byte, state: ref
DigestState):
+ ref DigestState;
+ sha256: fn(buf: array of byte, n: int, digest: array of byte, state: ref
DigestState):
+ ref DigestState;
+ sha384: fn(buf: array of byte, n: int, digest: array of byte, state: ref
DigestState):
+ ref DigestState;
+ sha512: fn(buf: array of byte, n: int, digest: array of byte, state: ref
DigestState):
+ ref DigestState;

hmac_sha1: fn(data: array of byte, n: int, key: array of byte, digest:
array of byte, state: ref DigestState):
ref DigestState;
hmac_md5: fn(data: array of byte, n: int, key: array of byte, digest:
array of byte, state: ref DigestState):
ref DigestState;

- SHA1dlen: con 20;
+ SHA1dlen: con 20;
+ SHA224dlen: con 28;
+ SHA256dlen: con 32;
+ SHA384dlen: con 48;
+ SHA512dlen: con 64;
MD5dlen: con 16;
MD4dlen: con 16;


==============================================================================
Revision: 35187c55a1
Author: for...@vitanuova.com
Date: Wed Feb 3 12:50:07 2010
Log: 20100203-2050
http://code.google.com/p/inferno-npe/source/detail?r=35187c55a1

Added:
/libsec/port/sha2.c
/libsec/port/sha256block.c
/libsec/port/sha512block.c
Modified:
/libsec/port/mkfile

=======================================
--- /dev/null
+++ /libsec/port/sha2.c Wed Feb 3 12:50:07 2010
@@ -0,0 +1,281 @@
+#include "os.h"
+#include <libsec.h>
+
+extern void _sha256block(SHA256state*, uchar*);
+extern void _sha512block(SHA512state*, uchar*);
+
+u32int sha224h0[] = {
+0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
+0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4,
+};
+u32int sha256h0[] = {
+0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
+0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
+};
+
+u64int sha384h0[] = {
+0xcbbb9d5dc1059ed8ULL, 0x629a292a367cd507ULL, 0x9159015a3070dd17ULL,
0x152fecd8f70e5939ULL,
+0x67332667ffc00b31ULL, 0x8eb44a8768581511ULL, 0xdb0c2e0d64f98fa7ULL,
0x47b5481dbefa4fa4ULL,
+};
+u64int sha512h0[] = {
+0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, 0x3c6ef372fe94f82bULL,
0xa54ff53a5f1d36f1ULL,
+0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL, 0x1f83d9abfb41bd6bULL,
0x5be0cd19137e2179ULL,
+};
+
+
+static SHA256state *
+sha256init(void)
+{
+ SHA256state *s;
+
+ s = malloc(sizeof(*s));
+ if(s == nil)
+ return nil;
+ s->malloced = 1;
+ s->seeded = 0;
+ s->len = 0;
+ s->blen = 0;
+
+ return s;
+}
+
+static void
+p32(u32int v, uchar *p)
+{
+ p[0] = v>>24;
+ p[1] = v>>16;
+ p[2] = v>>8;
+ p[3] = v>>0;
+}
+
+static void
+p64(u64int v, uchar *p)
+{
+ p32(v>>32, p);
+ p32(v, p+4);
+}
+
+enum {
+ HI = 0,
+ LO = 1,
+};
+static void
+p128(u64int v[2], uchar *p)
+{
+ p64(v[HI], p);
+ p64(v[LO], p+8);
+}
+
+static void
+uvvadd(u64int v[2], int n)
+{
+ v[LO] += n;
+ if(v[LO] < n) /* overflow */
+ v[HI]++;
+}
+
+static void
+uvvmult8(u64int v[2])
+{
+ v[HI] = (v[HI]<<3) | (v[LO] >> (64-3));
+ v[LO] <<= 3;
+}
+
+
+static void
+_sha256(uchar *p, ulong len, SHA256state *s)
+{
+ u32int take;
+
+ /* complete possible partial block from last time */
+ if(s->blen > 0 && s->blen+len >= SHA256bsize) {
+ take = SHA256bsize-s->blen;
+ memmove(s->buf+s->blen, p, take);
+ p += take;
+ len -= take;
+ _sha256block(s, s->buf);
+ s->len += SHA256bsize;
+ s->blen = 0;
+ memset(s->buf, 0, SHA256bsize);
+ }
+ /* whole blocks */
+ while(len >= SHA256bsize) {
+ _sha256block(s, p);
+ s->len += SHA256bsize;
+ p += SHA256bsize;
+ len -= SHA256bsize;
+ }
+ /* keep possible leftover bytes */
+ if(len > 0) {
+ memmove(s->buf+s->blen, p, len);
+ s->blen += len;
+ }
+}
+
+static void
+sha256finish(SHA256state *s, uchar *digest, int smaller)
+{
+ int i;
+ uchar end[SHA256bsize+8];
+ u32int nzero, nb, nd;
+
+ nzero = (2*SHA256bsize - s->blen - 1 - 8) % SHA256bsize;
+ end[0] = 0x80;
+ memset(end+1, 0, nzero);
+ nb = 8*(s->len+s->blen);
+ p64(nb, end+1+nzero);
+ _sha256(end, 1+nzero+8, s);
+
+ nd = SHA256dlen/4;
+ if(smaller)
+ nd = SHA224dlen/4;
+ for(i = 0; i < nd; i++, digest += 4)
+ p32(s->h32[i], digest);
+}
+
+static SHA256state*
+sha256x(uchar *p, ulong len, uchar *digest, SHA256state *s, int smaller)
+{
+ if(s == nil) {
+ s = sha256init();
+ if(s == nil)
+ return nil;
+ }
+
+ if(s->seeded == 0){
+ memmove(s->h32, smaller? sha224h0: sha256h0, sizeof s->h32);
+ s->seeded = 1;
+ }
+
+ _sha256(p, len, s);
+
+ if(digest == 0)
+ return s;
+
+ sha256finish(s, digest, smaller);
+ if(s->malloced == 1)
+ free(s);
+ return nil;
+}
+
+SHA256state*
+sha224(uchar *p, ulong len, uchar *digest, SHA256state *s)
+{
+ return sha256x(p, len, digest, s, 1);
+}
+
+SHA256state*
+sha256(uchar *p, ulong len, uchar *digest, SHA256state *s)
+{
+ return sha256x(p, len, digest, s, 0);
+}
+
+
+static SHA512state *
+sha512init(void)
+{
+ SHA512state *s;
+
+ s = malloc(sizeof(*s));
+ if(s == nil)
+ return nil;
+ s->malloced = 1;
+ s->seeded = 0;
+ s->nb128[HI] = 0;
+ s->nb128[LO] = 0;
+ s->blen = 0;
+
+ return s;
+}
+
+static void
+_sha512(uchar *p, ulong len, SHA512state *s)
+{
+ u32int take;
+
+ /* complete possible partial block from last time */
+ if(s->blen > 0 && s->blen+len >= SHA512bsize) {
+ take = SHA512bsize-s->blen;
+ memmove(s->buf+s->blen, p, take);
+ p += take;
+ len -= take;
+ _sha512block(s, s->buf);
+ uvvadd(s->nb128, SHA512bsize);
+ s->blen = 0;
+ memset(s->buf, 0, SHA512bsize);
+ }
+ /* whole blocks */
+ while(len >= SHA512bsize) {
+ _sha512block(s, p);
+ uvvadd(s->nb128, SHA512bsize);
+ p += SHA512bsize;
+ len -= SHA512bsize;
+ }
+ /* keep possible leftover bytes */
+ if(len > 0) {
+ memmove(s->buf+s->blen, p, len);
+ s->blen += len;
+ }
+}
+
+void
+sha512finish(SHA512state *s, uchar *digest, int smaller)
+{
+ int i;
+ uchar end[SHA512bsize+16];
+ u32int nzero, n;
+ u64int nb[2];
+
+ nzero = (2*SHA512bsize - s->blen - 1 - 16) % SHA512bsize;
+ end[0] = 0x80;
+ memset(end+1, 0, nzero);
+ nb[0] = s->nb128[0];
+ nb[1] = s->nb128[1];
+ uvvadd(nb, s->blen);
+ uvvmult8(nb);
+ p128(nb, end+1+nzero);
+ _sha512(end, 1+nzero+16, s);
+
+ n = SHA512dlen/8;
+ if(smaller)
+ n = SHA384dlen/8;
+ for(i = 0; i < n; i++, digest += 8)
+ p64(s->h64[i], digest);
+}
+
+static SHA512state*
+sha512x(uchar *p, ulong len, uchar *digest, SHA512state *s, int smaller)
+{
+ if(s == nil) {
+ s = sha512init();
+ if(s == nil)
+ return nil;
+ }
+
+ if(s->seeded == 0){
+ memmove(s->h64, smaller? sha384h0: sha512h0, sizeof s->h64);
+ s->seeded = 1;
+ }
+
+ _sha512(p, len, s);
+
+ if(digest == 0)
+ return s;
+
+ sha512finish(s, digest, smaller);
+ if(s->malloced == 1)
+ free(s);
+ return nil;
+}
+
+SHA512state*
+sha384(uchar *p, ulong len, uchar *digest, SHA512state *s)
+{
+ return sha512x(p, len, digest, s, 1);
+}
+
+SHA512state*
+sha512(uchar *p, ulong len, uchar *digest, SHA512state *s)
+{
+ return sha512x(p, len, digest, s, 0);
+}
=======================================
--- /dev/null
+++ /libsec/port/sha256block.c Wed Feb 3 12:50:07 2010
@@ -0,0 +1,81 @@
+#include "os.h"
+#include <libsec.h>
+
+enum {
+ SHA256rounds = 64,
+};
+
+u32int sha256const[] = {
+0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,
0x923f82a4, 0xab1c5ed5,
+0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe,
0x9bdc06a7, 0xc19bf174,
+0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa,
0x5cb0a9dc, 0x76f988da,
+0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
0x06ca6351, 0x14292967,
+0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb,
0x81c2c92e, 0x92722c85,
+0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624,
0xf40e3585, 0x106aa070,
+0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,
0x5b9cca4f, 0x682e6ff3,
+0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb,
0xbef9a3f7, 0xc67178f2,
+};
+
+
+#define CH(x,y,z) ((x&y) ^ (~x&z))
+#define MAJ(x,y,z) ((x&y) ^ (x&z) ^ (y&z))
+#define ROTR32(n, v) ((v>>n) | (v<<(32-n)))
+#define ROTR64(n, v) ((v>>n) | (v<<(64-n)))
+#define SHR(n, x) (x>>n)
+
+#define SIGMA0a(x) (ROTR32(2, x)^ROTR32(13, x)^ROTR32(22, x))
+#define SIGMA1a(x) (ROTR32(6, x)^ROTR32(11, x)^ROTR32(25, x))
+#define sigma0a(x) (ROTR32(7, x)^ROTR32(18, x)^SHR(3, x))
+#define sigma1a(x) (ROTR32(17, x)^ROTR32(19, x)^SHR(10, x))
+
+/* for use in _sha*() */
+#define A v[0]
+#define B v[1]
+#define C v[2]
+#define D v[3]
+#define E v[4]
+#define F v[5]
+#define G v[6]
+#define H v[7]
+
+static u32int
+g32(uchar *p)
+{
+ return p[0]<<24|p[1]<<16|p[2]<<8|p[3]<<0;
+}
+
+void
+_sha256block(SHA256state *s, uchar *buf)
+{
+ u32int w[2*SHA256bsize/4];
+ int i, t;
+ u32int t1, t2;
+ u32int v[8];
+
+ for(t = 0; t < nelem(w)/2; t++) {
+ if(t < 16) {
+ w[t] = g32(buf);
+ buf += 4;
+ }
+ }
+
+ memmove(v, s->h32, sizeof s->h32);
+
+ for(t = 0; t < SHA256rounds; t++) {
+ if(t >= 16)
+ w[t&31] = sigma1a(w[(t-2)&31]) + w[(t-7)&31] + sigma0a(w[(t-15)&31]) +
w[(t-16)&31];
+ t1 = H + SIGMA1a(E) + CH(E,F,G) + sha256const[t] + w[t&31];
+ t2 = SIGMA0a(A) + MAJ(A,B,C);
+ H = G;
+ G = F;
+ F = E;
+ E = D+t1;
+ D = C;
+ C = B;
+ B = A;
+ A = t1+t2;
+ }
+
+ for(i = 0; i < nelem(v); i++)
+ s->h32[i] += v[i];
+}
=======================================
--- /dev/null
+++ /libsec/port/sha512block.c Wed Feb 3 12:50:07 2010
@@ -0,0 +1,114 @@
+#include "os.h"
+#include <libsec.h>
+
+
+enum {
+ SHA512rounds = 80,
+};
+
+u64int sha512const[] = {
+0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, 0xb5c0fbcfec4d3b2fULL,
0xe9b5dba58189dbbcULL,
+0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, 0x923f82a4af194f9bULL,
0xab1c5ed5da6d8118ULL,
+0xd807aa98a3030242ULL, 0x12835b0145706fbeULL, 0x243185be4ee4b28cULL,
0x550c7dc3d5ffb4e2ULL,
+0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, 0x9bdc06a725c71235ULL,
0xc19bf174cf692694ULL,
+0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL, 0x0fc19dc68b8cd5b5ULL,
0x240ca1cc77ac9c65ULL,
+0x2de92c6f592b0275ULL, 0x4a7484aa6ea6e483ULL, 0x5cb0a9dcbd41fbd4ULL,
0x76f988da831153b5ULL,
+0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, 0xb00327c898fb213fULL,
0xbf597fc7beef0ee4ULL,
+0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL, 0x06ca6351e003826fULL,
0x142929670a0e6e70ULL,
+0x27b70a8546d22ffcULL, 0x2e1b21385c26c926ULL, 0x4d2c6dfc5ac42aedULL,
0x53380d139d95b3dfULL,
+0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, 0x81c2c92e47edaee6ULL,
0x92722c851482353bULL,
+0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL, 0xc24b8b70d0f89791ULL,
0xc76c51a30654be30ULL,
+0xd192e819d6ef5218ULL, 0xd69906245565a910ULL, 0xf40e35855771202aULL,
0x106aa07032bbd1b8ULL,
+0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, 0x2748774cdf8eeb99ULL,
0x34b0bcb5e19b48a8ULL,
+0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL, 0x5b9cca4f7763e373ULL,
0x682e6ff3d6b2b8a3ULL,
+0x748f82ee5defb2fcULL, 0x78a5636f43172f60ULL, 0x84c87814a1f0ab72ULL,
0x8cc702081a6439ecULL,
+0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, 0xbef9a3f7b2c67915ULL,
0xc67178f2e372532bULL,
+0xca273eceea26619cULL, 0xd186b8c721c0c207ULL, 0xeada7dd6cde0eb1eULL,
0xf57d4f7fee6ed178ULL,
+0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL, 0x113f9804bef90daeULL,
0x1b710b35131c471bULL,
+0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, 0x3c9ebe0a15c9bebcULL,
0x431d67c49c100d4cULL,
+0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL, 0x5fcb6fab3ad6faecULL,
0x6c44198c4a475817ULL,
+};
+
+
+static u32int
+g32(uchar *p)
+{
+ return p[0]<<24|p[1]<<16|p[2]<<8|p[3]<<0;
+}
+
+static u64int
+g64(uchar *p)
+{
+ return ((u64int)g32(p)<<32)|g32(p+4);
+}
+
+
+#define CH(x,y,z) ((x&y) ^ (~x&z))
+#define MAJ(x,y,z) ((x&y) ^ (x&z) ^ (y&z))
+#define ROTR32(n, v) ((v>>n) | (v<<(32-n)))
+#define ROTR64(n, v) ((v>>n) | (v<<(64-n)))
+#define SHR(n, x) (x>>n)
+
+#define SIGMA0b(x) (ROTR64(28, x)^ROTR64(34, x)^ROTR64(39, x))
+#define SIGMA1b(x) (ROTR64(14, x)^ROTR64(18, x)^ROTR64(41, x))
+#define sigma0b(x) (ROTR64(1, x)^ROTR64(8, x)^SHR(7, x))
+#define sigma1b(x) (ROTR64(19, x)^ROTR64(61, x)^SHR(6, x))
+
+#define A v[0]
+#define B v[1]
+#define C v[2]
+#define D v[3]
+#define E v[4]
+#define F v[5]
+#define G v[6]
+#define H v[7]
+
+void
+_sha512block(SHA512state *s, uchar *buf)
+{
+ u64int w[2*SHA512bsize/8];
+ int i, t;
+ u64int t1, t2, t3, v[8];
+
+ for(t = 0; t < nelem(w)/2; t++) {
+ if(t < 16) {
+ w[t] = g64(buf);
+ buf += 8;
+ }
+ }
+
+ memmove(v, s->h64, sizeof s->h64);
+
+ for(t = 0; t < SHA512rounds; t++) {
+ if(t >= 16) {
+ /* w[t&31] = sigma1b(w[(t-2)&31]) + w[(t-7)&31] + sigma0b(w[(t-15)&31])
+ w[(t-16)&31]; */
+ t2 = w[(t-2)&31];
+ t3 = w[(t-15)&31];
+ /* w[t&31] = sigma1b(t2) + w[(t-7)&31] + sigma0b(t3) + w[(t-16)&31]; */
+ t1 = sigma1b(t2);
+ t1 += w[(t-7)&31];
+ t1 += sigma0b(t3);
+ t1 += w[(t-16)&31];
+ w[t&31] = t1;
+ }
+ /* t1 = H + SIGMA1b(E) + CH(E,F,G) + sha512const[t] + w[t&31]; */
+ t1 = H;
+ t1 += SIGMA1b(E);
+ t1 += CH(E, F, G);
+ t1 += sha512const[t] + w[t&31];
+ /* t2 = SIGMA0b(A) + MAJ(A,B,C); */
+ t2 = SIGMA0b(A);
+ t2 += MAJ(A, B, C);
+ H = G;
+ G = F;
+ F = E;
+ E = D+t1;
+ D = C;
+ C = B;
+ B = A;
+ A = t1+t2;
+ }
+
+ for(i = 0; i < nelem(v); i++)
+ s->h64[i] += v[i];
+}
=======================================
--- /libsec/port/mkfile Fri Dec 22 09:07:39 2006
+++ /libsec/port/mkfile Wed Feb 3 12:50:07 2010
@@ -6,6 +6,7 @@
aes.c blowfish.c \
idea.c \
hmac.c md5.c md5block.c md4.c sha1.c sha1block.c\
+ sha2.c sha256block.c sha512block.c\
sha1pickle.c md5pickle.c\
rc4.c\
genrandom.c prng.c fastrand.c nfastrand.c\

==============================================================================
Revision: b034f80f9d
Author: Venkatesh Srinivas <m...@acm.jhu.edu>
Date: Wed Feb 3 13:28:15 2010
Log: Merge with inferno-os 20100203.

Adds SHA2, SHA256, and SHA512 to libsec, adds uvlong to many lib9.h, a few
minor other fixes.
http://code.google.com/p/inferno-npe/source/detail?r=b034f80f9d

Modified:
/CHANGES
/Linux/386/bin/mkext
/include/version.h

=======================================
--- /CHANGES Sat Jan 16 14:00:38 2010
+++ /CHANGES Wed Feb 3 13:28:15 2010
@@ -1,3 +1,8 @@
+20100203
+ appl/lib/cfg.b treat \r as white space (issue 69, 70)
+ add u64int to lib9.h files that needed it
+ add sha2.c sha256block.c sha512block.c to libsec/port and include/libsec.h
+ add new sha functions to module/keyring.m and libinterp/keyring.c
20100115
appl/cmd/tarfs.b man/4/tarfs changes to permission handling from mechiel
[issue 220]
appl/spree/mkfile add explicit -I$ROOT/module [issue 209, powerman]
=======================================
--- /Linux/386/bin/mkext Tue Nov 18 12:58:27 2008
+++ /Linux/386/bin/mkext Tue Nov 18 12:58:27 2008
Binary file, no diff available.
=======================================
--- /include/version.h Sat Jan 16 14:00:38 2010
+++ /include/version.h Wed Feb 3 13:28:15 2010
@@ -1,1 +1,1 @@
-#define VERSION "Fourth Edition (20100115)"
+#define VERSION "Fourth Edition (20100203)"

==============================================================================
Revision: dc2a5109fb
Author: Venkatesh Srinivas <m...@acm.jhu.edu>
Date: Wed Feb 3 13:29:43 2010
Log: Add uvlong to DragonFly BSD lib9.h.
http://code.google.com/p/inferno-npe/source/detail?r=dc2a5109fb

Modified:
/DragonFly/386/include/lib9.h

=======================================
--- /DragonFly/386/include/lib9.h Wed Jan 13 15:30:03 2010
+++ /DragonFly/386/include/lib9.h Wed Feb 3 13:29:43 2010
@@ -43,6 +43,8 @@
typedef long long int vlong;
typedef unsigned long long int uvlong;
typedef unsigned int u32int;
+typedef uvlong u64int;
+
typedef unsigned int mpdigit; /* for /sys/include/mp.h */
typedef unsigned short u16int;
typedef unsigned char u8int;

Reply all
Reply to author
Forward
0 new messages