Commit graph

4266 commits

Author SHA1 Message Date
aiju fe1e95d6d8 games/gb: timer array should be unsigned (thanks qwx) 2017-02-12 00:38:17 +01:00
aiju 6176b55759 games/gb: fix typo in the routine to load timer data (thanks qwx) 2017-02-11 23:52:35 +01:00
cinap_lenrek 6840a9aafd libsec: zero name buffer in X509toECpub() 2017-02-10 21:42:11 +01:00
cinap_lenrek fb2abc2a04 libsec: make X509toECpub() return CN name like X509toRSApub() 2017-02-10 21:36:19 +01:00
cinap_lenrek 24007b9120 libsec: revert asn1mpint(), rewrite rsa signature validation, cleanups
reverting asn1mpint() as all users really just expect
unsigned integers here. also openssl seems to interpret
rsa modulus as unsigned no matter what... so keeping
it as it was before.

handle nil cipher bytes in factotum_rsa_decrypt() due
to pkcs1padbuf() failing.

apply some lessions from intels berzerk paper:

instead of parsing the decrypted digest info blob, we
generate the *expected* blob's for all digest algorithms
that match the digest size and compare the results.

provide pkcs1 pad and unpad functions that consistently
enforce minimum padding size and handles block types 1
and 2.
2017-02-10 00:08:38 +01:00
mischief e8045cbcbf factotum: support sha256 algorithm in rsa pkcs#1 signing
also removed md2 oid, it is unused.
2017-02-09 09:08:43 +00:00
cinap_lenrek 6386a0391a libsec: handle signed asn.1 bigint to mpint conversion for x509 2017-02-06 21:40:42 +01:00
cinap_lenrek 486523bbc5 ip/ipconfig: have to refresh /net/cs, /net/dns after ndbconfig even tho /net/ndb didnt got written 2017-02-06 11:19:45 +01:00
cinap_lenrek bbce9c0566 rsagen: prefer 65537 as the default exponent when elen == 0, otherwise pick randomly 2017-02-06 04:25:38 +01:00
cinap_lenrek 5256f4063e libsec: fix mkbigint(), asn.1 uses two's compement signed representation
quick fix is to bias the rounding so the msb will always
be zero. should write proper conversion code to actually
deal with signed mpints... also for asn1mpint()... -- cinap
2017-02-06 03:50:03 +01:00
cinap_lenrek 02b3c609ed libsec: check if modulus is too small for message in pkcs1padbuf() 2017-02-06 02:03:16 +01:00
cinap_lenrek 1df513a2a1 libsec: need PKCS#9 "Extension Request" attribute (rsareq()) 2017-02-06 01:01:34 +01:00
cinap_lenrek 03e6d3a0f0 aan: remove fcallfmt 2017-02-05 06:14:42 +01:00
cinap_lenrek b8811b7a2f merge 2017-02-05 05:16:39 +01:00
cinap_lenrek 00575e07bb libsec: have rsagen() always produce postive !dk to avoid confusion 2017-02-05 05:15:17 +01:00
cinap_lenrek 541528252e merge 2017-02-05 02:50:11 +01:00
cinap_lenrek 96769e0476 libmp: fix mpmod() aliasing bug when n == r and x < 0 (thanks aiju, mischief)
mischief found this in rsafill()'s call mpmod(c2, x, x), where
d parameter is negative (rsagen created a rsa key with negative dk).
2017-02-05 02:48:13 +01:00
spew 3b24eb4c1f games/mix: implement Knuth's specification for comments 2017-02-03 18:55:02 -06:00
cinap_lenrek 7f12431009 aan: use unsigned message counters, reject repeated acks, cleanup debug prints 2017-02-04 01:39:36 +01:00
spew 930be3d317 libregexp: improve the transition to next available thread, instruction, and generation 2017-02-03 15:33:15 -06:00
spew 9ae083d816 libregexp: simplify regular expression vm implementation
Make the logic around who has priority over the final
match simpler by merging the priority generation and
match fields in a smarter way. Move the creation of
new thread matches up to the top to avoid jumping all
over the place.
2017-02-02 21:21:34 -06:00
cinap_lenrek f94167ebee ip/ipconfig: don't write /net/ndb when getting config from ndb (-N) 2017-02-02 22:00:51 +01:00
cinap_lenrek 65337bec22 aan: check negative message size in header 2017-02-02 20:53:05 +01:00
cinap_lenrek 7516e85813 audio/flacdec: continue after decode error (thanks deuteron) 2017-02-01 10:38:19 +01:00
cinap_lenrek d643cf2fe6 cwfs: handle worm exhaustion more gracefully
don't deadlock when cwgrow() detects we'r out of worm space
by releasing the cache superblock buffer.

don't allocate space beyond the worm device when dumping by
having slit() check. after cwrecur(), we check if there are
enougth blocks remaining to write the dump date directories
and superblocks.
2017-01-30 23:17:18 +01:00
cinap_lenrek 5171a0ac52 cwfs: fix cwcmd startdump 2017-01-27 02:00:20 +01:00
cinap_lenrek c6b2ad583e auth/keyfs: use ulong for time 2017-01-26 22:09:44 +01:00
cinap_lenrek 8ea917d119 secstore/secuser: use ulong for time 2017-01-26 22:06:57 +01:00
spew acd4a952bd games/mix: fix STZ bug, print CMPA instruction 2017-01-23 13:41:21 -06:00
cinap_lenrek 9278b94623 pc/pc64: get rid of timerset(0) case, was used with "i8253set off" ctl 2017-01-22 21:12:38 +01:00
cinap_lenrek 885d41dd7b sgi: get rid of timerset(0) case 2017-01-22 21:08:28 +01:00
cinap_lenrek 6cb359cc00 sgi: cleanup timer code
- no need to splhi() in timerset, always called with
  interrupts off.

- make timerset always update the period (next == 0)

- remove period update in fastticks(), simplify
  delta calculation.
2017-01-22 20:39:14 +01:00
cinap_lenrek a2eafd2cb0 merge 2017-01-22 00:43:44 +01:00
cinap_lenrek d6bb01da76 factotum: fix memory leak in findkey() 2017-01-22 00:42:13 +01:00
spew 339fda9164 games/mix: remove tests directory 2017-01-17 20:52:49 -06:00
spew 4b68ddfb5a games/mix: document -g option, rename tests to examples as it is in the man page 2017-01-17 20:51:08 -06:00
cinap_lenrek e9bf14eceb libsec: avoid temp variables in chacha/salsa ENCRYPT() macro
given that we only pass uchar* with constant offsets
to the s and d arguments of ENCRYPT(), we do not need
the temporary variables sp/dp and the compiler is
smart enougth to combine the const offset with the ones
from GET4() and PUT4() and emit single load and store
instructions for the byte accesses.
2017-01-15 04:09:47 +01:00
cinap_lenrek 03c44c44b0 rx: remove ssh code 2017-01-13 19:54:42 +01:00
khm dc8c7bf2b7 ssh: R.I.P. 2017-01-12 16:36:38 -08:00
cinap_lenrek cb1555c7d7 sgi: change definition of tas() to take void* like the rest 2017-01-12 21:11:34 +01:00
cinap_lenrek bdc1b187c4 merge 2017-01-12 20:17:52 +01:00
cinap_lenrek 2e23780d2f libsec: implement extended 192-bit nonce xchacha variant and hchacha function 2017-01-12 20:16:38 +01:00
cinap_lenrek 47f07b2669 kernel: make the mntcache robust against fileserver like fossil that do not change the qid.vers on wstat
introducing new ctrunc() function that invalidates any caches
for the passed in chan, invoked when handling wstat with a
specified file length or on file creation/truncation.

test program to reproduce the problem:

#include <u.h>
#include <libc.h>
#include <libsec.h>

void
main(int argc, char *argv[])
{
	int fd;
	Dir *d, nd;

	fd = create("xxx", ORDWR, 0666);
	write(fd, "1234", 4);
	d = dirstat("xxx");
	assert(d->length == 4);
	nulldir(&nd);
	nd.length = 0;
	dirwstat("xxx", &nd);
	d = dirstat("xxx");
	assert(d->length == 0);
	fd = open("xxx", OREAD);
	assert(read(fd, (void*)&d, 4) == 0);
}
2017-01-12 20:13:20 +01:00
cinap_lenrek 4aeefba681 kernel: add "close" ctl message for tcp connection to gracefully hang up a connection without a tcp reset (used by go) 2017-01-12 20:04:41 +01:00
spew a0cc369c15 games/mix: Add Knuth MIX emulator/assembler 2017-01-10 11:42:11 -06:00
cinap_lenrek c67d0c699f 6c: reverse register allocation order to avoid having to spill AX,DX and CX
allocating AX,CX,DX last improves 64-bit multiplication-add
chains like a*b + c*d as the multiplication does not need to save
and restore AX and DX registers in most cases. reserving CX for
shifts also helps.
2017-01-08 17:41:10 +01:00
cinap_lenrek 28089ee035 aux/data2s: compress output
encode printable characters litteraly, use D() macro to
reduce DATA instruction overhead.

this halves the time spend assembling $CONF.root.s for
the kernel build.
2017-01-07 20:36:13 +01:00
cinap_lenrek df6c190831 cfs: fix cfsctl interaction with mount cache (mount -C flag)
the root fileserver is mounted with the mount cache enabled
causing the contents of the cfsctl file to be cached as well
leading to wrong results. so after we generated the new stat
buffer, we increment the qid.vers so the cache starts out
clean.
2017-01-06 02:54:26 +01:00
cinap_lenrek 19dc7c2097 6c, 8c: fix "DI botch" evacuating DI/SI/CX registers to ".save" variables 2017-01-02 05:49:18 +01:00
cinap_lenrek 8547defe70 vgaigfx: enable softscreen by default
given that the igfx driver doesnt provide any acceleration functions
and drawing is usually faster with double buffering as it eleminates
reads over the pci bus, enable softscreen by default.
2016-12-29 03:46:08 +01:00
cinap_lenrek 9e95cb1ac9 samterm: avoid flushimage when theres nothing new to flush 2016-12-28 23:42:56 +01:00
cinap_lenrek 45512020d2 libmp: avoid temporary buffer allocation in mprand() 2016-12-28 18:19:52 +01:00
cinap_lenrek 7755561ae1 fplot: fix zoom egetrect check (thanks qu7uux) 2016-12-28 02:09:33 +01:00
cinap_lenrek 74f62ca21b fplot: parse negative numbers in argument to -r option (thanks qu7uux) 2016-12-28 02:08:45 +01:00
cinap_lenrek ed9fdc72f5 libsec: replace des based X9.17 genrandom() with chacha random number generator 2016-12-28 02:02:00 +01:00
cinap_lenrek 84228515b6 keyfs: print error message when reading /adm/keys fails 2016-12-26 19:48:38 +01:00
spew ff384cbddc libavl: fix manpage example, minor improvement to code 2016-12-24 17:58:31 -06:00
spew 0885ed1e80 alv(2): new avl implementation 2016-12-22 16:47:41 -06:00
cinap_lenrek 3bf89ed825 auth/as: simplify further 2016-12-22 21:55:56 +01:00
cinap_lenrek 82bf19941e auth/as, auth/none, auth/newns: consistent handling of command arguments, cleanup 2016-12-22 21:39:59 +01:00
cinap_lenrek 640adc8f82 merge 2016-12-22 01:59:00 +01:00
cinap_lenrek 1ebcdca4ba libauth: don't attempt to mount when opening mount srv file fails in nsop()
making newnsdebug error messages more usefull...
2016-12-22 01:56:19 +01:00
aiju a37a13074c mpxor: sign should be 1/-1, not 0/-1 2016-12-20 18:33:58 +01:00
cinap_lenrek 4f72cda4ac awk: improve random number generation
don't use rand() and scale it to 0..1, instead call
native frand() which produces uniform random number.

instead of seeding the rng with time(0), use truerand().
2016-12-18 18:00:45 +01:00
cinap_lenrek 2830cd7eb6 pc: modify cpu0 page tables in patwc() instead of current cpu ones
on 386 kernel, each processor has its own pdb where the primary
pdb for kernel mappings is on cpu0 and other cpu's lazily pull
pdb entries from cpu0 when they fault in vmapsync().

so we have to edit the table tables in the pdb of cpu0 and not
the current processor.
2016-12-17 19:47:35 +01:00
cinap_lenrek ea30cf94a5 pat write combinding support for 386 kernel, honor cpuid bits 2016-12-17 16:35:26 +01:00
cinap_lenrek d48a089486 pc64: implement simple write combining for framebuffers with the PAT
on some modern machines like the x250, the bios arranges the mtrr's
and the framebuffer membar in a way that doesnt allow us to mark
the framebuffer pages as write combining, leading to slow graphics.

since the pentium III, the processor interprets the page table bit
combinations of the WT, CD and bit7 bits as an index into the
page attribute table (PAT).

to not change the semantics of the WT and CD bits, we preserve
the bit patterns 0-3 and use the last entry 7 for write combining.
(done in mmuinit() for each core).

the new patwc() function takes virtual address range and changes
the page table marking the range as write combining. no attempt
is made on invalidating tlb's. doesnt matter in our case as the
following mtrr() call in screen.c does it for us.
2016-12-15 23:27:01 +01:00
cinap_lenrek f3b5bcffce acid: fix y.tab.h dependency for proc.$O 2016-12-15 22:08:57 +01:00
cinap_lenrek 052abe1cc8 xen: fix build by adding missing rdrandbuf() function 2016-12-14 20:02:07 +01:00
cinap_lenrek 6cbc226351 vncs: update devmouse code 2016-12-11 16:53:51 +01:00
cinap_lenrek 5cc1cb1820 vnc: don't prompt for password on auth_respond() failure 2016-12-11 16:52:38 +01:00
cinap_lenrek 5d353d62fe devmouse: remove unused static map[] array 2016-12-11 16:02:30 +01:00
cinap_lenrek b3c1fa9ecf devmouse: change msec argument of *mousetrack() to ulong 2016-12-10 16:12:18 +01:00
cinap_lenrek 7a145e89b3 audioac97: support for ICH4-ICH7 based cards with memory mapped registers (thanks echoline) 2016-12-05 18:32:58 +01:00
cinap_lenrek 9a55346264 devmouse: various bugfixes, simplify
the assumption of only one producer ((abs)moustratrack()) is not true
for external mouse events from /dev/mousein, so protect the mouse state
and queue with ilock().

get rid of mousecreate(), just use devcreate().

reset cursor when all instances of /dev/mouse and /dev/cursor got closed,
instead of also considering /dev/mousectl. the reason is that kbdfs keeps
the mousectl file open. so exiting a program that has the cursor changed
will properly reset the cursor to arrow.

don't access user buffer while holding cursor spinlock! the memory access
can fault. theres also no lock needed there, we'r just copying *from* the
cursor memory.

fix use of strtol(), p will always be set, check for end of string.

keep pointer coordinates onscreen (off by one).

make lastms() function to get the last millisecond delta of last
call for resynchronization.

fix msg[3] buffer overflow in m5mouseputc().

get rid of mouseshifted logic, it is not used.
2016-11-29 21:11:48 +01:00
cinap_lenrek 3dc64de2e4 omap: cleanup mouse.c, just a dummy for mousectl() 2016-11-29 20:54:17 +01:00
cinap_lenrek 807019d6eb omap: fix format string warning %d for long 2016-11-29 20:51:08 +01:00
cinap_lenrek 6d42467411 stdio: fix sclose() buffer overrun when terminating string, realloc() error handling (thanks porlock)
theres a bug is in sclose() where it doesnt check if wp is beyond
the buffer. also wp was not updated after realloc().

bug was reported by porlock on 9fans:

Plan 9's implementation of the standard C functions snprintf and
vsnprintf have a buffer overrun bug.

If the buffer length equals the output length (without the terminating
null), then one too many characters is written to the buffer.

For example,
              snprintf(buf, 4, "ABCD");

will write 5 characters to buf.
2016-11-27 21:20:27 +01:00
cinap_lenrek 0edcb33ca1 merge 2016-11-19 16:47:21 +01:00
cinap_lenrek 93f122b94a link loopbackmedium and netdevmedium in bcm/pif, sgi/indy and zynq kernels 2016-11-19 16:45:18 +01:00
ftrvxmtrx ee9b0eef89 libavl, libregexp: put debug functions back 2016-11-17 23:07:54 +01:00
ftrvxmtrx ed76659c05 /sys/src/lib*: clean up 2016-11-17 22:58:16 +01:00
cinap_lenrek 28f4567ba6 libmemdraw: cleanup fillpoly(), remove unused fillcolor hack 2016-11-17 20:10:07 +01:00
cinap_lenrek 6fc0e0541c libsec: remove unused get32() function 2016-11-17 19:54:13 +01:00
cinap_lenrek b4db73795e libmemdraw: remove unused static drawbuf variables and ptrfn() declaration 2016-11-17 19:42:12 +01:00
cinap_lenrek dd4de0b0fa devtls: remove unused get32() function 2016-11-17 18:14:06 +01:00
ftrvxmtrx 0930f44feb cmd: remove a bit of unused stuff 2016-11-17 02:59:40 +01:00
ftrvxmtrx c0d0f86b14 tar: remove unused variable 2016-11-17 02:14:59 +01:00
ftrvxmtrx e49f163ef3 clock: remove unused variable 2016-11-17 02:12:49 +01:00
ftrvxmtrx 4c0c82d6f7 page: remove unused variables 2016-11-17 02:11:35 +01:00
ftrvxmtrx ec32701973 ramfs: remove unused variable 2016-11-17 02:09:57 +01:00
ftrvxmtrx 4195e1a54e aan: didn't ask about sendcommand 2016-11-17 02:07:52 +01:00
ftrvxmtrx 8f221cfec1 libsec: remove unused aes_setupDec 2016-11-17 02:02:32 +01:00
cinap_lenrek 1a782fda3e pc64: check if vmap() range fits in VMAPLEN window, remove unneeded vmapsync(), rename fault386() to faultamd64() 2016-11-17 01:28:11 +01:00
cinap_lenrek 78d2a52577 ip/tcp: never raise the mss over the link mtu < 1280 for v6
v6 mandates minimum mtu of 1280, tho someone *could* setup
an interface with a lower mtu or set it lower for testing.
2016-11-16 00:54:04 +01:00
cinap_lenrek 323d625864 ip: get rid of update_mtucache() and restrict_mtu() prototypes 2016-11-15 22:13:08 +01:00
cinap_lenrek 30c5c3404b ip/pktmedium: no mintu, no maclen... thi is ip packets 2016-11-15 22:11:47 +01:00
cinap_lenrek 3579757291 ip/pktmedium: fix wrong hsize, theres no ethernet header on packet media
packet media is just raw ip packets, so theres no link-level
header there. was probably copy-pasted from ethermedium...
2016-11-15 21:54:03 +01:00
cinap_lenrek 1f628ef132 ip/tcp: only calculae mss from interface mtu when directly reachable for v6
we currently do not implement path mtu discovery so for
destinations that are not directly reachable assume the
minimum mtu of 1280 bytes.
2016-11-15 20:28:45 +01:00
cinap_lenrek fdc8187038 nusb/ether: support for "bridge" ctl message 2016-11-12 23:11:03 +01:00