gui-win32: delete utf-16 routines, just use WideCharToMultiByte()/MultiByteToWideChar() kernel32 functions
gui-win32: add support for surrogate pairs in rune16 functions
this was required to encode and decode characthers between U+10000-U+10FFFF
properly.
drawterm/gui-cocoa/screen.m: fix SEGFAULT during cursor updates (thanks Igor)
The patch contains the following modifications:
1. Fix declaration of `currentCursor` declaring it as a
property of the `DrawtermView` using the `retain`
attribute. This prevents drawterm from crashing as
the OSX graphical event loop refrains from deallocating
it while it is still in use.
2. Modification of gui-cocoa/screen.m:/^setcursor to use
'getBitmapDataPlanes' API function instead of
'static unsigned char data[64]' container.
(https://developer.apple.com/documentation/appkit/nsbitmapimagerep/1395490-getbitmapdataplanes?language=objc)
The idea is to avoid using static variables for memory
managed/supplied by OSX APIs.
3. Replace 'static GLuint tex;' and declare it as a
property of the `DrawtermView` as it is part of the
`DrawtermView`.
4. Move up declaration of 'DrawtermView' within the file.
Once the static variables like 'currentCursor'
and 'tex' have been moved to be properties of the DrawtermView
this change made sense.
This patch has been tested on OSX Catalina and Big Sur.
libsec: move zero check to curve25519_dh_finish()
As checking for all zero has to be done in a timing-safe
way to avoid a side channel, it is best todo this here
instead of letting the caller deal with it.
This adds a return type of int to curve25519_dh_finish()
where returning 0 means we got a all zero shared key.
RFC7748 states:
The check for the all-zero value results from the fact
that the X25519 function produces that value if it
operates on an input corresponding to a point with small
order, where the order divides the cofactor of the curve.
libsec: add curve25519 and adjust ECpriv point access
libsec: various changes to tls (import from 9front)
1. add the curve x25519 to tls, both client and server.
it's more faster, immune to timing attacks by design,
does not require verifying if the public key is valid,
etc etc. server-side has to check if the client supports
the curve, so a new function has been introduced to parse
the client's extensions.
2. reject weak dhe primes that can be easily cracked with
the number field sieve algorithm. this avoids attacks like
logjam.
3. stop putting unix time to the first 4 bytes of client/
server random. it can allow fingerprinting, tls 1.3 doesn't
recommend it any more and there was a draft to deprecate
this behaviour earlier.[1]
4. simply prf code, remove useless cipher enums.
[1] https://datatracker.ietf.org/doc/html/draft-mathewson-no-gmtunixtime-00
implement simulated mouse buttons for Mac laptops similar to plan9port.
For systems without a three button mouse, the keyboard modifier keys
can be used to modify the effect of the main mouse button. On Mac
systems, the option key changes the main button to button 2, and the
Command key changes it to button 3.
Pressing the key after the button is held down adds the button to
form a chord, so that for example on Macs selecting text with the
trackpad button and then typing Option without letting go of the button
will cause a 1-2 chord, cutting the selection.
These changes were inspired by rsc's plan9port.
remove .hgignore, update new repo url in README
license: it's all mit, baby.
Since drawterm upstream is now rebased to mit,
we're rebasing on their code.
win32: remove unused argv0 variable (clashes with main.c)
drawterm: properly handle enf of file in readstr() (from 9front cpu.c)
x11: reset Kshift state on focus change until we find a way to reset all modifier keys state
kern: remove per-process information from devcons
Devcons has no business poking at the process state.
The following files are being removed:
#c/cputime
#c/pgrpid
#c/pid
#c/ppid
#c/user
add preliminary riscv64 support from archlinux (thanks Sören Tempel)
devaudio-sndio: use a documented default device string
Passing NULL as a device string was never supposed to work,
at least I couldn't find a mention of it in documented interface.
It appeared to work anyway, up until recently, when sio_open
started failing.
gui-x11: handle WM_DELETE_WINDOW messages
previously drawterm did not handle the ICCCM[1] protocol for graceful window
closure. most if not all window managers will send this message, but it is
implemented inconsistently. some will forcibly terminate the X11 client's
connection if it doesn't handle it, and others will just give up. some prompt
for forcible termination. in any case, now we handle it.
to make this change work, we also setup the X11 window in the xkmcon
connection, because otherwise it seems not possible to receive the
ClientMessage in our event handler. without this the event would instead be
sent to the xdisplay connection, which we did not monitor for events.
[1] https://www.x.org/releases/X11R7.6/doc/xorg-docs/specs/ICCCM/icccm.html#window_deletion
freebsd: AUDIO=unix works, so use it. Tested on 12.1
devfs-posix: fix pread/pwrite for large (>2Gb) files