Commit graph

207 commits

Author SHA1 Message Date
Roberto E. Vargas Caballero
5e9d8a7b18 Add toascii() to ape 2019-09-09 16:00:06 +01:00
Roberto E. Vargas Caballero
e0720a48b0 Add mkstemp to stdlib.h
q
2019-09-09 15:58:39 +01:00
Ori Bernstein
ff9ce8210a Include integer limits from generic stdint.h in system-specific stdint.h 2019-09-06 18:01:52 -07:00
Ori Bernstein
c09546ccea Add missing UINTsz_MIN defines to ape stdint.h 2019-09-06 16:33:11 -07:00
David du Colombier
27824a6c0b sys/src/libventi: define VtEntryNoArchive constant 2019-09-06 11:55:35 -07:00
David du Colombier
cb091e7539 sys/src/libventi: implement vtsha1 and vtsha1check functions 2019-09-06 11:55:18 -07:00
David du Colombier
63ae9ed53a sys/src/libventi: implement vtreconn and vtredial functions 2019-09-06 11:54:44 -07:00
cinap_lenrek
85216d3d95 auth/rsa2asn1: implement private key export with -a flag (thanks kvik)
kvik writes:

I needed to convert the RSA private key that was laying around in
secstore into a format understood by UNIX® tools like SSH.

With asn12rsa(8) we can go from the ASN.1/DER to Plan 9 format, but not
back - so I wrote the libsec function asn1encodeRSApriv(2) and used it in
rsa2asn1(8) by adding the -a flag which causes the full private key to be
encoded and output.
2019-08-30 07:34:35 +02:00
cinap_lenrek
4b4d68487c stdio: fix putc(), plan9 version 2019-06-20 00:04:58 +02:00
cinap_lenrek
ef1bcc7338 ape: fix stdio putc() macro, avoiding "result of operation not used" warning
moving _IO_CHMASK masking on the right hand side fixes it.
2019-06-19 23:59:25 +02:00
Ori Bernstein
ceed9b8853 Sand edges down on GBIT64()/PBIT64() macros.
Now, you can safely use them in unbraced if statements, and
with char*s.
2019-05-06 17:26:38 -07:00
cinap_lenrek
4f0bfe0fb8 dtracy: avoid dmachlock() race
between being commited to a machno and having acquired the lock, the
scheduler could come in an schedule us on a different processor. the
solution is to have dtmachlock() take a special -1 argument to mean
"current mach" and return the actual mach number after the lock has
been acquired and interrupts being disabled.
2019-03-30 09:17:46 +01:00
cinap_lenrek
0af11f97b5 libip: replace v4parsecidr() with new parseipandmask()
we want to accept V4 subnets in CIDR notation consistently which
means we need to interpret the mask in context of the IP address.
so parseipmask() now has an additional v4 flag argument which
offsets the prefixlength by 96 so a /24 will be interpreted
as a /120.

parseipandmask() is the new function which handles this automatically
depending on the ip address type.

v4parsecidr() is now obsolete.
2019-02-11 23:26:57 +01:00
aiju
c7304ea03c dtracy: get rid of DTName struct, support more than three parts in a probe name, wildcard matching 2018-12-13 10:42:49 +00:00
aiju
40d6302b5f forgotten files 2018-12-11 09:20:34 +00:00
aiju
ca851bbb5e dtracy: call dtptrigger with a struct pointer rather than a list of arguments; put return value in arg9 2018-12-09 21:43:22 +00:00
aiju
58fa29447b dtracy: add support for aggregations 2018-12-08 15:07:53 +00:00
mischief
cb7375dcbc ape: declare gethostname 2018-12-02 03:30:22 -08:00
aiju
e15b1b8930 add dtracy.h 2018-11-10 20:01:19 +00:00
mischief
6df3f7bf38 libmp: declare mpfactorial 2018-11-04 11:37:02 -08:00
cinap_lenrek
19166f2cf3 libc: add procsetname() 2018-09-26 14:56:23 +02:00
cinap_lenrek
311e3b51c6 libc: return number of bytes produced for idn2utf() and utf2idn() 2018-09-26 14:32:17 +02:00
cinap_lenrek
dfec09c436 libc: add utf2idn() and idn2utf() functions to deal with internationalized domain names 2018-09-25 20:14:25 +02:00
cinap_lenrek
a4e444f430 libndb: make ndbipinfo() walk ipnet for all matching entries, concatenate and dedup result 2018-09-16 12:39:47 +02:00
spew
91d0343627 ape: an implemenation of getitimer setitimer 2018-07-01 18:48:12 -04:00
spew
55c122d59f ape: add strnlen 2018-06-21 11:56:37 -04:00
spew
3b376b43af ape: provide bogus chroot implementation 2018-06-20 22:19:37 -04:00
spew
583c6d269b ape: add some common fields for stat, grp and pwd 2018-06-17 17:38:00 -04:00
aiju
db71e19005 add libttf 2018-06-09 14:33:19 +00:00
cinap_lenrek
930efe67e8 ape: fix auth.h 2018-05-20 23:22:41 +02:00
cinap_lenrek
6e19d19285 separate MSCHAP(v2) and NTLM(v2) authentication
due to linux omiting the final Z(4) in the NTLMv2 reply, and
the need for the windom for LMv2 authentication, here is a new
AuthNTLM ticket request now with length and dom fields.
2018-05-20 22:49:24 +02:00
qwx
19d6a98038 ape: add signed fixed size integer typedefs to u.h 2018-05-13 07:13:00 +02:00
cinap_lenrek
8f91d94d19 merge 2018-05-01 23:40:00 +02:00
cinap_lenrek
190c40c9ff ip/ipconfig: populate /net/ndb from v6 router advertisements, configure multiple addresses in ndbconfig()
we now update /net/ndb with the following information gathered
from router advertisements (rfc6106 and plan9 specific options):

- recursive dns servers (option 25, ndb: dns=)
- dns search list (option 31, ndb: dnsdomain=)
- plan9 fileserver (option 250, ndb: fs=)
- plan9 authserver (option 251, ndb: auth=)

note the plan9 specific options can be disabled with the -G flag.

for ndbconfig (-N flag), we now collect all ip addresses in ndb
belonging to the devices mac address and configue them all. v6
addresses are getting added when a link local address exists
or the -6 flag has been specified to automatically configure one.

move the dhcp code in its own dhcp.c file and make symbols static
that are not used across modules.
2018-05-01 23:32:28 +02:00
aiju
29f03ba4e7 libsat, forp: fix va_list hack on amd64 2018-04-24 12:20:07 +01:00
mischief
034d0b08e9 ape: improve assert macro
in a statement such as:

if(expr)
	assert(a);
else
	assert(b);

the previous definition of assert would fail to compile, as the else
would be dangling.  with a ternary expression, this construct works
fine.
2018-04-02 21:44:21 -07:00
aiju
57edb0b2d4 sat.h: update to include satget 2018-03-28 20:36:04 +00:00
aiju
9f18b0f388 add #pragma incomplete to sat.h 2018-03-18 01:15:07 +00:00
aiju
c2c9562e3c add libsat 2018-03-17 19:26:26 +00:00
aiju
b7d31909f6 mptod/dtomp: add to mp.h 2018-03-09 21:30:06 +00:00
cinap_lenrek
34f19570b9 libndb: retire deprecated csgetval(), ndbgetval() and ndblookval() functions 2018-01-27 23:46:48 +01:00
cinap_lenrek
3004f058f6 libauth: add auth_respondAI() function to get AuthInfo for mschap/mschapv2 2018-01-21 22:37:45 +01:00
cinap_lenrek
fd1e50d653 authsrv: implement mschapv2 authentication, include MPPE secret in the ticket
this adds new rpc for mschapv2 authentication (21)

deliver the MPPE secret not after the ticket/authenticator
response as cheartext, but include it in the first 128 bit
of the ticket key. and the authenticator in the first 160 bit
of the authenticator random field.
2018-01-21 22:32:34 +01:00
cinap_lenrek
8ff72ce20d libsec: remove asn1toDSApriv() 2018-01-06 08:34:25 +01:00
cinap_lenrek
e8b46f6972 ape: update auth.h header for APE 2018-01-02 04:59:44 +01:00
cinap_lenrek
e1ca49d625 libauth: remove auth_wep() function, and non-existing httpauth() declaration 2018-01-02 04:31:21 +01:00
cinap_lenrek
c039b52fc3 libc: constant time implementation for encode(2) routines, fix base32
the string encoding functions touch secret key material
in a bunch of places (devtls, devcap), so make sure we do
not leak information by cache timing side channels, making
the encoding and decoding routines constant time.

we also expose the alphabets through encXchr()/decXchr()
functions so caller can find the end of a encoded string
before calling decode function (for libmp).

the base32 encoding was broken in several ways. inputs
lengths of len%5 == [2,3,4] had output truncated and
it was using non-standard alphabet. documenting the alphabet
change in the manpage.
2017-12-31 09:06:42 +01:00
cinap_lenrek
57f8b6ec75 libsec: implement SPKI fingerprinting for okCertificate()
Instead of only using a hash over the whole certificate for
white/black-listing, now we can also use a hash over the
Subject Public Key Info (SPKI) field of the certificate which
contians the public key algorithm and the public key itself.

This allows certificates to be renewed independendtly of the
public key.

X509dump() now prints the public key thumbprint in addition
to the certificate thumbprint.

tlsclient will print the certificate when run with -D flag.

okCertificate() will print the public key thumbprint in its
error string when no match has been found.
2017-12-30 03:07:47 +01:00
cinap_lenrek
3356e0e731 libsec: AES-NI support for amd64
Add assembler versions for aes_encrypt/aes_decrypt and the key
setup using AES-NI instruction set. This makes aes_encrypt and
aes_decrypt into function pointers which get initialized by
the first call to setupAESstate().

Note that the expanded round key words are *NOT* stored in big
endian order as with the portable implementation. For that reason
the AESstate.ekey and AESstate.dkey fields have been changed to
void* forcing an error when someone is accessing the roundkey
words. One offender was aesXCBmac, which doesnt appear to be
used and the code looks horrible so it has been deleted.

The AES-NI implementation is for amd64 only as it requires the
kernel to save/restore the FPU state across syscalls and
pagefaults.
2017-11-12 23:15:15 +01:00
cinap_lenrek
c021390e21 libsec: rewrite aex_xts_encrypt()/aes_xts_decrypt()
the previous implementation was not portable at all, assuming
little endian in gf_mulx() and that one can cast unaligned
pointers to ulong in xor128(). also the error code is likely
to be ignored, so better abort() when the length is not a
multiple of the AES block size.

we also pass in full AESstate structures now instead of
the expanded key longs, so that we do not need to hardcode
the number of rounds. this allows each indiviaul keys to
be bigger than 128 bit.
2017-10-29 21:49:24 +01:00