summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
12 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
13 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
13 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@
13 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).
13 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@.
13 daysAdd comment for crypto_cpu_caps_aarch64.Joel Sing
13 daysUse multipliers for stack offsets and tweak comment.Joel Sing
13 daysCheck the correct variable in cpuid().Joel Sing
13 daysGarbage collect a reference to ecp_mont.c, rewrap commentTheo Buehler
spotted by jsing
13 daysecp_methods.c: rewrap some linesTheo Buehler
13 daysLose the ugly GFp_simple_ and GFp_mont_ infixesTheo Buehler
13 daysMake ec_GFp_simple_* staticTheo Buehler
These functions are no longer shared between multiple files, so they can be static in ecp_methods.c and the long list of prototypes can go away.
13 daysMerge ecp_mont.c into ecp_methods.cTheo Buehler
13 daysKNF nit for end of comment markerTheo Buehler
13 daysRename ecp_smpl.c to ecp_methods.cTheo Buehler
While not the greatest of names, ecp_methods.c is better than ecp_smpl.c. It matches the naming ecx_methods.c and in a subsequent commit it will become the new home of the stuff in ecp_mont.c as well. discussed with jsing
14 daysFix a brainfart that happened to me in 2020:Ingo Schwarze
It is impossible to use EVP_DigestInit_ex(3) for CMAC. Besides, EVP_PKEY_CTX_new_id(3) does not produce an EVP_MD_CTX object. Instead, mention the easiest way to actually get the job done using EVP_PKEY_new_CMAC_key(3) and EVP_DigestSignInit(3). OK tb@
2024-11-10Wrap comment badly mistreated by an autoformatter due to missing /*-Theo Buehler
2024-11-10Garbage collect an unused variableTheo Buehler
2024-11-09Mention the key lengths of some encryption algorithms.Ingo Schwarze
This is relevant because EVP_EncryptInit(3) takes a "key" argument, and users need to consider the size of that argument. While here, also mention whether ciphers are stream ciphers or block ciphers and what the block size is.
2024-11-09libz: sync with upstreamTheo Buehler
fixes a possible redefinition of z_const and adds a range check for MAX_WBITS. ok bluhm
2024-11-08Weed out the last remaining refences to the obsoleteIngo Schwarze
function EVP_MD_CTX_init(3) and talk about EVP_MD_CTX_new(3) instead. This is similar in spirit to OpenSSL commit 25191fff (Dec 1, 2015), but i'm also mentioning EVP_MD_CTX_reset(3), slightly reordering some sentences in a more systematic way, and improving some related wordings to be more precise and read better.
2024-11-08Clean up EC_KEY_dup()Theo Buehler
This calls init() with the default method, so EC_KEY_copy() gets a chance to call finish() if the source's method doesn't match. But no init() call is made in EC_KEY_copy(). Of course the source method's copy() needs to be able to cope. The great news is that ssh uses this. Sigh. ok beck jsing
2024-11-08Sweep over EC_KEY_copy()Theo Buehler
This is a special snowflake. Its logic is such that it only overwrites things on the target that are available in the source. So if the source has no group (yes, that's possible), the destination's group will remain. Even better: if you copy a public key over what was previously a private key, the private scalar will remain. That's almost never going to result in a valid key. If you copy from a larger group to a smaller group the private scalar will most likely be out of range [1, order). Use dup functions instead of reimplementing badly and add a snarky comment courtesy of beck to one of those silly const annotations (there's a small addendum by me). ok beck jsing
2024-11-08Clean up EC_KEY_freeTheo Buehler
r is a silly name for an EC_KEY and it is silly to assign the refcount to a variable i (short for uninspired) when you can check the function return directly. Tweak sizeof in freezero to jsing's liking. ok beck jsing
2024-11-08Clean up EC_KEY_new_by_curve_name()Theo Buehler
Use a better variable name, simpler error handling. This could be simplified further if we decide to have an ec_key_set0_group() that avoids a copy. ok beck jsing
2024-11-08List CMAC_CTX_copy(3) in the SYNOPSIS. It was alreadyIngo Schwarze
mentioned in NAME and described in DESCRIPTION and RETURN VALUES.
2024-11-08Provide a replacement assembly implementation for SHA-256 on amd64.Joel Sing
Replace the perlasm generated SHA-256 assembly implementation with one that is actually readable. Call the assembly implementation from a C wrapper that can, in the future, dispatch to alternate implementations. Performance is similar (or even better) on modern CPUs, while somewhat slower on older CPUs (this is in part due to the wrapper, the impact of which is more noticable with small block sizes). Thanks to gkoehler@ and tb@ for testing. ok tb@
2024-11-08Rewrite bn2binpad.Joel Sing
Rewrite bn2binpad, removing some OpenSSL specific behaviour and unnecessary complexity. Our BN_num_bytes() does not return bogus lengths, so we don't need to see if things work out with nominated outputs. Swipe away some endianness_t, but continue to ignore negatives and don't dare give away padded zeroes. Implement a more readable constant time conversion. In particular, the little endian is the less common use case, which we can implement by reversing the padded output in place, rather than complicating all of the conversion code. ok beck@ tb@
2024-11-08Provide constant time comparison functions for size_t.Joel Sing
These will be used in an upcoming change. ok beck@ tb@
2024-11-08Relocate ECParameters_dup() to ec_asn1Theo Buehler
jsing rightly points out that this has nothing to do with ASN.1, but ec_lib.c has no EC_KEY knowledge otherwise (it's about groups and points) and moving it to ec_key.c is also not satisfactory since the weird d2i/i2d for ECParameters don't belong there either. no objection from jsing
2024-11-08Replace aarch64 CPU capabilities detection code.Joel Sing
Replace the aarch64 CPU detection code with a version that parses ISAR0, avoiding signal handling and SIGILL. This gets ISAR0 via sysctl(), but this can be adapted to other mechanisms for other platforms (or alternatively the same can be achieved via HWCAP). This now follows the same naming/design as used by amd64 and i386, hence define HAVE_CRYPTO_CPU_CAPS_INIT for aarch64. ok kettenis@ tb@
2024-11-08Rename EC_YBIT to EC_POINT_YBITTheo Buehler
2024-11-08Ugh. Don't return the group after freeing itTheo Buehler
CID 514612
2024-11-07document EVP_PKEY_CTRL_SET_MAC_KEY for CMACIngo Schwarze
2024-11-06document EVP_PKEY_CTRL_CIPHER, providing a bit of contextIngo Schwarze
2024-11-06About a year ago, the obsolete function EVP_Cipher(3) was moved out ofIngo Schwarze
the important manual page EVP_EncryptInit(3). Belatedly adjust some cross references.
2024-11-06EC_GROUP_set_seed(): flip order of seed and len null checksTheo Buehler
requested by jsing
2024-11-06Treat the curls in EC_GROUP_dup() with a flatironTheo Buehler
This was about as unreadable as four lines of code doing a trivial thing can get... ok jsing
2024-11-06Clean up EC_GROUP_copy()Theo Buehler
Switch from artistic free reinterpretations of public API in the same file to calling the real thing if possible. This means that we need to copy the group's coefficients first instead of last, so that we can call EC_GROUP_set_generator() to set - yes - all three of generator, order, and cofactor of the group. However, we may not have a generator yet since for some reason it is an optional field and some code relies on that. In that case simply copy over order and cofactor and punt on sanity checking for now (since this API never did that anyway). Finally set the seed using EC_GROUP_set_seed() instead of using a custom reimplementation. ok jsing
2024-11-06Switch EC_GROUP_new() to calloc()Theo Buehler
Use a single cleanup path, use calloc rather than setting several members to 0/NULL. This has the side effect that finished can be called even when init() wasn't called, but this isn't an issue with our EC_GROUP_METHODs. ok jsing
2024-11-06Toss tedu's cleanse into crypto_memory.cTheo Buehler
2024-11-06add an empty line between license and #include linesTheo Buehler
2024-11-06Rename malloc-wrapper.c to crypto_memory.cTheo Buehler
Apparently it's important that five trivial one-line wrappers remain in a file with the ISC license. So instead of cleaning the root directory of our favorite pigsty further by squashing all the useless legacy garbage into a single file, rename the oddly-named malloc-wrapper.c into crypto_memory.c. discussed with beck, jsing
2024-11-05Rename cpt_err.c into crypto_err.cTheo Buehler
It is a bit sad, because cpt is such an apt abbreviation for crypto that everybody immediately understands. discussed with jsing
2024-11-05Relocate FIPS stubs to crpyto_legacy.cTheo Buehler
discussed with jsing
2024-11-05CRYPTO_mem_ctrl() is also relocated to crypto_legacy.cTheo Buehler
discussed with jsing
2024-11-05Move OPENSSL_cleanse() to crypto_legacy()Theo Buehler
The correct spelling is explicit_bzero() and it doesn't need its own file. discussed with jsing
2024-11-05Fold cversion.c into crypto_legacy.cTheo Buehler
discussed with jsing
2024-11-05Rename cryptlib.c into crypto_legacy.cTheo Buehler
discussed with jsing
2024-11-05crypto_local.h: add comment to #endifTheo Buehler