summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/reallocarray.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2024-10-14Extend ec_asn1_test to check for correct curve coefficient encodingtb1-5/+50
2024-10-14Fix field element encoding for elliptic curve coefficientstb1-45/+36
SEC 1, section 2.3.5, is explicit that the encoding of an element of the field of definition for an elliptic curve needs to be a zero-padded octet string whose length matches the byte size of the field's degree. So use BN_bn2binpad() to fix this. Factor things into a simple helper to avoid copy-pasting. This gets rid of some of the most grotesque code in this file. ok jsing
2024-10-14Drop an obvious comment and fix indent for setting the seedtb1-4/+3
Also remove a pointless cast. ok jsing
2024-10-14In ec_asn1_group2curve() rename ok to ret, per usualtb1-4/+4
ok jsing
2024-10-13byt -> but; ok tb@jsg1-3/+3
2024-10-12Exercise the EC parameters code a bit moretb1-1/+103
Ensure all builtin curves can be roundtripped through DER as named curves, via explicit parameterization, using uncompressed, compressed and hybrid point formats.
2024-10-12Remove unnecessary str variable in ssl_stat.ctb1-427/+208
Drop about 1/4 of the lines in here by avoiding the use of a variable. For some reason the API in this file made me go listen to Pow R. Toc H. All of a sudden the lyrics made sense. I should probably be worried. ok beck jsing
2024-10-11Use a and b for the curve coefficientstb1-10/+11
No idea how anyone would think that tmp_1 and tmp_2 are better suited for this. ok jsing
2024-10-11Clean up ec_asn1_group2fieldid()tb1-32/+28
This drops some unnecessary freeing that was turned into a double free reachable via public API in OpenSSL 1.1. Other than that it unindents code and uses better variable names. ok jsing
2024-10-11Fix a long-standing bug in ec_asn1_group2pkparameters()tb1-2/+2
Only check for the OPENSSL_EC_NAMED_CURVE being set to treat the curve parameters as named curve parameters. ok jsing
2024-10-11Use defines for the CHOICE variants of ECPKPARAMETERStb1-7/+10
ok jsing
2024-10-11Remove NULL check in ec_asn1_pkparameters2group()tb1-5/+1
The callers already ensure that params != NULL. ok jsing
2024-10-11Use better variable names in ec_asn1_pkparameters2group()tb1-10/+13
ok jsing
2024-10-11First cleanup pass over ec_asn1_group2pkparameters()tb1-27/+25
Use better variable names and do things in a slightly more sensible order. This way the code becomes almost self-documenting. ok jsing
2024-10-11err.c: zap stray spacetb1-2/+2
2024-10-11Apply some style(9) and tidy some comments.jsing1-62/+73
2024-10-11Remove pointless locking from err_build_SYS_str_reasons().jsing1-20/+2
err_build_SYS_str_reasons() is only called during initialisation, under pthread_once(). As such, there is no need to grab CRYPTO_LOCK_ERR or check for reentrant calls. ok tb@
2024-10-11Convert err_clear_data() and err_clear() from macros to functions.jsing1-23/+25
ok tb@
2024-10-11Remove unused typedef for ERR_FNS.jsing1-3/+1
2024-10-11Add err_ prefix to build_SYS_str_reasons().jsing1-3/+3
2024-10-11Make ERR_str_{libraries,reasons,functs}[] const.jsing1-12/+18
Provide err_load_const_strings(), which takes a const ERR_STRING_DATA * and does not perform a library error value fixup. Make ERR_str_*[] tables const. ok tb@
2024-10-11Add ERR_LIB_SYS to the error values in ERR_str_functs[].jsing1-12/+12
This is currently added via err_load_strings(), which means ERR_str_functs[] cannot be made const. Adding ERR_LIB_SYS means the fixup becomes unnecessary. ok tb@
2024-10-11Add error regress coverage for ERR_LIB_SYS.jsing1-1/+19
These are dynamically populated based on strerror() values.
2024-10-11Remove params argument from ec_asn1_group2parameters()tb1-13/+8
Its only caller passes NULL, so we can simplify the entry point and the exit of this function a bit. ok jsing
2024-10-11Simplify ec_asn1_group2pkparameters()tb1-15/+8
The parameters argument is always NULL, so we can simplify this helper accordingly. ok jsing
2024-10-11Spell NULL in a simpler fashiontb1-3/+5
priv_key->parameters is always NULL at this point, since its corresponding entry in the ASN.1 template has ASN1_TFLG_OPTIONAL set, so there is no point in pretending to pass it to ec_asn1_group2pkparameters(). ok jsing
2024-10-11Clean up i2d_ECPKParameters()tb1-10/+13
Use better variable names and turn it into single-exit. This changes the behavior slightly in that an error is pushed onto the stack also for i2d_ECPKPARAMETERS() return values < 0. ok jsing
2024-10-10Remove unused CONF_imodule struct members and accessorstb2-69/+2
ok beck jsing
2024-10-09Remove SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHERtb1-2/+1
Nothing uses this and it collides with ALPN
2024-10-09Add missing alert descriptions (taken from RFC 8446)tb1-2/+11
This is so gross...
2024-10-09Add missing alerts to SSL_alert_desc_string{,_long}()tb1-7/+25
ok beck
2024-10-09Add missing alert errors and error stringstb2-2/+10
For every TLS alert there needs a corresponding error with error code having an offset of SSL_AD_REASON_OFFSET (aka 1000), otherwise the error stack fails to set the reason correctly. ok beck
2024-10-03Remove the unused field_mod_func from EC_GROUPtb1-4/+1
This was only used by the NIST method. For all other group methods it's an uninitialized pointer (as EC_GROUP_new() still uses the malloc + set all members to 0 idiom). ok jsing
2024-10-03Make EC{,PK}PARAMETERS_it statictb1-3/+3
They aren't used outside of this file.
2024-10-03Fix ASN1_INTEGER_to_BN() misusetb1-16/+16
Same issue/leak as for BN_to_ASN1_INTEGER(). Stop reusing the elliptic curve parameters a and b for order and cofacter. It's confusing. ok jsing
2024-10-03Switch field_bits to be an inttb1-3/+3
ok jsing
2024-10-03Fix BN_to_ASN1_INTEGER() misusetb1-7/+6
You can either let this API reuse an existing ASN1_INTEGER or you can let it allocate a new one. If you try to do both at the same time, you'll leak. ok jsing
2024-10-03Provide OPENSSL_INIT_NO_ATEXIT nooptb1-1/+2
The brilliant idea of installing a fragile non-idempotent cleanup atexit handler as a library has bitten many people over time. This gets particularly exciting when you can't control who dlopens the lib first (don't we all love Python bindings) or if you are in a threaded context. Fake OpenSSL clones chose not to do this but now get to carry a noop flag since people start opting out of this madness (there's a good old tradition at work here). ok beck joshua jsing millert miod
2024-10-03X509V3_EXT_get_nid.3: indicate what nid meanstb1-3/+3
2024-10-02Reorder functions.jsing1-297/+286
Reorder functions so that things are somewhat more logical, moving internal functions towards the top (and removing now unnecessary prototypes).
2024-10-02Remove err_fns and associated machinery.jsing1-142/+65
Like all good OpenSSL code, errors was built to be completely extensible. Thankfully, the ERR_{get,set}_implementation() functions were removed in r1.127 of err.c, which means that the extensibility can no longer be used. Take the first of many steps to clean up this code - remove err_fns and associated machinery, calling functions directly. Rename so that we have an 'err_' prefix rather than 'int_' (or nothing). ok joshua@ tb@
2024-10-02Hook up the err regress.jsing1-1/+2
2024-10-02Add initial regress for the error stack and ERR_* APIs.jsing2-0/+210
2024-10-02Enable additional CRYPTO_get_ex_new_index() tests.jsing1-6/+1
It was previously possible to call CRYPTO_get_ex_new_index() with either a negative index or a positive index that equaled or exceeded CRYPTO_EX_INDEX__COUNT. The reimplementation of exdata treats these as error cases.
2024-09-22Reinstate bounds check accidentally disabled when defining OPENSSL_NO_DTLS1tb1-3/+1
From Kenjiro Nakayama Closes https://github.com/libressl/portable/issues/1097
2024-09-20remove unneeded semicolons; checked by millert@jsg1-2/+2
2024-09-18Enable large number of extension tests and stop skippking QUIC transporttb1-8/+3
parameter extension which we now know about
2024-09-17tlsfuzzer: add a start-server convenience target for interactive testingtb1-2/+6
2024-09-17Replace OpenSSL 3.1 (which no longer is in ports) with 3.3tb1-2/+2
2024-09-14tlsfuzzer: grammar fix missed in previoustb1-2/+2