Skip to content

Commit 351ee99

Browse files
authored
Add rustls-mbedcrypto-provider (#2)
* feat: add rustls-mbedtls-provider * test: add tests & example * docs: update documents * ci: setup ci * fix; nit picks * refactor: use AeadKey for carrying key data * refactor: use fixed array for tag
1 parent ea01a25 commit 351ee99

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+10031
-34
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Checklist**
11+
* [ ] I've searched the issue tracker for similar bugs.
12+
13+
**Describe the bug**
14+
A clear and concise description of what the bug is.
15+
16+
**To Reproduce**
17+
Steps to reproduce the behavior:
18+
1. Use one of the examples to connect to `....`
19+
2. ...
20+
3. See error
21+
22+
**Applicable Version(s)**
23+
A list of versions and platforms you've tested with.
24+
25+
**Expected behavior**
26+
A clear and concise description of what you expected to happen.
27+
28+
**Additional context**
29+
Add any other context about the problem here.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: Dependency Update
3+
about: Request a dependency be updated
4+
title: Dependency update request
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
<!--
11+
Please note that we are only interested in **semver-incompatible** update requests. Updates to dependencies that are
12+
semver-compatible can be done in dependent projects without needing changes in this repository.
13+
14+
For example, if you are here because you believe Rustls is bringing in dependency `foo` at version `0.2.1` and
15+
you wish Rustls used `0.2.2` instead, you should not file an issue and instead should run `cargo update` in your
16+
dependent project. It would only be appropriate to file an issue if you require Rustls use `foo` at version `0.3.0+`.
17+
-->
18+
19+
**Checklist**
20+
* [ ] I've searched the issue tracker for similar requests
21+
* [ ] I've confirmed my request is for a semver-incompatible update
22+
23+
**Is your dependency update request related to a problem? Please describe.**
24+
A clear and concise description of what the problem is.
25+
26+
**Describe the solution you'd like**
27+
A clear and concise description of what you want to happen.
28+
29+
**Describe alternatives you've considered**
30+
A clear and concise description of any alternative solutions or features you've considered.
31+
32+
**Additional context**
33+
Add any other context or screenshots about the feature request here.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Checklist**
11+
* [ ] I've searched the issue tracker for similar requests
12+
13+
**Is your feature request related to a problem? Please describe.**
14+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
15+
16+
**Describe the solution you'd like**
17+
A clear and concise description of what you want to happen.
18+
19+
**Describe alternatives you've considered**
20+
A clear and concise description of any alternative solutions or features you've considered.
21+
22+
**Additional context**
23+
Add any other context or screenshots about the feature request here.

.github/codecov.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
coverage:
2+
status:
3+
patch:
4+
default:
5+
threshold: 0.05%
6+
project:
7+
default:
8+
threshold: 0.05%

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: cargo
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 10
8+
groups:
9+
crates-io:
10+
patterns:
11+
- "*"
12+
- package-ecosystem: github-actions
13+
directory: "/"
14+
schedule:
15+
interval: weekly

.github/workflows/build.yml

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
name: rustls-mbedcrypto-provider
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request:
8+
paths-ignore:
9+
- '*.md'
10+
- 'LICENSE'
11+
branches:
12+
- master
13+
merge_group:
14+
schedule:
15+
- cron: '30 13 * * 1,5'
16+
17+
env:
18+
CARGO_TERM_COLOR: always
19+
CARGO_NET_RETRY: 10
20+
21+
jobs:
22+
build:
23+
name: Build+test
24+
runs-on: ${{ matrix.os }}
25+
strategy:
26+
matrix:
27+
# test a bunch of toolchains on ubuntu
28+
rust:
29+
- stable
30+
- beta
31+
- nightly
32+
os: [ubuntu-20.04]
33+
# but only stable on macos/windows (slower platforms)
34+
include:
35+
- os: macos-latest
36+
rust: stable
37+
- os: windows-latest
38+
rust: stable
39+
steps:
40+
- name: Checkout sources
41+
uses: actions/checkout@v4
42+
with:
43+
persist-credentials: false
44+
45+
- name: Rust Cache
46+
uses: Swatinem/rust-cache@v2
47+
with:
48+
key: ${{ matrix.rust }}-${{ matrix.os }}
49+
50+
- name: Install ${{ matrix.rust }} toolchain
51+
uses: dtolnay/rust-toolchain@master
52+
with:
53+
toolchain: ${{ matrix.rust }}
54+
55+
- name: cargo build (debug; default features)
56+
run: cargo build --locked
57+
shell: bash
58+
59+
- name: cargo test (debug; all features)
60+
run: cargo test --locked --all-features
61+
shell: bash
62+
env:
63+
RUST_BACKTRACE: 1
64+
65+
features:
66+
name: Features
67+
runs-on: ubuntu-latest
68+
steps:
69+
- name: Checkout sources
70+
uses: actions/checkout@v4
71+
with:
72+
persist-credentials: false
73+
74+
- name: Rust Cache
75+
uses: Swatinem/rust-cache@v2
76+
77+
- name: Install stable toolchain
78+
uses: dtolnay/rust-toolchain@stable
79+
80+
- name: cargo build (debug; default features)
81+
run: cargo build --locked
82+
83+
- name: cargo test (debug; default features)
84+
run: cargo test --locked
85+
env:
86+
RUST_BACKTRACE: 1
87+
88+
- name: cargo test (debug; no default features)
89+
run: cargo test --locked --no-default-features
90+
91+
- name: cargo test (rustls_mbedcrypto_provider; debug; no default features; tls12)
92+
run: cargo test --locked --no-default-features --features tls12 --package rustls-mbedcrypto-provider
93+
94+
- name: cargo test (rustls_mbedcrypto_provider; debug; no default features; tls12, rdrand)
95+
run: cargo test --locked --no-default-features --features tls12,rdrand --package rustls-mbedcrypto-provider
96+
97+
- name: cargo test (release; no run)
98+
run: cargo test --locked --release --no-run
99+
100+
# TODO: add fuzz tests
101+
# TODO: add benchmarks
102+
103+
docs:
104+
name: Check for documentation errors
105+
runs-on: ubuntu-20.04
106+
steps:
107+
- name: Checkout sources
108+
uses: actions/checkout@v4
109+
with:
110+
persist-credentials: false
111+
112+
- name: Install rust toolchain
113+
uses: dtolnay/rust-toolchain@nightly
114+
115+
- name: cargo doc (all packages; all features)
116+
run: cargo doc --locked --all-features --no-deps --document-private-items
117+
env:
118+
RUSTDOCFLAGS: -Dwarnings
119+
120+
coverage:
121+
name: Measure coverage
122+
runs-on: ubuntu-20.04
123+
steps:
124+
- name: Checkout sources
125+
uses: actions/checkout@v4
126+
with:
127+
persist-credentials: false
128+
129+
- name: Rust Cache
130+
uses: Swatinem/rust-cache@v2
131+
132+
- name: Install rust toolchain
133+
uses: dtolnay/rust-toolchain@stable
134+
with:
135+
components: llvm-tools
136+
137+
- name: Install cargo-llvm-cov
138+
run: cargo install cargo-llvm-cov
139+
140+
- name: Measure coverage
141+
run: ./admin/coverage --lcov --output-path final.info
142+
143+
- name: Report to codecov.io
144+
uses: codecov/codecov-action@v3
145+
with:
146+
file: final.info
147+
fail_ci_if_error: false
148+
149+
# TODO: enable this after crate is published
150+
# semver:
151+
# name: Check semver compatibility
152+
# runs-on: ubuntu-latest
153+
# steps:
154+
# - name: Checkout sources
155+
# uses: actions/checkout@v4
156+
# with:
157+
# persist-credentials: false
158+
159+
# - name: Check semver
160+
# uses: obi1kenobi/cargo-semver-checks-action@v2
161+
162+
format:
163+
name: Format
164+
runs-on: ubuntu-latest
165+
steps:
166+
- name: Checkout sources
167+
uses: actions/checkout@v4
168+
with:
169+
persist-credentials: false
170+
- name: Install rust toolchain
171+
uses: dtolnay/rust-toolchain@stable
172+
with:
173+
components: rustfmt
174+
- name: Check formatting
175+
run: cargo fmt --all -- --check
176+
177+
clippy:
178+
name: Clippy
179+
runs-on: ubuntu-latest
180+
steps:
181+
- name: Checkout sources
182+
uses: actions/checkout@v4
183+
with:
184+
persist-credentials: false
185+
186+
- name: Rust Cache
187+
uses: Swatinem/rust-cache@v2
188+
189+
- name: Install rust toolchain
190+
uses: dtolnay/rust-toolchain@stable
191+
with:
192+
components: clippy
193+
- run: cargo clippy --locked --package rustls-mbedcrypto-provider --all-features --all-targets -- --deny warnings
194+
- run: cargo clippy --locked --package rustls-mbedcrypto-provider --no-default-features --all-targets -- --deny warnings
195+
196+
clippy-nightly:
197+
name: Clippy (Nightly)
198+
runs-on: ubuntu-latest
199+
steps:
200+
- name: Checkout sources
201+
uses: actions/checkout@v4
202+
with:
203+
persist-credentials: false
204+
205+
- name: Rust Cache
206+
uses: Swatinem/rust-cache@v2
207+
208+
- name: Install rust toolchain
209+
uses: dtolnay/rust-toolchain@nightly
210+
with:
211+
components: clippy
212+
- run: cargo clippy --locked --package rustls-mbedcrypto-provider --all-features --all-targets
213+
- run: cargo clippy --locked --package rustls-mbedcrypto-provider --no-default-features --all-targets

.github/workflows/ci.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.gitignore

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
.vscode/
22
target/
3-
3+
*.gcda
4+
*.gcno
5+
*.info
6+
sslkeylogfile.txt
7+
admin/rustfmt
8+
.DS_Store
9+
._.DS_Store
10+
**/.DS_Store
11+
**/._.DS_Store
12+
/.idea
13+
/default.profraw

.rustfmt.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
chain_width=40
22
max_width = 128
3-
struct_lit_width = 80
3+
struct_lit_width = 80

0 commit comments

Comments
 (0)