Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions include/openssl/bn.h
Original file line number Diff line number Diff line change
Expand Up @@ -975,10 +975,9 @@ OPENSSL_EXPORT unsigned BN_num_bits_word(BN_ULONG l);
#define BN_FLG_STATIC_DATA 0x02

// |BN_FLG_CONSTTIME| has been removed and intentionally omitted so code relying
// on it will not compile unless the flag above is set. Consumers should use the
// higher-level cryptographic algorithms exposed by other modules. Consumers
// within the library should call the appropriate timing-sensitive algorithm
// directly.
// on it will not compile. External consumers should use the higher-level
// cryptographic algorithms exposed by other modules. Consumers within the
// library should call the appropriate timing-sensitive algorithm directly.


#if defined(__cplusplus)
Expand Down
8 changes: 4 additions & 4 deletions include/openssl/modes.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ typedef void (*cbc128_f)(const uint8_t *in, uint8_t *out, size_t len,
const AES_KEY *key, uint8_t ivec[16], int enc);

// CRYPTO_cts128_encrypt encrypts |len| bytes from |in| to |out| in CBC
// Ciphertext Stealing (CTS) mode (CS1 / RFC 2040 convention: the last two
// ciphertext blocks are unconditionally swapped, and an exact-block-multiple
// input is handled as a 16-byte residue). The IV is updated in |ivec|. |key|
// must have been set up for encryption.
// Ciphertext Stealing (CTS) mode (CS3 / NIST SP 800-38A Addendum convention:
// the last two ciphertext blocks are unconditionally swapped, and an
// exact-block-multiple input is handled as a 16-byte residue). The IV is
// updated in |ivec|. |key| must have been set up for encryption.
//
// Returns the number of bytes written, equal to |len|, on success. Returns
// zero if |len| <= 16; for inputs of one block or fewer use plain CBC.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
From: AWS-LC integration CI <aws-lc-ci@amazon.com>
Subject: [PATCH] Use built-in Camellia when building against AWS-LC

AWS-LC does not implement Camellia, so krb5's OpenSSL Camellia
enc_provider (guarded on K5_OPENSSL_CAMELLIA) cannot link against it.
Rather than disabling the Camellia enctypes, select krb5's own built-in
Camellia implementation (K5_BUILTIN_CAMELLIA) when building against
AWS-LC, detected via OPENSSL_IS_AWSLC from <openssl/opensslv.h> (already
included by crypto_int.h under CRYPTO_OPENSSL). The built-in sources in
lib/crypto/builtin/ are always compiled on Unix, so this keeps all
Camellia enctypes and CMAC checksums fully functional with no changes to
the crypto test suite.

This mirrors the approach suggested by the krb5 maintainers:
https://github.com/krb5/krb5/pull/1533#issuecomment-4974308880

---
diff --git a/src/lib/crypto/krb/crypto_int.h b/src/lib/crypto/krb/crypto_int.h
index 3629616..fb30d1f 100644
--- a/src/lib/crypto/krb/crypto_int.h
+++ b/src/lib/crypto/krb/crypto_int.h
@@ -62,7 +62,11 @@
#endif

#define K5_OPENSSL_AES
+#ifdef OPENSSL_IS_AWSLC
+#define K5_BUILTIN_CAMELLIA
+#else
#define K5_OPENSSL_CAMELLIA
+#endif
#define K5_OPENSSL_DES
#define K5_OPENSSL_HMAC
#define K5_OPENSSL_MD5
13 changes: 4 additions & 9 deletions tests/ci/integration/run_krb5_integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ function krb5_build() {

# Run krb5's crypto unit tests. The full `make check` from the top of the tree
# spins up KDCs and exercises end-to-end Kerberos flows, which requires Python
# and additional CI plumbing. We build the test binaries then run the subset
# that exercises the AWS-LC backend (AES-CTS, HMAC, SHA-2, PRF, key derivation)
# without relying on Camellia (which AWS-LC doesn't implement) or DES
# behaviours that differ from stock OpenSSL.
# and additional CI plumbing. We build the test binaries then run the crypto
# test subset, which exercises the AWS-LC backend (AES-CTS, HMAC, SHA-2, PRF,
# key derivation) alongside krb5's built-in primitives (Camellia is served by
# the built-in implementation when building against AWS-LC).
function krb5_run_tests() {
pushd "${KRB5_SRC_FOLDER}/src/lib/crypto"

Expand All @@ -95,11 +95,6 @@ function krb5_run_tests() {
ln -sf "${AWS_LC_INSTALL_FOLDER}/lib/libcrypto.so" "../../lib/libcrypto.so"
ln -sf "${AWS_LC_INSTALL_FOLDER}/lib/libcrypto.so.1" "../../lib/libcrypto.so.1"

# The camellia-test binary is a no-op (exits 0) when Camellia is disabled,
# but `make check` compares its stdout to a golden file. Truncate the golden
# file so the comparison succeeds.
: > crypto_tests/camellia-expect-vt.txt

make -j "${NUM_CPU_THREADS}" check
popd
}
Expand Down
Loading