summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/seed48.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2023-11-09Convert asn1_item_sign() to X509_ALGOR_set0_by_nid()tb1-8/+4
ok jca
2023-11-09Fix X509_ALGOR_set0() usage in rsa_alg_set_oaep_padding()tb1-4/+6
Replace X509_ALGOR_set0() with X509_ALGOR_set0_by_nid(). This way there is no missing error checking for OBJ_nid2obj() and no nested functions. Slightly more importantly, this plugs two long standing potential leaks in this function (or previously rsa_cms_encrypt()) due to missing error checking: in the unlikely event that X509_ALGOR_set0() failed, astr/ostr would leak. ok jsing
2023-11-09Use X509_ALGOR_set0_by_nid() in rsa_mgf1md_to_maskGenAlgorithm()tb1-5/+2
ok jsing
2023-11-08More minor cleanup in rsa_alg_set_oaep_padding()tb1-4/+3
Test and assign one more instance replace a useless comment by an empty line.
2023-11-08Prepare further fixes of X509_ALGOR_set0() misusetb1-8/+7
In rsa_alg_set_oaep_padding() rename los to ostr for consistency with astr, make it have function scope, free ostr in the error path and assume X509_ALGOR_set0() success. ok jca
2023-11-08zap a stray spacetb1-2/+2
2023-11-08Rename os into astr in rsa_alg_set_oaep_padding()tb1-6/+6
2023-11-08Rename pkctx to pkey_ctx in rsa_alg_set_oaep_padding() and rsa_cms_encrypt()tb1-9/+9
2023-11-08Some simple cosmetics in rsa_alg_set_oaep_padding()tb1-4/+8
Rename rv into ret and split it on its own line, move labellen a bit down add some empty lines. To match style elsewhere. Most of this was requested by jsing
2023-11-08Split OAEP padding handling into a helper functiontb1-53/+59
This matches what is done for PKCS#1 1.5 and PSS. This function needs a lot of work still, but it's easier to do that without having to tiptoe around a lot of other garbage. ok jsing
2023-11-07Move CMS_RecipientInfo_ktri_get0_algs() down a few lines and fix itstb1-3/+6
error check
2023-11-07Move CMS_RecipientInfo_get0_pkey_ctx() to first use of pkctxtb1-3/+3
2023-11-07Fix an error message left out in the mustDecodeHexString() conversiontb1-2/+2
2023-11-07Pull up the handling of the two webcrypto special snowflakestb1-13/+9
2023-11-07Drop a useless line and bump copyright yearstb1-4/+3
2023-11-07Unwrap a few linestb1-72/+32
2023-11-07Wrap hex.DecodeString() into mustDecodeHexString()tb1-390/+78
The hex decoding is only done from the JSON files provided by the wycheproof-testvectors package. Failure is always fatal. So there is no need for repeated error checks, and we can use an ergonomic wrapper. Also rework the calculation of the message digest from input data this had a similar deficit. All in all this shaves off about 10% of the code and removes a lot of tedious repetition.
2023-11-07Use maps to retrieve various AES variantstb1-60/+72
2023-11-07Convert hashEvpMdFromString() to a maptb1-26/+19
2023-11-07Add stringer interfaces to the test groupstb1-102/+126
This simplifies and unifies a lot of error messages.
2023-11-07Inline rsa_ctx_to_pss_string()tb1-16/+6
After previous refactoring, rsa_all_set_pss_padding() is the last remaining caller of the weirdly named and ugly rsa_all_set_pss_padding(). This can be handled in a few simple lines now that this mess has slightly cleaner code.
2023-11-07Rename pkctx to pkey_ctx in rsa_{cms,item}_sign()tb1-26/+26
2023-11-07Trivial cleanup in rsa_cms_sign()tb1-5/+5
Check and assign the EVP_PKEY_CTX and move the extraction of the algorithm identifier from the signer info a few lines down.
2023-11-07Rework RSA_PKCS1_PSS_PADDING handling in rsa_item_sign()tb1-14/+4
The current convoluted mess can be handled with two calls to the new rsa_alg_set_pss_padding() helper. Not that this would be obvious at all. This fixes two more leaks in case of X509_ALGOR_set0() failure. ok jsing
2023-11-07Add a helper to set RSASSA-PSS padding parameterstb1-10/+29
This sets the AlgorithmIdentifier's algorithm to id-RSASSA-PSS with appropriate RSASSA-PSS parameters. This pulls a chunk of code out of rsa_cms_sign() and rewrites it with proper error checking, thereby fixing a long-standing leak. This helper can also be used in rsa_item_sign(), but that part is a bit special, and will therefore be commmitted separately. ok jsing
2023-11-07Add a helper to set RSA PKCS #1 v1.5 padding OIDtb1-12/+15
This removes a few duplicated and unchecked X509_ALGOR_set0() calls and factors them into a helper function that sets the AlgorithmIdentifier on the recipient info or signer info to rsaEncryption with null parameters. ok jsing
2023-11-06Pull everything except the actual run call out of the closuretb1-11/+9
The determination of the test group type and the JSON unmarshalling can be done before the closure without performance impact. This is more readable and eliminates the need of a temporary variable again. Suggested by jsing
2023-11-06Introduce testGroupFromAlgorithm()tb1-50/+54
This factors another ugly switch into a helper function. This should probably become a map eventually, but for now keep things straightforward.
2023-11-06Add a wycheproofTestGroupRunner interfacetb1-72/+26
This allows us to use a simpler way of running the individual test groups and gets rid of an ugly mostly copy-pasted switch inside a closure.
2023-11-06Add aliases for AES AEAD constructions and ChaChatb1-9/+12
These used the wycheproofTestGroupAead type but an upcoming change requires to change this. Introduce the aliases now to make the next diff cleaner.
2023-11-06Fix a for loop bug introduced in the concurrency refactortb1-3/+4
Due to Go's idiosyncratic semantics of for loops, tests would only run some of the test groups in the JSON file because by the time the closure is called, the array index could be changed. For example, on fast 8 core machines, the CMAC tests would run the last test group with key size 320 eight times rather than each of the eight test groups once. Make a copy of the pointer before passing it to the closure to avoid this issue. Simpler version of my initial fix from jsing
2023-11-06Uncomment json webcrypto line. Packages will have caught up...tb1-3/+2
2023-11-04KNF plus fixed a few signed vs unsigned compares (that we actuallyotto1-22/+33
not real problems)
2023-11-02Fix a few bizarre line wraps in x509.htb1-8/+5
2023-11-01Use X509_ALGOR_set0_by_nid() in X509_ALGOR_set_evp_md()tb1-6/+6
ok jsing
2023-11-01Add X509_ALGOR_set0_by_nid()tb2-2/+33
X509_ALGOR_set0() is annoyingly unergonomic since it takes an ASN1_OBJECT rather than a nid. This means that almost all callers call OBJ_obj2nid() and they often do this inline without error checking so that the resulting X509_ALGOR object is corrupted and may lead to incorrect encodings. Provide an internal alternative X509_ALGOR_set0_by_nid() that takes a nid instead of an ASN1_OBJECT and performs proper error checking. This will be used to convert callers of X509_ALGOR_set0() in the library. ok jsing
2023-11-01Explain the weird order of doing things in X509_ALGOR_set0()tb1-1/+2
2023-11-01Rename ptype and pval to parameter_type and parameter_valuetb1-7/+9
ok jsing
2023-11-01Unindent X509_ALGOR_set0_parameter()tb1-8/+11
ok jsing
2023-11-01Split X509_ALGOR_set0_parameter() out of X509_ALGOR_set0()tb1-6/+15
ok jsing
2023-11-01Split X509_ALGOR_set0_obj() out of X509_ALGOR_set0()tb1-3/+12
ok jsing
2023-10-31Remove 3 expected failures those got fixed in the regress code.claudio1-4/+1
2023-10-31unlink("/") just needs to error. Checking for a specific errno makesclaudio1-2/+2
little sense here since there are multiple possible errnos that could be returned. On OpenBSD this returns EISDIR and not EBUSY. OK mbuhl@ millert@
2023-10-31When creating a file in a directory the file gid is inherited fromclaudio1-2/+2
the directory and so checking against getgid() makes no sense. OK mbuhl@ millert@
2023-10-31Ignore closefrom() failure. This fails normally since fd 4 and up are allclaudio1-3/+2
closed. OK mbuhl@ millert@
2023-10-30Add support for OpenSSL 3.1 interop teststb8-11/+74
Until OpenSSL 3.1 has replaced OpenSSL 3.0 on most architectures, run both tests. Installed packages of OpenSSL 3.0 will update automatically to 3.1, so regress runners should not need to do anything.
2023-10-29Enable ISO C11 APIs when building libc, even with an older compiler.millert1-1/+9
Otherwise, the prototypes for timespec_get() and aligned_alloc() are not visible. OK guenther@
2023-10-29Fix an error exit in X509v3_addr_validate_path()tb1-3/+6
If the topmost cert is invalid, this should result in a validation failure. Do the same dance as elsewhere permitting the verify callback to intercept the error but ensuring that we throw an error. ok jsing
2023-10-27Include wait(2) status in error message, in the hopes of providing cluesanton1-2/+2
on why this occasionally fails.
2023-10-26A few micro-optimizations; ok asou@otto1-20/+15