summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_transcript.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2022-01-05Check NULL first and unindent the rest of the codeinoguchi1-41/+45
suggested by tb@
2022-01-05Convert openssl(1) cms option handlinginoguchi1-620/+1240
Just applying new option handling and no functional changes. Referred to verify.c and using 'verify_shared_options'. ok and comments from jsing@ and tb@
2022-01-05Provide regress for SSL public APIs.jsing3-1/+387
This will largely test curly and inconsistent APIs that are not covered by other regress tests. Currently, this tests the wonder that is SSL_get_peer_cert_chain().
2022-01-05Remove bandaid to work around expected range_should_be_prefix() problem.tb1-6/+2
2022-01-05Remove a bogus memcmp in range_should_be_prefix()tb1-3/+6
range_should_be_prefix() currently always fails. The reason for this is that OpenSSL commit 42d7d7dd incorrectly moved a memcmp() out of an assertion. As a consequence, the library emits and accepts incorrectly encoded ipAddrBlock extensions since it will never detect ranges that MUST be encoded as a prefix according to RFC 3779, 2.2.3.7. The return -1 from this memcmp() indicates to the callers that the range should be expressed as a range, so callers must check beforehand that min <= max to be able to fail. Thus, remove this memcmp() and add a check to make_addressRange(), the only caller that didn't already ensure that min <= max. This fixes the noisy output in regress/lib/libcrypto/x509/rfc3779. ok inoguchi jsing
2022-01-05Polish X509v3_addr_subset() a bittb1-15/+28
Use child and parent instead of a and b. Split unrelated checks. Use accessors and assign to local variables to avoid ugly line wrapping. Declare vriables up front instead of mixing declarations with assignments from function returns. ok inoguchi jsing
2022-01-05Readability tweaks in addr_contains()tb1-5/+13
Assign to local variables to avoid ugly line wrapping. ok inoguchi jsing
2022-01-05Fix a bug in addr_contains() introduced in OpenSSL commit be71c372tb1-2/+2
by returning 0 instead of -1 on extract_min_max() failure. Callers would interpret -1 as success of addr_contains(). ok inoguchi jsing
2022-01-04Readability tweaks in the print helper i2r_IPAddressOrRanges.tb1-9/+17
Assign repeated nested expressions to local variables and avoid some awkward line wrapping.
2022-01-04Consistently name variables with a _len suffix instead of mixingtb1-35/+35
things like prefixlen, afi_length, etc. suggested by jsing
2022-01-04Only check the parent to be canonical once we know it is non-NULL.tb1-6/+5
suggested by jsing during review
2022-01-04Refactor extract_min_max()tb1-11/+28
extract_min_max() crammed all the work in two return statements inside a switch. Make this more readable by splitting out the extraction of the min and max as BIT STRINGs from an addressPrefix or an addressRange and once that's done expanding them to raw addresses. ok inoguchi jsing
2022-01-04Remove checks that are duplicated in extract_min_max()tb1-8/+1
The NULL checks and the checks that aor->type is reasonable are already performed in extract_min_max(), so it is unnecessary to repeat them in X509v3_addr_get_range() ok inoguchi jsing
2022-01-04Make X509v3_addr_get_range() readable.tb1-7/+17
Instead of checking everything in a single if statement, group the checks according to their purposes. ok inoguchi jsing
2022-01-04Add a length check to make_addressPrefix()tb1-12/+25
Make the callers pass in the afi so that make_addressPrefix() can check prefixlen to be reasonable. If the afi is anything else than IPv4 or IPv6, cap its length at the length needed for IPv6. This way we avoid arbitrary out-of-bounds reads if the caller decides to pass in something stupid. ok inoguchi jsing
2022-01-04Remove some dead codetb1-7/+1
IPAddressRange_new() populates both its min and max members, so they won't ever be NULL and will never need to be allocated. ok inoguchi jsing
2022-01-04Drop a pointless NULL checktb1-3/+2
IPAddressOrRange_new() instantiates a choice type, so we need to allocate one member of the union ourselves, so aor->u.addressPrefix will always be NULL. ok inoguchi jsing
2022-01-04First pass over x509_addr_validate_path()tb1-37/+79
Replace reaching into the structs with IPAddressFamily accessors and add a few comments that explain what the code is actually doing. ok inoguchi jsing
2022-01-04Refactor IPAddressFamily accessorstb1-37/+90
Introduce a helper function that allows fetching the AFI and the optional SAFI out of an IPAddressFamily. Also add two wrappers that only fetch and validate the AFI, where validation currently only means that the length is between 2 and 3. Use these accessors throughout to simplify and streamline the code. ok inoguchi jsing
2022-01-04Return 0 on failure from send/get kex functions in the legacy stack.jsing2-43/+43
In the legacy stack, a message handling function returns -1 for failure, 0 for need more data and 1 for success (although in extra special cases 2 may also be used). However, the various send/get kex functions only need to indicate success or failure - switch these to return 0 on failure (rather than -1) and use normal result testing. This leaves GOST unchanged for now, as that code is special and needs extra work. ok inoguchi@ tb@
2022-01-04Use normal result testing for tls1_check_curve().jsing1-2/+2
2022-01-04Refactor ssl3_get_server_kex_ecdhe() to separate parsing and validation.jsing1-20/+18
If we receive something other than a "named curve", send a handshake failure alert as we're unable to complete the handshake with the given parameters. If the server responded with a curve that we did not advertise send an illegal parameter alert. ok inoguchi@ tb@
2022-01-04Pull key share group/length CBB code up from tls13_key_share_public()jsing2-27/+22
This provides better symmetry with the parsing code and will allow for better reuse with the legacy stack, which has different message structures. ok inoguchi@ tb@
2022-01-04Only allow zero length key shares when we know we're doing HRR.jsing1-3/+5
ok inoguchi@ tb@
2022-01-02fix strange indentation in code exampletb1-3/+3
2022-01-01contibutions -> contributionsjsg1-3/+3
2022-01-01identfier -> identifierjsg2-6/+6
2021-12-31excpetions -> exceptionsjsg1-3/+3
2021-12-31deafult -> defaultjsg1-3/+3
2021-12-29Plug memleakstb1-3/+11
CID 345150
2021-12-29Plug memleaktb1-2/+7
CID 345156
2021-12-29More EVP_* return value checkstb1-22/+60
CID 345152
2021-12-29Remove redundant NULL checkstb1-3/+1
CID 345154
2021-12-29Minor cleanup after EC_POINT_get_affine_coordinates() unified thetb1-23/+6
_GFp and _GF2m variants. CID 345155
2021-12-29More return value checks for EVP_* APItb1-16/+28
CID 345159
2021-12-29Check return values of EVP_* APItb1-6/+24
CID 345158
2021-12-29knfmt makes this slightly nicer.tb1-52/+49
2021-12-29One more leak of the same kindtb1-2/+2
2021-12-29Plug memleaktb1-3/+3
CID 345160
2021-12-29Set failed in test_random_points()tb1-2/+2
CID 345141
2021-12-28Fix typo in commenttb1-2/+2
2021-12-28Use lowercase letters for hexadecimal constants, as both jsing and Itb1-15/+15
prefer this.
2021-12-28Rewrite X509v3_addr_canonize() with new accessorstb1-7/+9
This is again a straightforward conversion and leads to something which matches our usual style more. ok jsing
2021-12-28Validate AFIs before sorting in X509v3_adr_canonize()tb1-1/+7
Again, we're dealing with necessarily not fully validated data here, so a check up front seems prudent. ok jsing
2021-12-28Rewrite/simplify X509v3_addr_is_canonical()tb1-40/+36
This is a more or less straightforward conversion using the new IPAddressFamily accessor API. As a result, some checks have become a bit stricter, which is only desirable here. ok jsing
2021-12-28Check AFI/SAFI before comparing them in X509v3_addr_is_canonical()tb1-1/+8
As mentioned in a previous commit, IPAddressFamily_cmp() can't really check for trailing garbage in addressFamily->data. Since the path validation and hence the X.509 validator call X509v3_addr_is_canonical(), this deals with only partially validated data. ok jsing
2021-12-28Make IPAddressFamily_cmp() more pleasing on the eyetb1-4/+11
Define and use MINIMUM() instead of a ternary operator and separate the code from the declarations. Also, we can spare a line to make the return legible instead of squeezing it into another ternary operator. addressFamily->data contains a two-bytes AFI and an optional one-byte SAFI. This function currently also compares any trailing garbage that may be present. Since comparison functions can't really error, this needs to be checked bofore it is used. Such checks will be added in subsequent commits. ok jsing
2021-12-28Style improvements in X509v3_addr_add_range()tb1-8/+15
ok jsing
2021-12-28Style improvements in X509v3_addr_add_prefix()tb1-7/+16
ok jsing
2021-12-28Another small readability tweak in X509v3_addr_inherits()tb1-2/+3
Declare IPAddressFamily before using it.