summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
7 hoursec_wNAF_mul(): remove r_is_at_infinity sillinessHEADmastercvs/HEADTheo Buehler
All the EC_POINT_* API has a fast path for the point at infinity. So we're not gaining more than a few cycles by making this terrible mess even more terrible than it already is by avoding calls ot it (it's also incorrect as it is since we don't know that the point is no longer at infinity when it is unset). Simplify and add a comment explaining what this mess is doing. ok jsing
8 hoursBump libutil majorClaudio Jeker
OK tb@
9 hoursUpdate ibuf and imsg manpage to include all new functions.Claudio Jeker
OK tb@
9 hoursAdd ibuf_read and msgbuf_read to read from a socket and msgbuf_getClaudio Jeker
to return the ibufs generated by the previous two functions. Error out if the hdrsz argument in msgbuf_new_reader is 0 or too big. Also check that the rbuf is allocated in ibuf_read and msgbuf_read. If not return EINVAL. Implement the imsg API using these functions and introduce imsgbuf_set_maxsize() to alter the maximum message size and imsgbuf_allow_fdpass() to allow fd passing (which is now off by default). Also cleanup the internals a bit and make imsgbuf_init() return int. OK tb@
9 hoursMake struct msgbuf opaque. Introduce msgbuf_new() and msgbuf_free() for that.Claudio Jeker
This does not yet fix the imsgbuf_init() function which can now error. OK tb@
9 hoursRemove fd from struct msgbuf, instead pass the fd to imsg_write andClaudio Jeker
msgbuf_write OK tb@
9 hoursReshuffle code and rename some internal functions.Claudio Jeker
OK tb@
9 hoursRetire ibuf_add_buf, replaced by better named ibuf_add_ibufClaudio Jeker
OK tb@
9 hoursOnly ldapd tried to handle fd exhaustion during imsg fd passing.Claudio Jeker
Remove the getdtablecount code from imsgbuf_read() and instead move the getdtablecount code into ldapd. Handle EMSGSIZE (the error returned when there are not enough free file descriptor slots) inside imsgbuf_read() by retrying the read to receive the data but without fd. A caller expecting an fd should check the return value of imsg_get_fd. OK tb@
9 hoursAdjust imsgbuf_read to return an int with either 1, 0 or -1.Claudio Jeker
Handle EAGAIN by a simple return 1 (same for the fd check). This way the caller will poll again and then retry later. OK tb@
9 hoursIntroduce imsgbuf_queuelen() which returns the numberClaudio Jeker
of messages ready for transmission. Returns 0 if nothing is pending. OK tb@
9 hoursRename imsg_init, imsg_clear, imsg_read, imsg_write and imsg_flushClaudio Jeker
to imsgbuf_init, imsgbuf_clear, imsgbuf_read, imsgbuf_write and imsgbuf_flush. This separates the imsgbuf API from the per-imsg API. OK tb@
9 hoursSimplify imsg_write, msgbuf_write and ibuf_write return codes.Claudio Jeker
Return 0 on success or when a temporary error happened (EAGAIN, ENOBUFS). Return -1 on error and set errno otherwise. Kill the old 0 return for EOF. This is not how write operations work. OK tb@
9 hoursIntroduce imsg_write() and use it instead of msgbuf_write().Claudio Jeker
This is just a thin wrapper around msgbuf_write() but it makes the API more consistent. OK tb@
9 hoursimsg_flush() should retry the write on EAGAIN errors.Claudio Jeker
OK tb@
9 hoursRefine imsg_forward(), do not close fd, just don't forward it.Claudio Jeker
imsg_free() will close the unclaimed fds at the end. OK tb@
9 hoursUse ibuf_fd_set() and ibuf_fd_get() to handle the fd passing in imsgs.Claudio Jeker
ibufs already close forgotten fds on free so now imsg_free behaves the same way. OK tb@
9 hoursAllow 0 sized ibuf_open() and mark stack buffers by setting the fd to -2.Claudio Jeker
For imsgs we want to be able to use ibufs even for empty messages and stash the fd into those ibufs. For that adjust the ibuf code to allow that. This adds an internal IBUF_FD_MARK_ON_STACK define that is now used for on stack ibufs instead of setting max to 0. OK tb@
9 hoursnline ibuf_realloc() in ibuf_reserve() it is the onlyClaudio Jeker
user and the function is simple enough. OK tb@
9 hoursAdd ibuf_get_string() to the ibuf API (used by bgpd and xlockmore)Claudio Jeker
OK tb@
10 hoursLet the user provide an alternative perfpolicy when on batteryJeremie Courreges-Anglas
The current behavior of "auto", which implies running at full speed when on AC power, does not fit all the hardware and use cases. For some people it results in more power consumption, more heat, more noise, etc. Extend the semantics of hw.perfpolicy and provide two buttons to specify the desired behavior: sysctl hw.perfpolicy=<policy while on ac>[,<policy while on battery>] Keep the default behavior of "high,auto". People can opt for "auto,auto" or simply "auto" instead. No objection from deraadt@, input and ok sobrado@ sthen@
4 daysec_lib: zap a useless commentTheo Buehler
5 daysMinor simplifications in ec_cmp()Theo Buehler
5 daysRewrite EC_GROUP_cmp()Theo Buehler
Use better variable names (cf. https://jmilne.org/math/tips.html#4) and avoid the weird style of assigning to r (what does r stand for anyway?) and short circuiting subsequent tests using if (r || ...). Also, do not reuse the variables for order and cofactor that were previously used for the curve coefficients. ok jsing
5 daysSimplify signature of ec_wNAF_mul()Theo Buehler
The only caller passes in num = 1 and is itself called in a path that ensures that the multiplier of the generator is != NULL. Consequently we don't need to deal with an array of points and an array of scalars so rename them accordingly. In addition, the change implies that numblocks and num_scalar are now always 1, so inline this information and take a first step towards disentangling this gordian knot. ok jsing
5 daysProvide a SHA-256 assembly implementation for amd64 using SHA-NI.Joel Sing
This provides a SHA-256 assembly implementation for amd64, which uses the Intel SHA Extensions (aka SHA New Instructions or SHA-NI). This provides a 3-5x performance gain on some Intel CPUs and many AMD CPUs. ok tb@
5 daysRemove sha512-x86_64.pl.Joel Sing
Now that we have replacement SHA-256 and SHA-512 assembly implementations for amd64, sha512-x86_64.pl can go the way of the dodo.
5 daysProvide a replacement assembly implementation for SHA-512 on amd64.Joel Sing
Replace the perlasm generated SHA-512 assembly with a more readable version and the same C wrapper introduced for SHA-256. As for SHA-256, on a modern CPU the performance is largely the same. ok tb@
5 daysAdd CPU capability detection for the Intel SHA extensions (aka SHA-NI).Joel Sing
This also provides a crypto_cpu_caps_amd64 variable that can be checked for CRYPTO_CPU_CAPS_AMD64_SHA. ok tb@
5 daysSpecify size for K256 symbol.Joel Sing
Missing sizes spotted by guenther@
5 daysMerge ec_kmeth into ec_keyTheo Buehler
5 daysShuffle the global default_ec_key_meth down a few linesTheo Buehler
5 daysMove the default EC_KEY_METHOD to the end of the fileTheo Buehler
6 daysUse a better curve and a better hash for the ECDSA_do_sign() exampleTheo Buehler
(Many examples in this directory are really bad. This is no exception.)
6 daysec_mult: fix includesTheo Buehler
7 daysEC_KEY_copy() don't leave stale private keys in placeTheo Buehler
As most other objects, EC_KEYs can be as sparsely and invalidly populated as imagination permits and the competent designers of EC_KEY_copy() chose to just copy over what's available (yeah, what kind of copy is that?) and leave in place what happens to be there. In particular, if the dest EC key was used with a different group and has a private key, but the source key doesn't, the dest private key remains intact, as invalid, incompatible and unusable as it may be. Fix this by clearing said private key. ok jsing
7 daysx509_policy.c: point at RFC 9618Theo Buehler
7 dayseck_prn: some more air to breatheTheo Buehler
7 dayseck_prn: fix includesTheo Buehler
7 daysec_prn: use pkey rather than pk for an EC_KEYTheo Buehler
7 dayseck_prn: use group rather than x for an EC_GROUPTheo Buehler
7 dayseck_prn: use ec_key rather than x for an EC_KEYTheo Buehler
7 dayseck_prn: consistently use bio for a BIO rather than b and bp randomlyTheo Buehler
7 dayseck_prn: sprinkle some empty lines and drop some parens for consistencyTheo Buehler
7 dayseck_prn: shuffle printing functions into a better orderTheo Buehler
8 daysAES_{decrypt,encrypt}() don't return void internal functionTheo Buehler
"A return statement with an expression shall not appear in a function whose return type is void." ok deraadt miod
9 daysThe subject of a certificate is not optionalTheo Buehler
A certificate must have a subject, so X509_get_subject_name() cannot return NULL on a correctly parsed certificate, even if the subject is empty (which is allowed). So if X509_get_subject_name() returns NULL, error instead of silently ignoring it in tls_check_common_name(). This is currently no issue. Where it matters, the match against the common name will fail later, so we fail closed anyway. ok jsing
9 daysUpdate libexpat to version 2.6.4.Alexander Bluhm
Relevant for OpenBSD are security fix #915, other changes #905 #902 #904 #317 #918 #914. Major library bump is necessary as new error constant has been added to a public header file. CVE-2024-50602 OK matthieu@ tb@ deraadt@
9 daysLink the new manual page EVP_PKEY_new_CMAC_key(3) to the buildIngo Schwarze
and purge the superseded information from the algorithm-independent page EVP_PKEY_new(3).
9 daysDocument EVP_PKEY_new_CMAC_key(3) in sufficient detail such that readersIngo Schwarze
stand a chance of using the API correctly. Admittedly, having so much text below EXAMPLES is somewhat unusual. While all that information is required to use the function correctly, strictly speaking, it is not part of the specification of what EVP_PKEY_new_CMAC_key(3) does, so it woundn't really belong in the DESCRIPTION. Now, designing an API function in such a way that using it correctly requires lots of information about *other* functions and such that all that additional information does not belong into the manual pages of those other functions (both because that would cause distractions in various other manual pages and because it would scatter required information around lots of different pages) is certainly not stellar API design. But we can't help that because these APIs were all originally designed by OpenSSL. Significant feedback and OK tb@.