summaryrefslogtreecommitdiff
path: root/src (unfollow)
Commit message (Collapse)AuthorFilesLines
2025-01-26Rewrite X509_NAME_ENTRY_oneline() using CBB and CBStb2-104/+123
This splits the horrid spaghetti into a few relatively straightforward helpers which do one thing at a time. There are still some spectacular dances around ASN1_GENERALSTRING, but let's blame that one on X.500. In brief, X509_NAME_ENTRY_oneline() iterates over the name entries, and writes out a line /name1=value1,/name2=value2,... which you may have seen variations of in issuer or subject output. The name is the short name or the long name or the textual representation of the OID (truncated to 79 characters) and the value is a string where printable ASCII characters are represented as themselves and otherwise as hexadecimal digits preceded by \x. Except for GENERALSTRING, where the four octet representation is shortened to single-octet representation if none of the top three octets in the entire string is populated. It's the mother of all pretty things. But, hey, you could do worse and try to parse this garbage... ok jsing
2025-01-26x509_utl.c: use normal order of internal headerstb1-3/+2
2025-01-25Remove #error if OPENSSL_NO_FOO is definedtb23-115/+23
discussed with jsing
2025-01-25Garbage collect field_type member of the EC methodstb2-6/+2
ok jsing
2025-01-25Promote a few functions from EC API to garbage bintb1-36/+41
EC_GROUP_method_of() and EC_METHOD_get_field_type() only ever used chained together as a convoluted means to retrieve the field type of a group. This is no longer useful since the answer will always be NID_X9_62_prime_field. EC_POINT_method_of(), EC_GROUP{,_have}_precompute_mult(): exposed by one of those expose-everything perl XS modules. ok jsing
2025-01-25Remove now unused internal ec_group_get_field_type()tb2-12/+2
ok jsing
2025-01-25Remove calls to ec_group_get_field_type() from EC_GROUP_cmp()tb1-3/+1
ok jsing
2025-01-25Make EC_KEY_precompute_mult() return 1 directlytb1-2/+2
This hasn't done anything in a long time. Only dovecot uses an unchecked call to this. With this we can remove EC_GROUP_precompute_mult(). ok jsing
2025-01-25Simplify ecpk_print_explicit_parameters()tb1-4/+2
At this point the NID is always NID_X9_62_prime_field, so we can use SN_X9_62_prime_field directly rather than getting the field type from the method and then converting the nid to an sn with OBJ_nid2sn(). ok jsing
2025-01-25Simplify ec_asn1_group2fieldid()tb1-25/+3
The field_type is always NID_X9_62_prime_field, no need to encode and retrieve this from the group method. ok jsing
2025-01-24Remove now unused perlasm script for MD5 on amd64.jsing1-265/+0
2025-01-24Provide a readable assembly implementation for MD5 on amd64.jsing5-10/+246
This appears to be about 5% faster than the current perlasm version on a modern Intel CPU. While here rename md5_block_asm_data_order to md5_block_data_order, for consistency with other hashes. ok tb@
2025-01-24Remove pointless call to EC_GROUP_precompute_mul()tb1-3/+1
2025-01-22ectest: zap stray whitespacetb1-2/+2
2025-01-22ectest: fix misleading indentationtb1-5/+7
2025-01-22ectest: remove unused definestb1-5/+1
2025-01-22ectest: even more lipsticktb1-17/+15
2025-01-22ectest: apply some more lipsticktb1-8/+3
2025-01-22ectest: switch from new + copy to dup. zap some NULL checks before freetb1-42/+15
2025-01-22bn_test: remove random negative dance for bn_div_reciprocal()tb1-3/+1
2025-01-22Use simpler (if a bit weird) dup instead of new + copytb1-5/+2
ok jsing
2025-01-22bn_recp: Avoid complication for negative modulitb2-13/+5
Instead of doing a weird dance, set the sign on N in BN_RECP_CTX_create(). Since we're not exposing a general purpose calculator API, we can simplify. ok jsing
2025-01-22Adjust for BN_div_recp() -> BN_div_reciprocal()tb1-3/+3
2025-01-22Rename BN_div_recp() into BN_div_reciprocal()tb2-7/+7
Requested by jsing
2025-01-22Split BN_mod_sqr_reciprocal() out of BN_mod_mul_reciprocal()tb3-23/+19
There's no need for BN_mod_mul_reciprocal() to have this complication. The caller knows when x == y, so place the burden on the caller. This simplifies both the caller side and the implementation in bn_recp.c. ok jsing
2025-01-22Remove the mul_generator_ct function pointer from EC_METHOD.jsing3-24/+8
There's no need for a separate mul_generator_ct() function pointer - we really only need mul_single_ct() and mul_double_nonct(). And rather than calling ec_mul_ct() and having it figure out which point to use, explicitly pass the generator point when calling mul_single_ct(). ok tb@
2025-01-22Expand the SM4_ROUNDS macro.jsing1-25/+83
This macro references variable names that are in the consuming function and are not actually passed to the macro. Expanding it makes the logic clearer. If we wanted to reduce code the middle six group of rounds could be implemented using a for loop (which the compiler can then choose to unroll). ok tb@
2025-01-22Replace {load,store}_u32_be() with crypto_{load,store}_be32toh().jsing1-39/+25
load_u32_be() and store_u32_be() are not symmetrical, with load_u32_be() having a rather unexpected indexing interface. Fix up the callers to perform their own indexing and use crypto_{load,store}_be32toh() instead. ok tb@
2025-01-22Pull the family key and constant key tables out of SM4_set_key().jsing1-28/+27
ok tb@
2025-01-22BN_mod_mul_reciprocal: remove y == NULL complicationtb1-14/+11
No caller ever passes y == NULL, so remove the corresponding contortions and unindent the relevant bits. ok jsing
2025-01-22Replace rotl() with crypto_rol_u32().jsing1-15/+10
ok tb@
2025-01-22Ensure the cyclic subgroup cycles in the expected number of iterations.jsing1-9/+14
Also print the iteration number and fix some indentation.
2025-01-22ectest: heed long forgotten XXX and switch back to BN_one()tb1-3/+2
2025-01-21EC_GROUP_check(): use accessor rather than reaching into the grouptb1-3/+4
The API will be removed soon. This prepares moving it to its only consumer.
2025-01-21ec/Makefile: remove excess tabstb1-9/+9
2025-01-21bn_test: use BN_RECP_CTX_create() rather than _new()/_set()tb1-5/+3
2025-01-21Move BN_RECP_CTX to the heaptb3-67/+48
This introduces a BN_RECP_CTX_create() function that allocates and populates the BN_RECP_CTX in a single call, without taking an unused BN_CTX argument. At the same time, make the N and Nr members BIGNUMs on the heap which are allocated by BN_RECP_CTX_create() and freed by BN_RECP_CTX_free() and remove the unnecessary flags argument. Garbage collect the now unused BN_RECP_CTX_{new,init,set}(). ok jsing
2025-01-20crypto.h: zap some offensive whitespacetb1-2/+2
2025-01-20Annotate why EVP_PKEY_CTX_ctrl_str() will stay for a whiletb1-1/+6
2025-01-19openssl x509: zap extra whitespace in usagetb1-2/+2
2025-01-19appstest: remove the two tests exercising -C minimallytb1-3/+3
2025-01-19Remove -C option from "apps"tb6-436/+12
As far as I can tell, this way of generating "C code" was only used to add stuff to pretty regress and even prettier speed "app" and otherwise it just served to make the library maintainer's lives even more miserable. ok jsing
2025-01-19md_test: switch from 2<<28 to 1<<29tb1-2/+2
discussed with jsing
2025-01-19Improve bit counter handling in MD5.jsing3-19/+18
Like most hashes, MD5 needs to keep count of the number of bits in the message being processed. However, rather than using a 64 bit counter this is implemented using two 32 bit values (which is exposed in the public API). Even with this hurdle, we can still use 64 bit math and let the compiler figure out how to best handle the situation (hopefully avoiding compiler warnings on 16 bit platforms in the process!). On amd64 this code now requires two instructions, instead of the previous five. While here remove a comment that is excessively visible and no longer completely accurate (and if you're going to redefine types like MD5_WORD you kinda need to know what you're doing). ok tb@ (who's going to miss the dear diary style comments)
2025-01-19ecparam: remove GF2m remnanttb1-14/+4
This removes the last in-tree dependency on EC_METHOD_get_field_type() and EC_GROUP_method_of() and removes some dead code which would generate code that wouldn't compile if it was reachable. ok jsing
2025-01-19Add regress coverage that checks the MD5 message bit counter handling.jsing1-1/+66
2025-01-18Simplify tls1_check_ec_key()tb1-7/+7
It doesn't need to have optional arguments anymore, so we can pass in values and don't need NULL checks and dereferencing. ok jsing
2025-01-18Rename grp to group like almost everywhere elsetb1-4/+4
2025-01-18Remove parentheses in return statementstb1-14/+14
ok cc + sha256
2025-01-18Remove two pointless NULL checkstb1-8/+1
The only caller ensures that the EC_KEY is not NULL and passes the address of comp_id on its stack, so neither will be NULL.