Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8dd09d2
pc/pc64: use linked lists for lapics and ioapics instead of arrays
cinaplenrek Jun 16, 2026
f4dfa08
libdraw: avoid temporary integer overflow in unitsperline() (thanks n…
SametSisartenep Jun 17, 2026
6c76017
git/get: don't silently change protocols from http to https
oridb Jun 17, 2026
75bd9e1
git: don't leak pipe fd into spawned programs
oridb Jun 17, 2026
8c6a6d3
disk/qcowfs: set refcount of new refcount blocks to 1
oridb Jun 18, 2026
048f21a
/sys/src: fix use of strncat
majiru Jun 19, 2026
77f00d6
libsec: blake2s: fix block chunking
majiru Jun 19, 2026
c771251
kernel: devaudio: fix parsing of "in" and "out" ignored options to vo…
majiru Jun 19, 2026
7e0e23d
pc/pc64: implement x2APIC support
cinaplenrek Jun 19, 2026
141de64
plan9.ini(8): fix *x2apic= description typo
cinaplenrek Jun 19, 2026
080da19
libsec: avoid strecpy() and use seprint() instead (for APE)
cinaplenrek Jun 19, 2026
22b3a18
ape: libsec: sync sha3 changes
majiru Jun 20, 2026
f56d81b
ape: libsec: reduce diff with main libsec.h
majiru Jun 20, 2026
98a89f1
libsec: sha3 and sha2 BIGMAC hmac functions
majiru Jun 20, 2026
484c7ec
kernel: nuke devsdp and ip/esp
majiru Jun 20, 2026
0f13f2c
pc/pc64: use x2apic when cpu0 uses it
cinaplenrek Jun 20, 2026
c96a2ce
upas/send: allow user to mail themselves if mbox dir isn't other writ…
Jun 20, 2026
06368ca
allocimage(2): document deprecation of dolock flag in (read|write)ima…
SametSisartenep Jun 21, 2026
0d2707d
pc: vmx: fix potential buffer overflow in fpregs write from typo
majiru Jun 22, 2026
8bf2c61
kernel: fix dropped beagle config for removal of esp
majiru Jun 22, 2026
ceafa0a
ip/tcp: propagate peer close to spliced loopback writer
rafael2knokia May 21, 2026
3a49407
ip/tcp: skip stray FIN when spliced peer was torn down
rafael2knokia May 22, 2026
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
27 changes: 21 additions & 6 deletions sys/include/ape/libsec.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ struct DES3state
};

void setupDES3state(DES3state *s, uchar key[3][8], uchar *ivec);
void triple_block_cipher(ulong keys[3][32], uchar[8], int);
void triple_block_cipher(ulong[3][32], uchar[8], int);
void des3CBCencrypt(uchar*, int, DES3state*);
void des3CBCdecrypt(uchar*, int, DES3state*);
void des3ECBencrypt(uchar*, int, DES3state*);
Expand All @@ -242,8 +242,12 @@ enum
Poly1305dlen= 16, /* Poly1305 digest length */
BLAKE2S_128dlen= 16, /* Blake2s-128 digest length */
BLAKE2S_256dlen= 32, /* Blake2s-256 digest length */

Hmacblksz = 64, /* in bytes; from rfc2104 */
SHA3_224dlen= 28, /* SHA3-224 digest length */
SHA3_256dlen= 32, /* SHA3-256 digest length */
SHA3_384dlen= 48, /* SHA3-384 digest length */
SHA3_512dlen= 64, /* SHA3-512 digest length */
SHAKE_128dlen= 16, /* SHAKE128 digest length */
SHAKE_256dlen= 32, /* SHAKE256 digest length */
};

typedef struct DigestState DigestState;
Expand All @@ -252,7 +256,7 @@ struct DigestState
uvlong len;
union {
u32int state[16];
u64int bstate[8];
u64int bstate[25];
};
uchar buf[256];
int blen;
Expand All @@ -278,16 +282,26 @@ DigestState* sha2_384(uchar*, ulong, uchar*, DigestState*);
DigestState* sha2_512(uchar*, ulong, uchar*, DigestState*);
DigestState* blake2s_128(uchar*, ulong, uchar*, DigestState*);
DigestState* blake2s_256(uchar*, ulong, uchar*, DigestState*);
DigestState* sha3_224(uchar*, ulong, uchar*, DigestState*);
DigestState* sha3_256(uchar*, ulong, uchar*, DigestState*);
DigestState* sha3_384(uchar*, ulong, uchar*, DigestState*);
DigestState* sha3_512(uchar*, ulong, uchar*, DigestState*);
DigestState* shake_128(uchar*, ulong, uchar*, ulong, DigestState*);
DigestState* shake_256(uchar*, ulong, uchar*, ulong, DigestState*);
DigestState* hmac_x(uchar *p, ulong len, uchar *key, ulong klen,
uchar *digest, DigestState *s,
DigestState*(*x)(uchar*, ulong, uchar*, DigestState*),
int xlen);
int xlen, int B);
DigestState* hmac_md5(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_sha1(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_sha2_224(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_sha2_256(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_sha2_384(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_sha2_512(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_sha3_224(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_sha3_256(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_sha3_384(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_sha3_512(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_blake2s_256(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* poly1305(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* mac_blake2s_128(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
Expand Down Expand Up @@ -373,8 +387,8 @@ void rsaprivfree(RSApriv*);
RSApub* rsaprivtopub(RSApriv*);
RSApub* X509toRSApub(uchar*, int, char*, int);
RSApub* X509reqtoRSApub(uchar*, int, char*, int);
RSApriv* asn1toRSApriv(uchar*, int);
RSApub* asn1toRSApub(uchar*, int);
RSApriv* asn1toRSApriv(uchar*, int);
void asn1dump(uchar *der, int len);
uchar* decodePEM(char *s, char *type, int *len, char **new_s);
PEMChain* decodepemchain(char *s, char *type);
Expand All @@ -389,6 +403,7 @@ mpint* pkcs1padbuf(uchar *buf, int len, mpint *modulus, int blocktype);
int pkcs1unpadbuf(uchar *buf, int len, mpint *modulus, int blocktype);
int asn1encodeRSApub(RSApub *pk, uchar *buf, int len);
int asn1encodeRSApriv(RSApriv *k, uchar *buf, int len);
int asn1encodeRSApubSPKI(RSApub *pk, uchar *buf, int len);
int asn1encodedigest(DigestState* (*fun)(uchar*, ulong, uchar*, DigestState*),
uchar *digest, uchar *buf, int len);

Expand Down
8 changes: 5 additions & 3 deletions sys/include/libsec.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,6 @@ enum
SHA3_512dlen= 64, /* SHA3-512 digest length */
SHAKE_128dlen= 16, /* SHAKE128 digest length */
SHAKE_256dlen= 32, /* SHAKE256 digest length */

Hmacblksz = 64, /* in bytes; from rfc2104 */
};

typedef struct DigestState DigestState;
Expand Down Expand Up @@ -285,13 +283,17 @@ DigestState* shake_256(uchar*, ulong, uchar*, ulong, DigestState*);
DigestState* hmac_x(uchar *p, ulong len, uchar *key, ulong klen,
uchar *digest, DigestState *s,
DigestState*(*x)(uchar*, ulong, uchar*, DigestState*),
int xlen);
int xlen, int B);
DigestState* hmac_md5(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_sha1(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_sha2_224(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_sha2_256(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_sha2_384(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_sha2_512(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_sha3_224(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_sha3_256(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_sha3_384(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_sha3_512(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* hmac_blake2s_256(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* poly1305(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
DigestState* mac_blake2s_128(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
Expand Down
5 changes: 1 addition & 4 deletions sys/man/2/allocimage
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,7 @@ The returned image is allocated using
.IR allocimage .
The
.I dolock
flag specifies whether the
.B Display
should be synchronized for multithreaded access; single-threaded
programs can leave it zero.
flag is kept for backwards compatibility and is otherwise ignored.
.PP
.I Writeimage
writes image
Expand Down
10 changes: 9 additions & 1 deletion sys/man/2/sechash
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ DS* blake2s_128(uchar *data, ulong dlen, uchar *digest, DS *state)
.Ti
DS* blake2s_256(uchar *data, ulong dlen, uchar *digest, DS *state)
.Ti
DS* hmac_x(uchar *p, ulong len, uchar *key, ulong klen, uchar *digest, DS *s, DS*(*x)(uchar*, ulong, uchar*, DS*), int xlen)
DS* hmac_x(uchar *p, ulong len, uchar *key, ulong klen, uchar *digest, DS *s, DS*(*x)(uchar*, ulong, uchar*, DS*), int xlen, int B)
.Ti
DS* hmac_md5(uchar *data, ulong dlen, uchar *key, ulong klen, uchar *digest, DS *state)
.Ti
Expand All @@ -74,6 +74,14 @@ DS* hmac_sha2_384(uchar *data, ulong dlen, uchar *key, ulong klen, uchar *digest
.Ti
DS* hmac_sha2_512(uchar *data, ulong dlen, uchar *key, ulong klen, uchar *digest, DS *state)
.Ti
DS* hmac_sha3_224(uchar *data, ulong dlen, uchar *key, ulong klen, uchar *digest, DS *state)
.Ti
DS* hmac_sha3_256(uchar *data, ulong dlen, uchar *key, ulong klen, uchar *digest, DS *state)
.Ti
DS* hmac_sha3_384(uchar *data, ulong dlen, uchar *key, ulong klen, uchar *digest, DS *state)
.Ti
DS* hmac_sha3_512(uchar *data, ulong dlen, uchar *key, ulong klen, uchar *digest, DS *state)
.Ti
DS* hmac_blake2s_256(uchar *data, ulong dlen, uchar *key, ulong klen, uchar *digest, DS *state)
.Ti
DS* poly1305(uchar *p, ulong len, uchar *key, ulong klen, uchar *digest, DS *state)
Expand Down
72 changes: 2 additions & 70 deletions sys/man/3/ip
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.TH IP 3
.SH NAME
ip, esp, gre, icmp, icmpv6, ipmux, rudp, tcp, udp, il \- network protocols over IP
ip, gre, icmp, icmpv6, ipmux, rudp, tcp, udp, il \- network protocols over IP
.SH SYNOPSIS
.nf
.2C
Expand All @@ -21,7 +21,6 @@ ip, esp, gre, icmp, icmpv6, ipmux, rudp, tcp, udp, il \- network protocols over
.B /net/log
.B /net/ndb
.sp 0.3v
.B /net/esp
.B /net/gre
.B /net/icmp
.B /net/icmpv6
Expand Down Expand Up @@ -525,9 +524,8 @@ The possible items are:
.BR tcpwin ,
.BR tcprxmt ,
.BR udpmsg ,
.BR ipmsg ,
and
.BR esp .
.BR ipmsg .
.TP
.BI clear\ arglist
.I Arglist
Expand Down Expand Up @@ -1020,72 +1018,6 @@ in the connect message.
.br
.ne 3
.
.SS ESP
ESP is the Encapsulating Security Payload (RFC 1827, obsoleted by RFC 4303)
for IPsec (RFC 4301).
We currently implement only tunnel mode, not transport mode.
It is used to set up an encrypted tunnel between machines.
Like GRE, ESP has no port numbers. Instead, the
port number in the
.B connect
message is the SPI (Security Association Identifier (sic)).
IP packets are written to and read from
.BR data .
The kernel encrypts any packets written to
.BR data ,
appends a MAC, and prefixes an ESP header before
sending to the other end of the tunnel.
Received packets are checked against their MAC's,
decrypted, and queued for reading from
.BR data .
In the following,
.I secret
is the hexadecimal encoding of a key,
without a leading
.LR 0x .
The control messages are:
.TF "\fLesp \fIalg secret\fR"
.PD
.TP
.BI esp\ "alg secret
Encrypt with the algorithm,
.IR alg ,
using
.I secret
as the key.
Possible algorithms are:
.BR null ,
.BR des_56_cbc ,
.BR des3_cbc ,
and eventually
.BR aes_128_cbc ,
and
.BR aes_ctr .
.TP
.BI ah\ "alg secret
Use the hash algorithm,
.IR alg ,
with
.I secret
as the key for generating the MAC.
Possible algorithms are:
.BR null ,
.BR hmac_sha1_96 ,
.BR hmac_md5_96 ,
and eventually
.BR aes_xcbc_mac_96 .
.TP
.B header
Turn on header mode. Every buffer read from
.B data
starts with 4 unused bytes, and the first 4 bytes
of every buffer written to
.B data
are ignored.
.TP
.B noheader
Turn off header mode.
.
.SS "IP packet filter
The directory
.B /net/ipmux
Expand Down
147 changes: 0 additions & 147 deletions sys/man/3/sdp

This file was deleted.

Loading