summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/recallocarray.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-12-08document BIO_indent(3);schwarze1-12/+53
while here, improve some of the existing text in minor ways
2021-12-08mark c2i_ASN1_OBJECT as intentionally undocumented;schwarze1-2/+4
discussed with jsing@
2021-12-08mark i2c_ASN1_BIT_STRING, c2i_ASN1_BIT_STRING, and c2i_ASN1_INTEGERschwarze1-2/+5
as intentionally undocumented; discussed with jsing@
2021-12-07Simple conversion to opaque EVP_CIPHER.tb1-5/+9
2021-12-07be more specific which NETSCAPE stuff to ignore, and whyschwarze1-10/+7
2021-12-07Some improvements allowing to handle asn1.h and x509v3.h:schwarze1-10/+47
* handle multiple qualifiers on the function return type * handle function pointer type declarations * handle unions inside structs * handle forward struct declarations * handle "typedef const" * handle ASN1_F_, ASN1_R_, and X509V3_R_ error constants * handle "#if defined" in the same way as "#ifdef" * skip whitespace between "#" and "define" * skip whitespace before C comments * ignore TYPEDEF_D2I2D_OF
2021-12-07lsearch(3): append key to array with memmove(3) instead of memcpy(3)cheloha1-2/+7
If the key overlaps the end of the array, memcpy(3) mutates the key and copies a corrupted value into the end of the array. If we use memmove(3) instead we at least end up with a clean copy of the key at the end of the array. This is closer to the intended behavior. With input from millert@ and deraadt@. Thread: https://marc.info/?l=openbsd-tech&m=163880307403606&w=2 ok millert@
2021-12-06In the next major bump, some BN macros will become functions.schwarze5-27/+11
In order to not forget it, already remove the statements that these APIs are currently implemented as macros: Not saying that doesn't make the documentation wrong.
2021-12-06Clean up a bunch of dead code in s_server.c and s_socket.ctb3-36/+21
jsg's analysis tool flagged a potential double free in do_server(). While this looks like a false positive, we can clean this code up a little: the host name passed to the callbacks isn't used by either sv_body() and www_body(), so it can be made local to do_accept() (an extra variable would not even be needed). Simplify the callbacks' signatures accordingly. Remove some commented out linger code that would never be used again anyway. ok inoguchi jsg
2021-12-05Simplify DH_check_params a bit.tb1-12/+4
It makes no sense to allocate an entire BN_CTX if we only use it to get a single BIGNUM, from which we subtract 1 to compare it to g. We can just use a plain BIGNUM and delete a bunch of lines. ok inoguchi jsing
2021-12-05Add initial regress for CT.jsing4-1/+415
This provides test coverage for SCT encoding/decoding.
2021-12-05Add RCS markerstb13-0/+13
2021-12-04gross trailing whitespacetb1-16/+16
2021-12-04List subdirectories as a simple list. Avoids a source of many mergetb1-6/+8
conflicts in my work on making much of libcrypto opaque. discussed with jsing
2021-12-04Annotate the structs to be moved to bn_lcl.h in the next bumptb1-1/+5
ok inoguchi jsing
2021-12-04Use BN_is_negative(p) instead of p->neg in one place.tb1-2/+2
2021-12-04Add #include "bn_lcl.h" to the files that will soon need it.tb15-15/+36
ok inoguchi jsing
2021-12-04Implement the BN_to_montgomery() macro as a functiontb2-2/+13
ok inoguchi jsing
2021-12-04Implement the BN_is_negative macro as a functiontb2-2/+13
ok inoguchi jsing
2021-12-04Provide function implementations for various BN_* macrostb2-4/+54
BN_abs_is_word, BN_is_{zero,one,word,odd}, BN_one, BN_zero_ex are now implemented as functions for internal use. They will be exposed publicly to replace the macros reaching into BIGNUM in the next bump. ok inoguchi jsing
2021-12-04Provide replacement functions for the BN_{get,set,with}_flags() macros.tb2-2/+34
ok inoguchi jsing
2021-12-04Provide replacement functions for the BN_GENCB_set{,_old}() macrostb2-3/+33
The function implementations are necessary to make BIGNUM opaque. They will be used in libcrypto internally until they will replace the macro implementations with the next bump. ok inoguchi jsing
2021-12-04Consolidate {d2i,i2d}_{pr,pu}.cjsing5-184/+43
Currently there are two files for private key ASN.1 (d2i_pr.c, i2d_pr.c) and two files for public key ASN.1 (d2i_pu.c, i2d_pu.c). All of the other ASN.1 code has d2i and i2d in the same per-object file. Consolidate d2i_pr.c/i2d_pr.c into a_pkey.c and consolidate d2i_pu.c/i2d_pu.c into a_pubkey.c before making any further changes to this code. ok tb@
2021-12-04Clean up and refactor server side DHE key exchange.jsing4-120/+116
Provide ssl_kex_generate_dhe_params_auto() which handles DHE key generation based on parameters determined by the specified key bits. Convert the existing DHE auto parameter selection code into a function that just tells us how many key bits to use. Untangle and rework the server side DHE key exchange to use the ssl_kex_* functions. ok inoguchi@ tb@
2021-12-04Move the minimum DHE key size check into ssl_kex_peer_params_dhe()jsing3-14/+19
ok inoguchi@ tb@
2021-12-04Check DH public key in ssl_kex_peer_public_dhe().jsing3-8/+22
Call DH_check_pub_key() after decoding the peer public key - this will be needed for the server DHE key exchange, but also benefits the client. ok inoguchi@ tb@
2021-12-04Free cert, key and ocsp_staple on exit of do_keypair_test().tb1-1/+4
Reported by Ilya Shipitsine, discussed with jsing
2021-12-04Convert main into single exit to appease asan.tb1-22/+33
2021-12-04Explicitly free EVP_MD_CTX to appease asan. Reported by Ilya Shipitsin.tb1-10/+16
2021-12-04Add regress for ECPKParameters ASN.1 encoding/decoding.jsing2-2/+210
2021-12-03Replace asn1_tlc_clear and asn1_tlc_clear_nc macros with a function.jsing1-32/+26
Call the replacement asn1_tlc_invalidate() since it does not actually clear the ASN1_TLC. While here, name the ASN1_TLC variables consistently as ctx, remove a pointless comment and simplify ASN1_item_d2i() slightly. ok inoguchi@ tb@
2021-12-03Group and sort includes.jsing1-3/+3
2021-12-03Call asn1_item_ex_d2i() directly from ASN1_item_d2i()jsing1-2/+5
ASN1_item_ex_d2i() is just a wrapper around the internal asn1_item_ex_d2i() function, so call asn1_item_ex_d2i() directly. ok inoguchi@ tb@
2021-12-03Convert ASN1_PCTX_new() to calloc().jsing1-10/+6
Rather than using malloc() and then initialising all struct members to zero values, use calloc(). ok schwarze@ tb@
2021-12-03Use calloc() for X509_CRL_METHOD_new() instead of malloc().jsing1-3/+4
This ensures that if any members are added to this struct, they will be initialised. ok schwarze@ tb@
2021-12-03Rewrite ASN1_STRING_cmp().jsing1-11/+8
This removes nested ifs and uses more sensible variable names. ok schwarze@ tb@
2021-12-03Convert ASN1_STRING_type_new() to calloc().jsing1-10/+7
Rather than using malloc() and then initialising all struct members, use calloc() and only initialise the single non-zero value member. ok schwarze@ tb@
2021-12-03Convert ASN1_OBJECT_new() to calloc().jsing1-11/+6
Rather than using malloc() and then initialising all struct members, use calloc() and only initialise the single non-zero value member. ok schwarze@ tb@
2021-12-03Convert {i2d,d2i}_{,EC_,DSA_,RSA_}PUBKEY{,_bio,_fp}() to templated ASN1jsing2-222/+430
These functions previously used the old ASN1_{d2i,i2d}_{bio,fp}() interfaces. ok inoguchi@ tb@
2021-12-03Use calloc() in EVP_PKEY_meth_new() instead of malloc() and settingtb1-29/+2
almost all members to 0. Just set the two things that need setting. ok jsing
2021-12-03Fix EVP_PKEY_{asn1,meth}_copy once and for alltb2-63/+23
It is very easy to forget to copy over newly added methods. Everyone working in this corner has run into this. Instead, preserve what needs preserving and use a struct copy, so all methods get copied from src to dest. tweak/ok jsing
2021-12-02bsearch(3): support arrays with more than INT_MAX elementscheloha1-2/+3
The "lim" variable needs to be a size_t to match nmemb, otherwise we get undefined behavior when nmemb exceeds INT_MAX. Prompted by a blog post by Joshua Bloch: https://ai.googleblog.com/2006/06/extra-extra-read-all-about-it-nearly.html Fixed by Chris Torek a long time ago: https://svnweb.freebsd.org/csrg/lib/libc/stdlib/bsearch.c?revision=51742&view=markup ok millert@
2021-12-02Tell testers which packages to install right away (and why)kn3-3/+7
Other regress tests do it differently; just fix/thouch those that did not mention any package name at all. This helps grepping logs for SKIPPED to find instructions for the next run.
2021-12-01Remove dead code.jsing1-21/+1
2021-11-30Add missing const qualifiers in a number of BN_* manuals.tb8-52/+52
ok schwarze
2021-11-30last whitespace diff for now.tb1-57/+62
2021-11-30KNF for BF_KEYtb1-4/+3
2021-11-30Fix some annoying whitespace inconsistencies.tb1-20/+20
2021-11-30Provide EVP_CTRL_AEAD_* defines.tb1-7/+10
This commit adds generic EVP_CTRL_AEAD_{SET,GET}_TAG and _SET_IVLEN defines and aliases the GCM and CCM versions to those. This is the publicly visible part of OpenSSL's e640fa02005. ok inoguchi jsing
2021-11-30Align ssl_kex_derive_ecdhe_ecp() with ssl_kex_derive_dhe()tb1-10/+10
sk is commonly used for a STACK_OF(), so call the shared key simply key. ok jsing