Path: blob/main/contrib/bearssl/samples/custom_profile.c
39534 views
/*1* Copyright (c) 2016 Thomas Pornin <[email protected]>2*3* Permission is hereby granted, free of charge, to any person obtaining4* a copy of this software and associated documentation files (the5* "Software"), to deal in the Software without restriction, including6* without limitation the rights to use, copy, modify, merge, publish,7* distribute, sublicense, and/or sell copies of the Software, and to8* permit persons to whom the Software is furnished to do so, subject to9* the following conditions:10*11* The above copyright notice and this permission notice shall be12* included in all copies or substantial portions of the Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,15* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF16* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND17* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS18* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN19* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN20* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE21* SOFTWARE.22*/2324#include "bearssl.h"2526/*27* A "profile" is an initialisation function for a SSL context, that28* configures a list of cipher suites and algorithm implementations.29* While BearSSL comes with a few predefined profiles, you might one30* to define you own, using the example below as guidance.31*32* Each individual initialisation call sets a parameter or an algorithm33* support. Setting a specific algorithm pulls in the implementation of34* that algorithm in the compiled binary, as per static linking35* behaviour. Removing some of this calls will then reduce total code36* footprint, but also mechanically prevents some features to be37* supported (protocol versions and cipher suites).38*39* The two below define profiles for the client and the server contexts,40* respectively. Of course, in a typical size-constrained application,41* you would use one or the other, not both, to avoid pulling in code42* for both.43*/4445void46example_client_profile(br_ssl_client_context *cc47/* and possibly some other arguments */)48{49/*50* A list of cipher suites, by preference (first is most51* preferred). The list below contains all cipher suites supported52* by BearSSL; trim it done to your needs.53*/54static const uint16_t suites[] = {55BR_TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,56BR_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,57BR_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,58BR_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,59BR_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,60BR_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,61BR_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,62BR_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,63BR_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,64BR_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,65BR_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,66BR_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,67BR_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,68BR_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,69BR_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256,70BR_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256,71BR_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384,72BR_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384,73BR_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256,74BR_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256,75BR_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384,76BR_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384,77BR_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA,78BR_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA,79BR_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA,80BR_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA,81BR_TLS_RSA_WITH_AES_128_GCM_SHA256,82BR_TLS_RSA_WITH_AES_256_GCM_SHA384,83BR_TLS_RSA_WITH_AES_128_CBC_SHA256,84BR_TLS_RSA_WITH_AES_256_CBC_SHA256,85BR_TLS_RSA_WITH_AES_128_CBC_SHA,86BR_TLS_RSA_WITH_AES_256_CBC_SHA,87BR_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA,88BR_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,89BR_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA,90BR_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA,91BR_TLS_RSA_WITH_3DES_EDE_CBC_SHA92};9394/*95* Client context must be cleared at some point. This sets96* every value and pointer to 0 or NULL.97*/98br_ssl_client_zero(cc);99100/*101* Define minimum and maximum protocol versions. Supported102* versions are:103* BR_TLS10 TLS 1.0104* BR_TLS11 TLS 1.1105* BR_TLS12 TLS 1.2106*/107br_ssl_engine_set_versions(&cc->eng, BR_TLS10, BR_TLS12);108109/*110* Set the PRF implementation(s).111* For TLS 1.0 and 1.1, the "prf10" is needed.112* For TLS 1.2, this depends on the cipher suite:113* -- cipher suites with a name ending in "SHA384" need "prf_sha384";114* -- all others need "prf_sha256".115*116* Note that a cipher suite like TLS_RSA_WITH_AES_128_CBC_SHA will117* use SHA-1 for the per-record MAC (that's what the final "SHA"118* means), but still SHA-256 for the PRF when selected along with119* the TLS-1.2 protocol version.120*/121br_ssl_engine_set_prf10(&cc->eng, &br_tls10_prf);122br_ssl_engine_set_prf_sha256(&cc->eng, &br_tls12_sha256_prf);123br_ssl_engine_set_prf_sha384(&cc->eng, &br_tls12_sha384_prf);124125/*126* Set hash functions for the engine. Required hash functions127* depend on the protocol and cipher suite:128*129* -- TLS 1.0 and 1.1 require both MD5 and SHA-1.130* -- With TLS 1.2, cipher suites with a name ending in "SHA384"131* require SHA-384.132* -- With TLS 1.2, cipher suites with a name ending in "SHA256"133* require SHA-256.134* -- With TLS 1.2, cipher suites with a name ending in "SHA"135* require both SHA-256 and SHA-1.136*137* Moreover, these hash functions are also used to compute138* hashes supporting signatures on the server side (for ECDHE_*139* cipher suites), and on the client side (for client140* certificates, except in the case of full static ECDH). In TLS141* 1.0 and 1.1, SHA-1 (and also MD5) will be used, but with TLS142* 1.2 these hash functions are negotiated between client and143* server; SHA-256 and/or SHA-384 should be sufficient in144* practice.145*146* Note that with current implementations, SHA-224 and SHA-256147* share the same file, so if you use one, you may have the other148* one with no additional overhead. Similarly, SHA-384 and SHA-512149* share the same implementation code.150*/151br_ssl_engine_set_hash(&cc->eng, br_md5_ID, &br_md5_vtable);152br_ssl_engine_set_hash(&cc->eng, br_sha1_ID, &br_sha1_vtable);153br_ssl_engine_set_hash(&cc->eng, br_sha224_ID, &br_sha224_vtable);154br_ssl_engine_set_hash(&cc->eng, br_sha256_ID, &br_sha256_vtable);155br_ssl_engine_set_hash(&cc->eng, br_sha384_ID, &br_sha384_vtable);156br_ssl_engine_set_hash(&cc->eng, br_sha512_ID, &br_sha512_vtable);157158/*159* Set the cipher suites. All specified cipher suite MUST be160* supported, and the relevant algorithms MUST have been161* configured (failure to provide needed implementations may162* trigger unwanted behaviours like segfaults or overflows).163*/164br_ssl_engine_set_suites(&cc->eng, suites,165(sizeof suites) / (sizeof suites[0]));166167/*168* Public-key algorithm implementations.169*170* -- RSA public core ("rsapub") is needed for "RSA" key exchange171* (cipher suites whose name starts with TLS_RSA).172*173* -- RSA signature verification ("rsavrfy") is needed for174* "ECDHE_RSA" cipher suites (not ECDH_RSA).175*176* -- Elliptic curve implementation ("ec") is needed for cipher177* suites that use elliptic curves (both "ECDH" and "ECDHE"178* cipher suites).179*180* -- ECDSA signature verification is needed for "ECDHE_ECDSA"181* cipher suites (but not for ECDHE_RSA, ECDH_ECDSA or ECDH_RSA).182*183* Normally, you use the "default" implementations, obtained184* through relevant function calls. These functions return185* implementations that are deemed "best" for the current186* platform, where "best" means "fastest within constant-time187* implementations". Selecting the default implementation is a188* mixture of compile-time and runtime checks.189*190* Nevertheless, specific implementations may be selected191* explicitly, e.g. to use code which is slower but with a192* smaller footprint.193*194* The RSA code comes in three variants, called "i15", "i31" and195* "i32". The "i31" code is somewhat faster than the "i32" code.196* Usually, "i31" is faster than "i15", except on some specific197* architectures (ARM Cortex M0, M0+, M1 and M3) where the "i15"198* should be preferred (the "i15" code is constant-time, while199* the "i31" is not, and the "i15" code is faster anyway).200*201* ECDSA code also comes in "i15" and "i31" variants. As in the202* case of RSA, the "i31" code is faster, except on the small203* ARM Cortex M, where the "i15" code is faster and safer.204*205* There are no less than 10 elliptic curve implementations:206*207* - ec_c25519_i15, ec_c25519_i31, ec_c25519_m15 and ec_c25519_m31208* implement Curve25519.209*210* - ec_p256_m15 and ec_p256_m31 implement NIST curve P-256.211*212* - ec_prime_i15 and ec_prime_i31 implement NIST curves P-256,213* P-384 and P-521.214*215* - ec_all_m15 is an aggregate implementation that uses216* ec_c25519_m15, ec_p256_m15 and ec_prime_i15.217*218* - ec_all_m31 is an aggregate implementation that uses219* ec_c25519_m31, ec_p256_m31 and ec_prime_i31.220*221* For a given curve, "m15" is faster than "i15" (but possibly222* with a larger code footprint) and "m31" is faster than "i31"223* (there again with a larger code footprint). For best224* performance, use ec_all_m31, except on the small ARM Cortex M225* where ec_all_m15 should be used. Referencing the other226* implementations directly will result in smaller code, but227* support for fewer curves and possibly lower performance.228*/229br_ssl_client_set_default_rsapub(cc);230br_ssl_engine_set_default_rsavrfy(&cc->eng);231br_ssl_engine_set_default_ecdsa(&cc->eng);232/* Alternate: set implementations explicitly.233br_ssl_client_set_rsapub(cc, &br_rsa_i31_public);234br_ssl_client_set_rsavrfy(cc, &br_rsa_i31_pkcs1_vrfy);235br_ssl_engine_set_ec(&cc->eng, &br_ec_all_m31);236br_ssl_engine_set_ecdsa(&cc->eng, &br_ecdsa_i31_vrfy_asn1);237*/238239/*240* Record handler:241* -- Cipher suites in AES_128_CBC, AES_256_CBC and 3DES_EDE_CBC242* need the CBC record handler ("set_cbc").243* -- Cipher suites in AES_128_GCM and AES_256_GCM need the GCM244* record handler ("set_gcm").245* -- Cipher suites in CHACHA20_POLY1305 need the ChaCha20+Poly1305246* record handler ("set_chapol").247*/248br_ssl_engine_set_cbc(&cc->eng,249&br_sslrec_in_cbc_vtable,250&br_sslrec_out_cbc_vtable);251br_ssl_engine_set_gcm(&cc->eng,252&br_sslrec_in_gcm_vtable,253&br_sslrec_out_gcm_vtable);254br_ssl_engine_set_chapol(&cc->eng,255&br_sslrec_in_chapol_vtable,256&br_sslrec_out_chapol_vtable);257258/*259* Symmetric encryption:260* -- AES_128_CBC and AES_256_CBC require an "aes_cbc" implementation261* (actually two implementations, for encryption and decryption).262* -- 3DES_EDE_CBC requires a "des_cbc" implementation263* (actually two implementations, for encryption and decryption).264* -- AES_128_GCM and AES_256_GCM require an "aes_ctr" imeplementation265* and also a GHASH implementation.266*267* Two 3DES implementations are provided:268*269* des_tab Classical table-based implementation; it is270* not constant-time.271*272* dest_ct Constant-time DES/3DES implementation. It is273* slower than des_tab.274*275* Four AES implementations are provided:276*277* aes_ct Constant-time AES implementation, for 32-bit278* systems.279*280* aes_ct64 Constant-time AES implementation, for 64-bit281* systems. It actually also runs on 32-bit systems,282* but, on such systems, it yields larger code and283* slightly worse performance. On 64-bit systems,284* aes_ct64 is about twice faster than aes_ct for285* CTR processing (GCM encryption and decryption),286* and for CBC (decryption only).287*288* aes_small Smallest implementation provided, but also the289* slowest, and it is not constant-time. Use it290* only if desperate for code size.291*292* aes_big Classical table-based AES implementation. This293* is decently fast and still resonably compact,294* but it is not constant-time.295*296* aes_x86ni Very fast implementation that uses the AES-NI297* opcodes on recent x86 CPU. But it may not be298* compiled in the library if the compiler or299* architecture is not supported; and the CPU300* may also not support the opcodes. Selection301* functions are provided to test for availability302* of the code and the opcodes.303*304* Whether having constant-time implementations is absolutely305* required for security depends on the context (in particular306* whether the target architecture actually has cache memory),307* and while side-channel analysis for non-constant-time AES308* code has been demonstrated in lab conditions, it certainly309* does not apply to all actual usages, and it has never been310* spotted in the wild. It is still considered cautious to use311* constant-time code by default, and to consider the other312* implementations only if duly measured performance issues make313* it mandatory.314*/315br_ssl_engine_set_aes_cbc(&cc->eng,316&br_aes_ct_cbcenc_vtable,317&br_aes_ct_cbcdec_vtable);318br_ssl_engine_set_aes_ctr(&cc->eng,319&br_aes_ct_ctr_vtable);320/* Alternate: aes_ct64321br_ssl_engine_set_aes_cbc(&cc->eng,322&br_aes_ct64_cbcenc_vtable,323&br_aes_ct64_cbcdec_vtable);324br_ssl_engine_set_aes_ctr(&cc->eng,325&br_aes_ct64_ctr_vtable);326*/327/* Alternate: aes_small328br_ssl_engine_set_aes_cbc(&cc->eng,329&br_aes_small_cbcenc_vtable,330&br_aes_small_cbcdec_vtable);331br_ssl_engine_set_aes_ctr(&cc->eng,332&br_aes_small_ctr_vtable);333*/334/* Alternate: aes_big335br_ssl_engine_set_aes_cbc(&cc->eng,336&br_aes_big_cbcenc_vtable,337&br_aes_big_cbcdec_vtable);338br_ssl_engine_set_aes_ctr(&cc->eng,339&br_aes_big_ctr_vtable);340*/341br_ssl_engine_set_des_cbc(&cc->eng,342&br_des_ct_cbcenc_vtable,343&br_des_ct_cbcdec_vtable);344/* Alternate: des_tab345br_ssl_engine_set_des_cbc(&cc->eng,346&br_des_tab_cbcenc_vtable,347&br_des_tab_cbcdec_vtable);348*/349350/*351* GHASH is needed for AES_128_GCM and AES_256_GCM. Three352* implementations are provided:353*354* ctmul Uses 32-bit multiplications with a 64-bit result.355*356* ctmul32 Uses 32-bit multiplications with a 32-bit result.357*358* ctmul64 Uses 64-bit multiplications with a 64-bit result.359*360* On 64-bit platforms, ctmul64 is the smallest and fastest of361* the three. On 32-bit systems, ctmul should be preferred. The362* ctmul32 implementation is meant to be used for the specific363* 32-bit systems that do not have a 32x32->64 multiplier (i.e.364* the ARM Cortex-M0 and Cortex-M0+).365*366* These implementations are all constant-time as long as the367* underlying multiplication opcode is constant-time (which is368* true for all modern systems, but not for older architectures369* such that ARM9 or 80486).370*/371br_ssl_engine_set_ghash(&cc->eng,372&br_ghash_ctmul);373/* Alternate: ghash_ctmul32374br_ssl_engine_set_ghash(&cc->eng,375&br_ghash_ctmul32);376*/377/* Alternate: ghash_ctmul64378br_ssl_engine_set_ghash(&cc->eng,379&br_ghash_ctmul64);380*/381382#if 0383/*384* For a client, the normal case is to validate the server385* certificate with regards to a set of trust anchors. This386* entails using a br_x509_minimal_context structure, configured387* with the relevant algorithms, as shown below.388*389* Alternatively, the client could "know" the intended server390* public key through an out-of-band mechanism, in which case391* a br_x509_knownkey_context is appropriate, for a much reduced392* code footprint.393*394* We assume here that the following extra parameters have been395* provided:396*397* xc engine context (br_x509_minimal_context *)398* trust_anchors trust anchors (br_x509_trust_anchor *)399* trust_anchors_num number of trust anchors (size_t)400*/401402/*403* The X.509 engine needs a hash function for processing the404* subject and issuer DN of certificates and trust anchors. Any405* supported hash function is appropriate; here we use SHA-256.406* The trust an407*/408br_x509_minimal_init(xc, &br_sha256_vtable,409trust_anchors, trust_anchors_num);410411/*412* Set suites and asymmetric crypto implementations. We use the413* "i31" code for RSA (it is somewhat faster than the "i32"414* implementation). These implementations are used for415* signature verification on certificates, but not for the416* SSL-specific usage of the server's public key. For instance,417* if the server has an EC public key but the rest of the chain418* (intermediate CA, root...) use RSA, then you would need only419* the RSA verification function below.420*/421br_x509_minimal_set_rsa(xc, &br_rsa_i31_pkcs1_vrfy);422br_x509_minimal_set_ecdsa(xc,423&br_ec_prime_i31, &br_ecdsa_i31_vrfy_asn1);424425/*426* Set supported hash functions. These are for signatures on427* certificates. There again, you only need the hash functions428* that are actually used in certificates, but if a given429* function was included for the SSL engine, you may as well430* add it here.431*432* Note: the engine explicitly rejects signatures that use MD5.433* Thus, there is no need for MD5 here.434*/435br_ssl_engine_set_hash(xc, br_sha1_ID, &br_sha1_vtable);436br_ssl_engine_set_hash(xc, br_sha224_ID, &br_sha224_vtable);437br_ssl_engine_set_hash(xc, br_sha256_ID, &br_sha256_vtable);438br_ssl_engine_set_hash(xc, br_sha384_ID, &br_sha384_vtable);439br_ssl_engine_set_hash(xc, br_sha512_ID, &br_sha512_vtable);440441/*442* Link the X.509 engine in the SSL engine.443*/444br_ssl_engine_set_x509(&cc->eng, &xc->vtable);445#endif446}447448/*449* Example server profile. Most of it is shared with the client450* profile, so see the comments in the client function for details.451*452* This example function assumes a server with a (unique) RSA private453* key, so the list of cipher suites is trimmed down for RSA.454*/455void456example_server_profile(br_ssl_server_context *cc,457const br_x509_certificate *chain, size_t chain_len,458const br_rsa_private_key *sk)459{460static const uint16_t suites[] = {461BR_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,462BR_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,463BR_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,464BR_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,465BR_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,466BR_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,467BR_TLS_RSA_WITH_AES_128_GCM_SHA256,468BR_TLS_RSA_WITH_AES_256_GCM_SHA384,469BR_TLS_RSA_WITH_AES_128_CBC_SHA256,470BR_TLS_RSA_WITH_AES_256_CBC_SHA256,471BR_TLS_RSA_WITH_AES_128_CBC_SHA,472BR_TLS_RSA_WITH_AES_256_CBC_SHA,473BR_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,474BR_TLS_RSA_WITH_3DES_EDE_CBC_SHA475};476477br_ssl_server_zero(cc);478br_ssl_engine_set_versions(&cc->eng, BR_TLS10, BR_TLS12);479480br_ssl_engine_set_prf10(&cc->eng, &br_tls10_prf);481br_ssl_engine_set_prf_sha256(&cc->eng, &br_tls12_sha256_prf);482br_ssl_engine_set_prf_sha384(&cc->eng, &br_tls12_sha384_prf);483484/*485* Apart from the requirements listed in the client side, these486* hash functions are also used by the server to compute its487* signature on ECDHE parameters. Which functions are needed488* depends on what the client may support; furthermore, the489* client may fail to send the relevant extension, in which490* case the server will default to whatever it can (as per the491* standard, it should be SHA-1 in that case).492*/493br_ssl_engine_set_hash(&cc->eng, br_md5_ID, &br_md5_vtable);494br_ssl_engine_set_hash(&cc->eng, br_sha1_ID, &br_sha1_vtable);495br_ssl_engine_set_hash(&cc->eng, br_sha224_ID, &br_sha224_vtable);496br_ssl_engine_set_hash(&cc->eng, br_sha256_ID, &br_sha256_vtable);497br_ssl_engine_set_hash(&cc->eng, br_sha384_ID, &br_sha384_vtable);498br_ssl_engine_set_hash(&cc->eng, br_sha512_ID, &br_sha512_vtable);499500br_ssl_engine_set_suites(&cc->eng, suites,501(sizeof suites) / (sizeof suites[0]));502503/*504* Elliptic curve implementation is used for ECDHE suites (but505* not for ECDH).506*/507br_ssl_engine_set_ec(&cc->eng, &br_ec_prime_i31);508509/*510* Set the "server policy": handler for the certificate chain511* and private key operations. Here, we indicate that the RSA512* private key is fit for both signing and decrypting, and we513* provide the two relevant implementations.514515* BR_KEYTYPE_KEYX allows TLS_RSA_*, BR_KEYTYPE_SIGN allows516* TLS_ECDHE_RSA_*.517*/518br_ssl_server_set_single_rsa(cc, chain, chain_len, sk,519BR_KEYTYPE_KEYX | BR_KEYTYPE_SIGN,520br_rsa_i31_private, br_rsa_i31_pkcs1_sign);521/*522* If the server used an EC private key, this call would look523* like this:524525br_ssl_server_set_single_ec(cc, chain, chain_len, sk,526BR_KEYTYPE_KEYX | BR_KEYTYPE_SIGN,527cert_issuer_key_type,528&br_ec_prime_i31, br_ecdsa_i31_sign_asn1);529530* Note the tricky points:531*532* -- "ECDH" cipher suites use only the EC code (&br_ec_prime_i31);533* the ECDHE_ECDSA cipher suites need both the EC code and534* the ECDSA signature implementation.535*536* -- For "ECDH" (not "ECDHE") cipher suites, the engine must537* know the key type (RSA or EC) for the intermediate CA that538* issued the server's certificate; this is an artefact of539* how the protocol is defined. BearSSL won't try to decode540* the server's certificate to obtain that information (it541* could do that, the code is there, but it would increase the542* footprint). So this must be provided by the caller.543*544* -- BR_KEYTYPE_KEYX allows ECDH, BR_KEYTYPE_SIGN allows545* ECDHE_ECDSA.546*/547548br_ssl_engine_set_cbc(&cc->eng,549&br_sslrec_in_cbc_vtable,550&br_sslrec_out_cbc_vtable);551br_ssl_engine_set_gcm(&cc->eng,552&br_sslrec_in_gcm_vtable,553&br_sslrec_out_gcm_vtable);554555br_ssl_engine_set_aes_cbc(&cc->eng,556&br_aes_ct_cbcenc_vtable,557&br_aes_ct_cbcdec_vtable);558br_ssl_engine_set_aes_ctr(&cc->eng,559&br_aes_ct_ctr_vtable);560/* Alternate: aes_ct64561br_ssl_engine_set_aes_cbc(&cc->eng,562&br_aes_ct64_cbcenc_vtable,563&br_aes_ct64_cbcdec_vtable);564br_ssl_engine_set_aes_ctr(&cc->eng,565&br_aes_ct64_ctr_vtable);566*/567/* Alternate: aes_small568br_ssl_engine_set_aes_cbc(&cc->eng,569&br_aes_small_cbcenc_vtable,570&br_aes_small_cbcdec_vtable);571br_ssl_engine_set_aes_ctr(&cc->eng,572&br_aes_small_ctr_vtable);573*/574/* Alternate: aes_big575br_ssl_engine_set_aes_cbc(&cc->eng,576&br_aes_big_cbcenc_vtable,577&br_aes_big_cbcdec_vtable);578br_ssl_engine_set_aes_ctr(&cc->eng,579&br_aes_big_ctr_vtable);580*/581br_ssl_engine_set_des_cbc(&cc->eng,582&br_des_ct_cbcenc_vtable,583&br_des_ct_cbcdec_vtable);584/* Alternate: des_tab585br_ssl_engine_set_des_cbc(&cc->eng,586&br_des_tab_cbcenc_vtable,587&br_des_tab_cbcdec_vtable);588*/589590br_ssl_engine_set_ghash(&cc->eng,591&br_ghash_ctmul);592/* Alternate: ghash_ctmul32593br_ssl_engine_set_ghash(&cc->eng,594&br_ghash_ctmul32);595*/596/* Alternate: ghash_ctmul64597br_ssl_engine_set_ghash(&cc->eng,598&br_ghash_ctmul64);599*/600}601602603