Skip to content

Commit

Permalink
Fix and add CI for C++98
Browse files Browse the repository at this point in the history
  • Loading branch information
samuel40791765 committed Feb 19, 2025
1 parent 9557a58 commit b98b993
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 36 deletions.
2 changes: 1 addition & 1 deletion include/openssl/aead.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_gcm_tls13(void);
// evp_aead_direction_t denotes the direction of an AEAD operation.
enum evp_aead_direction_t {
evp_aead_open,
evp_aead_seal,
evp_aead_seal
};

// EVP_AEAD_CTX_init_with_direction calls |EVP_AEAD_CTX_init| for normal
Expand Down
2 changes: 1 addition & 1 deletion include/openssl/bn.h
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ OPENSSL_EXPORT int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe,
enum bn_primality_result_t {
bn_probably_prime,
bn_composite,
bn_non_prime_power_composite,
bn_non_prime_power_composite
};

// BN_enhanced_miller_rabin_primality_test tests whether |w| is probably a prime
Expand Down
2 changes: 1 addition & 1 deletion include/openssl/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ enum fips_counter_t {
fips_counter_evp_aes_128_ctr = 2,
fips_counter_evp_aes_256_ctr = 3,

fips_counter_max = 3,
fips_counter_max = 3
};

// FIPS_read_counter returns a counter of the number of times the specific
Expand Down
2 changes: 1 addition & 1 deletion include/openssl/curve25519.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ OPENSSL_EXPORT void ED25519_keypair_from_seed(uint8_t out_public_key[ED25519_PUB
// must be “Alice” and the other be “Bob”.
enum spake2_role_t {
spake2_role_alice,
spake2_role_bob,
spake2_role_bob
};

// SPAKE2_CTX_new creates a new |SPAKE2_CTX| (which can only be used for a
Expand Down
2 changes: 1 addition & 1 deletion include/openssl/ec.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ typedef enum {

// POINT_CONVERSION_HYBRID indicates that the point is encoded as z||x||y,
// where z specifies which solution of the quadratic equation y is.
POINT_CONVERSION_HYBRID = 6,
POINT_CONVERSION_HYBRID = 6
} point_conversion_form_t;


Expand Down
2 changes: 1 addition & 1 deletion include/openssl/service_indicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ OPENSSL_EXPORT const char* awslc_version_string(void);

enum FIPSStatus {
AWSLC_NOT_APPROVED = 0,
AWSLC_APPROVED = 1,
AWSLC_APPROVED = 1
};

#if defined(AWSLC_FIPS)
Expand Down
14 changes: 7 additions & 7 deletions include/openssl/ssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ OPENSSL_EXPORT void *SSL_CTX_get_default_passwd_cb_userdata(const SSL_CTX *ctx);
enum ssl_private_key_result_t {
ssl_private_key_success,
ssl_private_key_retry,
ssl_private_key_failure,
ssl_private_key_failure
};

// ssl_private_key_method_st (aka |SSL_PRIVATE_KEY_METHOD|) describes private
Expand Down Expand Up @@ -2557,7 +2557,7 @@ enum ssl_ticket_aead_result_t {
ssl_ticket_aead_ignore_ticket,
// ssl_ticket_aead_error indicates that a fatal error occured and the
// handshake should be terminated.
ssl_ticket_aead_error,
ssl_ticket_aead_error
};

// ssl_ticket_aead_method_st (aka |SSL_TICKET_AEAD_METHOD|) contains methods
Expand Down Expand Up @@ -2895,7 +2895,7 @@ OPENSSL_EXPORT void SSL_set_verify(SSL *ssl, int mode,
enum ssl_verify_result_t {
ssl_verify_ok,
ssl_verify_invalid,
ssl_verify_retry,
ssl_verify_retry
};

// SSL_CTX_set_custom_verify configures certificate verification. |mode| is one
Expand Down Expand Up @@ -3832,7 +3832,7 @@ enum ssl_encryption_level_t {
ssl_encryption_initial = 0,
ssl_encryption_early_data,
ssl_encryption_handshake,
ssl_encryption_application,
ssl_encryption_application
};

// ssl_quic_method_st (aka |SSL_QUIC_METHOD|) describes custom QUIC hooks.
Expand Down Expand Up @@ -4133,7 +4133,7 @@ enum ssl_early_data_reason_t {
// The value of the largest entry.
ssl_early_data_unsupported_with_custom_extension = 15,
ssl_early_data_reason_max_value =
ssl_early_data_unsupported_with_custom_extension,
ssl_early_data_unsupported_with_custom_extension
};

// SSL_get_early_data_reason returns details why 0-RTT was accepted or rejected
Expand Down Expand Up @@ -4651,7 +4651,7 @@ enum ssl_renegotiate_mode_t {
ssl_renegotiate_once,
ssl_renegotiate_freely,
ssl_renegotiate_ignore,
ssl_renegotiate_explicit,
ssl_renegotiate_explicit
};

// SSL_set_renegotiate_mode configures how |ssl|, a client, reacts to
Expand Down Expand Up @@ -4792,7 +4792,7 @@ enum ssl_select_cert_result_t {
ssl_select_cert_retry = 0,
// ssl_select_cert_error indicates that a fatal error occured and the
// handshake should be terminated.
ssl_select_cert_error = -1,
ssl_select_cert_error = -1
};

// SSL_early_callback_ctx_extension_get searches the extensions in
Expand Down
10 changes: 10 additions & 0 deletions tests/ci/cdk/cdk/codebuild/github_ci_linux_x86_omnibus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-20.04_clang-8x_latest

- identifier: c99_cplusplus98_checker # The checker script runs on gcc.
buildspec: ./tests/ci/codebuild/common/run_simple_target.yml
env:
type: LINUX_CONTAINER
privileged-mode: false
compute-type: BUILD_GENERAL1_SMALL
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-22.04_gcc-12x_latest
variables:
AWS_LC_CI_TARGET: "tests/coding_guidelines/c99_cplusplus98_test.sh"

- identifier: ubuntu1604_gcc5x_x86
buildspec: ./tests/ci/codebuild/common/run_simple_target.yml
env:
Expand Down
2 changes: 1 addition & 1 deletion tests/ci/codebuild/linux-x86/pre-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ phases:
- ./tests/check_objects_and_errors.sh
- go run ./tests/check_licenses.go
- ./tests/check_generated_src.sh
- ./tests/coding_guidelines/coding_guidelines_test.sh
- ./tests/coding_guidelines/style.sh
- (cd util && go run ./doc.go)
10 changes: 0 additions & 10 deletions tests/ci/run_posix_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,6 @@ build_and_test -DDISABLE_PERL=ON -DENABLE_DILITHIUM=ON
echo "Testing building with AArch64 Data-Independent Timing (DIT) on."
build_and_test -DENABLE_DATA_INDEPENDENT_TIMING=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_DILITHIUM=ON

if [[ "${AWSLC_C99_TEST}" == "1" ]]; then
echo "Testing the C99 compatability of AWS-LC headers."
./tests/coding_guidelines/c99_gcc_test.sh
fi

if [[ "${AWSLC_CODING_GUIDELINES_TEST}" == "1" ]]; then
echo "Testing that AWS-LC is compliant with the coding guidelines."
source ./tests/coding_guidelines/coding_guidelines_test.sh
fi

# Lightly verify that uncommon build options does not break the build. Fist
# define a list of typical build options to verify the special build option with
build_options_to_test=("" "-DBUILD_SHARED_LIBS=1" "-DCMAKE_BUILD_TYPE=Release" "-DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release" "-DDISABLE_PERL=ON -DDISABLE_GO=ON")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ INCLUDE_FILES=`ls $INCLUDE_DIR/openssl/*.h | grep -v $INCLUDE_DIR/openssl/arm_ar
# some non-ISO practices, but not all — only those for which ISO C requires a
# diagnostic, and some others for which diagnostics have been added."
# https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

${CC} -std=c99 -c -I${INCLUDE_DIR} -include ${INCLUDE_FILES} -Wpedantic -fsyntax-only -Werror
${CC} -std=c99 -c -I${INCLUDE_DIR} $(echo ${INCLUDE_FILES} | sed 's/[^ ]* */-include &/g') -Wpedantic -fsyntax-only -Werror ./tests/compiler_features_tests/builtin_swap_check.c

# AWS C SDKs conforms to C99. They set `C_STANDARD 99` which will set the
# flag `-std=gnu99`
Expand All @@ -34,5 +33,12 @@ ${CC} -std=c99 -c -I${INCLUDE_DIR} -include ${INCLUDE_FILES} -Wpedantic -fsyntax
# https://cmake.org/cmake/help/latest/prop_tgt/C_STANDARD.html
#
# the c99 and gnu99 modes are different, so let's test both.

${CC} -std=gnu99 -c -I${INCLUDE_DIR} -include ${INCLUDE_FILES} -Wpedantic -fsyntax-only -Werror
${CC} -std=gnu99 -c -I${INCLUDE_DIR} $(echo ${INCLUDE_FILES} | sed 's/[^ ]* */-include &/g') -Wpedantic -fsyntax-only -Werror ./tests/compiler_features_tests/builtin_swap_check.c

# Our SSL headers use C++, but older compilers do not have the C++11 flag enabled by
# default. Not all consuming applications that use older compilers have enabled the
# C++11 feature flag. To ensure a smoother integration process for migrating
# applications, we should ensure that the default settings of older C++ compilers
# work with our header files.
${CXX} -std=c++98 -c -I${INCLUDE_DIR} $(echo ${INCLUDE_FILES} | sed 's/[^ ]* */-include &/g') -Wpedantic -fsyntax-only -Werror ./tests/compiler_features_tests/builtin_swap_check.c
${CXX} -std=gnu++98 -c -I${INCLUDE_DIR} $(echo ${INCLUDE_FILES} | sed 's/[^ ]* */-include &/g') -Wpedantic -fsyntax-only -Werror ./tests/compiler_features_tests/builtin_swap_check.c
8 changes: 0 additions & 8 deletions tests/coding_guidelines/coding_guidelines_test.sh

This file was deleted.

0 comments on commit b98b993

Please sign in to comment.