summaryrefslogtreecommitdiff
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Mop up the last MD32_XARRAY.jsing2023-08-101-197/+187
| | | | | | | MD32_XARRAY was added as a workaround for a broken HP C compiler (circa 1999). Clean it up to simplify the code. No change in generated assembly.
* Inline the remaining 10 lines from rmdconst.h.jsing2023-08-102-75/+12
| | | | Discussed with tb@
* Inline X variables definitions.jsing2023-08-102-345/+175
| | | | | | | | | Inline the WL and WR defines, which only add yet another layer of abstraction and make the code harder to follow. No change to generated assembly. Discussed with tb@
* Inline shift values.jsing2023-08-102-330/+170
| | | | | | | | Inline the SL and SR defines, which only makes the code harder to follow. No change to generated assembly. Discussed with tb@
* Apply some more style(9).jsing2023-08-101-170/+171
| | | | No change in generated assembly.
* Various fixes in {dh,dsa}_priv_encode()tb2023-08-102-40/+48
| | | | | | | | | | Avoid creating an ASN1_STRING with negative length, set type, data and length via ASN1_STRING_type_new() and ASN1_STRING_set0() instead of doing this manually. Check return value for i2d_ASN1_INTEGER() and use an intermediate ASN1_OBJECT instead of nested function calls. Finally, clear sensitive data with freezero(). ok jsing
* rsa_priv_encode: plug leak on PKCS8_pkey_set0() failuretb2023-08-101-15/+19
| | | | | | Change the code to use safer idioms and avoid nested function calls. ok jsing
* Improve byte order handling in gcm128.jsing2023-08-101-329/+44
| | | | | | Replace a pile of byte order handling mess with htobe*() and be*toh(). ok tb@
* Remove MD32_REG_T.jsing2023-08-106-48/+16
| | | | | | | | | This is a hack that is only enabled on a handful of 64 bit platforms, as a workaround for poor compiler optimisation. If you're running an archiac compiler on an archiac architecture, then you can deal with slightly lower performance. ok tb@
* Add the forgotten .In lineschwarze2023-08-091-3/+4
| | | | and fix a typo: s/content objects/content octets/.
* In objects.h rev. 1.14 and 1.15 (Jan 2022), tb@ providedschwarze2023-08-091-5/+65
| | | | | OBJ_get0_data(3) and OBJ_length(3). Document them. Feedback and OK tb@.
* Rework BN_BLINDING to use pthread_t directlytb2023-08-093-28/+18
| | | | | | | | | | Instead of CRYPTO_THREADID, which passes pthread_via through unsigned long, we can use pthread_self() and pthread_equal() directly. This commit keeps using the awkward 'local' nomenclature as that is used throughout the rsa code. This will be changed after the blinding code will have been fully merged into rsa_blinding.c. ok jsing
* Merge remainder of rsa_crpt.c into rsa_eay.ctb2023-08-093-130/+55
| | | | | Most of these are one line wrappers around methods implemented in rsa_eay.c by default.
* Move RSA blinding API from rsa_crpt.c to rsa_blinding.ctb2023-08-092-102/+102
|
* Move RSA_blinding_{on,off}() to the bottom of the filetb2023-08-091-29/+29
|
* Move bn_blind.c to rsa_blinding.ctb2023-08-094-13/+14
| | | | discussed with jsing
* Make declaration and definition of BN_BLINDING_new() match.tb2023-08-092-4/+4
| | | | Also, make mod const.
* Merge BN_BLINDING_create_param() into BN_BLINDING_new()tb2023-08-093-33/+16
|
* Set up the blinding factors on first usetb2023-08-091-27/+14
| | | | | | | Only call BN_BLINDING_setup() from BN_BLINDING_update(). This allows another simplification of the counter logic. ok jsing
* Remove retry loop in BN_BLINDING_setup()tb2023-08-091-24/+5
| | | | | | | If we generate a non-invertible blinding, we have accidentally factored the modulus. This won't happen, so get rid of this ugly complication. ok jsing
* Compute a square using BN_mod_sqr() instead of BN_mod_mul()tb2023-08-091-3/+3
| | | | ok jsing
* Simplify BN_BLINDING_invert()tb2023-08-091-14/+5
| | | | | | | If the blinding is non-NULL, Ai is set on it, so no need to check for that. Also, we can get away with a single call to BN_mod_mul(). ok jsing
* Unwrap a linetb2023-08-091-3/+2
|
* Unwrap a linetb2023-08-081-3/+2
|
* Drop the unused BN_BLINDING argument of BN_BLINDING_create_param()tb2023-08-083-14/+11
|
* Rename ret into b in BN_BLINDING_setup()tb2023-08-081-8/+8
|
* Factor the actual setup step for the blinding into a helpertb2023-08-081-30/+43
| | | | ok jsing
* X509_STORE_CTX_get_check_issued(3) is weird.schwarze2023-08-081-0/+9
| | | | | | Both the function return type and the function name are so long that for displaying the function prototype, a line break is needed after the function return type.
* Make BN_BLINDING respect some invariantstb2023-08-081-48/+17
| | | | | | | | | | | | Pass e and mod into BN_BLINDING_new() for now and unconditionally allocate A and Ai. This way non-NULL blindings always have these four members set. This allows removing several unnecessary checks in the update, convert and parameter creation code paths. Fix exit BN_BLINDING_create_param() so as to signal errors to the caller if a non-NULL blinding was passed. This fixes a long standing bug. ok jsing
* Simplify RSA_setup_blinding()tb2023-08-081-21/+16
| | | | | | | Make this look a bit more like other code we cleaned up avoiding nesting and unnecessary else branches. ok jsing
* Remove ECDSA nonce padding kludgetb2023-08-081-22/+1
| | | | | | | | | | | This was a workaround due to the historically non-constant time scalar multiplication in the EC code. Since Brumley and Tuveri implemented the Montgomery ladder, this is no longer useful and should have been removed a long time ago, as it now does more harm than good. Keep the preallocations as they still help hiding some timing info. ok jsing
* In objects.h rev. 1.17 (Jan 14, 2022),schwarze2023-08-081-7/+1
| | | | | | | | | | | | tb@ removed the following macros from the public API: _DECLARE_OBJ_BSEARCH_CMP_FN DECLARE_OBJ_BSEARCH_CMP_FN DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN IMPLEMENT_OBJ_BSEARCH_CMP_FN IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN OBJ_bsearch OBJ_bsearch_ex In objects.h rev. 1.20 (Nov 11, 2022), jsing@ unifdef'ed USE_OBJ_MAC. Stop marking these names as intentionally undocumented.
* No need to mark BN_options() as intentionally undocumented any longer.schwarze2023-08-071-1/+0
| | | | | | | | In bn.h rev. 1.75 (July 31, 2023), tb@ removed it from the public API. While here, stop marking BN_prime_checks as obsolete. In BN_generate_prime.3 rev. 1.23 (May 11, 2023), tb@ documented the constant BN_prime_checks in that manual page.
* Mark asn1_ps_func as obsolete and intentionally undocumented.schwarze2023-08-071-0/+1
| | | | | In bio.h rev. 1.59 (July 28, 2023), tb@ removed the last four functions that took function pointers of this type from the public API.
* Mark BIT_STRING_BITNAME as obsolete and intentionally undocumented.schwarze2023-08-071-0/+1
| | | | | In asn1.h rev. 1.80 (July 28, 2023), tb@ removed the last three functions that were using this data type from the public API.
* Add a regress test exercising BIO_dup_chain() and triggering the leaktb2023-08-071-1/+43
| | | | fixed in bio_lib.c r1.47 as confirmed by ASAN.
* Fix two leaks in BIO_dup_chain()tb2023-08-071-19/+17
| | | | | | | | If CRYPTO_dup_ex_data() fails, the new_bio is leaked. If an error occurs after the first iteration, all members of the new chain except the head are leaked. ok jsing
* Add missing space before =tb2023-08-071-2/+2
|
* remove trailing comma in NAME;jmc2023-08-051-3/+3
|
* Move the ENGINE_new() prototype a line downtb2023-08-041-2/+2
|
* Link new ccs test to buildtb2023-08-031-1/+7
| | | | | Exception needed since the test expects an unexpected_message alert, while we throw a decode_error.
* Make the bn_rand_interval() API a bit more ergonomictb2023-08-0311-52/+57
| | | | | | | | | | | | | | | | | | Provide bn_rand_in_range() which is a slightly tweaked version of what was previously called bn_rand_range(). The way bn_rand_range() is called in libcrypto, the lower bound is always expressible as a word. In fact, most of the time it is 1, the DH code uses a 2, the MR tests in BPSW use 3 and an exceptinally high number appears in the Tonelli-Shanks implementation where we use 32. Converting these lower bounds to BIGNUMs on the call site is annoying so let bn_rand_interval() do that internally and route that through bn_rand_in_range(). This way we can avoid using BN_sub_word(). Adjust the bn_isqrt() test to use bn_rand_in_range() since that's the only caller that uses actual BIGNUMs as lower bounds. ok jsing
* Retire the bn_rand_interval() testtb2023-08-032-115/+1
| | | | | | This test was never particularly useful. An upcoming API change for the internal bn_rand_interval() API would require some adjustments. It's not worth it.
* Remove unused sk/lh macrostb2023-08-031-170/+1
| | | | ok jsing miod
* More whitespace fixes from knfmttb2023-08-021-7/+7
|
* Remove extraneous parentheses and fix weird whitespace.tb2023-08-021-16/+15
|
* Drop the _ex from BN_BLINDING_{convert,invert}_ex()tb2023-08-023-12/+12
|
* Remove the unused BN_BLINDING_{convert,invert}()tb2023-08-022-16/+2
| | | | ok jsing
* Make BN_BLINDING_{new,update}() static in bn_blind.ctb2023-08-022-6/+4
| | | | ok jsing
* Remove the unused flags member of BN_BLINDINGtb2023-08-022-10/+4
| | | | | | | Nothing sets this, so remove it along with BN_BLINDING_NO_{UPDATE,RECREATE} and some checks that are always true. ok jsing