Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate OpenSSL-based OCB implementation from others #1195

Merged
merged 1 commit into from
Jun 7, 2022

Conversation

bbarenblat
Copy link
Contributor

Split src/crypto/ocb.cc into two files – one containing the AES-OCB implementation backed by OpenSSL, and the other containing implementations backed by Apple Common Crypto and Nettle. This paves the way for a new OpenSSL implementation that uses OpenSSL 1.1’s OCB support directly, rather than one that merely uses OpenSSL to provide the underlying block cipher.

Remove support for rijndael-alg-fst.c and compiler-provided AES intrinsics, since they’re not in use anymore. (Mosh can still use hardware-accelerated AES if it’s available; it just now relies exclusively on the underlying cryptography library to accelerate AES if possible.)

Update the build system to conditionally compile in either ocb_openssl.cc or ocb_internal.cc, depending on which cryptography
library you pass to ./configure.

To make this commit easy to audit, ocb_openssl.cc and ocb_internal.cc are trivially diffable against ocb.cc (now deleted). Expected diffs consist of a copyright notice update, a preprocessor check to ensure the appropriate cryptography implementation has been selected, and deletions to remove code that’s no longer in use. This does mean a substantial amount of code is duplicated between ocb_openssl.cc and ocb_internal.cc; however, ocb_openssl.cc should be completely replaced soon, so it won’t be an issue in the long term.

Bug: #1174

Split src/crypto/ocb.cc into two files – one containing the AES-OCB
implementation backed by OpenSSL, and the other containing
implementations backed by Apple Common Crypto and Nettle. This paves the
way for a new OpenSSL implementation that uses OpenSSL 1.1’s OCB support
directly, rather than one that merely uses OpenSSL to provide the
underlying block cipher.

Remove support for rijndael-alg-fst.c and compiler-provided AES
intrinsics, since they’re not in use anymore. (Mosh can still use
hardware-accelerated AES if it’s available; it just now relies
exclusively on the underlying cryptography library to accelerate AES if
possible.)

Update the build system to conditionally compile in either
ocb_openssl.cc or ocb_internal.cc, depending on which cryptography
library you pass to ./configure.

To make this commit easy to audit, ocb_openssl.cc and ocb_internal.cc
are trivially diffable against ocb.cc (now deleted). Expected diffs
consist of a copyright notice update, a preprocessor check to ensure the
appropriate cryptography implementation has been selected, and deletions
to remove code that’s no longer in use. This does mean a substantial
amount of code is duplicated between ocb_openssl.cc and ocb_internal.cc;
however, ocb_openssl.cc should be completely replaced soon, so it won’t
be an issue in the long term.

Bug: mobile-shell#1174
@achernya achernya merged commit a563093 into mobile-shell:master Jun 7, 2022
@eminence eminence added this to the 1.4.0 milestone Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants