Skip to content
Open
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
1 change: 1 addition & 0 deletions releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@
"aws-c-cal"
],
"versions": [
"0.9.13-1",
"0.9.10-1"
]
},
Expand Down
8 changes: 4 additions & 4 deletions subprojects/aws-c-cal.wrap
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[wrap-file]
directory = aws-c-cal-0.9.10
source_url = https://github.com/awslabs/aws-c-cal/archive/refs/tags/v0.9.10.tar.gz
source_filename = aws-c-cal-0.9.10.tar.gz
source_hash = a41b389e942fadd599a6a0f692b75480d663f1e702c0301177f00f365e0c9b94
directory = aws-c-cal-0.9.13
source_url = https://github.com/awslabs/aws-c-cal/archive/refs/tags/v0.9.13.tar.gz
source_filename = aws-c-cal-0.9.13.tar.gz
source_hash = 80b7c6087b0af461b4483e4c9483aea2e0dac5d9fb2289b057159ea6032409e1
patch_directory = aws-c-cal

[provide]
Expand Down
117 changes: 75 additions & 42 deletions subprojects/packagefiles/aws-c-cal/meson.build
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
project(
'aws-c-cal',
'c',
version: '0.9.10',
version: '0.9.13',
meson_version: '>=0.63.0',

Check notice on line 5 in subprojects/packagefiles/aws-c-cal/meson.build

View workflow job for this annotation

GitHub Actions / Ubuntu (x86_64)

Minimum Meson version is 0.63.0

0.56.0: oldest version supported by WrapDB 0.57.0: fs.read 0.59.0: feature_option.allowed(), feature_option.disable_auto_if() 0.63.0: preserve_path arg in install_headers
license: 'Apache-2.0',
)

Expand All @@ -11,34 +11,61 @@
pkg = import('pkgconfig')

tests_opt = get_option('tests').disable_auto_if(meson.is_subproject())
ed25519_everywhere = get_option('ed25519_everywhere')

public_c_args = ['-DAWS_CAL_USE_IMPORT_EXPORT=1']
# aws-c-cal doesn't use openssl on windows or darwin, on those platforms it uses the native crypto libraries
# as it's required for compliance with platform policies. On linux and emscripten openssl is used.
may_have_openssl = host_machine.system() in ['linux', 'emscripten']
is_windows = host_machine.system() == 'windows'
is_darwin = host_machine.system() == 'darwin'

byo_crypto = get_option('byo_crypto')
ed25519_everywhere = get_option('ed25519_everywhere').disable_auto_if(
not may_have_openssl,
)

c_args = ['-DAWS_CAL_EXPORTS=1']

public_c_args = []
if (
get_option('default_library') == 'shared'
and host_machine.system() == 'windows'
) or host_machine.system() != 'windows'
public_c_args += ['-DAWS_CAL_USE_IMPORT_EXPORT=1']
endif

if host_machine.system() == 'windows' and host_machine.cpu_family() in [
'x86',
'aarch64',
]
error('unsupported architecture: only x86_64 Windows is supported')
error('unsupported architecture: only x86_64 is supported on Windows')
endif

aws_c_common_dep = dependency('aws-c-common')
libcrypto_dep = dependency(
'libcrypto',
'openssl',
version: '>=1.1',
required: not byo_crypto.allowed(),
)

ncrypt = cc.find_library(
'ncrypt',
required: host_machine.system() == 'windows',
required: false,
)

foundation = dependency(
'appleframeworks',
modules: ['Security', 'CoreFoundation'],
required: host_machine.system() == 'darwin',
required: false,
)

if is_windows
byo_crypto = byo_crypto.disable_auto_if(ncrypt.found())
endif

if is_darwin
byo_crypto = byo_crypto.disable_auto_if(foundation.found())
endif

src = files(
'source/cal.c',
'source/der.c',
Expand All @@ -52,45 +79,49 @@
'source/symmetric_cipher.c',
)

if ed25519_everywhere or host_machine.system() == 'linux'
if byo_crypto.allowed()
c_args += ['-DBYO_CRYPTO=1']
endif

if libcrypto_dep.found()
src += files('source/shared/ed25519.c', 'source/shared/lccrypto_common.c')
c_args = ['-DAWS_USE_LIBCRYPTO_TO_SUPPORT_ED25519_EVERYWHERE']
c_args += ['-DAWS_USE_LIBCRYPTO_TO_SUPPORT_ED25519_EVERYWHERE']
else
src += files('source/shared/ed25519_noop.c')
src += files('source/ed25519.c', 'source/shared/ed25519_noop.c')
endif

if host_machine.system() in ['cygwin', 'windows']
src += files(
'source/windows/bcrypt_aes.c',
'source/windows/bcrypt_ecc.c',
'source/windows/bcrypt_hash.c',
'source/windows/bcrypt_hmac.c',
'source/windows/bcrypt_platform_init.c',
'source/windows/bcrypt_rsa.c',
)
elif host_machine.system() == 'darwin'
src += files(
'source/darwin/commoncrypto_aes.c',
'source/darwin/commoncrypto_hmac.c',
'source/darwin/commoncrypto_md5.c',
'source/darwin/commoncrypto_platform_init.c',
'source/darwin/commoncrypto_sha1.c',
'source/darwin/commoncrypto_sha256.c',
'source/darwin/commoncrypto_sha512.c',
'source/darwin/securityframework_ecc.c',
'source/darwin/securityframework_rsa.c',
)
elif host_machine.system() == 'linux'
src += files(
'source/unix/openssl_aes.c',
'source/unix/openssl_platform_init.c',
'source/unix/openssl_rsa.c',
'source/unix/opensslcrypto_ecc.c',
'source/unix/opensslcrypto_hash.c',
'source/unix/opensslcrypto_hmac.c',
)
else
error('Unsupported platform: ' + host_machine.system())
if not byo_crypto.allowed()
if host_machine.system() in ['cygwin', 'windows']
src += files(
'source/windows/bcrypt_aes.c',
'source/windows/bcrypt_ecc.c',
'source/windows/bcrypt_hash.c',
'source/windows/bcrypt_hmac.c',
'source/windows/bcrypt_platform_init.c',
'source/windows/bcrypt_rsa.c',
)
elif host_machine.system() == 'darwin'
src += files(
'source/darwin/commoncrypto_aes.c',
'source/darwin/commoncrypto_hmac.c',
'source/darwin/commoncrypto_md5.c',
'source/darwin/commoncrypto_platform_init.c',
'source/darwin/commoncrypto_sha1.c',
'source/darwin/commoncrypto_sha256.c',
'source/darwin/commoncrypto_sha512.c',
'source/darwin/securityframework_ecc.c',
'source/darwin/securityframework_rsa.c',
)
elif host_machine.system() in ['linux', 'emscripten']
src += files(
'source/unix/openssl_aes.c',
'source/unix/openssl_platform_init.c',
'source/unix/openssl_rsa.c',
'source/unix/opensslcrypto_ecc.c',
'source/unix/opensslcrypto_hash.c',
'source/unix/opensslcrypto_hmac.c',
)
endif
endif

inc = include_directories('include')
Expand All @@ -101,7 +132,9 @@
c_args: c_args + public_c_args,
dependencies: [aws_c_common_dep, libcrypto_dep, ncrypt, foundation],
include_directories: inc,
install: true,
version: meson.project_version(),
gnu_symbol_visibility: 'hidden',
)

aws_c_cal_dep = declare_dependency(
Expand Down
10 changes: 8 additions & 2 deletions subprojects/packagefiles/aws-c-cal/meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ option(

option(
'ed25519_everywhere',
type: 'boolean',
value: false,
type: 'feature',
description: 'Experimental feature to support ED25519 keygen on platforms that do not support it in os libs (i.e. win/mac)',
)

option(
'byo_crypto',
type: 'feature',
value: 'disabled',
description: 'Set this if you want to provide your own cryptography implementation. This will cause the defaults to not be compiled.',
)
2 changes: 1 addition & 1 deletion subprojects/packagefiles/aws-c-cal/tests.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

sha256_nist_test_case_1
sha256_nist_test_case_2
sha256_nist_test_case_3
Expand Down Expand Up @@ -86,6 +85,7 @@ ecdsa_signature_encode_helper_roundtrip
ecdsa_export_sec1_roundtrip
ecdsa_export_pkcs8_roundtrip
ecdsa_export_spki_roundtrip
ecdsa_signature_decode_helper
rsa_encryption_roundtrip_pkcs1_from_user
rsa_encryption_roundtrip_oaep_sha256_from_user
rsa_encryption_roundtrip_oaep_sha512_from_user
Expand Down
Loading