summaryrefslogtreecommitdiff
path: root/src (unfollow)
Commit message (Collapse)AuthorFilesLines
2022-05-05Fix argument order in HKDF and HKDF_extract().tb1-5/+5
2022-05-05Add hkdf_pkey_meth to the standard_methods[]tb1-1/+3
ok beck jsing
2022-05-05Link kdf/ to the buildtb1-1/+7
ok beck jsing
2022-05-05Provide EVP_PKEY_HKDF alias for NID_hkdftb1-1/+2
ok beck jsing
2022-05-05Provide KDFerr() and KDFerror() macrostb1-1/+4
ok beck jsing
2022-05-05Provide versions of EVP_PKEY_CTX_{str,hex}2ctrl() for internal use.tb2-2/+38
ok beck jsing
2022-05-05Ditch #defines for tls1_prf and scrypt. Drop unused errors and massagetb2-95/+8
some const. ok beck jsing
2022-05-05Translate from OpenSSL's HKDF API to BoringSSL API.tb1-8/+7
ok beck jsing
2022-05-05Remove function codes from errors, i.e., KDFerr(A, B) -> KDFerror(B)tb1-5/+5
ok beck jsing
2022-05-05Fix typo in previous.tb1-2/+2
2022-05-05Inline OPENSSL_memdup() using malloc() + memcpy()tb1-3/+5
ok beck jsing
2022-05-05Translate OPENSSL_{cleanse,clear_free,free,zalloc}() to libc API.tb1-11/+11
ok beck jsing
2022-05-05Adjust includes for LibreSSLtb1-4/+7
ok beck jsing
2022-05-05Use C99 initializres for hkdf_pkey_methtb1-26/+10
ok beck jsing
2022-05-05Remove OpenSSL versions of HKDF*().tb1-117/+1
ok beck jsing
2022-05-05Fix includes of the removed kdferr.htb2-4/+3
2022-05-05Add NID for HKDFtb2-0/+4
ok beck jsing
2022-05-04remove accidentally duplicated linetb1-2/+1
2022-05-04Whitespace nit (knfmt(1) agrees after inserting an empty line after thetb1-4/+5
variable declaration)
2022-05-04KNF according to knfmt(1)tb2-275/+288
2022-05-04Add RCS tagstb3-0/+3
2022-05-04Restore copyright years to 2016-2018 as they were before the previoustb2-2/+2
commit.
2022-05-04Reinstate the licenses that were replaced with license stubs intb2-12/+100
OpenSSL commits d2e9e320186f0917cc940f46bdf1a7e4120da9b0 and b6cff313cbb1d0381b329fe4f6a8f009cdb270e4
2022-05-04Bump copyright years to 2016-2018 as it was before the previous commit.tb1-1/+1
2022-05-04Reinstate the license that was replaced with a stub in OpenSSL committb1-5/+49
21dcbebc6e35419f1842f39a125374ea1ba45693
2022-05-04Inline kdferr.h at the end of kdf.htb2-55/+37
2022-05-04Rename hkdf.c to hkdf_evp.c to avoid a name clash with hkdf/hkdf.ctb1-0/+0
2022-05-04Import HKDF code from OpenSSL 1.1.1otb4-0/+571
This imports verbatim copies as of the OpenSSL_1_1_1o tag of crypto/kdf/hkdf.c crypto/kdf/hkdf_err.c include/openssl/kdf.h include/openssl/kdferr.h from https://www.github.com/openssl/openssl.git into lib/libcrypto/kdf. We only want the EVP interface to HKDF since some ports need them. Not yet linked to the build since it will not compile. Follow-on commits will add KNF, clean up and make this compile. Tests of an early draft version by abieber and Caspar Schutijser ok jsing
2022-05-04Rewrite asn1_collect() and asn1_find_end() with CBS.jsing1-77/+80
Use more readable variable and arguments names in the process. ok tb@
2022-05-04Avoid special handling of definite length before calling asn1_find_end().jsing1-10/+4
The asn1_find_end() function handles definite length ASN.1, which means that there is no point in the only caller having code to explicitly handle definite length - it can just call the function. ok tb@
2022-05-04Change asn1_check_tag_cbs() out_len from long to size_t.jsing1-4/+10
The long vs size_t checks can be handled in the asn1_check_tag() wrapper and this will help to avoid propagating long vs size_t issues into new code. ok tb@
2022-04-28Add tests that decode sequences into ASN.1 strings.jsing1-1/+97
Test decoding of sequences with length and indefinite length into an ASN.1 string - in this case the ASN.1 is not decoded, rather the octets are stored directly as the content of the string. This exercises a specific path through the ASN.1 decoder. (you know asn1complex is living up to its name when you have to import openssl/asn1t.h directly...)
2022-04-28Rewrite asn1_check_tlen() using CBS.jsing3-63/+113
Rather than calling asn1_get_object_cbs(), call asn1_get_identifier_cbs(), then immediately proceed with the tag number and tag class check. Only if that succeeds (or it is not required) do we call asn1_get_length_cbs(). This avoids incurring the overhead of decoding the length in the case where the tag number and tag class do not match. While here rename asn1_check_tlen() to asn1_check_tag() - while we decode the length, what we are normally checking is the tag number and tag class. Also rename the arguments for readability. For now the argument types and encoding remain unchanged. ok inoguchi@ tb@
2022-04-28Refactor ASN1_TIME_adj_internal()tb1-84/+82
ASN1_TIME_adj_internal() does some strange dances with remembering allocations in a boolean and using strlen(p) to deduce what happened inside *_string_from_tm(). It also (mis)translates a NULL p to an illegal time value error. This can be streamlined by converting directly from a struct tm into an ASN1_TIME and setting the errors when they occur instead of trying to deduce them from a NULL return. This is made a bit uglier than necessary due to the reuse-or-allocate semantics of the public API. At the cost of a little code duplication, ASN1_TIME_adj_internal() becomes very easy and ASN1_TIME_to_generalizedtime() is also simplified somewhat. ok inoguchi jsing
2022-04-28Fix comparison in openssl(1) pkcs12inoguchi1-3/+3
comment from tb@
2022-04-28Compare pointer value with NULL in openssl(1) pkcs12inoguchi1-31/+31
ok tb@
2022-04-27Decode via c2i_ASN1_INTEGER_cbs() from asn1_ex_c2i().jsing2-5/+5
2022-04-27Ensure we clear the error stack before running tests that print errors.jsing2-2/+10
2022-04-27Enable ASN.1 INTEGER tests with invalid lengths/encodings.jsing1-3/+1
2022-04-27Rewrite c2i_ASN1_INTEGER() using CBS.jsing1-84/+129
This also makes validation stricter and inline with X.690 - we now reject zero length inputs (rather than treating them as zero values) and enforce minimal encoding. ok tb@
2022-04-27Remove the ASN.1 decoder tag/length cache (TLC).jsing1-90/+37
Currently, every time an ASN.1 identifier and length is decoded it is stored in a tag/length cache for potential reuse. However, the only time this is actually of benefit is when decoding CHOICE or SEQUENCE with OPTIONAL fields (or MSTRING and ANY due to less than ideal implementation). For CHOICE and SEQUENCE with OPTIONAL fields the current code attempts to decode the first option and if that fails, it moves onto the next option and attempts to decode it, repeating until it succeeds (or runs out of options). There are a number of problems with the cache. Firstly, it adds complexity to the ASN.1 decoder since it has to be passed up and down through the various layers. Secondly, there is nothing that keeps the cached data in synchronisation with the input stream. This makes it fragile and a potential security risk. Thirdly, the type is in the public headers and API, meaning that we cannot readily change the types or fields to improve the code. Testing also suggests that in typical decoding cases we actually get a small performance increase by removing the cache. There are also several other options that would improve decoding performance, which we can visit once we have simpler and more robust code. ok beck@ inoguchi@ tb@
2022-04-27ASN1_{,const_}check_infinite_end(3) were removed in the last major bump,tb1-5/+2
so there's no longer a need to document that they are undocumented.
2022-04-26Decode via c2i_ASN1_BIT_STRING_cbs() from asn1_ex_c2i().jsing3-9/+14
ok inoguchi@ tb@
2022-04-23Rewrite c2i_ASN1_BIT_STRING() using CBS.jsing1-44/+83
Also switch to freeing and allocating, rather than attempting to recycle. While here, factor out the flags ASN1_STRING_FLAG_BITS_LEFT bit bashing and use the name "unused bits" rather than "bits left", to be more inline with X.690 wording. ok inoguchi@ tb@
2022-04-23Convert asn1_ex_c2i() to CBS.jsing3-24/+43
This allows us to make direct use of c2i_ASN1_OBJECT_cbs(). ok inoguchi@ tb@
2022-04-23Add ASN1_INTEGER test coverage.jsing1-1/+248
2022-04-21Add missing self. From antontb1-2/+2
2022-04-21Clarify comments at the start of {asid,addr}_validate_path_internal()tb2-7/+7
Requested by jsing
2022-04-21Avoid expensive RFC 3779 checks during cert verificationtb3-16/+22
X509v3_{addr,asid}_is_canonical() check that the ipAddrBlocks and autonomousSysIds extension conform to RFC 3779. These checks are not cheap. Certs containing non-conformant extensions should not be considered valid, so mark them with EXFLAG_INVALID while caching the extension information in x509v3_cache_extensions(). This way the expensive check while walking the chains during X509_verify_cert() is replaced with a cheap check of the extension flags. This avoids a lot of superfluous work when validating numerous certs with similar chains against the same roots as is done in rpki-client. Issue noticed and fix suggested by claudio ok claudio inoguchi jsing
2022-04-21Fix X509_get_extension_flags()tb1-2/+2
Ensure that EXFLAG_INVALID is set on X509_get_purpose() failure. ok inoguchi jsing