Git Product home page Git Product logo

Comments (4)

mattcaswell avatar mattcaswell commented on July 3, 2024

There is some limited support for this already via the so-called "stitched" ciphers. I say limited because the support is only for certain ciphersuites and only when Encrypt-Then-Mac is not in use. This is mostly a legacy feature that has not been updated for Encrypt-Then-Mac. See for example:

openssl/ssl/ssl_ciph.c

Lines 584 to 628 in b9e084f

if ((*enc != NULL)
&& (*md != NULL
|| (EVP_CIPHER_get_flags(*enc) & EVP_CIPH_FLAG_AEAD_CIPHER))
&& (c->algorithm_mac == SSL_AEAD
|| mac_pkey_type == NULL || *mac_pkey_type != NID_undef)) {
const EVP_CIPHER *evp = NULL;
if (use_etm
|| s->ssl_version >> 8 != TLS1_VERSION_MAJOR
|| s->ssl_version < TLS1_VERSION)
return 1;
if (c->algorithm_enc == SSL_RC4
&& c->algorithm_mac == SSL_MD5)
evp = ssl_evp_cipher_fetch(ctx->libctx, NID_rc4_hmac_md5,
ctx->propq);
else if (c->algorithm_enc == SSL_AES128
&& c->algorithm_mac == SSL_SHA1)
evp = ssl_evp_cipher_fetch(ctx->libctx,
NID_aes_128_cbc_hmac_sha1,
ctx->propq);
else if (c->algorithm_enc == SSL_AES256
&& c->algorithm_mac == SSL_SHA1)
evp = ssl_evp_cipher_fetch(ctx->libctx,
NID_aes_256_cbc_hmac_sha1,
ctx->propq);
else if (c->algorithm_enc == SSL_AES128
&& c->algorithm_mac == SSL_SHA256)
evp = ssl_evp_cipher_fetch(ctx->libctx,
NID_aes_128_cbc_hmac_sha256,
ctx->propq);
else if (c->algorithm_enc == SSL_AES256
&& c->algorithm_mac == SSL_SHA256)
evp = ssl_evp_cipher_fetch(ctx->libctx,
NID_aes_256_cbc_hmac_sha256,
ctx->propq);
if (evp != NULL) {
ssl_evp_cipher_free(*enc);
ssl_evp_md_free(*md);
*enc = evp;
*md = NULL;
}
return 1;
}

The idea here is that certain composite cipher + MAC combinations are treated like a single AEAD cipher. These are very much "special" ciphersuites and are treated slightly differently to other ciphersuites.

Generally there has not been much interest in pursuing this idea since in recent years AEAD ciphers are the preferred approach so you do not have this split of separate cipher and MAC stages. It is also preferred to try and keep the ciphers "standard" without having special case TLS knowledge inside the cipher implementation. Since all TLSv1.3 ciphersuites are AEAD anyway and the most preferred TLSv1.2 ciphersuites are also AEAD the benefits are small.

from openssl.

mynidiravichandra avatar mynidiravichandra commented on July 3, 2024

Hi Matt,
Thanks for your reply.
I have seen this stitched cipher implementation earlier. Still this is just a (enc+mac) operation together. It doesn't do any addition of padding, record header to the payload on TX and removal of padding, record header stripping on RX. I am trying to see all of this can be cooked into this new feature.

from openssl.

mynidiravichandra avatar mynidiravichandra commented on July 3, 2024

Hi @mattcaswell ,
As part of our next exercise, we plan to do code profiling in the code. The goal of this exercise is to quantify the benefits of adding complete record processing feature by measuring cycles of each of these record APIs. If we can provide the performance benefits of this feature, can we plan this feature for future release?

from openssl.

mattcaswell avatar mattcaswell commented on July 3, 2024

As part of our next exercise, we plan to do code profiling in the code. The goal of this exercise is to quantify the benefits of adding complete record processing feature by measuring cycles of each of these record APIs. If we can provide the performance benefits of this feature, can we plan this feature for future release?

We would of course be interested in seeing any statistics you have on a performance benefit. I can't say whether we would include such a feature or not. We would need to consider the potential benefits weighed against how invasive or extensive the changes are, and how many people are likely to see the benefits.

from openssl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.