Skip to content

Commit 36e17cd

Browse files
tink-core: rename tink crate to tink-core (#77)
1 parent 09ea696 commit 36e17cd

File tree

213 files changed

+1119
-1056
lines changed

Some content is hidden

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

213 files changed

+1119
-1056
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ jobs:
4848
override: true
4949
- run: rustc --version
5050
- run: cargo test --all -- --nocapture
51-
- run: (cd tink && cargo test -- --nocapture)
52-
- run: (cd tink && cargo test --features=json -- --nocapture)
51+
- run: (cd core && cargo test -- --nocapture)
52+
- run: (cd core && cargo test --features=json -- --nocapture)
5353

5454
formatting:
5555
runs-on: ubuntu-latest

Cargo.lock

+37-37
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[workspace]
22
members = [
33
"aead",
4+
"core",
45
"daead",
56
"examples/aead",
67
"examples/daead",
@@ -20,15 +21,14 @@ members = [
2021
"streaming",
2122
"tests",
2223
"testing",
23-
"tink",
2424
]
2525

2626
# Patch dependencies on tink crates so that they refer to the versions within this same repository.
2727
[patch.crates-io]
2828
rinkey = { path = "rinkey" }
29-
tink = { path = "tink" }
3029
tink-aead = { path = "aead" }
3130
tink-awskms = { path = "integration/awskms" }
31+
tink-core = { path = "core" }
3232
tink-daead = { path = "daead" }
3333
tink-gcpkms = { path = "integration/gcpkms" }
3434
tink-mac = { path = "mac" }

README.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@ An introduction to working with the Tink API is [provided here](docs/RUST-HOWTO.
2828

2929
## Crate Structure
3030

31-
The core `tink` crate holds common functionality and includes the `trait` definitions for all
31+
The `tink-core` crate holds common functionality and includes the `trait` definitions for all
3232
[primitives](https://github.com/google/tink/blob/v1.5.0/docs/PRIMITIVES.md), but includes
3333
very little cryptographic functionality.
3434

3535
Individual cryptographic primitives are implemented in `tink-<primitive>` crates, which depend on:
3636

37-
- the `tink` crate for common types and helpers
37+
- the `tink-core` crate for common types and helpers
3838
- the `tink-proto` crate for protobuf-derived `struct`s
3939
- the RustCrypto crates to provide underlying cryptographic implementations.
4040

4141
For example, the `tink-aead` crate provides code that performs authenticated encryption with additional data (AEAD),
42-
implementing the `tink::Aead` trait.
42+
implementing the `Aead` trait from `tink-core`.
4343

4444
All of the tests for the Tink crates are integration tests (i.e. only use public APIs) and reside in a separate
4545
`tink-tests` crate.
@@ -108,7 +108,7 @@ Many Go functions return values of form `(ReturnType, error)`; the Rust equivale
108108
where `E` is some type that implements the [`Error` trait](https://doc.rust-lang.org/std/error/trait.Error.html).
109109

110110
The Rust port uses the `TinkError` type for `E`. This type includes an optional inner `Error`, and the
111-
`tink::utils` module also includes the `wrap_err()` helper, which is used as an equivalent for the common Go pattern
111+
`tink_core::utils` module also includes the `wrap_err()` helper, which is used as an equivalent for the common Go pattern
112112
of wrapping errors:
113113

114114
```Go
@@ -178,13 +178,13 @@ places (e.g. hash function names, curve names). Wherever possible, the Rust por
178178

179179
### JSON Output
180180

181-
Tink supports the encoding of `Keyset` and `EncryptedKeyset` types as JSON when the `json` feature of the `tink` crate
181+
Tink supports the encoding of `Keyset` and `EncryptedKeyset` types as JSON when the `json` feature of the `tink-core` crate
182182
is enabled, with the following conventions:
183183

184184
- Values of type `bytes` are serialized to base64-encoded strings (standard encoding).
185185
- Enum values are serialized as capitalized strings (e.g. `"ASYMMETRIC_PRIVATE"`).
186186

187-
The `tink::keyset::json_io` module includes `serde` serialization code which matches these conventions, and
187+
The `tink_core::keyset::json_io` module includes `serde` serialization code which matches these conventions, and
188188
the [prost-build](https://crates.io/crates/prost-build) invocation that creates the Rust protobuf message
189189
definitions includes a collection of extra options to force the generation of the appropriate `serde`
190190
attributes.
@@ -197,20 +197,20 @@ This section describes the mapping between the upstream Go packages and the equi
197197

198198
| Rust Crate/Module | Go Package |
199199
|----------------------|------------|
200-
| `tink::cryptofmt` | `core/cryptofmt` |
201-
| `tink::keyset` | `keyset` |
202-
| `tink::primitiveset` | `core/primitiveset` |
203-
| `tink::registry` | `core/registry` |
204-
| `tink` | `tink` |
200+
| `tink_core::cryptofmt` | `core/cryptofmt` |
201+
| `tink_core::keyset` | `keyset` |
202+
| `tink_core::primitiveset` | `core/primitiveset` |
203+
| `tink_core::registry` | `core/registry` |
204+
| `tink-core` | `tink` |
205205
| `tink-proto` | `*_go_proto` |
206206

207207
#### Common Crypto
208208

209209
| Rust Crate/Module | Go Package |
210210
|------------------------|------------|
211211
| | `kwp` |
212-
| `tink::subtle::random` | `subtle/random` |
213-
| `tink::subtle` | `subtle` |
212+
| `tink_core::subtle::random` | `subtle/random` |
213+
| `tink_core::subtle` | `subtle` |
214214

215215
#### Primitives
216216

@@ -228,10 +228,10 @@ This section describes the mapping between the upstream Go packages and the equi
228228

229229
| Rust Crate/Module | Go Package | Notes |
230230
|--------------------------|------------|--------|
231-
| `tink::keyset::insecure` | `insecurecleartextkeyset` | Gated on (non-default) `insecure` feature |
232-
| `tink::keyset::insecure` | `internal` | Gated on (non-default) `insecure` feature |
233-
| `tink::keyset::insecure` | `testkeyset` | Gated on (non-default) `insecure` feature |
234-
| `tink-tests` | `testutil` | Depends on `insecure` feature of `tink` crate |
231+
| `tink_core::keyset::insecure` | `insecurecleartextkeyset` | Gated on (non-default) `insecure` feature |
232+
| `tink_core::keyset::insecure` | `internal` | Gated on (non-default) `insecure` feature |
233+
| `tink_core::keyset::insecure` | `testkeyset` | Gated on (non-default) `insecure` feature |
234+
| `tink-tests` | `testutil` | Depends on `insecure` feature of `tink-core` crate |
235235
| `tink-testing` | `services` (`/testing/go/`) |
236236
| `tink-testing::proto` | `testing_api_go_grpc` (`/proto/testing/`) |
237237
| | `main` (`/tools/testing/go/`) |

aead/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ chacha20poly1305 = "^0.7"
1919
generic-array = "^0.14"
2020
prost = "^0.6.1"
2121
rand = "^0.7"
22-
tink = "^0.1"
22+
tink-core = "^0.1"
2323
tink-mac = "^0.1"
2424
tink-proto = "^0.1"

aead/benches/benchmark.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ use test::Bencher;
2020
const MSG: &[u8] = b"this data needs to be encrypted";
2121
const AAD: &[u8] = b"this data needs to be authenticated, but not encrypted";
2222

23-
fn setup(kt: tink_proto::KeyTemplate) -> (Box<dyn tink::Aead>, Vec<u8>) {
23+
fn setup(kt: tink_proto::KeyTemplate) -> (Box<dyn tink_core::Aead>, Vec<u8>) {
2424
tink_aead::init();
25-
let kh = tink::keyset::Handle::new(&kt).unwrap();
25+
let kh = tink_core::keyset::Handle::new(&kt).unwrap();
2626
let a = tink_aead::new(&kh).unwrap();
2727
let ct = a.encrypt(MSG, AAD).unwrap();
2828
(a, ct)

0 commit comments

Comments
 (0)