chore: checkpoint before Python removal

This commit is contained in:
2026-03-26 22:33:59 +00:00
parent 683cec9307
commit e568ddf82a
29972 changed files with 11269302 additions and 2 deletions

View File

@@ -0,0 +1,22 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
// Builtin swap was added in GCC 4.8 https://gcc.gnu.org/gcc-4.8/changes.html.
// Recent versions of Clang pretend to be 4.2 but they do support the builtin
// swap functions.
#include <stdint.h>
#include <stdlib.h>
int main(int argc, char **argv) {
uint16_t test16 = 0;
test16 = __builtin_bswap16(test16);
uint32_t test32 = 0;
test32 = __builtin_bswap32(test32);
uint64_t test64 = 0;
test64 = __builtin_bswap64(test64);
return EXIT_SUCCESS;
}

View File

@@ -0,0 +1,24 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
// Simple program that should also be able to compiler, udeful to test different
// compiler flags
#include <stdlib.h>
#include <stdatomic.h>
// Some platforms define ATOMIC_LONG_LOCK_FREE as an expression like:
// (__atomic_always_lock_free (sizeof (atomic_long), (void *) 0) ? 2 :
// (__atomic_is_lock_free (sizeof (atomic_long), (void *) 0) ? 1 : 0))
// which relies on __atomic_is_lock_free which is a runtime function and not a
// compile time constant. This means ATOMIC_LONG_LOCK_FREE can not be used in a
// preprocessor check which AWS-LC needs to do to swap implementations of
// CRYPTO_refcount_inc at compile time. If that is the case the following #if
// won't compile, the following message is helpful to debug any future issues.
#if ATOMIC_LONG_LOCK_FREE < 0
#error "Should not get here, the above line should be false or invalid"
#endif
int main(int argc, char **argv) {
return EXIT_SUCCESS;
}

View File

@@ -0,0 +1,20 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
// This file checks if <linux/random.h> can be included. Currently, we assume
// that the compiler error is caused by '__u32' not being defined.
// Theory:
// crypto/fipsmodule/rand/urandom.c includes the <linux/random.h> Linux header.
// Some old Linux OS does not define '__u32' causing the following error:
// /usr/include/linux/random.h:38:2: error: unknown type name '__u32'
// __u32 buf[0];
// ^
#if defined(DEFINE_U32)
typedef unsigned int __u32;
#endif
#include <linux/random.h>
#include <stdlib.h>
int main(int argc, char **argv) {
return EXIT_SUCCESS;
}

View File

@@ -0,0 +1,16 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv) {
// A bug of 'memcmp' is reported in gcc (9.2, 9.3, 10.1). See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95189
// AWS-LC warns the build when detecting the unexpected 'memcmp' behavior.
// Below test case is equivalent to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95189#c7
char a[] = "\0abc";
int res = memcmp(a, "\0\0\0\0", 4);
printf("memcmp result %d\n", res);
// If the 'memcmp' bug exists, below will return 1.
return (res == 0);
}

View File

@@ -0,0 +1,12 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
// Test for NEON SHA3 extension support in the assembler
// Requires -march=armv8.4-a+sha3 compiler flag
int main(void) {
__asm__("eor3 v0.16b, v1.16b, v2.16b, v3.16b");
__asm__("bcax v0.16b, v1.16b, v2.16b, v3.16b");
__asm__("rax1 v0.2d, v1.2d, v2.2d ");
__asm__("xar v0.2d, v1.2d, v2.2d, #0x2a ");
return 0;
}

View File

@@ -0,0 +1,24 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
// Old versions of GCC don't support __has_include which could be used to check
// for stdalign.h, try to compile this instead.
#include <stdalign.h>
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
int main(int argc, char **argv) {
alignas(8) uint8_t test[16];
size_t alignment = alignof(uint8_t);
test[0] = 0;
// Try to eliminate dead store optimisation and similar
if (alignment == 1000 && test[0] != 0) {
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}