Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] Python compatability with Java/NET #638

Closed
wants to merge 354 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
354 commits
Select commit Hold shift + click to select a range
6c4f727
support enums
lucasmcdonald3 Jan 29, 2024
847851d
support enums
lucasmcdonald3 Jan 29, 2024
2096528
support enums
lucasmcdonald3 Jan 29, 2024
342c24c
support enums
lucasmcdonald3 Jan 29, 2024
7b2be5e
error ahndling
lucasmcdonald3 Jan 31, 2024
6f48c26
refs
lucasmcdonald3 Jan 31, 2024
d9a2349
refs
lucasmcdonald3 Jan 31, 2024
270b622
refs
lucasmcdonald3 Jan 31, 2024
f8f2db7
refs
lucasmcdonald3 Jan 31, 2024
0d74d09
refs
lucasmcdonald3 Jan 31, 2024
42bc236
refs
lucasmcdonald3 Jan 31, 2024
285f64f
refs
lucasmcdonald3 Jan 31, 2024
ef80c54
refs
lucasmcdonald3 Jan 31, 2024
51cb42c
Merge branch 'main' into lucmcdon/python-mpl
lucasmcdonald3 Feb 1, 2024
2a01e1a
repoly
lucasmcdonald3 Feb 1, 2024
3183fd1
merge
lucasmcdonald3 Feb 1, 2024
a27a29f
refactor
lucasmcdonald3 Feb 1, 2024
80916d5
refactor
lucasmcdonald3 Feb 1, 2024
7eedd46
cleanup
lucasmcdonald3 Feb 1, 2024
5c581a6
fix
lucasmcdonald3 Feb 1, 2024
d8c7d03
fix
lucasmcdonald3 Feb 1, 2024
69078a7
rm references
lucasmcdonald3 Feb 2, 2024
73909a1
user friendly access path
lucasmcdonald3 Feb 2, 2024
729ea93
add
lucasmcdonald3 Feb 2, 2024
6e44a87
format
lucasmcdonald3 Feb 5, 2024
7fbfabb
repoly kms
lucasmcdonald3 Feb 5, 2024
53aa262
cleanup
lucasmcdonald3 Feb 5, 2024
6d239ac
repoly ddb
lucasmcdonald3 Feb 5, 2024
2f07480
merge
lucasmcdonald3 Feb 5, 2024
f08661f
repoly mpl and test
lucasmcdonald3 Feb 5, 2024
c44d896
repoly
lucasmcdonald3 Feb 5, 2024
40839d7
add module_
lucasmcdonald3 Feb 7, 2024
5f6d5b4
new smithy-python aiohttp version
lucasmcdonald3 Feb 7, 2024
1451de9
update smithy-python aiohttp minver
lucasmcdonald3 Feb 7, 2024
b08130c
update
lucasmcdonald3 Feb 23, 2024
3407f97
Merge branch 'main' into lucmcdon/python-mpl
lucasmcdonald3 Feb 24, 2024
5d84b3d
merge
lucasmcdonald3 Mar 4, 2024
75c3e00
repoly, update
lucasmcdonald3 Mar 4, 2024
36dbecc
update
lucasmcdonald3 Mar 4, 2024
1a473c4
missing files
lucasmcdonald3 Mar 4, 2024
2347baf
missing files
lucasmcdonald3 Mar 4, 2024
e632a86
missing files
lucasmcdonald3 Mar 4, 2024
30545ac
retranspile
lucasmcdonald3 Mar 4, 2024
d036c0e
manual fix
lucasmcdonald3 Mar 5, 2024
67d1d8a
fix ../../
lucasmcdonald3 Mar 6, 2024
1dcd597
repoly
lucasmcdonald3 Mar 6, 2024
2ca8a64
add module
lucasmcdonald3 Mar 7, 2024
d7619c7
define extern
lucasmcdonald3 Mar 7, 2024
73d0db6
define extern
lucasmcdonald3 Mar 7, 2024
c829ffb
define extern
lucasmcdonald3 Mar 7, 2024
c6bf96e
define extern
lucasmcdonald3 Mar 7, 2024
763898c
dafnyutf8bytes
lucasmcdonald3 Mar 8, 2024
7b69d54
utf8
lucasmcdonald3 Mar 11, 2024
e12833c
utf8
lucasmcdonald3 Mar 11, 2024
6eeaa30
utf8
lucasmcdonald3 Mar 11, 2024
de489b5
utf8 import
lucasmcdonald3 Mar 11, 2024
a004461
utf8 import
lucasmcdonald3 Mar 11, 2024
b76cd44
repoly
lucasmcdonald3 Mar 28, 2024
7b1e9a9
cleanup
lucasmcdonald3 Apr 1, 2024
f7b7b69
merge
lucasmcdonald3 Apr 1, 2024
5f1c366
use python smithy-dafny
lucasmcdonald3 Apr 1, 2024
c8b87f2
update smithy-dafny
lucasmcdonald3 Apr 1, 2024
666b379
poly updates
lucasmcdonald3 Apr 1, 2024
8a1d7f0
rerun gha
lucasmcdonald3 Apr 1, 2024
129807d
format
lucasmcdonald3 Apr 2, 2024
a4ddc5d
repoly
lucasmcdonald3 Apr 2, 2024
01a7024
repoly
lucasmcdonald3 Apr 2, 2024
cd3da3c
clean externs
lucasmcdonald3 Apr 2, 2024
a0480e8
clean
lucasmcdonald3 Apr 2, 2024
5bcbe25
add empty module
lucasmcdonald3 Apr 2, 2024
dc54b05
empty module
lucasmcdonald3 Apr 2, 2024
2b0d051
vectors pass
lucasmcdonald3 Apr 3, 2024
6eb3003
add empty module
lucasmcdonald3 Apr 3, 2024
f37722a
add empty module
lucasmcdonald3 Apr 3, 2024
d6bd485
rm circualr dpendnency
lucasmcdonald3 Apr 3, 2024
0f63bb2
changes
lucasmcdonald3 Apr 3, 2024
f7e85df
update, multiprocessing
lucasmcdonald3 Apr 3, 2024
6a717f7
missing files
lucasmcdonald3 Apr 3, 2024
b3ef4c4
shim
lucasmcdonald3 Apr 3, 2024
356c314
m
lucasmcdonald3 Apr 16, 2024
bd8ddd1
m
lucasmcdonald3 Apr 16, 2024
2b81bcf
m
lucasmcdonald3 Apr 16, 2024
cf350ad
fix keystore -> keyStore
lucasmcdonald3 Apr 17, 2024
2d404a8
fix dep errors
lucasmcdonald3 Apr 24, 2024
9fa38a3
add enums
lucasmcdonald3 Apr 24, 2024
935bdd2
enum convert
lucasmcdonald3 Apr 24, 2024
0bc9438
fix
lucasmcdonald3 Apr 29, 2024
b44673d
fix
lucasmcdonald3 Apr 30, 2024
6dfdcf8
add kms rsa debug lines
lucasmcdonald3 May 1, 2024
350c27c
better debug
lucasmcdonald3 May 1, 2024
73ce6c2
m
lucasmcdonald3 May 1, 2024
1b59390
mplv2
lucasmcdonald3 May 15, 2024
cd2b720
Missing files
lucasmcdonald3 May 15, 2024
339354a
fix utf8
lucasmcdonald3 May 15, 2024
f87800d
fix
lucasmcdonald3 May 15, 2024
c350c9b
fix
lucasmcdonald3 May 15, 2024
92c7748
fix
lucasmcdonald3 May 16, 2024
d5ec6f7
missing file
lucasmcdonald3 May 16, 2024
5a46337
sig
lucasmcdonald3 May 16, 2024
34222ac
sig
lucasmcdonald3 May 16, 2024
223fe93
fix refs
lucasmcdonald3 May 16, 2024
bcf7949
regen
lucasmcdonald3 May 17, 2024
c510b8d
repoly/transpile
lucasmcdonald3 May 22, 2024
251df7c
update
lucasmcdonald3 May 22, 2024
339cb4b
update
lucasmcdonald3 May 22, 2024
9cc6d63
fix the module_ stuff
lucasmcdonald3 May 22, 2024
19cbc08
fix errs
lucasmcdonald3 May 22, 2024
e5f071b
cleanup externs
lucasmcdonald3 May 23, 2024
6ae151d
cleanup
lucasmcdonald3 May 23, 2024
b6a02a5
maybe?
lucasmcdonald3 May 23, 2024
47a897d
comment
lucasmcdonald3 May 23, 2024
6731481
comment
lucasmcdonald3 May 28, 2024
81a7389
merge
lucasmcdonald3 May 28, 2024
0aa9953
fix
lucasmcdonald3 May 30, 2024
35415ed
store initial_key_bytes, not initial_hmac
lucasmcdonald3 May 30, 2024
64dcdf9
copyright
lucasmcdonald3 May 30, 2024
5a40176
copyright
lucasmcdonald3 May 30, 2024
6c20c79
kms extern cleanup
lucasmcdonald3 May 31, 2024
5ac8cf7
conflict
lucasmcdonald3 May 31, 2024
9939256
regen
lucasmcdonald3 Jun 12, 2024
26de793
client region
lucasmcdonald3 Jun 12, 2024
03ee3e5
postal horn :)
lucasmcdonald3 Jun 12, 2024
1bb94a7
test
lucasmcdonald3 Jun 12, 2024
bbf9ff5
add missing files
lucasmcdonald3 Jun 12, 2024
052becb
comment
lucasmcdonald3 Jun 12, 2024
872142c
cleanup
lucasmcdonald3 Jun 12, 2024
996c709
fix
lucasmcdonald3 Jun 12, 2024
c198cd3
enforce required
lucasmcdonald3 Jun 13, 2024
9336e78
debug constraints
lucasmcdonald3 Jun 13, 2024
d6ad20f
revert
lucasmcdonald3 Jun 13, 2024
36441f1
update
lucasmcdonald3 Jun 14, 2024
2fe26cb
dafny lock
lucasmcdonald3 Jun 14, 2024
98f7b90
commit gen
lucasmcdonald3 Jun 14, 2024
6288170
clean stdlib externs
lucasmcdonald3 Jun 14, 2024
bd01a04
...
lucasmcdonald3 Jun 17, 2024
b7844c1
...
lucasmcdonald3 Jun 17, 2024
70c8848
generated changes
lucasmcdonald3 Jun 24, 2024
9c5b9ed
test vectors
lucasmcdonald3 Jun 25, 2024
f38adcb
fix time
lucasmcdonald3 Jul 24, 2024
02abcaa
updates
lucasmcdonald3 Jul 24, 2024
f734b7f
work
lucasmcdonald3 Jul 25, 2024
29c2c24
merge
lucasmcdonald3 Jul 25, 2024
770ee3d
changes
lucasmcdonald3 Jul 25, 2024
d24ec85
tests
lucasmcdonald3 Jul 25, 2024
d3f8e78
cleanup
lucasmcdonald3 Jul 25, 2024
5149e2c
clean
lucasmcdonald3 Jul 26, 2024
45c55ea
merge
lucasmcdonald3 Jul 26, 2024
c0f80f9
oops
lucasmcdonald3 Jul 26, 2024
663acb4
python interop
lucasmcdonald3 Jul 26, 2024
4d23abe
interop python
lucasmcdonald3 Jul 26, 2024
35e1328
repoly
lucasmcdonald3 Jul 29, 2024
a6b00ff
retranspile
lucasmcdonald3 Jul 29, 2024
76e6e9b
merge
lucasmcdonald3 Jul 29, 2024
442d587
Merge branch 'python-reviewed' into lucmcdon/python-mpl-v2
lucasmcdonald3 Jul 29, 2024
ba5352c
merge from reviewed
lucasmcdonald3 Jul 30, 2024
3970a54
cleanup
lucasmcdonald3 Jul 30, 2024
e455717
cleanup
lucasmcdonald3 Jul 30, 2024
9e55594
Merge branch 'python-reviewed' into lucmcdon/python-mpl-v2
lucasmcdonald3 Jul 30, 2024
fd4d7c8
wip ecdh
lucasmcdonald3 Aug 2, 2024
4df0cad
wip ecdh
lucasmcdonald3 Aug 2, 2024
4b4660f
Merge branch 'python-reviewed' into lucmcdon/python-mpl-v2
lucasmcdonald3 Aug 2, 2024
41365ab
4.7 upgrade
lucasmcdonald3 Aug 2, 2024
0bb55e0
no import ecdh
lucasmcdonald3 Aug 2, 2024
e3b3b05
fix testvector models
lucasmcdonald3 Aug 2, 2024
0dc26ae
extern
lucasmcdonald3 Aug 2, 2024
161416a
fix
lucasmcdonald3 Aug 2, 2024
effd022
rsa
lucasmcdonald3 Aug 2, 2024
80dd1c0
rsa
lucasmcdonald3 Aug 2, 2024
b0138bf
rsa
lucasmcdonald3 Aug 2, 2024
4659e40
rsa
lucasmcdonald3 Aug 2, 2024
9cf27b3
wip
lucasmcdonald3 Aug 5, 2024
2500ab5
?
lucasmcdonald3 Aug 5, 2024
306bda4
wip
lucasmcdonald3 Aug 5, 2024
591cf5a
test: More ECDH known value tests
lucasmcdonald3 Aug 5, 2024
fcee6ef
format
lucasmcdonald3 Aug 5, 2024
bb767e5
expect
lucasmcdonald3 Aug 5, 2024
dc9bd8a
format
lucasmcdonald3 Aug 5, 2024
7fef9c1
tests passing
lucasmcdonald3 Aug 5, 2024
5231eec
clean
lucasmcdonald3 Aug 6, 2024
555331b
use main java
lucasmcdonald3 Aug 6, 2024
1f22be6
cleanup
lucasmcdonald3 Aug 6, 2024
316f52c
main net
lucasmcdonald3 Aug 6, 2024
161df16
cleanup
lucasmcdonald3 Aug 6, 2024
d5b8067
repoly
lucasmcdonald3 Aug 6, 2024
665ba74
repoly/retranspile
lucasmcdonald3 Aug 6, 2024
373f6f4
repoly/retranspile on reviewed branch
lucasmcdonald3 Aug 6, 2024
b87aadf
Merge branch 'python-ecdh' into lucmcdon/python-mpl-v2
lucasmcdonald3 Aug 6, 2024
c37941a
Merge branch 'python-reviewed' into lucmcdon/python-mpl-v2
lucasmcdonald3 Aug 6, 2024
9974c3c
merge
lucasmcdonald3 Aug 6, 2024
1c72370
wip
lucasmcdonald3 Aug 6, 2024
79ec6a8
wip
lucasmcdonald3 Aug 6, 2024
473a34a
fix: add ECDH error message for Rust (#574)
ajewellamz Aug 6, 2024
20afcfd
clean
lucasmcdonald3 Aug 7, 2024
74e1d20
fin
lucasmcdonald3 Aug 7, 2024
e019fa0
clean
lucasmcdonald3 Aug 7, 2024
1888df0
m
lucasmcdonald3 Aug 7, 2024
8b53a1f
chore: Change exception raised for SM2 (#576)
lucasmcdonald3 Aug 7, 2024
94460d3
sync
lucasmcdonald3 Aug 7, 2024
6ff754d
clean
lucasmcdonald3 Aug 7, 2024
0ffc223
clean
lucasmcdonald3 Aug 7, 2024
56d3e61
sync
lucasmcdonald3 Aug 7, 2024
cf4528b
clean
lucasmcdonald3 Aug 7, 2024
aab8b5a
merge
lucasmcdonald3 Aug 7, 2024
ecb1f4c
reset smithy-dafny
lucasmcdonald3 Aug 7, 2024
c28b4c0
cleanup
lucasmcdonald3 Aug 8, 2024
841029d
sync
lucasmcdonald3 Aug 8, 2024
11870b1
chore: add intermediate test for compression test (#580)
ajewellamz Aug 8, 2024
a7ad0be
Merge
lucasmcdonald3 Aug 8, 2024
1e182e9
wip timestamp
lucasmcdonald3 Aug 8, 2024
c07a51f
fix: GetCurrentTimeStamp returns ISO8601 format (#575)
seebees Aug 9, 2024
c6afd1c
main's dafny
lucasmcdonald3 Aug 9, 2024
ae8baf4
safe sed
lucasmcdonald3 Aug 12, 2024
7028d93
wip
lucasmcdonald3 Aug 12, 2024
9b60f7d
sed
lucasmcdonald3 Aug 12, 2024
effe974
more
lucasmcdonald3 Aug 12, 2024
58c564e
merge
lucasmcdonald3 Aug 12, 2024
8e7f318
chore: Rename AtomicPrimitives Dafny module name
lucasmcdonald3 Aug 12, 2024
c4a6ca9
clean
lucasmcdonald3 Aug 12, 2024
83711fd
Merge branch 'main' into primitives-name
lucasmcdonald3 Aug 12, 2024
bd44ca8
chore: add documentation to externs (#590)
ajewellamz Aug 13, 2024
ff815b2
cleanup
lucasmcdonald3 Aug 16, 2024
f496fa3
Merge branch 'python-reviewed' into python-ecdhs
lucasmcdonald3 Aug 16, 2024
d0d08f4
clean
lucasmcdonald3 Aug 19, 2024
941af2e
merge
lucasmcdonald3 Aug 19, 2024
d51d648
fix: Remove 4.4 DDB and KMS patches, abstract test to work on later D…
robin-aws Aug 20, 2024
1baeefb
Merge branch 'main' into primitives-name
lucasmcdonald3 Aug 21, 2024
46cb1db
Merge branch 'main' into lucmcdon/python-mpl-v2
lucasmcdonald3 Aug 21, 2024
f12fe5b
fix: Remove uses of `:|` (#618)
atomb Aug 22, 2024
66f30ed
chore: remove case-based if statement (#630)
atomb Aug 23, 2024
4b459f1
main dfy
lucasmcdonald3 Aug 23, 2024
f87dae2
Merge branch 'primitives-name' into python-compat
lucasmcdonald3 Aug 23, 2024
d70d4c7
python
lucasmcdonald3 Aug 23, 2024
7c17d71
wip
lucasmcdonald3 Aug 23, 2024
98a2726
win
lucasmcdonald3 Aug 26, 2024
c0b4d2e
debug win
lucasmcdonald3 Aug 26, 2024
53df667
debug
lucasmcdonald3 Aug 26, 2024
89f56a3
debug
lucasmcdonald3 Aug 26, 2024
45bed31
m
lucasmcdonald3 Aug 26, 2024
3e5fde7
m
lucasmcdonald3 Aug 26, 2024
c1dbc8f
m
lucasmcdonald3 Aug 26, 2024
5d01647
m
lucasmcdonald3 Aug 26, 2024
6cbed77
no reuse
lucasmcdonald3 Aug 26, 2024
aa7c504
Merge branch 'main' into python-compat
lucasmcdonald3 Aug 26, 2024
7356f2b
m
lucasmcdonald3 Aug 26, 2024
a305ae7
m
lucasmcdonald3 Aug 26, 2024
cc9aa5f
m
lucasmcdonald3 Aug 26, 2024
f89cef4
m
lucasmcdonald3 Aug 26, 2024
718ed43
m
lucasmcdonald3 Aug 26, 2024
95b46df
Revert "m"
lucasmcdonald3 Aug 26, 2024
8342b16
clean
lucasmcdonald3 Aug 26, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# This local action sets up code dependencies
# to run Smithy-Dafny CI in GitHub Actions workflows.
#

name: "Install Smithy-Dafny codegen dependencies"
description: "Install Java package dependencies required to run Smithy-Dafny codegen"
runs:
using: "composite"
steps:
- name: Install smithy-dafny-codegen Rust dependencies locally
uses: gradle/gradle-build-action@v2
with:
arguments: :codegen-client:pTML :codegen-core:pTML :rust-runtime:pTML
build-root-directory: smithy-dafny/smithy-dafny-codegen-modules/smithy-rs

- name: Install smithy-dafny-codegen Python dependencies locally
uses: gradle/gradle-build-action@v2
with:
arguments: :smithy-python-codegen:pTML
build-root-directory: smithy-dafny/codegen/smithy-dafny-codegen-modules/smithy-python/codegen
11 changes: 10 additions & 1 deletion .github/workflows/library_codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
# The specification submodule is private so we don't have access, but we don't need
# it to verify the Dafny code. Instead we manually pull the submodules we DO need.
- run: git submodule update --init libraries
- run: git submodule update --init smithy-dafny
- run: git submodule update --init --recursive smithy-dafny

# Only used to format generated code
# and to translate version strings such as "nightly-latest"
Expand All @@ -56,6 +56,15 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}

- name: Setup Java 17 for codegen
uses: actions/setup-java@v3
with:
distribution: "corretto"
java-version: "17"

- name: Install Smithy-Dafny codegen dependencies
uses: ./.github/actions/install_smithy_dafny_codegen_dependencies

- uses: ./.github/actions/polymorph_codegen
with:
Expand Down
30 changes: 27 additions & 3 deletions .github/workflows/library_interop_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
ubuntu-latest,
macos-12,
]
language: [java, net]
language: [java, net, python]
# https://taskei.amazon.dev/tasks/CrypTool-5284
dotnet-version: ["6.0.x"]
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -57,6 +57,16 @@ jobs:
distribution: "corretto"
java-version: 17

- name: Setup Python for running tests
uses: actions/setup-python@v4
with:
python-version: 3.11
architecture: x64
- run: |
python -m pip install --upgrade pip
pip install --upgrade tox
pip install poetry

- name: Setup Dafny
uses: dafny-lang/[email protected]
with:
Expand Down Expand Up @@ -89,6 +99,8 @@ jobs:
CORES=$(node -e 'console.log(os.cpus().length)')
make transpile_net

# Python implementation is expected to be committed and doesn't need to be built

- name: Setup gradle
if: matrix.language == 'java'
uses: gradle/gradle-build-action@v2
Expand Down Expand Up @@ -128,8 +140,8 @@ jobs:
ubuntu-latest,
macos-12,
]
encrypting_language: [java, net]
decrypting_language: [java, net]
encrypting_language: [java, net, python]
decrypting_language: [java, net, python]
dotnet-version: ["6.0.x"]
runs-on: ${{ matrix.os }}
permissions:
Expand Down Expand Up @@ -166,6 +178,16 @@ jobs:
with:
distribution: "corretto"
java-version: 17

- name: Setup Python for running tests
uses: actions/setup-python@v4
with:
python-version: 3.11
architecture: x64
- run: |
python -m pip install --upgrade pip
pip install --upgrade tox
pip install poetry

- name: Setup Dafny
uses: dafny-lang/[email protected]
Expand Down Expand Up @@ -199,6 +221,8 @@ jobs:
CORES=$(node -e 'console.log(os.cpus().length)')
make transpile_net

# Python implementation is expected to be committed and doesn't need to be built

- name: Download Encrypt Manifest Artifact
uses: actions/download-artifact@v4
with:
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/library_python_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# This workflow performs tests in Python.
name: Library Python tests

on:
workflow_call:
inputs:
dafny:
description: "The Dafny version to run"
required: true
type: string
regenerate-code:
description: "Regenerate code using smithy-dafny"
required: false
default: false
type: boolean

jobs:
testPython:
strategy:
fail-fast: false
matrix:
library:
[
StandardLibrary,
AwsCryptographyPrimitives,
ComAmazonawsKms,
ComAmazonawsDynamodb,
AwsCryptographicMaterialProviders,
TestVectorsAwsCryptographicMaterialProviders,
]
python-version: ["3.11"]
os: [
ubuntu-latest,
macos-latest,
]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
permissions:
id-token: write
contents: read
steps:
- name: Support longpaths on Git checkout
run: |
git config --global core.longpaths true

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-MPL-Dafny-Role-us-west-2
role-session-name: PythonTests

- uses: actions/checkout@v4
# The specification submodule is private so we don't have access, but we don't need
# it to verify the Dafny code. Instead we manually pull the submodules we DO need.
- run: git submodule update --init libraries
- run: git submodule update --init smithy-dafny

- name: Setup Dafny
uses: dafny-lang/[email protected]
with:
dafny-version: ${{ inputs.dafny }}

- name: Setup Python ${{ matrix.python-version }} for running tests
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- run: |
python -m pip install --upgrade pip
pip install --upgrade tox
pip install poetry

# We would build the Dafny implementation here,
# but Python libraries will commit their generated Dafny.

- name: Test ${{ matrix.library }}
working-directory: ./${{ matrix.library }}
shell: bash
run: |
make test_python
6 changes: 6 additions & 0 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ jobs:
uses: ./.github/workflows/library_net_tests.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
pr-ci-python:
needs: getVersion
uses: ./.github/workflows/library_python_tests.yml
with:
# TODO: Once minimum Dafny version is 4.7.0, point this at `getVersion` output
dafny: 4.7.0
pr-interop-test:
needs: getVersion
uses: ./.github/workflows/library_interop_tests.yml
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
url = https://github.com/dafny-lang/libraries.git
[submodule "smithy-dafny"]
path = smithy-dafny
url = https://robin-aws@github.com/smithy-lang/smithy-dafny.git
url = https://github.com/smithy-lang/smithy-dafny.git
[submodule "aws-encryption-sdk-specification"]
path = aws-encryption-sdk-specification
url = https://github.com/awslabs/aws-encryption-sdk-specification.git
48 changes: 48 additions & 0 deletions AwsCryptographicMaterialProviders/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

CORES=2

ENABLE_EXTERN_PROCESSING=1

include ../SharedMakefileV2.mk

PROJECT_SERVICES := \
Expand Down Expand Up @@ -44,6 +46,52 @@ SERVICE_DEPS_AwsCryptographyKeyStore := \
ComAmazonawsDynamodb \
AwsCryptographicMaterialProviders/dafny/AwsCryptographicMaterialProviders \

# Constants for languages that drop extern names (Python, Go)

MPL_CORE_TYPES_FILE_PATH=dafny/AwsCryptographicMaterialProviders/Model/AwsCryptographyMaterialProvidersTypes.dfy
MPL_CORE_TYPES_FILE_WITH_EXTERN_STRING="module {:extern \"software.amazon.cryptography.materialproviders.internaldafny.types\" } AwsCryptographyMaterialProvidersTypes"
MPL_CORE_TYPES_FILE_WITHOUT_EXTERN_STRING="module AwsCryptographyMaterialProvidersTypes"

MPL_CORE_INDEX_FILE_PATH=dafny/AwsCryptographicMaterialProviders/src/Index.dfy
MPL_CORE_INDEX_FILE_WITH_EXTERN_STRING="module {:extern \"software.amazon.cryptography.materialproviders.internaldafny\" } MaterialProviders refines AbstractAwsCryptographyMaterialProvidersService"
MPL_CORE_INDEX_FILE_WITHOUT_EXTERN_STRING="module MaterialProviders refines AbstractAwsCryptographyMaterialProvidersService"

KEYSTORE_TYPES_FILE_PATH=dafny/AwsCryptographyKeystore/Model/AwsCryptographyKeyStoreTypes.dfy
KEYSTORE_TYPES_FILE_WITH_EXTERN_STRING="module {:extern \"software.amazon.cryptography.keystore.internaldafny.types\" } AwsCryptographyKeyStoreTypes"
KEYSTORE_TYPES_FILE_WITHOUT_EXTERN_STRING="module AwsCryptographyKeyStoreTypes"

KEYSTORE_INDEX_FILE_PATH=dafny/AwsCryptographyKeystore/src/Index.dfy
KEYSTORE_INDEX_FILE_WITH_EXTERN_STRING="module {:extern \"software.amazon.cryptography.keystore.internaldafny\"} KeyStore refines AbstractAwsCryptographyKeyStoreService"
KEYSTORE_INDEX_FILE_WITHOUT_EXTERN_STRING="module KeyStore refines AbstractAwsCryptographyKeyStoreService"

SYNCHRONIZED_LOCAL_CMC_FILE_PATH=dafny/AwsCryptographicMaterialProviders/src/CMCs/SynchronizedLocalCMC.dfy
SYNCHRONIZED_LOCAL_CMC_WITH_EXTERN_STRING="module {:options \"\/functionSyntax:4\" } {:extern \"software.amazon.cryptography.internaldafny.SynchronizedLocalCMC\" } SynchronizedLocalCMC {"
SYNCHRONIZED_LOCAL_CMC_WITHOUT_EXTERN_STRING="module {:options \"\/functionSyntax:4\" } SynchronizedLocalCMC {"

STORM_TRACKING_CMC_FILE_PATH=dafny/AwsCryptographicMaterialProviders/src/CMCs/StormTrackingCMC.dfy
STORM_TRACKING_CMC_WITH_EXTERN_STRING="module {:options \"\/functionSyntax:4\" } {:extern \"software.amazon.cryptography.internaldafny.StormTrackingCMC\" } StormTrackingCMC {"
STORM_TRACKING_CMC_WITHOUT_EXTERN_STRING="module {:options \"\/functionSyntax:4\" } StormTrackingCMC {"

_sed_types_file_remove_extern:
$(MAKE) _sed_file SED_FILE_PATH=$(MPL_CORE_TYPES_FILE_PATH) SED_BEFORE_STRING=$(MPL_CORE_TYPES_FILE_WITH_EXTERN_STRING) SED_AFTER_STRING=$(MPL_CORE_TYPES_FILE_WITHOUT_EXTERN_STRING)
$(MAKE) _sed_file SED_FILE_PATH=$(KEYSTORE_TYPES_FILE_PATH) SED_BEFORE_STRING=$(KEYSTORE_TYPES_FILE_WITH_EXTERN_STRING) SED_AFTER_STRING=$(KEYSTORE_TYPES_FILE_WITHOUT_EXTERN_STRING)

_sed_index_file_remove_extern:
$(MAKE) _sed_file SED_FILE_PATH=$(MPL_CORE_INDEX_FILE_PATH) SED_BEFORE_STRING=$(MPL_CORE_INDEX_FILE_WITH_EXTERN_STRING) SED_AFTER_STRING=$(MPL_CORE_INDEX_FILE_WITHOUT_EXTERN_STRING)
$(MAKE) _sed_file SED_FILE_PATH=$(KEYSTORE_INDEX_FILE_PATH) SED_BEFORE_STRING=$(KEYSTORE_INDEX_FILE_WITH_EXTERN_STRING) SED_AFTER_STRING=$(KEYSTORE_INDEX_FILE_WITHOUT_EXTERN_STRING)
$(MAKE) _sed_file SED_FILE_PATH=$(SYNCHRONIZED_LOCAL_CMC_FILE_PATH) SED_BEFORE_STRING=$(SYNCHRONIZED_LOCAL_CMC_WITH_EXTERN_STRING) SED_AFTER_STRING=$(SYNCHRONIZED_LOCAL_CMC_WITHOUT_EXTERN_STRING)
$(MAKE) _sed_file SED_FILE_PATH=$(STORM_TRACKING_CMC_FILE_PATH) SED_BEFORE_STRING=$(STORM_TRACKING_CMC_WITH_EXTERN_STRING) SED_AFTER_STRING=$(STORM_TRACKING_CMC_WITHOUT_EXTERN_STRING)

_sed_types_file_add_extern:
$(MAKE) _sed_file SED_FILE_PATH=$(MPL_CORE_TYPES_FILE_PATH) SED_BEFORE_STRING=$(MPL_CORE_TYPES_FILE_WITHOUT_EXTERN_STRING) SED_AFTER_STRING=$(MPL_CORE_TYPES_FILE_WITH_EXTERN_STRING)
$(MAKE) _sed_file SED_FILE_PATH=$(KEYSTORE_TYPES_FILE_PATH) SED_BEFORE_STRING=$(KEYSTORE_TYPES_FILE_WITHOUT_EXTERN_STRING) SED_AFTER_STRING=$(KEYSTORE_TYPES_FILE_WITH_EXTERN_STRING)

_sed_index_file_add_extern:
$(MAKE) _sed_file SED_FILE_PATH=$(MPL_CORE_INDEX_FILE_PATH) SED_BEFORE_STRING=$(MPL_CORE_INDEX_FILE_WITHOUT_EXTERN_STRING) SED_AFTER_STRING=$(MPL_CORE_INDEX_FILE_WITH_EXTERN_STRING)
$(MAKE) _sed_file SED_FILE_PATH=$(KEYSTORE_INDEX_FILE_PATH) SED_BEFORE_STRING=$(KEYSTORE_INDEX_FILE_WITHOUT_EXTERN_STRING) SED_AFTER_STRING=$(KEYSTORE_INDEX_FILE_WITH_EXTERN_STRING)
$(MAKE) _sed_file SED_FILE_PATH=$(SYNCHRONIZED_LOCAL_CMC_FILE_PATH) SED_BEFORE_STRING=$(SYNCHRONIZED_LOCAL_CMC_WITHOUT_EXTERN_STRING) SED_AFTER_STRING=$(SYNCHRONIZED_LOCAL_CMC_WITH_EXTERN_STRING)
$(MAKE) _sed_file SED_FILE_PATH=$(STORM_TRACKING_CMC_FILE_PATH) SED_BEFORE_STRING=$(STORM_TRACKING_CMC_WITHOUT_EXTERN_STRING) SED_AFTER_STRING=$(STORM_TRACKING_CMC_WITH_EXTERN_STRING)

# Python

PYTHON_MODULE_NAME=aws_cryptographic_materialproviders
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module AwsCryptographyMaterialProvidersOperations refines AbstractAwsCryptograph
import StormTracker
import StormTrackingCMC
import Crypto = AwsCryptographyPrimitivesTypes
import Aws.Cryptography.Primitives
import AtomicPrimitives
import opened AwsKmsUtils
import DefaultClientSupplier
import Materials
Expand All @@ -68,7 +68,7 @@ module AwsCryptographyMaterialProvidersOperations refines AbstractAwsCryptograph
import RequiredEncryptionContextCMM

datatype Config = Config(
nameonly crypto: Primitives.AtomicPrimitivesClient
nameonly crypto: AtomicPrimitives.AtomicPrimitivesClient
)

type InternalConfig = Config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ module DefaultCMM {
import UTF8
import Types = AwsCryptographyMaterialProvidersTypes
import Crypto = AwsCryptographyPrimitivesTypes
import Aws.Cryptography.Primitives
import AtomicPrimitives
import Defaults
import Commitment
import Seq
import SortedSets

class DefaultCMM
extends CMM.VerifiableInterface
{
const cryptoPrimitives: Primitives.AtomicPrimitivesClient
const cryptoPrimitives: AtomicPrimitives.AtomicPrimitivesClient

predicate ValidState()
ensures ValidState() ==> History in Modifies
Expand All @@ -50,7 +51,7 @@ module DefaultCMM {
//# the caller MUST provide the following value:
//# - [Keyring](#keyring)
k: Types.IKeyring,
c: Primitives.AtomicPrimitivesClient
c: AtomicPrimitives.AtomicPrimitivesClient
)
requires k.ValidState() && c.ValidState()
ensures keyring == k && cryptoPrimitives == c
Expand Down Expand Up @@ -329,7 +330,7 @@ module DefaultCMM {
//# - The operations made on the encryption context on the Get Encryption Materials call
//# SHOULD be inverted on the Decrypt Materials call.

method DecryptMaterials'(
method {:vcs_split_on_every_assert} DecryptMaterials'(
input: Types.DecryptMaterialsInput
)
returns (output: Result<Types.DecryptMaterialsOutput, Types.Error>)
Expand Down Expand Up @@ -478,25 +479,36 @@ module DefaultCMM {
var requiredEncryptionContextKeys := [];
if input.reproducedEncryptionContext.Some? {
var keysSet := input.reproducedEncryptionContext.value.Keys;
while keysSet != {}
ghost var keysSet' := keysSet;
var keysSeq := SortedSets.ComputeSetToSequence(keysSet);
var i := 0;
while i < |keysSeq|
invariant Seq.HasNoDuplicates(keysSeq)
invariant forall j | 0 <= j < i && i < |keysSeq| :: keysSeq[j] !in keysSet'
invariant forall j | i <= j < |keysSeq| :: keysSeq[j] in keysSet'
invariant |keysSet'| == |keysSeq| - i
invariant forall key
|
&& key in input.reproducedEncryptionContext.value
&& key in input.encryptionContext
&& key !in keysSet
&& key !in keysSet'
:: input.reproducedEncryptionContext.value[key] == input.encryptionContext[key]
invariant forall key <- requiredEncryptionContextKeys
:: key !in input.encryptionContext
{
var key :| key in keysSet;
var key := keysSeq[i];
if key in input.encryptionContext {
:- Need(input.reproducedEncryptionContext.value[key] == input.encryptionContext[key],
Types.AwsCryptographicMaterialProvidersException(
message := "Encryption context does not match reproduced encryption context."));
} else {
requiredEncryptionContextKeys := requiredEncryptionContextKeys + [key];
}
keysSet := keysSet - {key};
keysSet' := keysSet' - {key};
i := i + 1;
assert forall j | i <= j < |keysSeq| :: keysSeq[j] in keysSet' by {
reveal Seq.HasNoDuplicates();
}
}
}

Expand Down
Loading
Loading