Commit graph

102 commits

Author SHA1 Message Date
cinap_lenrek 3794b1c14f libc: improve alignment of QLp structure on amd64, cosmetics
the QLp structure used to occupy 24 bytes on amd64.
with some rearranging the fields we can get it to 16 bytes,
saving 8K in the data section for the 1024 preallocated
structs in the ql arena.

the rest of the changes are of cosmetic nature:

- getqlp() zeros the next pointer, so there is no need to set
  it when queueing the entry.

- always explicitely compare pointers to nil.

- delete unused code from ape's qlock.c
2017-10-28 18:53:27 +02:00
cinap_lenrek 45b7d60bf3 libsec: add AES CFB and AES OFB stream ciphers 2017-10-17 21:34:01 +02:00
cinap_lenrek 346f5828e0 libsec: sha256 support for thumbprint files, use it in ssh as well
initThumbprints() now takes an application tag argument
so x509 and ssh can coexist.

the thumbprint entries can now hold both sha1 and sha256
hashes. okThumbprint() now takes a len argument for the
hash length used.

the new function okCertificate() hashes the certificate
with both and checks for any matches.

on failure, okCertificate() returns 0 and sets error string.

we also check for include loops now in thumbfiles, limiting
the number of includes to 8.
2017-04-23 19:00:08 +02: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 62d3108646 ape/libsec: add secp384r1 curve parameters for tls 2016-10-30 20:32:03 +01:00
cinap_lenrek 7bcbef11eb ape: fix format clash, %z is for size_t (which is a long currently), not pointer sized 2016-09-14 00:18:45 +02:00
cinap_lenrek a0150376df ape: bring strtod() in line with plan9's libc version 2016-09-11 23:20:55 +02:00
cinap_lenrek 5debddf8af ape: add d_stat struct in dirent struct allowing the avoidance of stats 2016-08-28 03:39:49 +02:00
cinap_lenrek ad6bb37e33 ape/libauth: add PASSWDLEN constant to compile passtokey.c from native libauthsrv (thanks lawler) 2016-08-04 10:38:20 +02:00
cinap_lenrek 1492f46f87 libsec: add scrypt password based key derivation function 2016-07-10 21:41:57 +02:00
cinap_lenrek 986886f2b8 retire the dec alpha port 2016-05-04 16:11:48 +02:00
cinap_lenrek 14685d6595 ape: return plan9 error strings from strerror()
when _syserrno() fails to map a plan9 error string to
a unix error number, we copy the plan9 error string
to the per process error buffer "plan9err" and set
errno = EPLAN9.

when strerror() is called with EPLAN9, it returns
a pointer to the plan9err buffer.
2016-05-04 00:23:48 +02:00
cinap_lenrek ce1edc3436 ape/libsec: fix nuke target to remove /$objtype/lib/ape/libsec.a instead of /$objtype/lib/libsec.a 2016-04-29 20:18:28 +02:00
ben 85824350b5 remove ape regexp library, add utility for awk native port 2016-04-27 07:52:41 -05:00
cinap_lenrek 2fa4c8ef66 libsec: implement elliptic curve group operations in jacobian coordinate system 2016-04-20 20:09:59 +02:00
cinap_lenrek 94e39c482e ape: explicitely list the ape libs to build in mkfile 2016-04-11 20:43:48 +02:00
cinap_lenrek 45f3c56a53 ape: removing openssl 2016-04-11 20:39:12 +02:00
cinap_lenrek 464763202b ape: add libauth, libbio, libmp and libsec as replacements for openssl 2016-04-11 20:23:34 +02:00
cinap_lenrek 3238f124b8 ape: move compatibility libc.h to lib9 directory and incooperate needed functions for ape/mp (wip) 2016-04-10 03:01:37 +02:00
cinap_lenrek ea6910b706 ape: remove broken 9errstr.c 2016-04-10 02:54:29 +02:00
cinap_lenrek 5e37087451 ape: add internal _NSEC() function and make gettimeofday() use it 2016-04-10 02:52:31 +02:00
cinap_lenrek 6a651b42ac ape/stdio: %z format is VLONG on amd64 2016-01-07 19:20:30 +01:00
cinap_lenrek 4308f6e7e6 ape/fmt: %p and %z format for amd64 2016-01-07 19:04:12 +01:00
cinap_lenrek 1dd7f0893b ape: add missing _subv() function to 386/vlop.s 2015-10-04 20:16:41 +02:00
cinap_lenrek 9e3ef5c777 ape: add machine specific code for spim 2015-10-04 19:50:24 +02:00
cinap_lenrek d2af6b40af libc: add _uv2d()/uv2f() and _vas*d() functions to vlrt.c
on 32 bit archs, implement 64 bit vasop with floatingpoint right hand side.
also added is uvlong->double conversion function.
2015-10-04 19:49:02 +02:00
mischief 8737864294 ape: add badrect object into ape libdraw 2015-09-25 16:44:25 -07:00
cinap_lenrek 4b6506cb57 ape: fix build for objtype=spim 2015-08-08 08:17:54 +02:00
cinap_lenrek 63759d2efb ape: implement altzone for tzset() 2015-08-04 02:01:41 +02:00
cinap_lenrek 333812ca38 ape: fix mktime() again 2015-08-04 02:00:37 +02:00
cinap_lenrek cd92790c50 ape: port libc smp tas() for arm 2015-07-07 19:53:26 +02:00
ftrvxmtrx a25758dce7 fix strncmp/memcmp used with a wrong number 2015-06-11 22:13:55 +02:00
cinap_lenrek dfdc52ea7a libc: use Runemax instead of hardcoded 0x65536 for fmtchar check (thanks qrstuv) 2015-05-17 07:02:44 +02:00
cinap_lenrek 1cff9ab4e8 ape: fix main9 for mips 2015-03-25 13:56:04 +01:00
cinap_lenrek cabf90e4ee ape: fix lockinit() for mips 2015-03-25 08:33:11 +01:00
cinap_lenrek 3889ada959 ape: silence compiler "no return at end of function" for mips lock.c 2015-03-18 19:30:12 +01:00
cinap_lenrek 2ab042f11e getfcr: change getfcr/setfcr to use VFP 2014-12-25 17:44:49 +01:00
cinap_lenrek a5b0b6ba2c ape: add fprint %z format (thanks Ori_B) 2014-12-22 09:18:18 +01:00
cinap_lenrek fafc17b049 expr: fix missing type declarations for match(), which broke on amd64 as pointers dont fit into a long 2014-07-12 03:02:21 +02:00
cinap_lenrek ca35949c20 ape/stdio: set errno to EMFILE when running out of streams 2014-05-29 00:34:47 +02:00
cinap_lenrek 2c5c784255 prof: properly save and restore RARG for amd64
amd64 passes first argument in RARG (BP) register
which has the be preserved duing _profin() and
_profout() calls. to handle this we introduce
_saveret() and _savearg(). _saveret() returns
AX, _savearg() returns RARG (BP). for archs other
and amd64, _saveret() and _savearg() are the
same function, doing nothing.

restoing works with dummy function:

uintptr
_restore(uintptr, uintptr ret)
{
	return ret;
}

...

ret = _saveret();
arg = _savearg();
...
return _restore(arg, ret);

as we pass arg as the first argument, RARG (BP) is
restored.
2014-02-17 13:25:24 +01:00
cinap_lenrek ed9e9f98e9 libc and ape support for amd64 2014-02-01 10:31:41 +01:00
cinap_lenrek 43ae553195 ape: remove local copy of memccpy() 2014-01-20 00:05:19 +01:00
cinap_lenrek 7143b286b7 ape: move strdup() from libbsd to libap (from sources)
including <string.h> should be enougth to make strdup()
available.
2013-12-28 05:14:10 +01:00
mischief 61269254d0 synchronize ape's vfprintf with libstdio
in ape's vfprintf we don't check if the file we're writing is actually a string buffer, resulting in a return of -1, when we should actually return the number of bytes that would be written.
2013-11-06 11:22:15 -08:00
cinap_lenrek 4a9f900726 mkfiles: do not rely on path containing the . element
when executing generated binaries and helper scripts,
always execute them as ./name instead of relying that
path contsins the dot.
2013-10-26 20:22:01 +02:00
cinap_lenrek cdc2c30e99 reverting semaphore lock changes from sources (r41ccd6d221da, rb28756e5ba29)
semaphore locks have much higher overhead than initially presented
in the "Semaphores in Plan9" paper. until the reason for it has been
found out i will revert the changes.
2013-09-26 22:24:31 +02:00
cinap_lenrek f811708ffc ape: change tas/sleep locks to cas/semacquire/semrelease locks (from sources) 2013-09-21 19:55:52 +02:00
cinap_lenrek b38d197995 ape: fix _main stack setup for arm (_privates and _errnoloc was inside argv) 2013-06-08 23:53:28 +02:00
cinap_lenrek 389d6a1054 ape: change types from unsigned long to void* for rendezvous() and segattach()/segbrk() (erik), use uniqueue rendezvous tags for _buf and listen 2013-05-11 18:34:40 +02:00