From 332771c9b85384dbf3a0e592a3422d505f2e5dc4 Mon Sep 17 00:00:00 2001 From: DmitriyMusatkin Date: Wed, 2 Oct 2024 13:01:18 -0700 Subject: [PATCH 01/13] bind out crc64 --- aws-crt-checksums/Crc.cs | 9 +++++++++ crt/aws-checksums | 2 +- native/src/crc.c | 9 +++++++-- tests/CrcTest.cs | 18 ++++++++++++++++++ 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/aws-crt-checksums/Crc.cs b/aws-crt-checksums/Crc.cs index f1639bc..d5b7378 100644 --- a/aws-crt-checksums/Crc.cs +++ b/aws-crt-checksums/Crc.cs @@ -18,9 +18,14 @@ public delegate UInt32 aws_dotnet_crc32([In, MarshalAs(UnmanagedType.LPArray, Si [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] public delegate UInt32 aws_dotnet_crc32c([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2, ArraySubType = UnmanagedType.U1)] byte[] buffer, Int32 length, UInt32 previous); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + public delegate UInt64 aws_dotnet_crc64nvme([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2, ArraySubType = UnmanagedType.U1)] byte[] buffer, + Int32 length, UInt64 previous); public static aws_dotnet_crc32 crc32 = NativeAPI.Bind(); public static aws_dotnet_crc32c crc32c = NativeAPI.Bind(); + public static aws_dotnet_crc64nvme crc64nvme = NativeAPI.Bind(); } public static uint crc32(byte[] buffer, uint previous = 0) { @@ -30,5 +35,9 @@ public static uint crc32c(byte[] buffer, uint previous = 0) { return API.crc32c(buffer, buffer.Length, previous); } + public static ulong crc64nvme(byte[] buffer, ulong previous = 0) + { + return API.crc64nvme(buffer, buffer.Length, previous); + } } } diff --git a/crt/aws-checksums b/crt/aws-checksums index aac442a..ce04ab0 160000 --- a/crt/aws-checksums +++ b/crt/aws-checksums @@ -1 +1 @@ -Subproject commit aac442a2dbbb5e72d0a3eca8313cf65e7e1cac2f +Subproject commit ce04ab00b3ecc41912f478bfedca39f8e1919d6b diff --git a/native/src/crc.c b/native/src/crc.c index 83aa151..5c5d50c 100644 --- a/native/src/crc.c +++ b/native/src/crc.c @@ -9,10 +9,15 @@ AWS_DOTNET_API uint32_t aws_dotnet_crc32(const uint8_t *input, int length, uint32_t previous) { - return aws_checksums_crc32(input, length, previous); + return aws_checksums_crc32_ex(input, (size_t)length, previous); } AWS_DOTNET_API uint32_t aws_dotnet_crc32c(const uint8_t *input, int length, uint32_t previous) { - return aws_checksums_crc32c(input, length, previous); + return aws_checksums_crc32c_ex(input, (size_t)length, previous); +} + +AWS_DOTNET_API +uint64_t aws_dotnet_crc64nvme(const uint8_t *input, int length, uint64_t previous) { + return aws_checksums_crc64nvme_ex(input, (size_t)length, previous); } diff --git a/tests/CrcTest.cs b/tests/CrcTest.cs index 1224abc..1026faf 100644 --- a/tests/CrcTest.cs +++ b/tests/CrcTest.cs @@ -107,5 +107,23 @@ public void TestCrc32cLargeBuffer() uint expected = 0xfb5b991d; Assert.Equal(expected, res); } + [Fact] + public void TestCrc64NVMEZeroes() + { + byte[] zeroes = new byte[32]; + ulong res = Crc.crc64nvme(zeroes); + ulong expected = 0xCF3473434D4ECF3B; + Assert.Equal(expected, res); + } + [Fact] + public void TestCrc64NVMEZeroesIterated() + { + ulong res = 0; + for (int i = 0; i < 32; i++) { + res = Crc.crc64nvme(new byte[1], res); + } + ulong expected = 0xCF3473434D4ECF3B; + Assert.Equal(expected, res); + } } } From f4132a6607c7c580992ef556bb32a78e4900a2bb Mon Sep 17 00:00:00 2001 From: DmitriyMusatkin Date: Wed, 2 Oct 2024 13:15:14 -0700 Subject: [PATCH 02/13] do tests actually work? --- tests/CrcTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CrcTest.cs b/tests/CrcTest.cs index 1026faf..7f3dc5b 100644 --- a/tests/CrcTest.cs +++ b/tests/CrcTest.cs @@ -122,7 +122,7 @@ public void TestCrc64NVMEZeroesIterated() for (int i = 0; i < 32; i++) { res = Crc.crc64nvme(new byte[1], res); } - ulong expected = 0xCF3473434D4ECF3B; + ulong expected = 0xCF3473434D4ECF3A; Assert.Equal(expected, res); } } From 68293f8c43e0faf63afb20339b708df61903b562 Mon Sep 17 00:00:00 2001 From: DmitriyMusatkin Date: Wed, 2 Oct 2024 13:22:40 -0700 Subject: [PATCH 03/13] yeah they do --- tests/CrcTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CrcTest.cs b/tests/CrcTest.cs index 7f3dc5b..1026faf 100644 --- a/tests/CrcTest.cs +++ b/tests/CrcTest.cs @@ -122,7 +122,7 @@ public void TestCrc64NVMEZeroesIterated() for (int i = 0; i < 32; i++) { res = Crc.crc64nvme(new byte[1], res); } - ulong expected = 0xCF3473434D4ECF3A; + ulong expected = 0xCF3473434D4ECF3B; Assert.Equal(expected, res); } } From abb56c9ba7955062de59395bf62aa64ab718e82e Mon Sep 17 00:00:00 2001 From: DmitriyMusatkin Date: Wed, 2 Oct 2024 13:48:17 -0700 Subject: [PATCH 04/13] bump versions --- .github/workflows/ci.yml | 10 +++++----- crt/aws-c-common | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 82f0696..97caa45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: - 'main' env: - BUILDER_VERSION: v0.9.17 + BUILDER_VERSION: v0.9.67 BUILDER_SOURCE: releases BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net PACKAGE_NAME: aws-crt-dotnet @@ -94,7 +94,7 @@ jobs: arch: [x64] steps: - name: Setup dotnet # Use setup dotnet action as Windows-2019 image no longer contains .net5.0 - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: | 3.1.x @@ -117,7 +117,7 @@ jobs: arch: [x86, x64] steps: - name: Setup dotnet - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: #TODO: Specify architecture to install 32 bit .net when that is supported (https://github.com/actions/setup-dotnet/issues/72) dotnet-version: | @@ -138,7 +138,7 @@ jobs: runs-on: macos-12 steps: - name: Setup dotnet # Use setup dotnet action as macos-12 image no longer contains .net5.0 and .net3.1 - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: | 3.1.x @@ -166,7 +166,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout Source - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: true fetch-depth: 0 diff --git a/crt/aws-c-common b/crt/aws-c-common index 4f874ce..b9959f5 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit 4f874cea50a70bc6ebcd85c6ce1c6c0016b5aff4 +Subproject commit b9959f5922a4b969beab8f0b99aa0b34bc9ee55c From 98f3d873d74b5174c23e510455647ea2b029270a Mon Sep 17 00:00:00 2001 From: DmitriyMusatkin Date: Wed, 2 Oct 2024 14:39:28 -0700 Subject: [PATCH 05/13] older image --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97caa45..7151e24 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: - 'main' env: - BUILDER_VERSION: v0.9.67 + BUILDER_VERSION: v0.9.64 BUILDER_SOURCE: releases BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net PACKAGE_NAME: aws-crt-dotnet From 5b673995ec0b69aeb0c251573de57b9bdf38ef81 Mon Sep 17 00:00:00 2001 From: DmitriyMusatkin Date: Wed, 2 Oct 2024 14:44:08 -0700 Subject: [PATCH 06/13] do we still need this? --- .github/workflows/ci.yml | 2 +- builder.json | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7151e24..97caa45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: - 'main' env: - BUILDER_VERSION: v0.9.64 + BUILDER_VERSION: v0.9.67 BUILDER_SOURCE: releases BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net PACKAGE_NAME: aws-crt-dotnet diff --git a/builder.json b/builder.json index 79c8c91..58d8d20 100644 --- a/builder.json +++ b/builder.json @@ -11,15 +11,6 @@ "imports": [ "dotnetcore" ], - "hosts": { - "al2": { - "packages": [ - "libicu", - "zlib", - "libcurl" - ] - } - }, "targets": { "linux": { "imports": [ From f4a0f7a7e5f935f979fbfe530edf0a71c2faa63d Mon Sep 17 00:00:00 2001 From: DmitriyMusatkin Date: Wed, 2 Oct 2024 14:59:24 -0700 Subject: [PATCH 07/13] ok we need some --- builder.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/builder.json b/builder.json index 58d8d20..1e57849 100644 --- a/builder.json +++ b/builder.json @@ -11,6 +11,13 @@ "imports": [ "dotnetcore" ], + "hosts": { + "al2": { + "packages": [ + "libicu" + ] + } + }, "targets": { "linux": { "imports": [ From 91d9a599950bc7491c2b68793576cf1be3d51a61 Mon Sep 17 00:00:00 2001 From: DmitriyMusatkin Date: Wed, 2 Oct 2024 15:05:31 -0700 Subject: [PATCH 08/13] revert setup dotnet version bump --- .github/workflows/ci.yml | 6 +++--- builder.json | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97caa45..055119b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,7 +94,7 @@ jobs: arch: [x64] steps: - name: Setup dotnet # Use setup dotnet action as Windows-2019 image no longer contains .net5.0 - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v3 with: dotnet-version: | 3.1.x @@ -117,7 +117,7 @@ jobs: arch: [x86, x64] steps: - name: Setup dotnet - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v3 with: #TODO: Specify architecture to install 32 bit .net when that is supported (https://github.com/actions/setup-dotnet/issues/72) dotnet-version: | @@ -138,7 +138,7 @@ jobs: runs-on: macos-12 steps: - name: Setup dotnet # Use setup dotnet action as macos-12 image no longer contains .net5.0 and .net3.1 - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v3 with: dotnet-version: | 3.1.x diff --git a/builder.json b/builder.json index 1e57849..79c8c91 100644 --- a/builder.json +++ b/builder.json @@ -14,7 +14,9 @@ "hosts": { "al2": { "packages": [ - "libicu" + "libicu", + "zlib", + "libcurl" ] } }, From 04eca82c06c3c081315110c763aa76468bf82965 Mon Sep 17 00:00:00 2001 From: DmitriyMusatkin Date: Wed, 2 Oct 2024 15:08:20 -0700 Subject: [PATCH 09/13] hmm --- builder.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/builder.json b/builder.json index 79c8c91..d7ca937 100644 --- a/builder.json +++ b/builder.json @@ -15,8 +15,7 @@ "al2": { "packages": [ "libicu", - "zlib", - "libcurl" + "libssl" ] } }, From 840bd9de6ec1de02b6201c7db17bf26f75155224 Mon Sep 17 00:00:00 2001 From: DmitriyMusatkin Date: Wed, 2 Oct 2024 15:14:45 -0700 Subject: [PATCH 10/13] naming --- builder.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder.json b/builder.json index d7ca937..23bf1a5 100644 --- a/builder.json +++ b/builder.json @@ -15,7 +15,7 @@ "al2": { "packages": [ "libicu", - "libssl" + "openssl-devel" ] } }, From 0d1cd3f17d1e012c4fa4801030d18cb9e891694a Mon Sep 17 00:00:00 2001 From: DmitriyMusatkin Date: Wed, 2 Oct 2024 15:19:50 -0700 Subject: [PATCH 11/13] ugh --- builder.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder.json b/builder.json index 23bf1a5..90d06c7 100644 --- a/builder.json +++ b/builder.json @@ -15,7 +15,7 @@ "al2": { "packages": [ "libicu", - "openssl-devel" + "libssl3" ] } }, From 47445aa5751cd6ee599b692fb00cbc72180b04af Mon Sep 17 00:00:00 2001 From: DmitriyMusatkin Date: Wed, 2 Oct 2024 15:22:32 -0700 Subject: [PATCH 12/13] ugh2 --- builder.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder.json b/builder.json index 90d06c7..f46ec29 100644 --- a/builder.json +++ b/builder.json @@ -15,7 +15,7 @@ "al2": { "packages": [ "libicu", - "libssl3" + "openssl11-devel" ] } }, From 44fd84bdcbe14152c83f89810bfd6c9703874242 Mon Sep 17 00:00:00 2001 From: DmitriyMusatkin Date: Wed, 2 Oct 2024 15:46:48 -0700 Subject: [PATCH 13/13] ok lets revert builder --- .github/workflows/ci.yml | 2 +- builder.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 055119b..ca7bd76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: - 'main' env: - BUILDER_VERSION: v0.9.67 + BUILDER_VERSION: v0.9.17 BUILDER_SOURCE: releases BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net PACKAGE_NAME: aws-crt-dotnet diff --git a/builder.json b/builder.json index f46ec29..79c8c91 100644 --- a/builder.json +++ b/builder.json @@ -15,7 +15,8 @@ "al2": { "packages": [ "libicu", - "openssl11-devel" + "zlib", + "libcurl" ] } },