mirror of
https://github.com/apple/swift-crypto
synced 2026-11-23 04:34:21 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d67ac68d09 | ||
|
|
0473010f58 | ||
|
|
20053871fa | ||
|
|
b6b60c3938 | ||
|
|
64a1a98e47 | ||
|
|
3be1b8cbd4 | ||
|
|
77b30226ac | ||
|
|
de232cbd67 | ||
|
|
36ea42cbb3 | ||
|
|
5000bef967 | ||
|
|
d237bf149c | ||
|
|
94930a7edf | ||
|
|
12e6f9ef3a | ||
|
|
132b8e5fd1 | ||
|
|
fced1f801f | ||
|
|
bfb37dfb92 |
No files matched your search
@@ -0,0 +1 @@
|
||||
Sources/CCryptoBoringSSL/* linguist-vendored
|
||||
@@ -1,20 +0,0 @@
|
||||
### Expected behavior
|
||||
_[what you expected to happen]_
|
||||
|
||||
### Actual behavior
|
||||
_[what actually happened]_
|
||||
|
||||
### Steps to reproduce
|
||||
|
||||
1. ...
|
||||
2. ...
|
||||
|
||||
### If possible, minimal yet complete reproducer code (or URL to code)
|
||||
|
||||
_[anything to help us reproducing the issue]_
|
||||
|
||||
### SwiftLog version/commit hash
|
||||
|
||||
_[the SwiftLog tag/commit hash]_
|
||||
|
||||
### Swift & OS version (output of `swift --version && uname -a`)
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
---
|
||||
name: 🐛 Bug Report
|
||||
about: If something isn't working as expected
|
||||
|
||||
---
|
||||
|
||||
<!-- Thanks for contributing to Swift Crypto! Before you submit your issue, please make sure you followed our checklist and check the appropriate boxes by putting an x in the [ ]: [x] -->
|
||||
|
||||
### New Issue Checklist
|
||||
|
||||
- [ ] I'm using the latest version of Swift Crypto (master branch)
|
||||
- [ ] I read the [Contribution Guidelines](https://github.com/apple/swift-crypto/blob/master/CONTRIBUTING.md)
|
||||
- [ ] I searched for [existing GitHub issues](https://github.com/apple/swift-crypto/issues)
|
||||
|
||||
### Expected behavior
|
||||
_[what you expected to happen]_
|
||||
|
||||
### Actual behavior
|
||||
_[what actually happened]_
|
||||
|
||||
### Steps to reproduce
|
||||
|
||||
1. ...
|
||||
2. ...
|
||||
|
||||
### If possible, minimal yet complete reproducer code (or URL to code)
|
||||
|
||||
_[anything to help us reproducing the issue]_
|
||||
|
||||
### Swift Crypto version/commit hash
|
||||
|
||||
_[the Swift Crypto tag/commit hash]_
|
||||
|
||||
### Environment
|
||||
|
||||
Stand in the root of the repo and run `./scripts/environments.sh` and paste the output below
|
||||
|
||||
<details>
|
||||
<pre>PLEASE_REPLACE_THIS_STIRNG_WITH_OUTPUT_OF_script_environments_THAT_IS_IN_YOUR_PASTEBOARD</pre>
|
||||
</details>
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
---
|
||||
name: 💡 Feature Request
|
||||
about: A suggestion for a new feature
|
||||
|
||||
---
|
||||
|
||||
### New API Proposal: <Feature Name>
|
||||
|
||||
#### Motivation:
|
||||
|
||||
<What use-case is this API proposal trying to serve? Are there any protocols in existence that require this API? If so, which? Please provide links to specifications where applicable, or peer implementations when attempting to perform interop work.>
|
||||
|
||||
#### Importance:
|
||||
|
||||
<Does this API unlock entirely new use-cases, or is it possible to achieve the same functionality with existing API, but in easier ways?>
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
---
|
||||
name: ❓ Support Question
|
||||
about: Not sure how something works or how to implement some functionality? Ask us here! (But please check the docs first)
|
||||
|
||||
---
|
||||
|
||||
### Question Checklist
|
||||
|
||||
- [ ] I'm using the latest version of Swift Crypto (master branch)
|
||||
- [ ] I read the [Contribution Guidelines](https://github.com/apple/swift-crypto/blob/master/CONTRIBUTING.md)
|
||||
- [ ] I searched for [existing GitHub issues](https://github.com/apple/swift-crypto/issues)
|
||||
|
||||
### Question Subject
|
||||
<!-- What tool/action do you have a question about? -->
|
||||
<!-- Is this a question about documentation? -->
|
||||
|
||||
#### Question Description
|
||||
<!-- Please include expected behavior and any relevant code samples with your question if possible -->
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
---
|
||||
name: 😱 Regression
|
||||
about: If a recent release broke a feature (Please make sure you know the last known working release version)
|
||||
|
||||
---
|
||||
|
||||
<!-- Thanks for contributing to Swift Crypto! Before you submit your issue, please make sure you followed our checklist and check the appropriate boxes by putting an x in the [ ]: [x] -->
|
||||
|
||||
### New Regression Checklist
|
||||
|
||||
- [ ] I'm using the latest version of Swift Crypto (master branch)
|
||||
- [ ] I read the [Contribution Guidelines](https://github.com/apple/swift-crypto/blob/master/CONTRIBUTING.md)
|
||||
- [ ] I searched for [existing GitHub issues](https://github.com/apple/swift-crypto/issues)
|
||||
|
||||
### Regression Information
|
||||
<!-- Knowing the breaking versions and last working versions helps us track down the regression easier -->
|
||||
- Breaking version: [e.g. `2.x.x`]
|
||||
- Last working version: [e.g. `2.x.x`]
|
||||
|
||||
### Regression Description
|
||||
<!-- Please include what's happening, expected behavior, and any relevant code samples -->
|
||||
|
||||
### Swift Crypto version/commit hash
|
||||
|
||||
_[the Swift Crypto tag/commit hash]_
|
||||
|
||||
### Environment
|
||||
|
||||
Stand in the root of the repo and run `./scripts/environments.sh` and paste the output below
|
||||
|
||||
<details>
|
||||
<pre>PLEASE_REPLACE_THIS_STIRNG_WITH_OUTPUT_OF_script_environments_THAT_IS_IN_YOUR_PASTEBOARD</pre>
|
||||
</details>
|
||||
@@ -1,5 +1,16 @@
|
||||
_[One line description of your change]_
|
||||
|
||||
<!-- Thanks for contributing to Swift Crypto! Before you submit your issue, please make sure you followed our checklist and check the appropriate boxes by putting an x in the [ ]: [x] -->
|
||||
|
||||
### Checklist
|
||||
- [ ] I've run tests to see all new and existing tests pass
|
||||
- [ ] I've followed the code style of the rest of the project
|
||||
- [ ] I've read the [Contribution Guidelines](CONTRIBUTING.md)
|
||||
- [ ] I've updated the documentation if necessary
|
||||
|
||||
#### If you've made changes to `gyb` files
|
||||
- [ ] I've run `.script/generate_boilerplate_files_with_gyb` and included updated generated files in a commit of this pull request
|
||||
|
||||
### Motivation:
|
||||
|
||||
_[Explain here the context, and why you're making that change. What is the problem you're trying to solve.]_
|
||||
@@ -10,4 +21,4 @@ _[Describe the modifications you've done.]_
|
||||
|
||||
### Result:
|
||||
|
||||
_[After your change, what will change.]_
|
||||
_[After your change, what will change.]_
|
||||
@@ -10,3 +10,4 @@ Package.resolved
|
||||
.podspecs
|
||||
DerivedData
|
||||
.swiftpm
|
||||
**/gyb.pyc
|
||||
@@ -0,0 +1,2 @@
|
||||
Alexander Cyon <alex.cyon@gmail.com> <Sajjon@users.noreply.github.com>
|
||||
Tomer Doron <tomer@apple.com>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<array/>
|
||||
</plist>
|
||||
@@ -11,8 +11,13 @@ needs to be listed here.
|
||||
|
||||
### Contributors
|
||||
|
||||
- Alexander Cyon <alex.cyon@gmail.com>
|
||||
- Austin Conlon <austinconlon@icloud.com>
|
||||
- Cory Benfield <lukasa@apple.com>
|
||||
- George Barnett <gbrntt@gmail.com>
|
||||
- Tomer Doron <tomer@apple.com>
|
||||
|
||||
**Updating this list**
|
||||
## Updating this list
|
||||
|
||||
Please do not edit this file manually. It is generated using `./scripts/generate_contributors_list.sh`. If a name is misspelled or appearing multiple times: add an entry in `./.mailmap`
|
||||
Please do not edit this file manually. It is generated using `./scripts/generate_contributors_list.sh`.
|
||||
If a name is misspelled or appearing multiple times: add an entry in `./.mailmap` (see [docs](https://git-scm.com/docs/git-shortlog#_mapping_authors))
|
||||
+2
-2
@@ -7,7 +7,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
@@ -20,7 +20,7 @@
|
||||
// Sources/CCryptoBoringSSL directory. The source repository is at
|
||||
// https://boringssl.googlesource.com/boringssl.
|
||||
//
|
||||
// BoringSSL Commit: 0416e8c3055c7fcfd6c3eab4c127a36df1e6097b
|
||||
// BoringSSL Commit: 5298ef99bf2b2d77600b3bb74dd572027bf495be
|
||||
|
||||
import PackageDescription
|
||||
|
||||
|
||||
@@ -1,84 +1,112 @@
|
||||
# SwiftCrypto
|
||||
# Swift Crypto
|
||||
|
||||
SwiftCrypto is an open-source implementation of a substantial portion of the API of [Apple CryptoKit](https://developer.apple.com/documentation/cryptokit) suitable for use on Linux platforms. It enables cross-platform or server applications with the advantages of CryptoKit.
|
||||
Swift Crypto is an open-source implementation of a substantial portion of the API of [Apple CryptoKit](https://developer.apple.com/documentation/cryptokit) suitable for use on Linux platforms. It enables cross-platform or server applications with the advantages of CryptoKit.
|
||||
|
||||
## Functionality
|
||||
|
||||
SwiftCrypto exposes the portions of the CryptoKit API that do not rely on specialised hardware to any Swift application. It provides safe APIs that abstract over the complexity of many cryptographic primitives that need to be used in modern applications. These APIs encourage safe usages of the underlying primitives, follow cryptographic best practices, and should be the first choice for building applications that need to use cryptography.
|
||||
Swift Crypto exposes the portions of the CryptoKit API that do not rely on specialised hardware to any Swift application. It provides safe APIs that abstract over the complexity of many cryptographic primitives that need to be used in modern applications. These APIs encourage safe usages of the underlying primitives, follow cryptographic best practices, and should be the first choice for building applications that need to use cryptography.
|
||||
|
||||
The current features of SwiftCrypto cover key exchange, key derivation, encryption and decryption, hashing, message authentication, and more.
|
||||
The current features of Swift Crypto cover key exchange, key derivation, encryption and decryption, hashing, message authentication, and more.
|
||||
|
||||
For specific API documentation, please see our documentation.
|
||||
|
||||
## Implementation
|
||||
|
||||
SwiftCrypto compiles in two distinct modes depending on the platform for which it is being built.
|
||||
Swift Crypto compiles in two distinct modes depending on the platform for which it is being built.
|
||||
|
||||
When building SwiftCrypto for use on an Apple platform where CryptoKit is already available, SwiftCrypto compiles its entire API surface down to nothing and simply re-exports the API of CryptoKit. This means that when using Apple platforms SwiftCrypto simply delegates all work to the core implementation of CryptoKit, as though SwiftCrypto was not even there.
|
||||
When building Swift Crypto for use on an Apple platform where CryptoKit is already available, Swift Crypto compiles its entire API surface down to nothing and simply re-exports the API of CryptoKit. This means that when using Apple platforms Swift Crypto simply delegates all work to the core implementation of CryptoKit, as though Swift Crypto was not even there.
|
||||
|
||||
When building SwiftCrypto for use on Linux, SwiftCrypto builds substantially more code. In particular, we build:
|
||||
When building Swift Crypto for use on Linux, Swift Crypto builds substantially more code. In particular, we build:
|
||||
|
||||
1. A vendored copy of BoringSSL's libcrypto.
|
||||
2. The common API of SwiftCrypto and CryptoKit.
|
||||
2. The common API of Swift Crypto and CryptoKit.
|
||||
3. The backing implementation of this common API, which calls into BoringSSL.
|
||||
|
||||
The API code, and some cryptographic primitives which are directly implemented in Swift, are exactly the same for both Apple CryptoKit and SwiftCrypto. The backing BoringSSL-based implementation is unique to SwiftCrypto.
|
||||
The API code, and some cryptographic primitives which are directly implemented in Swift, are exactly the same for both Apple CryptoKit and Swift Crypto. The backing BoringSSL-based implementation is unique to Swift Crypto.
|
||||
|
||||
## Evolution
|
||||
|
||||
The vast majority of the SwiftCrypto code is intended to remain in lockstep with the current version of Apple CryptoKit. For this reason, patches that extend the API of SwiftCrypto will be evaluated cautiously. For any such extension there are two possible outcomes for adding the API.
|
||||
The vast majority of the Swift Crypto code is intended to remain in lockstep with the current version of Apple CryptoKit. For this reason, patches that extend the API of Swift Crypto will be evaluated cautiously. For any such extension there are two possible outcomes for adding the API.
|
||||
|
||||
Firstly, if the API is judged to be generally valuable and suitable for contribution to Apple CryptoKit, the API will be merged into a Staging namespace in SwiftCrypto. This Staging namespace is a temporary home for any API that is expected to become available in Apple CryptoKit but that is not available today. This enables users to use the API soon after merging. When the API is generally available in CryptoKit the API will be deprecated in the Staging namespace and made available in the main SwiftCrypto namespace.
|
||||
Firstly, if the API is judged to be generally valuable and suitable for contribution to Apple CryptoKit, the API will be merged into a Staging namespace in Swift Crypto. This Staging namespace is a temporary home for any API that is expected to become available in Apple CryptoKit but that is not available today. This enables users to use the API soon after merging. When the API is generally available in CryptoKit the API will be deprecated in the Staging namespace and made available in the main Swift Crypto namespace.
|
||||
|
||||
Secondly, if the API is judged not to meet the criteria for acceptance in general CryptoKit but is sufficiently important to have available for server use-cases, it will be merged into a Server namespace. APIs are not expected to leave this namespace, as it indicates that they are not generally available but can only be accessed when using SwiftCrypto.
|
||||
Secondly, if the API is judged not to meet the criteria for acceptance in general CryptoKit but is sufficiently important to have available for server use-cases, it will be merged into a Server namespace. APIs are not expected to leave this namespace, as it indicates that they are not generally available but can only be accessed when using Swift Crypto.
|
||||
|
||||
Note that SwiftCrypto does not intend to support all possible cryptographic primitives. SwiftCrypto will focus on safe, modern cryptographic primitives that are broadly useful and that do not easily lend themselves to misuse. This means that some cryptographic algorithms may never be supported: for example, 3DES is highly unlikely to ever be supported by SwiftCrypto due to the difficulty of safely deploying it and its legacy status. Please be aware when proposing the addition of new primitives to SwiftCrypto that the proposal may be refused for this reason.
|
||||
Note that Swift Crypto does not intend to support all possible cryptographic primitives. Swift Crypto will focus on safe, modern cryptographic primitives that are broadly useful and that do not easily lend themselves to misuse. This means that some cryptographic algorithms may never be supported: for example, 3DES is highly unlikely to ever be supported by Swift Crypto due to the difficulty of safely deploying it and its legacy status. Please be aware when proposing the addition of new primitives to Swift Crypto that the proposal may be refused for this reason.
|
||||
|
||||
### Code Organisation
|
||||
|
||||
Files in this repository are divided into two groups, based on whether they have a name that ends in `_boring` or are in a `BoringSSL` directory, or if they are not.
|
||||
|
||||
Files that meet the above criteria are specific to the SwiftCrypto implementation. Changes to these files can be made fairly easily, so long as they meet the criteria below. If your file needs to `import CCryptoBoringSSL` or access a BoringSSL API, it needs to be marked this way.
|
||||
Files that meet the above criteria are specific to the Swift Crypto implementation. Changes to these files can be made fairly easily, so long as they meet the criteria below. If your file needs to `import CCryptoBoringSSL` or access a BoringSSL API, it needs to be marked this way.
|
||||
|
||||
Files that do not have the `_boring` suffix are part of the public API of CryptoKit. Changing these requires passing a higher bar, as any change in these files must be accompanied by a change in CryptoKit itself.
|
||||
|
||||
### Contributing New Primitives
|
||||
## Contributing
|
||||
|
||||
To contribute a new cryptographic primitive to SwiftCrypto, you should address the following questions:
|
||||
Before contributing please read [CONTRIBUTING.md](CONTRIBUTING.md), also make sure to read the two following sections.
|
||||
|
||||
#### Contributing new primitives
|
||||
|
||||
To contribute a new cryptographic primitive to Swift Crypto, you should address the following questions:
|
||||
|
||||
1. What is the new primitive for?
|
||||
2. How widely is it deployed?
|
||||
3. Is it specified in any public specifications or used by any such specification?
|
||||
4. How easy is it to misuse?
|
||||
5. In what way does SwiftCrypto fail to satisfy that use-case today?
|
||||
5. In what way does Swift Crypto fail to satisfy that use-case today?
|
||||
|
||||
In addition, new primitive implementations will only be accepted in cases where the implementation is thoroughly tested, including being tested with all currently available test vectors. If the [Wycheproof](https://github.com/google/wycheproof) project provides vectors for the algorithm those should be tested as well. It must be possible to ensure that we can appropriately regression test our implementations.
|
||||
|
||||
### Contributing bug fixes
|
||||
#### Contributing bug fixes
|
||||
|
||||
If you discover a bug with SwiftCrypto, please report it via GitHub.
|
||||
If you discover a bug with Swift Crypto, please report it via GitHub.
|
||||
|
||||
If you are interested in fixing a bug, feel free to open a pull request. Please also submit regression tests with bug fixes to ensure that they are not regressed in future.
|
||||
|
||||
If you have issues with CryptoKit, instead of Swift Crypto, please use Feedback Assistant to file those issues as you normally would.
|
||||
If you have issues with CryptoKit, instead of Swift Crypto, please use [Feedback Assistant](https://feedbackassistant.apple.com) to file those issues as you normally would.
|
||||
|
||||
### Get started contributing
|
||||
|
||||
#### `gyb`
|
||||
|
||||
Some of the files in this project are autogenerated (metaprogramming) using the Swift Utils tools called [gyb](https://github.com/apple/swift/blob/master/utils/gyb.py) (_"generate your boilerplate"_). `gyb` is included in [`./scripts/gyb`](scripts/gyb).
|
||||
|
||||
`gyb` will generate some `Foobar.swift` Swift file from some `Foobar.swift.gyb` _template_ file. **You should not edit `Foobar.swift` directly**, since all manual edits in that generated file will be overwritten the next time `gyb` is run.
|
||||
|
||||
You run `gyb` for a single file like so:
|
||||
|
||||
```bash
|
||||
./scripts/gyb --line-directive "" Sources/Foobar.swift.gyb -o Sources/Foobar.swift
|
||||
```
|
||||
|
||||
More conveniently you can run the bash script `./scripts/generate_boilerplate_files_with_gyb.sh` to generate all Swift files from their corresponding gyb template.
|
||||
|
||||
**If you add a new `.gyb` file, you should append a `// MARK: - Generated file, do NOT edit` warning** inside it, e.g.
|
||||
|
||||
```swift
|
||||
// MARK: - Generated file, do NOT edit
|
||||
// any edits of this file WILL be overwritten and thus discarded
|
||||
// see section `gyb` in `README` for details.
|
||||
```
|
||||
|
||||
### Security
|
||||
|
||||
If you believe you have identified a vulnerability in swift-crypto, please [report that vulnerability to Apple through the usual channel](https://support.apple.com/en-us/HT201220).
|
||||
If you believe you have identified a vulnerability in Swift Crypto, please [report that vulnerability to Apple through the usual channel](https://support.apple.com/en-us/HT201220).
|
||||
|
||||
### Swift versions
|
||||
|
||||
SwiftCrypto supports Swift 5.1 and later.
|
||||
Swift Crypto supports Swift 5.1 and later.
|
||||
|
||||
### Compatibility
|
||||
|
||||
SwiftCrypto follows [SemVer 2.0.0](https://semver.org/#semantic-versioning-200). Our public API is the same as that of CryptoKit (except where we lack an implementation entirely), as well as everything in the Server and Staging namespaces. We do not maintain a stable ABI, as SwiftCrypto is a source-only distribution.
|
||||
Swift Crypto follows [SemVer 2.0.0](https://semver.org/#semantic-versioning-200). Our public API is the same as that of CryptoKit (except where we lack an implementation entirely), as well as everything in the Server and Staging namespaces. We do not maintain a stable ABI, as Swift Crypto is a source-only distribution.
|
||||
|
||||
What this means for you is that you should depend on SwiftCrypto with a version range that covers everything from the minimum SwiftCrypto version you require up to the next major version.
|
||||
In SwiftPM that can be easily done specifying for example `from: "1.0.0"` meaning that you support SwiftCrypto in every version starting from 1.0.0 up to (excluding) 2.0.0.
|
||||
SemVer and SwiftCrypto's Public API guarantees should result in a working program without having to worry about testing every single version for compatibility.
|
||||
What this means for you is that you should depend on Swift Crypto with a version range that covers everything from the minimum Swift Crypto version you require up to the next major version.
|
||||
In SwiftPM that can be easily done specifying for example `from: "1.0.0"` meaning that you support Swift Crypto in every version starting from 1.0.0 up to (excluding) 2.0.0.
|
||||
SemVer and Swift Crypto's Public API guarantees should result in a working program without having to worry about testing every single version for compatibility.
|
||||
|
||||
### Developing SwiftCrypto on macOS
|
||||
### Developing Swift Crypto on macOS
|
||||
|
||||
SwiftCrypto normally defers to the OS implementation of CryptoKit on macOS. Naturally, this makes developing SwiftCrypto on macOS tricky. To get SwiftCrypto to build the open source implementation on macOS, uncomment the line that reads: `//.define("CRYPTO_IN_SWIFTPM_FORCE_BUILD_API")`, as this will force SwiftCrypto to build its public API.
|
||||
Swift Crypto normally defers to the OS implementation of CryptoKit on macOS. Naturally, this makes developing Swift Crypto on macOS tricky. To get Swift Crypto to build the open source implementation on macOS, uncomment the line that reads: `//.define("CRYPTO_IN_SWIFTPM_FORCE_BUILD_API")`, as this will force Swift Crypto to build its public API.
|
||||
|
||||
@@ -447,6 +447,10 @@ int CBB_add_u16(CBB *cbb, uint16_t value) {
|
||||
return cbb_buffer_add_u(cbb->base, value, 2);
|
||||
}
|
||||
|
||||
int CBB_add_u16le(CBB *cbb, uint16_t value) {
|
||||
return CBB_add_u16(cbb, CRYPTO_bswap2(value));
|
||||
}
|
||||
|
||||
int CBB_add_u24(CBB *cbb, uint32_t value) {
|
||||
if (!CBB_flush(cbb)) {
|
||||
return 0;
|
||||
@@ -463,6 +467,10 @@ int CBB_add_u32(CBB *cbb, uint32_t value) {
|
||||
return cbb_buffer_add_u(cbb->base, value, 4);
|
||||
}
|
||||
|
||||
int CBB_add_u32le(CBB *cbb, uint32_t value) {
|
||||
return CBB_add_u32(cbb, CRYPTO_bswap4(value));
|
||||
}
|
||||
|
||||
int CBB_add_u64(CBB *cbb, uint64_t value) {
|
||||
if (!CBB_flush(cbb)) {
|
||||
return 0;
|
||||
@@ -470,6 +478,10 @@ int CBB_add_u64(CBB *cbb, uint64_t value) {
|
||||
return cbb_buffer_add_u(cbb->base, value, 8);
|
||||
}
|
||||
|
||||
int CBB_add_u64le(CBB *cbb, uint64_t value) {
|
||||
return CBB_add_u64(cbb, CRYPTO_bswap8(value));
|
||||
}
|
||||
|
||||
void CBB_discard_child(CBB *cbb) {
|
||||
if (cbb->child == NULL) {
|
||||
return;
|
||||
|
||||
@@ -120,6 +120,14 @@ int CBS_get_u16(CBS *cbs, uint16_t *out) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CBS_get_u16le(CBS *cbs, uint16_t *out) {
|
||||
if (!CBS_get_u16(cbs, out)) {
|
||||
return 0;
|
||||
}
|
||||
*out = CRYPTO_bswap2(*out);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CBS_get_u24(CBS *cbs, uint32_t *out) {
|
||||
uint64_t v;
|
||||
if (!cbs_get_u(cbs, &v, 3)) {
|
||||
@@ -138,10 +146,26 @@ int CBS_get_u32(CBS *cbs, uint32_t *out) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CBS_get_u32le(CBS *cbs, uint32_t *out) {
|
||||
if (!CBS_get_u32(cbs, out)) {
|
||||
return 0;
|
||||
}
|
||||
*out = CRYPTO_bswap4(*out);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CBS_get_u64(CBS *cbs, uint64_t *out) {
|
||||
return cbs_get_u(cbs, out, 8);
|
||||
}
|
||||
|
||||
int CBS_get_u64le(CBS *cbs, uint64_t *out) {
|
||||
if (!cbs_get_u(cbs, out, 8)) {
|
||||
return 0;
|
||||
}
|
||||
*out = CRYPTO_bswap8(*out);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CBS_get_last_u8(CBS *cbs, uint8_t *out) {
|
||||
if (cbs->len == 0) {
|
||||
return 0;
|
||||
|
||||
@@ -51,7 +51,8 @@ OPENSSL_STATIC_ASSERT(ERR_LIB_DIGEST == 29, "library value changed");
|
||||
OPENSSL_STATIC_ASSERT(ERR_LIB_CIPHER == 30, "library value changed");
|
||||
OPENSSL_STATIC_ASSERT(ERR_LIB_HKDF == 31, "library value changed");
|
||||
OPENSSL_STATIC_ASSERT(ERR_LIB_USER == 32, "library value changed");
|
||||
OPENSSL_STATIC_ASSERT(ERR_NUM_LIBS == 33, "number of libraries changed");
|
||||
OPENSSL_STATIC_ASSERT(ERR_LIB_TRUST_TOKEN == 33, "library value changed");
|
||||
OPENSSL_STATIC_ASSERT(ERR_NUM_LIBS == 34, "number of libraries changed");
|
||||
|
||||
const uint32_t kOpenSSLReasonValues[] = {
|
||||
0xc32083a,
|
||||
@@ -190,44 +191,44 @@ const uint32_t kOpenSSLReasonValues[] = {
|
||||
0x283480ac,
|
||||
0x283500ea,
|
||||
0x28358c6c,
|
||||
0x2c322f0c,
|
||||
0x2c322f1d,
|
||||
0x2c3292e8,
|
||||
0x2c332f1a,
|
||||
0x2c33af2c,
|
||||
0x2c342f40,
|
||||
0x2c34af52,
|
||||
0x2c352f6d,
|
||||
0x2c35af7f,
|
||||
0x2c362f92,
|
||||
0x2c332f2b,
|
||||
0x2c33af3d,
|
||||
0x2c342f51,
|
||||
0x2c34af63,
|
||||
0x2c352f7e,
|
||||
0x2c35af90,
|
||||
0x2c362fa3,
|
||||
0x2c36832d,
|
||||
0x2c372f9f,
|
||||
0x2c37afb1,
|
||||
0x2c382fd6,
|
||||
0x2c38afed,
|
||||
0x2c392ffb,
|
||||
0x2c39b00b,
|
||||
0x2c3a301d,
|
||||
0x2c3ab031,
|
||||
0x2c3b3042,
|
||||
0x2c3bb061,
|
||||
0x2c372fb0,
|
||||
0x2c37afc2,
|
||||
0x2c382fe7,
|
||||
0x2c38affe,
|
||||
0x2c39300c,
|
||||
0x2c39b01c,
|
||||
0x2c3a302e,
|
||||
0x2c3ab042,
|
||||
0x2c3b3053,
|
||||
0x2c3bb072,
|
||||
0x2c3c12fa,
|
||||
0x2c3c9310,
|
||||
0x2c3d3075,
|
||||
0x2c3d3086,
|
||||
0x2c3d9329,
|
||||
0x2c3e3092,
|
||||
0x2c3eb0a0,
|
||||
0x2c3f30b8,
|
||||
0x2c3fb0d0,
|
||||
0x2c4030fa,
|
||||
0x2c3e30a3,
|
||||
0x2c3eb0b1,
|
||||
0x2c3f30c9,
|
||||
0x2c3fb0e1,
|
||||
0x2c40310b,
|
||||
0x2c4091fb,
|
||||
0x2c41310b,
|
||||
0x2c41b11e,
|
||||
0x2c41311c,
|
||||
0x2c41b12f,
|
||||
0x2c4211c1,
|
||||
0x2c42b12f,
|
||||
0x2c42b140,
|
||||
0x2c430722,
|
||||
0x2c43b053,
|
||||
0x2c442fc4,
|
||||
0x2c44b0dd,
|
||||
0x2c43b064,
|
||||
0x2c442fd5,
|
||||
0x2c44b0ee,
|
||||
0x30320000,
|
||||
0x30328015,
|
||||
0x3033001f,
|
||||
@@ -384,219 +385,220 @@ const uint32_t kOpenSSLReasonValues[] = {
|
||||
0x403b9ad8,
|
||||
0x403c0064,
|
||||
0x403c8083,
|
||||
0x403d1b5c,
|
||||
0x403d9b72,
|
||||
0x403e1b81,
|
||||
0x403e9bb9,
|
||||
0x403f1bd3,
|
||||
0x403f9bfb,
|
||||
0x40401c10,
|
||||
0x40409c24,
|
||||
0x40411c41,
|
||||
0x40419c5c,
|
||||
0x40421c75,
|
||||
0x40429c88,
|
||||
0x40431c9c,
|
||||
0x40439cb4,
|
||||
0x40441ccb,
|
||||
0x403d1b39,
|
||||
0x403d9b4f,
|
||||
0x403e1b5e,
|
||||
0x403e9b96,
|
||||
0x403f1bb0,
|
||||
0x403f9bd8,
|
||||
0x40401bed,
|
||||
0x40409c01,
|
||||
0x40411c3c,
|
||||
0x40419c57,
|
||||
0x40421c70,
|
||||
0x40429c83,
|
||||
0x40431c97,
|
||||
0x40439caf,
|
||||
0x40441cc6,
|
||||
0x404480ac,
|
||||
0x40451ce0,
|
||||
0x40459cf2,
|
||||
0x40461d16,
|
||||
0x40469d36,
|
||||
0x40471d44,
|
||||
0x40479d6b,
|
||||
0x40481ddc,
|
||||
0x40489e0f,
|
||||
0x40491e26,
|
||||
0x40499e40,
|
||||
0x404a1e57,
|
||||
0x404a9e75,
|
||||
0x404b1e8d,
|
||||
0x404b9ea4,
|
||||
0x404c1eba,
|
||||
0x404c9ecc,
|
||||
0x404d1eed,
|
||||
0x404d9f26,
|
||||
0x404e1f3a,
|
||||
0x404e9f47,
|
||||
0x404f1f8e,
|
||||
0x404f9fd4,
|
||||
0x4050202b,
|
||||
0x4050a03f,
|
||||
0x40512072,
|
||||
0x40522082,
|
||||
0x4052a0a6,
|
||||
0x405320be,
|
||||
0x4053a0d1,
|
||||
0x405420e6,
|
||||
0x4054a109,
|
||||
0x40552117,
|
||||
0x4055a154,
|
||||
0x40562161,
|
||||
0x4056a17a,
|
||||
0x40572192,
|
||||
0x4057a1a5,
|
||||
0x405821ba,
|
||||
0x4058a1e1,
|
||||
0x40592210,
|
||||
0x4059a23d,
|
||||
0x405a2251,
|
||||
0x405aa261,
|
||||
0x405b2279,
|
||||
0x405ba28a,
|
||||
0x405c229d,
|
||||
0x405ca2dc,
|
||||
0x405d22e9,
|
||||
0x405da30e,
|
||||
0x405e234c,
|
||||
0x40451cdb,
|
||||
0x40459ced,
|
||||
0x40461d11,
|
||||
0x40469d31,
|
||||
0x40471d3f,
|
||||
0x40479d66,
|
||||
0x40481dd7,
|
||||
0x40489e0a,
|
||||
0x40491e21,
|
||||
0x40499e3b,
|
||||
0x404a1e52,
|
||||
0x404a9e70,
|
||||
0x404b1e88,
|
||||
0x404b9eb5,
|
||||
0x404c1ecb,
|
||||
0x404c9edd,
|
||||
0x404d1efe,
|
||||
0x404d9f37,
|
||||
0x404e1f4b,
|
||||
0x404e9f58,
|
||||
0x404f1f9f,
|
||||
0x404f9fe5,
|
||||
0x4050203c,
|
||||
0x4050a050,
|
||||
0x40512083,
|
||||
0x40522093,
|
||||
0x4052a0b7,
|
||||
0x405320cf,
|
||||
0x4053a0e2,
|
||||
0x405420f7,
|
||||
0x4054a11a,
|
||||
0x40552128,
|
||||
0x4055a165,
|
||||
0x40562172,
|
||||
0x4056a18b,
|
||||
0x405721a3,
|
||||
0x4057a1b6,
|
||||
0x405821cb,
|
||||
0x4058a1f2,
|
||||
0x40592221,
|
||||
0x4059a24e,
|
||||
0x405a2262,
|
||||
0x405aa272,
|
||||
0x405b228a,
|
||||
0x405ba29b,
|
||||
0x405c22ae,
|
||||
0x405ca2ed,
|
||||
0x405d22fa,
|
||||
0x405da31f,
|
||||
0x405e235d,
|
||||
0x405e8ab3,
|
||||
0x405f236d,
|
||||
0x405fa37a,
|
||||
0x40602388,
|
||||
0x4060a3aa,
|
||||
0x4061240b,
|
||||
0x4061a443,
|
||||
0x4062245a,
|
||||
0x4062a46b,
|
||||
0x40632490,
|
||||
0x4063a4a5,
|
||||
0x406424bc,
|
||||
0x4064a4e8,
|
||||
0x40652503,
|
||||
0x4065a51a,
|
||||
0x40662532,
|
||||
0x4066a55c,
|
||||
0x40672587,
|
||||
0x4067a5cc,
|
||||
0x40682614,
|
||||
0x4068a635,
|
||||
0x40692667,
|
||||
0x4069a695,
|
||||
0x406a26b6,
|
||||
0x406aa6d6,
|
||||
0x406b285e,
|
||||
0x406ba881,
|
||||
0x406c2897,
|
||||
0x406cab3a,
|
||||
0x406d2b69,
|
||||
0x406dab91,
|
||||
0x406e2bbf,
|
||||
0x406eac0c,
|
||||
0x406f2c47,
|
||||
0x406fac7f,
|
||||
0x40702c92,
|
||||
0x4070acaf,
|
||||
0x405f237e,
|
||||
0x405fa38b,
|
||||
0x40602399,
|
||||
0x4060a3bb,
|
||||
0x4061241c,
|
||||
0x4061a454,
|
||||
0x4062246b,
|
||||
0x4062a47c,
|
||||
0x406324a1,
|
||||
0x4063a4b6,
|
||||
0x406424cd,
|
||||
0x4064a4f9,
|
||||
0x40652514,
|
||||
0x4065a52b,
|
||||
0x40662543,
|
||||
0x4066a56d,
|
||||
0x40672598,
|
||||
0x4067a5dd,
|
||||
0x40682625,
|
||||
0x4068a646,
|
||||
0x40692678,
|
||||
0x4069a6a6,
|
||||
0x406a26c7,
|
||||
0x406aa6e7,
|
||||
0x406b286f,
|
||||
0x406ba892,
|
||||
0x406c28a8,
|
||||
0x406cab4b,
|
||||
0x406d2b7a,
|
||||
0x406daba2,
|
||||
0x406e2bd0,
|
||||
0x406eac1d,
|
||||
0x406f2c58,
|
||||
0x406fac90,
|
||||
0x40702ca3,
|
||||
0x4070acc0,
|
||||
0x40710802,
|
||||
0x4071acc1,
|
||||
0x40722cd4,
|
||||
0x4072ad0a,
|
||||
0x40732d22,
|
||||
0x4071acd2,
|
||||
0x40722ce5,
|
||||
0x4072ad1b,
|
||||
0x40732d33,
|
||||
0x407394fa,
|
||||
0x40742d36,
|
||||
0x4074ad50,
|
||||
0x40752d61,
|
||||
0x4075ad75,
|
||||
0x40762d83,
|
||||
0x40742d47,
|
||||
0x4074ad61,
|
||||
0x40752d72,
|
||||
0x4075ad86,
|
||||
0x40762d94,
|
||||
0x407692be,
|
||||
0x40772da8,
|
||||
0x4077adca,
|
||||
0x40782de5,
|
||||
0x4078ae1e,
|
||||
0x40792e35,
|
||||
0x4079ae4b,
|
||||
0x407a2e77,
|
||||
0x407aae8a,
|
||||
0x407b2e9f,
|
||||
0x407baeb1,
|
||||
0x407c2ee2,
|
||||
0x407caeeb,
|
||||
0x407d2650,
|
||||
0x407d9fe4,
|
||||
0x407e2dfa,
|
||||
0x407ea1f1,
|
||||
0x407f1d58,
|
||||
0x407f9afe,
|
||||
0x40801f9e,
|
||||
0x40809d80,
|
||||
0x40812094,
|
||||
0x40819f78,
|
||||
0x40822baa,
|
||||
0x40772db9,
|
||||
0x4077addb,
|
||||
0x40782df6,
|
||||
0x4078ae2f,
|
||||
0x40792e46,
|
||||
0x4079ae5c,
|
||||
0x407a2e88,
|
||||
0x407aae9b,
|
||||
0x407b2eb0,
|
||||
0x407baec2,
|
||||
0x407c2ef3,
|
||||
0x407caefc,
|
||||
0x407d2661,
|
||||
0x407d9ff5,
|
||||
0x407e2e0b,
|
||||
0x407ea202,
|
||||
0x407f1d53,
|
||||
0x407f9e9f,
|
||||
0x40801faf,
|
||||
0x40809d7b,
|
||||
0x408120a5,
|
||||
0x40819f89,
|
||||
0x40822bbb,
|
||||
0x40829ae4,
|
||||
0x408321cc,
|
||||
0x4083a4cd,
|
||||
0x40841d94,
|
||||
0x4084a229,
|
||||
0x408522ae,
|
||||
0x4085a3d2,
|
||||
0x4086232e,
|
||||
0x40869ffe,
|
||||
0x40872bf0,
|
||||
0x4087a420,
|
||||
0x40881b45,
|
||||
0x4088a5df,
|
||||
0x40891b94,
|
||||
0x40899b21,
|
||||
0x408a28cf,
|
||||
0x408321dd,
|
||||
0x4083a4de,
|
||||
0x40841d8f,
|
||||
0x4084a23a,
|
||||
0x408522bf,
|
||||
0x4085a3e3,
|
||||
0x4086233f,
|
||||
0x4086a00f,
|
||||
0x40872c01,
|
||||
0x4087a431,
|
||||
0x40881b22,
|
||||
0x4088a5f0,
|
||||
0x40891b71,
|
||||
0x40899afe,
|
||||
0x408a28e0,
|
||||
0x408a9912,
|
||||
0x408b2ec6,
|
||||
0x408bac5c,
|
||||
0x408c22be,
|
||||
0x408b2ed7,
|
||||
0x408bac6d,
|
||||
0x408c22cf,
|
||||
0x408c992e,
|
||||
0x408d1df5,
|
||||
0x408d9dc6,
|
||||
0x408e1f0f,
|
||||
0x408ea134,
|
||||
0x408f25f3,
|
||||
0x408fa3ee,
|
||||
0x409025a8,
|
||||
0x4090a300,
|
||||
0x409128b7,
|
||||
0x408d1df0,
|
||||
0x408d9dc1,
|
||||
0x408e1f20,
|
||||
0x408ea145,
|
||||
0x408f2604,
|
||||
0x408fa3ff,
|
||||
0x409025b9,
|
||||
0x4090a311,
|
||||
0x409128c8,
|
||||
0x40919954,
|
||||
0x40921be1,
|
||||
0x4092ac2b,
|
||||
0x40932ced,
|
||||
0x4093a00f,
|
||||
0x40941da8,
|
||||
0x4094a8e8,
|
||||
0x4095247c,
|
||||
0x4095ae57,
|
||||
0x40962bd7,
|
||||
0x40969fb7,
|
||||
0x4097205a,
|
||||
0x40979f5e,
|
||||
0x41f42789,
|
||||
0x41f9281b,
|
||||
0x41fe270e,
|
||||
0x41fea92b,
|
||||
0x41ff2a1c,
|
||||
0x420327a2,
|
||||
0x420827c4,
|
||||
0x4208a800,
|
||||
0x420926f2,
|
||||
0x4209a83a,
|
||||
0x420a2749,
|
||||
0x420aa729,
|
||||
0x420b2769,
|
||||
0x420ba7e2,
|
||||
0x420c2a38,
|
||||
0x420ca8f8,
|
||||
0x420d2912,
|
||||
0x420da949,
|
||||
0x42122963,
|
||||
0x421729ff,
|
||||
0x4217a9a5,
|
||||
0x421c29c7,
|
||||
0x421f2982,
|
||||
0x42212a4f,
|
||||
0x422629e2,
|
||||
0x422b2b1e,
|
||||
0x422baacc,
|
||||
0x422c2b06,
|
||||
0x422caa8b,
|
||||
0x422d2a6a,
|
||||
0x422daaeb,
|
||||
0x422e2ab1,
|
||||
0x40921bbe,
|
||||
0x4092ac3c,
|
||||
0x40932cfe,
|
||||
0x4093a020,
|
||||
0x40941da3,
|
||||
0x4094a8f9,
|
||||
0x4095248d,
|
||||
0x4095ae68,
|
||||
0x40962be8,
|
||||
0x40969fc8,
|
||||
0x4097206b,
|
||||
0x40979f6f,
|
||||
0x40981c1e,
|
||||
0x41f4279a,
|
||||
0x41f9282c,
|
||||
0x41fe271f,
|
||||
0x41fea93c,
|
||||
0x41ff2a2d,
|
||||
0x420327b3,
|
||||
0x420827d5,
|
||||
0x4208a811,
|
||||
0x42092703,
|
||||
0x4209a84b,
|
||||
0x420a275a,
|
||||
0x420aa73a,
|
||||
0x420b277a,
|
||||
0x420ba7f3,
|
||||
0x420c2a49,
|
||||
0x420ca909,
|
||||
0x420d2923,
|
||||
0x420da95a,
|
||||
0x42122974,
|
||||
0x42172a10,
|
||||
0x4217a9b6,
|
||||
0x421c29d8,
|
||||
0x421f2993,
|
||||
0x42212a60,
|
||||
0x422629f3,
|
||||
0x422b2b2f,
|
||||
0x422baadd,
|
||||
0x422c2b17,
|
||||
0x422caa9c,
|
||||
0x422d2a7b,
|
||||
0x422daafc,
|
||||
0x422e2ac2,
|
||||
0x4432072d,
|
||||
0x4432873c,
|
||||
0x44330748,
|
||||
@@ -651,69 +653,69 @@ const uint32_t kOpenSSLReasonValues[] = {
|
||||
0x4c411557,
|
||||
0x4c4193da,
|
||||
0x4c421543,
|
||||
0x50323141,
|
||||
0x5032b150,
|
||||
0x5033315b,
|
||||
0x5033b16b,
|
||||
0x50343184,
|
||||
0x5034b19e,
|
||||
0x503531ac,
|
||||
0x5035b1c2,
|
||||
0x503631d4,
|
||||
0x5036b1ea,
|
||||
0x50373203,
|
||||
0x5037b216,
|
||||
0x5038322e,
|
||||
0x5038b23f,
|
||||
0x50393254,
|
||||
0x5039b268,
|
||||
0x503a3288,
|
||||
0x503ab29e,
|
||||
0x503b32b6,
|
||||
0x503bb2c8,
|
||||
0x503c32e4,
|
||||
0x503cb2fb,
|
||||
0x503d3314,
|
||||
0x503db32a,
|
||||
0x503e3337,
|
||||
0x503eb34d,
|
||||
0x503f335f,
|
||||
0x50323152,
|
||||
0x5032b161,
|
||||
0x5033316c,
|
||||
0x5033b17c,
|
||||
0x50343195,
|
||||
0x5034b1af,
|
||||
0x503531bd,
|
||||
0x5035b1d3,
|
||||
0x503631e5,
|
||||
0x5036b1fb,
|
||||
0x50373214,
|
||||
0x5037b227,
|
||||
0x5038323f,
|
||||
0x5038b250,
|
||||
0x50393265,
|
||||
0x5039b279,
|
||||
0x503a3299,
|
||||
0x503ab2af,
|
||||
0x503b32c7,
|
||||
0x503bb2d9,
|
||||
0x503c32f5,
|
||||
0x503cb30c,
|
||||
0x503d3325,
|
||||
0x503db33b,
|
||||
0x503e3348,
|
||||
0x503eb35e,
|
||||
0x503f3370,
|
||||
0x503f837b,
|
||||
0x50403372,
|
||||
0x5040b382,
|
||||
0x5041339c,
|
||||
0x5041b3ab,
|
||||
0x504233c5,
|
||||
0x5042b3e2,
|
||||
0x504333f2,
|
||||
0x5043b402,
|
||||
0x50443411,
|
||||
0x50403383,
|
||||
0x5040b393,
|
||||
0x504133ad,
|
||||
0x5041b3bc,
|
||||
0x504233d6,
|
||||
0x5042b3f3,
|
||||
0x50433403,
|
||||
0x5043b413,
|
||||
0x50443422,
|
||||
0x50448431,
|
||||
0x50453425,
|
||||
0x5045b443,
|
||||
0x50463456,
|
||||
0x5046b46c,
|
||||
0x5047347e,
|
||||
0x5047b493,
|
||||
0x504834b9,
|
||||
0x5048b4c7,
|
||||
0x504934da,
|
||||
0x5049b4ef,
|
||||
0x504a3505,
|
||||
0x504ab515,
|
||||
0x504b3535,
|
||||
0x504bb548,
|
||||
0x504c356b,
|
||||
0x504cb599,
|
||||
0x504d35ab,
|
||||
0x504db5c8,
|
||||
0x504e35e3,
|
||||
0x504eb5ff,
|
||||
0x504f3611,
|
||||
0x504fb628,
|
||||
0x50503637,
|
||||
0x50453436,
|
||||
0x5045b454,
|
||||
0x50463467,
|
||||
0x5046b47d,
|
||||
0x5047348f,
|
||||
0x5047b4a4,
|
||||
0x504834ca,
|
||||
0x5048b4d8,
|
||||
0x504934eb,
|
||||
0x5049b500,
|
||||
0x504a3516,
|
||||
0x504ab526,
|
||||
0x504b3546,
|
||||
0x504bb559,
|
||||
0x504c357c,
|
||||
0x504cb5aa,
|
||||
0x504d35bc,
|
||||
0x504db5d9,
|
||||
0x504e35f4,
|
||||
0x504eb610,
|
||||
0x504f3622,
|
||||
0x504fb639,
|
||||
0x50503648,
|
||||
0x505086f1,
|
||||
0x5051364a,
|
||||
0x5051365b,
|
||||
0x58320f65,
|
||||
0x68320f27,
|
||||
0x68328c7f,
|
||||
@@ -755,6 +757,8 @@ const uint32_t kOpenSSLReasonValues[] = {
|
||||
0x783e0aa2,
|
||||
0x783e8a54,
|
||||
0x7c3211d7,
|
||||
0x843213ed,
|
||||
0x84328083,
|
||||
};
|
||||
|
||||
const size_t kOpenSSLReasonValuesLen = sizeof(kOpenSSLReasonValues) / sizeof(kOpenSSLReasonValues[0]);
|
||||
@@ -1109,7 +1113,6 @@ const char kOpenSSLReasonStringData[] =
|
||||
"BAD_WRITE_RETRY\0"
|
||||
"BIO_NOT_SET\0"
|
||||
"BLOCK_CIPHER_PAD_IS_WRONG\0"
|
||||
"BUFFERED_MESSAGES_ON_CIPHER_CHANGE\0"
|
||||
"CANNOT_HAVE_BOTH_PRIVKEY_AND_METHOD\0"
|
||||
"CANNOT_PARSE_LEAF_CERT\0"
|
||||
"CA_DN_LENGTH_MISMATCH\0"
|
||||
@@ -1122,6 +1125,7 @@ const char kOpenSSLReasonStringData[] =
|
||||
"CERT_LENGTH_MISMATCH\0"
|
||||
"CHANNEL_ID_NOT_P256\0"
|
||||
"CHANNEL_ID_SIGNATURE_INVALID\0"
|
||||
"CIPHER_MISMATCH_ON_EARLY_DATA\0"
|
||||
"CIPHER_OR_HASH_UNAVAILABLE\0"
|
||||
"CLIENTHELLO_PARSE_FAILED\0"
|
||||
"CLIENTHELLO_TLSEXT\0"
|
||||
@@ -1148,6 +1152,7 @@ const char kOpenSSLReasonStringData[] =
|
||||
"ERROR_IN_RECEIVED_CIPHER_LIST\0"
|
||||
"ERROR_PARSING_EXTENSION\0"
|
||||
"EXCESSIVE_MESSAGE_SIZE\0"
|
||||
"EXCESS_HANDSHAKE_DATA\0"
|
||||
"EXTRA_DATA_IN_MESSAGE\0"
|
||||
"FRAGMENT_MISMATCH\0"
|
||||
"GOT_NEXT_PROTO_WITHOUT_EXTENSION\0"
|
||||
|
||||
@@ -472,7 +472,7 @@ static void aes_nohw_transpose(AES_NOHW_BATCH *batch) {
|
||||
// |num_blocks| must be at most |AES_NOHW_BATCH|.
|
||||
static void aes_nohw_to_batch(AES_NOHW_BATCH *out, const uint8_t *in,
|
||||
size_t num_blocks) {
|
||||
// Don't leave unused blocks unitialized.
|
||||
// Don't leave unused blocks uninitialized.
|
||||
memset(out, 0, sizeof(AES_NOHW_BATCH));
|
||||
assert(num_blocks <= AES_NOHW_BATCH_SIZE);
|
||||
for (size_t i = 0; i < num_blocks; i++) {
|
||||
|
||||
@@ -995,553 +995,6 @@ bn_sub_words:
|
||||
popl %ebp
|
||||
ret
|
||||
.size bn_sub_words,.-.L_bn_sub_words_begin
|
||||
.globl bn_sub_part_words
|
||||
.hidden bn_sub_part_words
|
||||
.type bn_sub_part_words,@function
|
||||
.align 16
|
||||
bn_sub_part_words:
|
||||
.L_bn_sub_part_words_begin:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
|
||||
movl 20(%esp),%ebx
|
||||
movl 24(%esp),%esi
|
||||
movl 28(%esp),%edi
|
||||
movl 32(%esp),%ebp
|
||||
xorl %eax,%eax
|
||||
andl $4294967288,%ebp
|
||||
jz .L029aw_finish
|
||||
.L030aw_loop:
|
||||
|
||||
movl (%esi),%ecx
|
||||
movl (%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,(%ebx)
|
||||
|
||||
movl 4(%esi),%ecx
|
||||
movl 4(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,4(%ebx)
|
||||
|
||||
movl 8(%esi),%ecx
|
||||
movl 8(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,8(%ebx)
|
||||
|
||||
movl 12(%esi),%ecx
|
||||
movl 12(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,12(%ebx)
|
||||
|
||||
movl 16(%esi),%ecx
|
||||
movl 16(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,16(%ebx)
|
||||
|
||||
movl 20(%esi),%ecx
|
||||
movl 20(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,20(%ebx)
|
||||
|
||||
movl 24(%esi),%ecx
|
||||
movl 24(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,24(%ebx)
|
||||
|
||||
movl 28(%esi),%ecx
|
||||
movl 28(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,28(%ebx)
|
||||
|
||||
addl $32,%esi
|
||||
addl $32,%edi
|
||||
addl $32,%ebx
|
||||
subl $8,%ebp
|
||||
jnz .L030aw_loop
|
||||
.L029aw_finish:
|
||||
movl 32(%esp),%ebp
|
||||
andl $7,%ebp
|
||||
jz .L031aw_end
|
||||
|
||||
movl (%esi),%ecx
|
||||
movl (%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,(%ebx)
|
||||
addl $4,%esi
|
||||
addl $4,%edi
|
||||
addl $4,%ebx
|
||||
decl %ebp
|
||||
jz .L031aw_end
|
||||
|
||||
movl (%esi),%ecx
|
||||
movl (%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,(%ebx)
|
||||
addl $4,%esi
|
||||
addl $4,%edi
|
||||
addl $4,%ebx
|
||||
decl %ebp
|
||||
jz .L031aw_end
|
||||
|
||||
movl (%esi),%ecx
|
||||
movl (%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,(%ebx)
|
||||
addl $4,%esi
|
||||
addl $4,%edi
|
||||
addl $4,%ebx
|
||||
decl %ebp
|
||||
jz .L031aw_end
|
||||
|
||||
movl (%esi),%ecx
|
||||
movl (%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,(%ebx)
|
||||
addl $4,%esi
|
||||
addl $4,%edi
|
||||
addl $4,%ebx
|
||||
decl %ebp
|
||||
jz .L031aw_end
|
||||
|
||||
movl (%esi),%ecx
|
||||
movl (%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,(%ebx)
|
||||
addl $4,%esi
|
||||
addl $4,%edi
|
||||
addl $4,%ebx
|
||||
decl %ebp
|
||||
jz .L031aw_end
|
||||
|
||||
movl (%esi),%ecx
|
||||
movl (%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,(%ebx)
|
||||
addl $4,%esi
|
||||
addl $4,%edi
|
||||
addl $4,%ebx
|
||||
decl %ebp
|
||||
jz .L031aw_end
|
||||
|
||||
movl (%esi),%ecx
|
||||
movl (%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,(%ebx)
|
||||
addl $4,%esi
|
||||
addl $4,%edi
|
||||
addl $4,%ebx
|
||||
.L031aw_end:
|
||||
cmpl $0,36(%esp)
|
||||
je .L032pw_end
|
||||
movl 36(%esp),%ebp
|
||||
cmpl $0,%ebp
|
||||
je .L032pw_end
|
||||
jge .L033pw_pos
|
||||
|
||||
movl $0,%edx
|
||||
subl %ebp,%edx
|
||||
movl %edx,%ebp
|
||||
andl $4294967288,%ebp
|
||||
jz .L034pw_neg_finish
|
||||
.L035pw_neg_loop:
|
||||
|
||||
movl $0,%ecx
|
||||
movl (%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,(%ebx)
|
||||
|
||||
movl $0,%ecx
|
||||
movl 4(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,4(%ebx)
|
||||
|
||||
movl $0,%ecx
|
||||
movl 8(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,8(%ebx)
|
||||
|
||||
movl $0,%ecx
|
||||
movl 12(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,12(%ebx)
|
||||
|
||||
movl $0,%ecx
|
||||
movl 16(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,16(%ebx)
|
||||
|
||||
movl $0,%ecx
|
||||
movl 20(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,20(%ebx)
|
||||
|
||||
movl $0,%ecx
|
||||
movl 24(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,24(%ebx)
|
||||
|
||||
movl $0,%ecx
|
||||
movl 28(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,28(%ebx)
|
||||
|
||||
addl $32,%edi
|
||||
addl $32,%ebx
|
||||
subl $8,%ebp
|
||||
jnz .L035pw_neg_loop
|
||||
.L034pw_neg_finish:
|
||||
movl 36(%esp),%edx
|
||||
movl $0,%ebp
|
||||
subl %edx,%ebp
|
||||
andl $7,%ebp
|
||||
jz .L032pw_end
|
||||
|
||||
movl $0,%ecx
|
||||
movl (%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
decl %ebp
|
||||
movl %ecx,(%ebx)
|
||||
jz .L032pw_end
|
||||
|
||||
movl $0,%ecx
|
||||
movl 4(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
decl %ebp
|
||||
movl %ecx,4(%ebx)
|
||||
jz .L032pw_end
|
||||
|
||||
movl $0,%ecx
|
||||
movl 8(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
decl %ebp
|
||||
movl %ecx,8(%ebx)
|
||||
jz .L032pw_end
|
||||
|
||||
movl $0,%ecx
|
||||
movl 12(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
decl %ebp
|
||||
movl %ecx,12(%ebx)
|
||||
jz .L032pw_end
|
||||
|
||||
movl $0,%ecx
|
||||
movl 16(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
decl %ebp
|
||||
movl %ecx,16(%ebx)
|
||||
jz .L032pw_end
|
||||
|
||||
movl $0,%ecx
|
||||
movl 20(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
decl %ebp
|
||||
movl %ecx,20(%ebx)
|
||||
jz .L032pw_end
|
||||
|
||||
movl $0,%ecx
|
||||
movl 24(%edi),%edx
|
||||
subl %eax,%ecx
|
||||
movl $0,%eax
|
||||
adcl %eax,%eax
|
||||
subl %edx,%ecx
|
||||
adcl $0,%eax
|
||||
movl %ecx,24(%ebx)
|
||||
jmp .L032pw_end
|
||||
.L033pw_pos:
|
||||
andl $4294967288,%ebp
|
||||
jz .L036pw_pos_finish
|
||||
.L037pw_pos_loop:
|
||||
|
||||
movl (%esi),%ecx
|
||||
subl %eax,%ecx
|
||||
movl %ecx,(%ebx)
|
||||
jnc .L038pw_nc0
|
||||
|
||||
movl 4(%esi),%ecx
|
||||
subl %eax,%ecx
|
||||
movl %ecx,4(%ebx)
|
||||
jnc .L039pw_nc1
|
||||
|
||||
movl 8(%esi),%ecx
|
||||
subl %eax,%ecx
|
||||
movl %ecx,8(%ebx)
|
||||
jnc .L040pw_nc2
|
||||
|
||||
movl 12(%esi),%ecx
|
||||
subl %eax,%ecx
|
||||
movl %ecx,12(%ebx)
|
||||
jnc .L041pw_nc3
|
||||
|
||||
movl 16(%esi),%ecx
|
||||
subl %eax,%ecx
|
||||
movl %ecx,16(%ebx)
|
||||
jnc .L042pw_nc4
|
||||
|
||||
movl 20(%esi),%ecx
|
||||
subl %eax,%ecx
|
||||
movl %ecx,20(%ebx)
|
||||
jnc .L043pw_nc5
|
||||
|
||||
movl 24(%esi),%ecx
|
||||
subl %eax,%ecx
|
||||
movl %ecx,24(%ebx)
|
||||
jnc .L044pw_nc6
|
||||
|
||||
movl 28(%esi),%ecx
|
||||
subl %eax,%ecx
|
||||
movl %ecx,28(%ebx)
|
||||
jnc .L045pw_nc7
|
||||
|
||||
addl $32,%esi
|
||||
addl $32,%ebx
|
||||
subl $8,%ebp
|
||||
jnz .L037pw_pos_loop
|
||||
.L036pw_pos_finish:
|
||||
movl 36(%esp),%ebp
|
||||
andl $7,%ebp
|
||||
jz .L032pw_end
|
||||
|
||||
movl (%esi),%ecx
|
||||
subl %eax,%ecx
|
||||
movl %ecx,(%ebx)
|
||||
jnc .L046pw_tail_nc0
|
||||
decl %ebp
|
||||
jz .L032pw_end
|
||||
|
||||
movl 4(%esi),%ecx
|
||||
subl %eax,%ecx
|
||||
movl %ecx,4(%ebx)
|
||||
jnc .L047pw_tail_nc1
|
||||
decl %ebp
|
||||
jz .L032pw_end
|
||||
|
||||
movl 8(%esi),%ecx
|
||||
subl %eax,%ecx
|
||||
movl %ecx,8(%ebx)
|
||||
jnc .L048pw_tail_nc2
|
||||
decl %ebp
|
||||
jz .L032pw_end
|
||||
|
||||
movl 12(%esi),%ecx
|
||||
subl %eax,%ecx
|
||||
movl %ecx,12(%ebx)
|
||||
jnc .L049pw_tail_nc3
|
||||
decl %ebp
|
||||
jz .L032pw_end
|
||||
|
||||
movl 16(%esi),%ecx
|
||||
subl %eax,%ecx
|
||||
movl %ecx,16(%ebx)
|
||||
jnc .L050pw_tail_nc4
|
||||
decl %ebp
|
||||
jz .L032pw_end
|
||||
|
||||
movl 20(%esi),%ecx
|
||||
subl %eax,%ecx
|
||||
movl %ecx,20(%ebx)
|
||||
jnc .L051pw_tail_nc5
|
||||
decl %ebp
|
||||
jz .L032pw_end
|
||||
|
||||
movl 24(%esi),%ecx
|
||||
subl %eax,%ecx
|
||||
movl %ecx,24(%ebx)
|
||||
jnc .L052pw_tail_nc6
|
||||
movl $1,%eax
|
||||
jmp .L032pw_end
|
||||
.L053pw_nc_loop:
|
||||
movl (%esi),%ecx
|
||||
movl %ecx,(%ebx)
|
||||
.L038pw_nc0:
|
||||
movl 4(%esi),%ecx
|
||||
movl %ecx,4(%ebx)
|
||||
.L039pw_nc1:
|
||||
movl 8(%esi),%ecx
|
||||
movl %ecx,8(%ebx)
|
||||
.L040pw_nc2:
|
||||
movl 12(%esi),%ecx
|
||||
movl %ecx,12(%ebx)
|
||||
.L041pw_nc3:
|
||||
movl 16(%esi),%ecx
|
||||
movl %ecx,16(%ebx)
|
||||
.L042pw_nc4:
|
||||
movl 20(%esi),%ecx
|
||||
movl %ecx,20(%ebx)
|
||||
.L043pw_nc5:
|
||||
movl 24(%esi),%ecx
|
||||
movl %ecx,24(%ebx)
|
||||
.L044pw_nc6:
|
||||
movl 28(%esi),%ecx
|
||||
movl %ecx,28(%ebx)
|
||||
.L045pw_nc7:
|
||||
|
||||
addl $32,%esi
|
||||
addl $32,%ebx
|
||||
subl $8,%ebp
|
||||
jnz .L053pw_nc_loop
|
||||
movl 36(%esp),%ebp
|
||||
andl $7,%ebp
|
||||
jz .L054pw_nc_end
|
||||
movl (%esi),%ecx
|
||||
movl %ecx,(%ebx)
|
||||
.L046pw_tail_nc0:
|
||||
decl %ebp
|
||||
jz .L054pw_nc_end
|
||||
movl 4(%esi),%ecx
|
||||
movl %ecx,4(%ebx)
|
||||
.L047pw_tail_nc1:
|
||||
decl %ebp
|
||||
jz .L054pw_nc_end
|
||||
movl 8(%esi),%ecx
|
||||
movl %ecx,8(%ebx)
|
||||
.L048pw_tail_nc2:
|
||||
decl %ebp
|
||||
jz .L054pw_nc_end
|
||||
movl 12(%esi),%ecx
|
||||
movl %ecx,12(%ebx)
|
||||
.L049pw_tail_nc3:
|
||||
decl %ebp
|
||||
jz .L054pw_nc_end
|
||||
movl 16(%esi),%ecx
|
||||
movl %ecx,16(%ebx)
|
||||
.L050pw_tail_nc4:
|
||||
decl %ebp
|
||||
jz .L054pw_nc_end
|
||||
movl 20(%esi),%ecx
|
||||
movl %ecx,20(%ebx)
|
||||
.L051pw_tail_nc5:
|
||||
decl %ebp
|
||||
jz .L054pw_nc_end
|
||||
movl 24(%esi),%ecx
|
||||
movl %ecx,24(%ebx)
|
||||
.L052pw_tail_nc6:
|
||||
.L054pw_nc_end:
|
||||
movl $0,%eax
|
||||
.L032pw_end:
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
.size bn_sub_part_words,.-.L_bn_sub_part_words_begin
|
||||
#endif
|
||||
.section .note.GNU-stack,"",@progbits
|
||||
#endif // defined(__i386__) && defined(__linux__)
|
||||
|
||||
@@ -119,16 +119,13 @@ static void bn_mul_normal(BN_ULONG *r, const BN_ULONG *a, size_t na,
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(OPENSSL_X86) || defined(OPENSSL_NO_ASM)
|
||||
// Here follows specialised variants of bn_add_words() and bn_sub_words(). They
|
||||
// have the property performing operations on arrays of different sizes. The
|
||||
// sizes of those arrays is expressed through cl, which is the common length (
|
||||
// basicall, min(len(a),len(b)) ), and dl, which is the delta between the two
|
||||
// lengths, calculated as len(a)-len(b). All lengths are the number of
|
||||
// BN_ULONGs... For the operations that require a result array as parameter,
|
||||
// it must have the length cl+abs(dl). These functions should probably end up
|
||||
// in bn_asm.c as soon as there are assembler counterparts for the systems that
|
||||
// use assembler files.
|
||||
// it must have the length cl+abs(dl).
|
||||
|
||||
static BN_ULONG bn_sub_part_words(BN_ULONG *r, const BN_ULONG *a,
|
||||
const BN_ULONG *b, int cl, int dl) {
|
||||
@@ -282,11 +279,6 @@ static BN_ULONG bn_sub_part_words(BN_ULONG *r, const BN_ULONG *a,
|
||||
|
||||
return c;
|
||||
}
|
||||
#else
|
||||
// On other platforms the function is defined in asm.
|
||||
BN_ULONG bn_sub_part_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
|
||||
int cl, int dl);
|
||||
#endif
|
||||
|
||||
// bn_abs_sub_part_words computes |r| = |a| - |b|, storing the absolute value
|
||||
// and returning a mask of all ones if the result was negative and all zeros if
|
||||
@@ -294,8 +286,7 @@ BN_ULONG bn_sub_part_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
|
||||
// convention.
|
||||
//
|
||||
// TODO(davidben): Make this take |size_t|. The |cl| + |dl| calling convention
|
||||
// is confusing. The trouble is 32-bit x86 implements |bn_sub_part_words| in
|
||||
// assembly, but we can probably just delete it?
|
||||
// is confusing.
|
||||
static BN_ULONG bn_abs_sub_part_words(BN_ULONG *r, const BN_ULONG *a,
|
||||
const BN_ULONG *b, int cl, int dl,
|
||||
BN_ULONG *tmp) {
|
||||
|
||||
@@ -284,6 +284,18 @@ int ec_felem_equal(const EC_GROUP *group, const EC_FELEM *a, const EC_FELEM *b);
|
||||
OPENSSL_EXPORT int ec_bignum_to_scalar(const EC_GROUP *group, EC_SCALAR *out,
|
||||
const BIGNUM *in);
|
||||
|
||||
// ec_scalar_to_bytes serializes |in| as a big-endian bytestring to |out| and
|
||||
// sets |*out_len| to the number of bytes written. The number of bytes written
|
||||
// is |BN_num_bytes(&group->order)|, which is at most |EC_MAX_BYTES|.
|
||||
void ec_scalar_to_bytes(const EC_GROUP *group, uint8_t *out, size_t *out_len,
|
||||
const EC_SCALAR *in);
|
||||
|
||||
// ec_scalar_from_bytes deserializes |in| and stores the resulting scalar over
|
||||
// group |group| to |out|. It returns one on success and zero if |in| is
|
||||
// invalid.
|
||||
int ec_scalar_from_bytes(const EC_GROUP *group, EC_SCALAR *out,
|
||||
const uint8_t *in, size_t len);
|
||||
|
||||
// ec_random_nonzero_scalar sets |out| to a uniformly selected random value from
|
||||
// 1 to |group->order| - 1. It returns one on success and zero on error.
|
||||
int ec_random_nonzero_scalar(const EC_GROUP *group, EC_SCALAR *out,
|
||||
@@ -334,9 +346,9 @@ int ec_point_mul_scalar(const EC_GROUP *group, EC_RAW_POINT *r,
|
||||
int ec_point_mul_scalar_base(const EC_GROUP *group, EC_RAW_POINT *r,
|
||||
const EC_SCALAR *scalar);
|
||||
|
||||
// ec_point_mul_scalar_public performs the same computation as
|
||||
// ec_point_mul_scalar. It further assumes that the inputs are public so
|
||||
// there is no concern about leaking their values through timing.
|
||||
// ec_point_mul_scalar_public sets |r| to
|
||||
// generator * |g_scalar| + |p| * |p_scalar|. It assumes that the inputs are
|
||||
// public so there is no concern about leaking their values through timing.
|
||||
OPENSSL_EXPORT int ec_point_mul_scalar_public(const EC_GROUP *group,
|
||||
EC_RAW_POINT *r,
|
||||
const EC_SCALAR *g_scalar,
|
||||
|
||||
@@ -51,6 +51,36 @@ int ec_random_nonzero_scalar(const EC_GROUP *group, EC_SCALAR *out,
|
||||
additional_data);
|
||||
}
|
||||
|
||||
void ec_scalar_to_bytes(const EC_GROUP *group, uint8_t *out, size_t *out_len,
|
||||
const EC_SCALAR *in) {
|
||||
size_t len = BN_num_bytes(&group->order);
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
out[len - i - 1] = in->bytes[i];
|
||||
}
|
||||
*out_len = len;
|
||||
}
|
||||
|
||||
int ec_scalar_from_bytes(const EC_GROUP *group, EC_SCALAR *out,
|
||||
const uint8_t *in, size_t len) {
|
||||
if (len != BN_num_bytes(&group->order)) {
|
||||
OPENSSL_PUT_ERROR(EC, EC_R_INVALID_SCALAR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
OPENSSL_memset(out, 0, sizeof(EC_SCALAR));
|
||||
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
out->bytes[i] = in[len - i - 1];
|
||||
}
|
||||
|
||||
if (!bn_less_than_words(out->words, group->order.d, group->order.width)) {
|
||||
OPENSSL_PUT_ERROR(EC, EC_R_INVALID_SCALAR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ec_scalar_add(const EC_GROUP *group, EC_SCALAR *r, const EC_SCALAR *a,
|
||||
const EC_SCALAR *b) {
|
||||
const BIGNUM *order = &group->order;
|
||||
|
||||
@@ -122,6 +122,14 @@ void ECDSA_SIG_free(ECDSA_SIG *sig) {
|
||||
OPENSSL_free(sig);
|
||||
}
|
||||
|
||||
const BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig) {
|
||||
return sig->r;
|
||||
}
|
||||
|
||||
const BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig) {
|
||||
return sig->s;
|
||||
}
|
||||
|
||||
void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **out_r,
|
||||
const BIGNUM **out_s) {
|
||||
if (out_r != NULL) {
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/* Copyright (c) 2020, Google Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
||||
|
||||
#ifndef OPENSSL_HEADER_CRYPTO_RAND_GETRANDOM_FILLIN_H
|
||||
#define OPENSSL_HEADER_CRYPTO_RAND_GETRANDOM_FILLIN_H
|
||||
|
||||
#include <CCryptoBoringSSL_base.h>
|
||||
|
||||
|
||||
#if defined(OPENSSL_LINUX)
|
||||
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#if defined(OPENSSL_X86_64)
|
||||
#define EXPECTED_NR_getrandom 318
|
||||
#elif defined(OPENSSL_X86)
|
||||
#define EXPECTED_NR_getrandom 355
|
||||
#elif defined(OPENSSL_AARCH64)
|
||||
#define EXPECTED_NR_getrandom 278
|
||||
#elif defined(OPENSSL_ARM)
|
||||
#define EXPECTED_NR_getrandom 384
|
||||
#elif defined(OPENSSL_PPC64LE)
|
||||
#define EXPECTED_NR_getrandom 359
|
||||
#endif
|
||||
|
||||
#if defined(EXPECTED_NR_getrandom)
|
||||
#define USE_NR_getrandom
|
||||
|
||||
#if defined(__NR_getrandom)
|
||||
|
||||
#if __NR_getrandom != EXPECTED_NR_getrandom
|
||||
#error "system call number for getrandom is not the expected value"
|
||||
#endif
|
||||
|
||||
#else // __NR_getrandom
|
||||
|
||||
#define __NR_getrandom EXPECTED_NR_getrandom
|
||||
|
||||
#endif // __NR_getrandom
|
||||
|
||||
#endif // EXPECTED_NR_getrandom
|
||||
|
||||
#if !defined(GRND_NONBLOCK)
|
||||
#define GRND_NONBLOCK 1
|
||||
#endif
|
||||
#if !defined(GRND_RANDOM)
|
||||
#define GRND_RANDOM 2
|
||||
#endif
|
||||
|
||||
#endif // OPENSSL_LINUX
|
||||
|
||||
|
||||
#endif // OPENSSL_HEADER_CRYPTO_RAND_GETRANDOM_FILLIN_H
|
||||
@@ -65,38 +65,12 @@
|
||||
#include <CCryptoBoringSSL_thread.h>
|
||||
#include <CCryptoBoringSSL_mem.h>
|
||||
|
||||
#include "getrandom_fillin.h"
|
||||
#include "../delocate.h"
|
||||
#include "../../internal.h"
|
||||
|
||||
|
||||
#if defined(OPENSSL_LINUX)
|
||||
|
||||
#if defined(OPENSSL_X86_64)
|
||||
#define EXPECTED_NR_getrandom 318
|
||||
#elif defined(OPENSSL_X86)
|
||||
#define EXPECTED_NR_getrandom 355
|
||||
#elif defined(OPENSSL_AARCH64)
|
||||
#define EXPECTED_NR_getrandom 278
|
||||
#elif defined(OPENSSL_ARM)
|
||||
#define EXPECTED_NR_getrandom 384
|
||||
#elif defined(OPENSSL_PPC64LE)
|
||||
#define EXPECTED_NR_getrandom 359
|
||||
#endif
|
||||
|
||||
#if defined(EXPECTED_NR_getrandom)
|
||||
#define USE_NR_getrandom
|
||||
|
||||
#if defined(__NR_getrandom)
|
||||
|
||||
#if __NR_getrandom != EXPECTED_NR_getrandom
|
||||
#error "system call number for getrandom is not the expected value"
|
||||
#endif
|
||||
|
||||
#else // __NR_getrandom
|
||||
|
||||
#define __NR_getrandom EXPECTED_NR_getrandom
|
||||
|
||||
#endif // __NR_getrandom
|
||||
#if defined(USE_NR_getrandom)
|
||||
|
||||
#if defined(OPENSSL_MSAN)
|
||||
void __msan_unpoison(void *, size_t);
|
||||
@@ -119,16 +93,7 @@ static ssize_t boringssl_getrandom(void *buf, size_t buf_len, unsigned flags) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif // EXPECTED_NR_getrandom
|
||||
|
||||
#if !defined(GRND_NONBLOCK)
|
||||
#define GRND_NONBLOCK 1
|
||||
#endif
|
||||
#if !defined(GRND_RANDOM)
|
||||
#define GRND_RANDOM 2
|
||||
#endif
|
||||
|
||||
#endif // OPENSSL_LINUX
|
||||
#endif // USE_NR_getrandom
|
||||
|
||||
// rand_lock is used to protect the |*_requested| variables.
|
||||
DEFINE_STATIC_MUTEX(rand_lock)
|
||||
|
||||
@@ -167,6 +167,22 @@ int RSA_up_ref(RSA *rsa) {
|
||||
|
||||
unsigned RSA_bits(const RSA *rsa) { return BN_num_bits(rsa->n); }
|
||||
|
||||
const BIGNUM *RSA_get0_n(const RSA *rsa) { return rsa->n; }
|
||||
|
||||
const BIGNUM *RSA_get0_e(const RSA *rsa) { return rsa->e; }
|
||||
|
||||
const BIGNUM *RSA_get0_d(const RSA *rsa) { return rsa->d; }
|
||||
|
||||
const BIGNUM *RSA_get0_p(const RSA *rsa) { return rsa->p; }
|
||||
|
||||
const BIGNUM *RSA_get0_q(const RSA *rsa) { return rsa->q; }
|
||||
|
||||
const BIGNUM *RSA_get0_dmp1(const RSA *rsa) { return rsa->dmp1; }
|
||||
|
||||
const BIGNUM *RSA_get0_dmq1(const RSA *rsa) { return rsa->dmq1; }
|
||||
|
||||
const BIGNUM *RSA_get0_iqmp(const RSA *rsa) { return rsa->iqmp; }
|
||||
|
||||
void RSA_get0_key(const RSA *rsa, const BIGNUM **out_n, const BIGNUM **out_e,
|
||||
const BIGNUM **out_d) {
|
||||
if (out_n != NULL) {
|
||||
|
||||
@@ -368,7 +368,7 @@ static BN_BLINDING *rsa_blinding_get(RSA *rsa, unsigned *index_used,
|
||||
CRYPTO_MUTEX_lock_write(&rsa->lock);
|
||||
|
||||
uint8_t *const free_inuse_flag =
|
||||
memchr(rsa->blindings_inuse, 0, rsa->num_blindings);
|
||||
OPENSSL_memchr(rsa->blindings_inuse, 0, rsa->num_blindings);
|
||||
if (free_inuse_flag != NULL) {
|
||||
*free_inuse_flag = 1;
|
||||
*index_used = free_inuse_flag - rsa->blindings_inuse;
|
||||
|
||||
@@ -689,6 +689,10 @@ OPENSSL_EXPORT void CRYPTO_free_ex_data(CRYPTO_EX_DATA_CLASS *ex_data_class,
|
||||
// Endianness conversions.
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 2
|
||||
static inline uint16_t CRYPTO_bswap2(uint16_t x) {
|
||||
return __builtin_bswap16(x);
|
||||
}
|
||||
|
||||
static inline uint32_t CRYPTO_bswap4(uint32_t x) {
|
||||
return __builtin_bswap32(x);
|
||||
}
|
||||
@@ -700,7 +704,11 @@ static inline uint64_t CRYPTO_bswap8(uint64_t x) {
|
||||
OPENSSL_MSVC_PRAGMA(warning(push, 3))
|
||||
#include <stdlib.h>
|
||||
OPENSSL_MSVC_PRAGMA(warning(pop))
|
||||
#pragma intrinsic(_byteswap_uint64, _byteswap_ulong)
|
||||
#pragma intrinsic(_byteswap_uint64, _byteswap_ulong, _byteswap_ushort)
|
||||
static inline uint16_t CRYPTO_bswap2(uint16_t x) {
|
||||
return _byteswap_ushort(x);
|
||||
}
|
||||
|
||||
static inline uint32_t CRYPTO_bswap4(uint32_t x) {
|
||||
return _byteswap_ulong(x);
|
||||
}
|
||||
@@ -709,6 +717,10 @@ static inline uint64_t CRYPTO_bswap8(uint64_t x) {
|
||||
return _byteswap_uint64(x);
|
||||
}
|
||||
#else
|
||||
static inline uint16_t CRYPTO_bswap2(uint16_t x) {
|
||||
return (x >> 8) | (x << 8);
|
||||
}
|
||||
|
||||
static inline uint32_t CRYPTO_bswap4(uint32_t x) {
|
||||
x = (x >> 16) | (x << 16);
|
||||
x = ((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8);
|
||||
|
||||
@@ -84,7 +84,10 @@ static void __asan_unpoison_memory_region(const void *addr, size_t size) {}
|
||||
// Windows doesn't really support weak symbols as of May 2019, and Clang on
|
||||
// Windows will emit strong symbols instead. See
|
||||
// https://bugs.llvm.org/show_bug.cgi?id=37598
|
||||
#if defined(__GNUC__) || (defined(__clang__) && !defined(_MSC_VER))
|
||||
|
||||
// Swift Crypto disables this for compatibility with weird libraries. See
|
||||
// https://github.com/apple/swift-nio-ssl/issues/189
|
||||
#if 0
|
||||
// sdallocx is a sized |free| function. By passing the size (which we happen to
|
||||
// always know in BoringSSL), the malloc implementation can save work. We cannot
|
||||
// depend on |sdallocx| being available so we declare a wrapper that falls back
|
||||
@@ -105,6 +108,10 @@ void sdallocx(void *ptr, size_t size, int flags) {
|
||||
}
|
||||
|
||||
void *OPENSSL_malloc(size_t size) {
|
||||
if (size + OPENSSL_MALLOC_PREFIX < size) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *ptr = malloc(size + OPENSSL_MALLOC_PREFIX);
|
||||
if (ptr == NULL) {
|
||||
return NULL;
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
/* This file is generated by crypto/obj/objects.go. */
|
||||
|
||||
|
||||
#define NUM_NID 961
|
||||
#define NUM_NID 962
|
||||
|
||||
static const uint8_t kObjectData[] = {
|
||||
/* NID_rsadsi */
|
||||
@@ -7111,6 +7111,10 @@ static const uint8_t kObjectData[] = {
|
||||
0x01,
|
||||
0x0e,
|
||||
0x03,
|
||||
/* NID_X25519 */
|
||||
0x2b,
|
||||
0x65,
|
||||
0x6e,
|
||||
/* NID_ED25519 */
|
||||
0x2b,
|
||||
0x65,
|
||||
@@ -7119,6 +7123,10 @@ static const uint8_t kObjectData[] = {
|
||||
0x2b,
|
||||
0x65,
|
||||
0x71,
|
||||
/* NID_X448 */
|
||||
0x2b,
|
||||
0x65,
|
||||
0x6f,
|
||||
};
|
||||
|
||||
static const ASN1_OBJECT kObjects[NUM_NID] = {
|
||||
@@ -8747,8 +8755,8 @@ static const ASN1_OBJECT kObjects[NUM_NID] = {
|
||||
NID_dhSinglePass_cofactorDH_sha512kdf_scheme, 6, &kObjectData[6169], 0},
|
||||
{"dh-std-kdf", "dh-std-kdf", NID_dh_std_kdf, 0, NULL, 0},
|
||||
{"dh-cofactor-kdf", "dh-cofactor-kdf", NID_dh_cofactor_kdf, 0, NULL, 0},
|
||||
{"X25519", "X25519", NID_X25519, 0, NULL, 0},
|
||||
{"ED25519", "ED25519", NID_ED25519, 3, &kObjectData[6175], 0},
|
||||
{"X25519", "X25519", NID_X25519, 3, &kObjectData[6175], 0},
|
||||
{"ED25519", "ED25519", NID_ED25519, 3, &kObjectData[6178], 0},
|
||||
{"ChaCha20-Poly1305", "chacha20-poly1305", NID_chacha20_poly1305, 0, NULL,
|
||||
0},
|
||||
{"KxRSA", "kx-rsa", NID_kx_rsa, 0, NULL, 0},
|
||||
@@ -8760,7 +8768,8 @@ static const ASN1_OBJECT kObjects[NUM_NID] = {
|
||||
{"KxANY", "kx-any", NID_kx_any, 0, NULL, 0},
|
||||
{"AuthANY", "auth-any", NID_auth_any, 0, NULL, 0},
|
||||
{"CECPQ2", "CECPQ2", NID_CECPQ2, 0, NULL, 0},
|
||||
{"ED448", "ED448", NID_ED448, 3, &kObjectData[6178], 0},
|
||||
{"ED448", "ED448", NID_ED448, 3, &kObjectData[6181], 0},
|
||||
{"X448", "X448", NID_X448, 3, &kObjectData[6184], 0},
|
||||
};
|
||||
|
||||
static const uint16_t kNIDsInShortNameOrder[] = {
|
||||
@@ -8958,6 +8967,7 @@ static const uint16_t kNIDsInShortNameOrder[] = {
|
||||
458 /* UID */,
|
||||
0 /* UNDEF */,
|
||||
948 /* X25519 */,
|
||||
961 /* X448 */,
|
||||
11 /* X500 */,
|
||||
378 /* X500algorithms */,
|
||||
12 /* X509 */,
|
||||
@@ -9828,6 +9838,7 @@ static const uint16_t kNIDsInLongNameOrder[] = {
|
||||
133 /* Time Stamping */,
|
||||
375 /* Trust Root */,
|
||||
948 /* X25519 */,
|
||||
961 /* X448 */,
|
||||
12 /* X509 */,
|
||||
402 /* X509v3 AC Targeting */,
|
||||
746 /* X509v3 Any Policy */,
|
||||
@@ -10674,8 +10685,8 @@ static const uint16_t kNIDsInLongNameOrder[] = {
|
||||
static const uint16_t kNIDsInOIDOrder[] = {
|
||||
434 /* 0.9 (OBJ_data) */,
|
||||
182 /* 1.2 (OBJ_member_body) */,
|
||||
676 /* 1.3 (OBJ_identified_organization) */,
|
||||
379 /* 1.3 (OBJ_org) */,
|
||||
676 /* 1.3 (OBJ_identified_organization) */,
|
||||
11 /* 2.5 (OBJ_X500) */,
|
||||
647 /* 2.23 (OBJ_international_organizations) */,
|
||||
380 /* 1.3.6 (OBJ_dod) */,
|
||||
@@ -10687,6 +10698,8 @@ static const uint16_t kNIDsInOIDOrder[] = {
|
||||
435 /* 0.9.2342 (OBJ_pss) */,
|
||||
183 /* 1.2.840 (OBJ_ISO_US) */,
|
||||
381 /* 1.3.6.1 (OBJ_iana) */,
|
||||
948 /* 1.3.101.110 (OBJ_X25519) */,
|
||||
961 /* 1.3.101.111 (OBJ_X448) */,
|
||||
949 /* 1.3.101.112 (OBJ_ED25519) */,
|
||||
960 /* 1.3.101.113 (OBJ_ED448) */,
|
||||
677 /* 1.3.132 (OBJ_certicom_arc) */,
|
||||
|
||||
@@ -23,12 +23,18 @@ OPENSSL_MSVC_PRAGMA(warning(push, 3))
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
|
||||
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
#include <bcrypt.h>
|
||||
OPENSSL_MSVC_PRAGMA(comment(lib, "bcrypt.lib"))
|
||||
#else
|
||||
// #define needed to link in RtlGenRandom(), a.k.a. SystemFunction036. See the
|
||||
// "Community Additions" comment on MSDN here:
|
||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa387694.aspx
|
||||
#define SystemFunction036 NTAPI SystemFunction036
|
||||
#include <ntsecapi.h>
|
||||
#undef SystemFunction036
|
||||
#endif // WINAPI_PARTITION_APP && !WINAPI_PARTITION_DESKTOP
|
||||
|
||||
OPENSSL_MSVC_PRAGMA(warning(pop))
|
||||
|
||||
@@ -41,7 +47,17 @@ void CRYPTO_sysrand(uint8_t *out, size_t requested) {
|
||||
if (requested < output_bytes_this_pass) {
|
||||
output_bytes_this_pass = (ULONG)requested;
|
||||
}
|
||||
// On non-UWP configurations, use RtlGenRandom instead of BCryptGenRandom
|
||||
// to avoid accessing resources that may be unavailable inside the
|
||||
// Chromium sandbox. See https://crbug.com/boringssl/307
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
|
||||
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
if (!BCRYPT_SUCCESS(BCryptGenRandom(
|
||||
/*hAlgorithm=*/NULL, out, output_bytes_this_pass,
|
||||
BCRYPT_USE_SYSTEM_PREFERRED_RNG))) {
|
||||
#else
|
||||
if (RtlGenRandom(out, output_bytes_this_pass) == FALSE) {
|
||||
#endif // WINAPI_PARTITION_APP && !WINAPI_PARTITION_DESKTOP
|
||||
abort();
|
||||
}
|
||||
requested -= output_bytes_this_pass;
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
/* Copyright (c) 2020, Google Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
||||
|
||||
#include <CCryptoBoringSSL_bn.h>
|
||||
#include <CCryptoBoringSSL_bytestring.h>
|
||||
#include <CCryptoBoringSSL_ec.h>
|
||||
#include <CCryptoBoringSSL_err.h>
|
||||
#include <CCryptoBoringSSL_mem.h>
|
||||
#include <CCryptoBoringSSL_nid.h>
|
||||
#include <CCryptoBoringSSL_trust_token.h>
|
||||
|
||||
#include "../fipsmodule/bn/internal.h"
|
||||
#include "../fipsmodule/ec/internal.h"
|
||||
|
||||
|
||||
// Privacy Pass uses a custom elliptic curve construction described in
|
||||
// https://eprint.iacr.org/2020/072.pdf (section 7, construction 4). Ths
|
||||
// construction provides anonymous tokens with private metadata and validity
|
||||
// verification.
|
||||
|
||||
// get_h returns a randomly selected point for the Privacy Pass protocol.
|
||||
//
|
||||
// x: 66591746412783875033873351891229753622964683369847172829242944646280287810
|
||||
// 81195403447871073952234683395256591180452378091073292247502091640572714366
|
||||
// 588045092
|
||||
// y: 12347430519393087872533727997980072129796839266949808299436682045034861065
|
||||
// 18810630511924722292325611253427311923464047364545304196431830383014967865
|
||||
// 162306253
|
||||
//
|
||||
// This point was generated with the following Python code.
|
||||
|
||||
/*
|
||||
import hashlib
|
||||
|
||||
SEED_H = 'PrivacyPass H'
|
||||
|
||||
A = -3
|
||||
B = 0x051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00
|
||||
P = 2**521 - 1
|
||||
|
||||
def get_y(x):
|
||||
y2 = (x**3 + A*x + B) % P
|
||||
y = pow(y2, (P+1)/4, P)
|
||||
if (y*y) % P != y2:
|
||||
raise ValueError("point not on curve")
|
||||
return y
|
||||
|
||||
def bit(h,i):
|
||||
return (ord(h[i/8]) >> (i%8)) & 1
|
||||
|
||||
b = 521
|
||||
def decode_point(so):
|
||||
s = hashlib.sha256(so + '0').digest() + hashlib.sha256(so + '1').digest() + \
|
||||
hashlib.sha256(so + '2').digest()
|
||||
|
||||
x = 0
|
||||
for i in range(0,b):
|
||||
x = x + (long(bit(s,i))<<i)
|
||||
if x >= P:
|
||||
raise ValueError("x out of range")
|
||||
y = get_y(x)
|
||||
if y & 1 != bit(s,b-1): y = P-y
|
||||
return (x, y)
|
||||
|
||||
|
||||
def gen_point(seed):
|
||||
v = hashlib.sha256(seed).digest()
|
||||
it = 1
|
||||
while True:
|
||||
try:
|
||||
x,y = decode_point(v)
|
||||
except Exception, e:
|
||||
print e
|
||||
it += 1
|
||||
v = hashlib.sha256(v).digest()
|
||||
continue
|
||||
print "Found in %d iterations:" % it
|
||||
print " x = %d" % x
|
||||
print " y = %d" % y
|
||||
print " Encoded (hex): (%x, %x)" % (x, y)
|
||||
return (x, y)
|
||||
|
||||
if __name__ == "__main__":
|
||||
gen_point(SEED_H)
|
||||
*/
|
||||
|
||||
static EC_POINT *get_h(void) {
|
||||
EC_GROUP *group = EC_GROUP_new_by_curve_name(NID_secp521r1);
|
||||
if (group == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const BN_ULONG kHGenX[] = {
|
||||
TOBN(0x3d01749f, 0xc51e4724),
|
||||
TOBN(0x31c28621, 0xf95c98b9),
|
||||
TOBN(0x6dc5392a, 0xd4ce846e),
|
||||
TOBN(0xda645354, 0x4ef9760d),
|
||||
TOBN(0x5945d13e, 0x25337e4c),
|
||||
TOBN(0xeb0f6bc0, 0x5c0ecefe),
|
||||
TOBN(0xab291003, 0x6f4ef5bd),
|
||||
TOBN(0xa9f79ebc, 0x126cefd1),
|
||||
0x000001f0,
|
||||
};
|
||||
static const BIGNUM kX = STATIC_BIGNUM(kHGenX);
|
||||
|
||||
static const BN_ULONG kHGenY[] = {
|
||||
TOBN(0xffa6a0ea, 0x966792cd),
|
||||
TOBN(0x6e783d17, 0x08e3df3c),
|
||||
TOBN(0xb5617012, 0x72ac6ab0),
|
||||
TOBN(0xe0bcf350, 0x5c7e6641),
|
||||
TOBN(0x53bc55ea, 0xad8f261d),
|
||||
TOBN(0xbba93b9d, 0x70491eb4),
|
||||
TOBN(0x5214756f, 0x36d9c7fa),
|
||||
TOBN(0x1762517d, 0x325e29ac),
|
||||
0x0000005c,
|
||||
};
|
||||
static const BIGNUM kY = STATIC_BIGNUM(kHGenY);
|
||||
|
||||
EC_POINT *h = EC_POINT_new(group);
|
||||
if (h == NULL ||
|
||||
!EC_POINT_set_affine_coordinates_GFp(group, h, &kX, &kY, NULL)) {
|
||||
EC_POINT_free(h);
|
||||
return NULL;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
// generate_keypair generates a keypair for the Private Metadata construction.
|
||||
// |out_x| and |out_y| are set to the secret half of the keypair, while
|
||||
// |*out_pub| is set to the public half of the keypair. It returns one on
|
||||
// success and zero on failure.
|
||||
static int generate_keypair(EC_SCALAR *out_x, EC_SCALAR *out_y,
|
||||
EC_POINT **out_pub, const EC_GROUP *group) {
|
||||
EC_POINT *h = get_h();
|
||||
if (h == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const uint8_t kDefaultAdditionalData[32] = {0};
|
||||
EC_RAW_POINT tmp1, tmp2;
|
||||
EC_POINT *pub = EC_POINT_new(group);
|
||||
if (pub == NULL ||
|
||||
!ec_random_nonzero_scalar(group, out_x, kDefaultAdditionalData) ||
|
||||
!ec_random_nonzero_scalar(group, out_y, kDefaultAdditionalData) ||
|
||||
!ec_point_mul_scalar_base(group, &tmp1, out_x) ||
|
||||
!ec_point_mul_scalar(group, &tmp2, &h->raw, out_y)) {
|
||||
EC_POINT_free(h);
|
||||
EC_POINT_free(pub);
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
group->meth->add(group, &pub->raw, &tmp1, &tmp2);
|
||||
*out_pub = pub;
|
||||
|
||||
EC_POINT_free(h);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int TRUST_TOKEN_generate_key(uint8_t *out_priv_key, size_t *out_priv_key_len,
|
||||
size_t max_priv_key_len, uint8_t *out_pub_key,
|
||||
size_t *out_pub_key_len, size_t max_pub_key_len,
|
||||
uint32_t id) {
|
||||
int ok = 0;
|
||||
EC_POINT *pub0 = NULL, *pub1 = NULL, *pubs = NULL;
|
||||
CBB cbb;
|
||||
CBB_zero(&cbb);
|
||||
uint8_t *buf = NULL;
|
||||
EC_GROUP *group = EC_GROUP_new_by_curve_name(NID_secp521r1);
|
||||
if (group == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
EC_SCALAR x0, y0, x1, y1, xs, ys;
|
||||
if (!generate_keypair(&x0, &y0, &pub0, group) ||
|
||||
!generate_keypair(&x1, &y1, &pub1, group) ||
|
||||
!generate_keypair(&xs, &ys, &pubs, group)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_KEYGEN_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
|
||||
size_t scalar_len = BN_num_bytes(&group->order);
|
||||
if (!CBB_init_fixed(&cbb, out_priv_key, max_priv_key_len) ||
|
||||
!CBB_add_u32(&cbb, id)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_BUFFER_TOO_SMALL);
|
||||
goto err;
|
||||
}
|
||||
|
||||
const EC_SCALAR *scalars[] = {&x0, &y0, &x1, &y1, &xs, &ys};
|
||||
for (size_t i = 0; i < OPENSSL_ARRAY_SIZE(scalars); i++) {
|
||||
if (!CBB_add_space(&cbb, &buf, scalar_len)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_BUFFER_TOO_SMALL);
|
||||
goto err;
|
||||
}
|
||||
ec_scalar_to_bytes(group, buf, &scalar_len, scalars[i]);
|
||||
}
|
||||
|
||||
if (!CBB_finish(&cbb, NULL, out_priv_key_len)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_BUFFER_TOO_SMALL);
|
||||
goto err;
|
||||
}
|
||||
|
||||
CBB pub_cbb;
|
||||
if (!CBB_init_fixed(&cbb, out_pub_key, max_pub_key_len) ||
|
||||
!CBB_add_u32(&cbb, id) ||
|
||||
!CBB_add_u16_length_prefixed(&cbb, &pub_cbb) ||
|
||||
!EC_POINT_point2cbb(&pub_cbb, group, pub0, POINT_CONVERSION_UNCOMPRESSED,
|
||||
NULL) ||
|
||||
!CBB_add_u16_length_prefixed(&cbb, &pub_cbb) ||
|
||||
!EC_POINT_point2cbb(&pub_cbb, group, pub1, POINT_CONVERSION_UNCOMPRESSED,
|
||||
NULL) ||
|
||||
!CBB_add_u16_length_prefixed(&cbb, &pub_cbb) ||
|
||||
!EC_POINT_point2cbb(&pub_cbb, group, pubs, POINT_CONVERSION_UNCOMPRESSED,
|
||||
NULL) ||
|
||||
!CBB_finish(&cbb, NULL, out_pub_key_len)) {
|
||||
OPENSSL_PUT_ERROR(TRUST_TOKEN, TRUST_TOKEN_R_BUFFER_TOO_SMALL);
|
||||
goto err;
|
||||
}
|
||||
|
||||
ok = 1;
|
||||
|
||||
err:
|
||||
CBB_cleanup(&cbb);
|
||||
EC_POINT_free(pub0);
|
||||
EC_POINT_free(pub1);
|
||||
EC_POINT_free(pubs);
|
||||
return ok;
|
||||
}
|
||||
@@ -129,6 +129,14 @@ const ASN1_TIME *X509_get0_notBefore(const X509 *x)
|
||||
return x->cert_info->validity->notBefore;
|
||||
}
|
||||
|
||||
ASN1_TIME *X509_getm_notBefore(X509 *x)
|
||||
{
|
||||
// Note this function takes a const |X509| pointer in OpenSSL. We require
|
||||
// non-const as this allows mutating |x|. If it comes up for compatibility,
|
||||
// we can relax this.
|
||||
return x->cert_info->validity->notBefore;
|
||||
}
|
||||
|
||||
int X509_set_notAfter(X509 *x, const ASN1_TIME *tm)
|
||||
{
|
||||
ASN1_TIME *in;
|
||||
@@ -151,6 +159,14 @@ const ASN1_TIME *X509_get0_notAfter(const X509 *x)
|
||||
return x->cert_info->validity->notAfter;
|
||||
}
|
||||
|
||||
ASN1_TIME *X509_getm_notAfter(X509 *x)
|
||||
{
|
||||
// Note this function takes a const |X509| pointer in OpenSSL. We require
|
||||
// non-const as this allows mutating |x|. If it comes up for compatibility,
|
||||
// we can relax this.
|
||||
return x->cert_info->validity->notAfter;
|
||||
}
|
||||
|
||||
int X509_set_pubkey(X509 *x, EVP_PKEY *pkey)
|
||||
{
|
||||
if ((x == NULL) || (x->cert_info == NULL))
|
||||
|
||||
@@ -177,7 +177,7 @@ X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc)
|
||||
}
|
||||
|
||||
int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type,
|
||||
unsigned char *bytes, int len, int loc,
|
||||
const unsigned char *bytes, int len, int loc,
|
||||
int set)
|
||||
{
|
||||
X509_NAME_ENTRY *ne;
|
||||
@@ -191,7 +191,7 @@ int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type,
|
||||
}
|
||||
|
||||
int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type,
|
||||
unsigned char *bytes, int len, int loc,
|
||||
const unsigned char *bytes, int len, int loc,
|
||||
int set)
|
||||
{
|
||||
X509_NAME_ENTRY *ne;
|
||||
@@ -298,7 +298,8 @@ X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne,
|
||||
}
|
||||
|
||||
X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid,
|
||||
int type, unsigned char *bytes,
|
||||
int type,
|
||||
const unsigned char *bytes,
|
||||
int len)
|
||||
{
|
||||
const ASN1_OBJECT *obj = OBJ_nid2obj(nid);
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
This directory is derived from BoringSSL cloned from https://boringssl.googlesource.com/boringssl at revision 0416e8c3055c7fcfd6c3eab4c127a36df1e6097b
|
||||
This directory is derived from BoringSSL cloned from https://boringssl.googlesource.com/boringssl at revision 5298ef99bf2b2d77600b3bb74dd572027bf495be
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
@@ -56,6 +56,7 @@
|
||||
#include "CCryptoBoringSSL_safestack.h"
|
||||
#include "CCryptoBoringSSL_sha.h"
|
||||
#include "CCryptoBoringSSL_siphash.h"
|
||||
#include "CCryptoBoringSSL_trust_token.h"
|
||||
#include "CCryptoBoringSSL_x509v3.h"
|
||||
|
||||
#endif // C_CRYPTO_BORINGSSL_H
|
||||
@@ -189,7 +189,7 @@ extern "C" {
|
||||
// A consumer may use this symbol in the preprocessor to temporarily build
|
||||
// against multiple revisions of BoringSSL at the same time. It is not
|
||||
// recommended to do so for longer than is necessary.
|
||||
#define BORINGSSL_API_VERSION 9
|
||||
#define BORINGSSL_API_VERSION 10
|
||||
|
||||
#if defined(BORINGSSL_SHARED_LIBRARY)
|
||||
|
||||
|
||||
@@ -454,10 +454,13 @@
|
||||
#define CBB_add_space BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBB_add_space)
|
||||
#define CBB_add_u16 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBB_add_u16)
|
||||
#define CBB_add_u16_length_prefixed BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBB_add_u16_length_prefixed)
|
||||
#define CBB_add_u16le BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBB_add_u16le)
|
||||
#define CBB_add_u24 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBB_add_u24)
|
||||
#define CBB_add_u24_length_prefixed BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBB_add_u24_length_prefixed)
|
||||
#define CBB_add_u32 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBB_add_u32)
|
||||
#define CBB_add_u32le BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBB_add_u32le)
|
||||
#define CBB_add_u64 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBB_add_u64)
|
||||
#define CBB_add_u64le BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBB_add_u64le)
|
||||
#define CBB_add_u8 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBB_add_u8)
|
||||
#define CBB_add_u8_length_prefixed BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBB_add_u8_length_prefixed)
|
||||
#define CBB_cleanup BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBB_cleanup)
|
||||
@@ -496,10 +499,13 @@
|
||||
#define CBS_get_optional_asn1_uint64 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_get_optional_asn1_uint64)
|
||||
#define CBS_get_u16 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_get_u16)
|
||||
#define CBS_get_u16_length_prefixed BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_get_u16_length_prefixed)
|
||||
#define CBS_get_u16le BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_get_u16le)
|
||||
#define CBS_get_u24 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_get_u24)
|
||||
#define CBS_get_u24_length_prefixed BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_get_u24_length_prefixed)
|
||||
#define CBS_get_u32 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_get_u32)
|
||||
#define CBS_get_u32le BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_get_u32le)
|
||||
#define CBS_get_u64 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_get_u64)
|
||||
#define CBS_get_u64le BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_get_u64le)
|
||||
#define CBS_get_u8 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_get_u8)
|
||||
#define CBS_get_u8_length_prefixed BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_get_u8_length_prefixed)
|
||||
#define CBS_init BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, CBS_init)
|
||||
@@ -696,6 +702,8 @@
|
||||
#define ECDSA_SIG_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ECDSA_SIG_free)
|
||||
#define ECDSA_SIG_from_bytes BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ECDSA_SIG_from_bytes)
|
||||
#define ECDSA_SIG_get0 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ECDSA_SIG_get0)
|
||||
#define ECDSA_SIG_get0_r BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ECDSA_SIG_get0_r)
|
||||
#define ECDSA_SIG_get0_s BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ECDSA_SIG_get0_s)
|
||||
#define ECDSA_SIG_marshal BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ECDSA_SIG_marshal)
|
||||
#define ECDSA_SIG_max_len BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ECDSA_SIG_max_len)
|
||||
#define ECDSA_SIG_new BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ECDSA_SIG_new)
|
||||
@@ -1434,8 +1442,16 @@
|
||||
#define RSA_generate_key_ex BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RSA_generate_key_ex)
|
||||
#define RSA_generate_key_fips BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RSA_generate_key_fips)
|
||||
#define RSA_get0_crt_params BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RSA_get0_crt_params)
|
||||
#define RSA_get0_d BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RSA_get0_d)
|
||||
#define RSA_get0_dmp1 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RSA_get0_dmp1)
|
||||
#define RSA_get0_dmq1 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RSA_get0_dmq1)
|
||||
#define RSA_get0_e BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RSA_get0_e)
|
||||
#define RSA_get0_factors BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RSA_get0_factors)
|
||||
#define RSA_get0_iqmp BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RSA_get0_iqmp)
|
||||
#define RSA_get0_key BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RSA_get0_key)
|
||||
#define RSA_get0_n BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RSA_get0_n)
|
||||
#define RSA_get0_p BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RSA_get0_p)
|
||||
#define RSA_get0_q BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RSA_get0_q)
|
||||
#define RSA_get_ex_data BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RSA_get_ex_data)
|
||||
#define RSA_get_ex_new_index BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RSA_get_ex_new_index)
|
||||
#define RSA_is_opaque BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RSA_is_opaque)
|
||||
@@ -1519,6 +1535,7 @@
|
||||
#define SXNET_get_id_ulong BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SXNET_get_id_ulong)
|
||||
#define SXNET_it BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SXNET_it)
|
||||
#define SXNET_new BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SXNET_new)
|
||||
#define TRUST_TOKEN_generate_key BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, TRUST_TOKEN_generate_key)
|
||||
#define USERNOTICE_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, USERNOTICE_free)
|
||||
#define USERNOTICE_it BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, USERNOTICE_it)
|
||||
#define USERNOTICE_new BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, USERNOTICE_new)
|
||||
@@ -1968,6 +1985,8 @@
|
||||
#define X509_get_serialNumber BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_get_serialNumber)
|
||||
#define X509_get_signature_nid BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_get_signature_nid)
|
||||
#define X509_get_subject_name BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_get_subject_name)
|
||||
#define X509_getm_notAfter BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_getm_notAfter)
|
||||
#define X509_getm_notBefore BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_getm_notBefore)
|
||||
#define X509_gmtime_adj BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_gmtime_adj)
|
||||
#define X509_issuer_and_serial_cmp BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_issuer_and_serial_cmp)
|
||||
#define X509_issuer_and_serial_hash BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_issuer_and_serial_hash)
|
||||
@@ -2358,11 +2377,13 @@
|
||||
#define ec_random_nonzero_scalar BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ec_random_nonzero_scalar)
|
||||
#define ec_scalar_add BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ec_scalar_add)
|
||||
#define ec_scalar_equal_vartime BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ec_scalar_equal_vartime)
|
||||
#define ec_scalar_from_bytes BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ec_scalar_from_bytes)
|
||||
#define ec_scalar_from_montgomery BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ec_scalar_from_montgomery)
|
||||
#define ec_scalar_inv_montgomery BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ec_scalar_inv_montgomery)
|
||||
#define ec_scalar_inv_montgomery_vartime BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ec_scalar_inv_montgomery_vartime)
|
||||
#define ec_scalar_is_zero BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ec_scalar_is_zero)
|
||||
#define ec_scalar_mul_montgomery BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ec_scalar_mul_montgomery)
|
||||
#define ec_scalar_to_bytes BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ec_scalar_to_bytes)
|
||||
#define ec_scalar_to_montgomery BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ec_scalar_to_montgomery)
|
||||
#define ec_simple_scalar_inv_montgomery BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ec_simple_scalar_inv_montgomery)
|
||||
#define ecp_nistz256_avx2_select_w7 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, ecp_nistz256_avx2_select_w7)
|
||||
|
||||
@@ -459,10 +459,13 @@
|
||||
#define _CBB_add_space BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBB_add_space)
|
||||
#define _CBB_add_u16 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBB_add_u16)
|
||||
#define _CBB_add_u16_length_prefixed BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBB_add_u16_length_prefixed)
|
||||
#define _CBB_add_u16le BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBB_add_u16le)
|
||||
#define _CBB_add_u24 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBB_add_u24)
|
||||
#define _CBB_add_u24_length_prefixed BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBB_add_u24_length_prefixed)
|
||||
#define _CBB_add_u32 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBB_add_u32)
|
||||
#define _CBB_add_u32le BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBB_add_u32le)
|
||||
#define _CBB_add_u64 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBB_add_u64)
|
||||
#define _CBB_add_u64le BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBB_add_u64le)
|
||||
#define _CBB_add_u8 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBB_add_u8)
|
||||
#define _CBB_add_u8_length_prefixed BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBB_add_u8_length_prefixed)
|
||||
#define _CBB_cleanup BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBB_cleanup)
|
||||
@@ -501,10 +504,13 @@
|
||||
#define _CBS_get_optional_asn1_uint64 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_get_optional_asn1_uint64)
|
||||
#define _CBS_get_u16 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_get_u16)
|
||||
#define _CBS_get_u16_length_prefixed BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_get_u16_length_prefixed)
|
||||
#define _CBS_get_u16le BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_get_u16le)
|
||||
#define _CBS_get_u24 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_get_u24)
|
||||
#define _CBS_get_u24_length_prefixed BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_get_u24_length_prefixed)
|
||||
#define _CBS_get_u32 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_get_u32)
|
||||
#define _CBS_get_u32le BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_get_u32le)
|
||||
#define _CBS_get_u64 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_get_u64)
|
||||
#define _CBS_get_u64le BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_get_u64le)
|
||||
#define _CBS_get_u8 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_get_u8)
|
||||
#define _CBS_get_u8_length_prefixed BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_get_u8_length_prefixed)
|
||||
#define _CBS_init BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, CBS_init)
|
||||
@@ -701,6 +707,8 @@
|
||||
#define _ECDSA_SIG_free BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ECDSA_SIG_free)
|
||||
#define _ECDSA_SIG_from_bytes BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ECDSA_SIG_from_bytes)
|
||||
#define _ECDSA_SIG_get0 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ECDSA_SIG_get0)
|
||||
#define _ECDSA_SIG_get0_r BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ECDSA_SIG_get0_r)
|
||||
#define _ECDSA_SIG_get0_s BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ECDSA_SIG_get0_s)
|
||||
#define _ECDSA_SIG_marshal BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ECDSA_SIG_marshal)
|
||||
#define _ECDSA_SIG_max_len BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ECDSA_SIG_max_len)
|
||||
#define _ECDSA_SIG_new BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ECDSA_SIG_new)
|
||||
@@ -1439,8 +1447,16 @@
|
||||
#define _RSA_generate_key_ex BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, RSA_generate_key_ex)
|
||||
#define _RSA_generate_key_fips BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, RSA_generate_key_fips)
|
||||
#define _RSA_get0_crt_params BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, RSA_get0_crt_params)
|
||||
#define _RSA_get0_d BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, RSA_get0_d)
|
||||
#define _RSA_get0_dmp1 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, RSA_get0_dmp1)
|
||||
#define _RSA_get0_dmq1 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, RSA_get0_dmq1)
|
||||
#define _RSA_get0_e BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, RSA_get0_e)
|
||||
#define _RSA_get0_factors BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, RSA_get0_factors)
|
||||
#define _RSA_get0_iqmp BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, RSA_get0_iqmp)
|
||||
#define _RSA_get0_key BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, RSA_get0_key)
|
||||
#define _RSA_get0_n BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, RSA_get0_n)
|
||||
#define _RSA_get0_p BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, RSA_get0_p)
|
||||
#define _RSA_get0_q BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, RSA_get0_q)
|
||||
#define _RSA_get_ex_data BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, RSA_get_ex_data)
|
||||
#define _RSA_get_ex_new_index BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, RSA_get_ex_new_index)
|
||||
#define _RSA_is_opaque BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, RSA_is_opaque)
|
||||
@@ -1524,6 +1540,7 @@
|
||||
#define _SXNET_get_id_ulong BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, SXNET_get_id_ulong)
|
||||
#define _SXNET_it BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, SXNET_it)
|
||||
#define _SXNET_new BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, SXNET_new)
|
||||
#define _TRUST_TOKEN_generate_key BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, TRUST_TOKEN_generate_key)
|
||||
#define _USERNOTICE_free BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, USERNOTICE_free)
|
||||
#define _USERNOTICE_it BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, USERNOTICE_it)
|
||||
#define _USERNOTICE_new BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, USERNOTICE_new)
|
||||
@@ -1973,6 +1990,8 @@
|
||||
#define _X509_get_serialNumber BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, X509_get_serialNumber)
|
||||
#define _X509_get_signature_nid BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, X509_get_signature_nid)
|
||||
#define _X509_get_subject_name BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, X509_get_subject_name)
|
||||
#define _X509_getm_notAfter BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, X509_getm_notAfter)
|
||||
#define _X509_getm_notBefore BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, X509_getm_notBefore)
|
||||
#define _X509_gmtime_adj BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, X509_gmtime_adj)
|
||||
#define _X509_issuer_and_serial_cmp BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, X509_issuer_and_serial_cmp)
|
||||
#define _X509_issuer_and_serial_hash BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, X509_issuer_and_serial_hash)
|
||||
@@ -2363,11 +2382,13 @@
|
||||
#define _ec_random_nonzero_scalar BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ec_random_nonzero_scalar)
|
||||
#define _ec_scalar_add BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ec_scalar_add)
|
||||
#define _ec_scalar_equal_vartime BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ec_scalar_equal_vartime)
|
||||
#define _ec_scalar_from_bytes BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ec_scalar_from_bytes)
|
||||
#define _ec_scalar_from_montgomery BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ec_scalar_from_montgomery)
|
||||
#define _ec_scalar_inv_montgomery BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ec_scalar_inv_montgomery)
|
||||
#define _ec_scalar_inv_montgomery_vartime BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ec_scalar_inv_montgomery_vartime)
|
||||
#define _ec_scalar_is_zero BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ec_scalar_is_zero)
|
||||
#define _ec_scalar_mul_montgomery BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ec_scalar_mul_montgomery)
|
||||
#define _ec_scalar_to_bytes BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ec_scalar_to_bytes)
|
||||
#define _ec_scalar_to_montgomery BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ec_scalar_to_montgomery)
|
||||
#define _ec_simple_scalar_inv_montgomery BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ec_simple_scalar_inv_montgomery)
|
||||
#define _ecp_nistz256_avx2_select_w7 BORINGSSL_ADD_PREFIX_MAC_ASM(BORINGSSL_PREFIX, ecp_nistz256_avx2_select_w7)
|
||||
|
||||
@@ -102,6 +102,10 @@ OPENSSL_EXPORT int CBS_get_u8(CBS *cbs, uint8_t *out);
|
||||
// advances |cbs|. It returns one on success and zero on error.
|
||||
OPENSSL_EXPORT int CBS_get_u16(CBS *cbs, uint16_t *out);
|
||||
|
||||
// CBS_get_u16le sets |*out| to the next, little-endian uint16_t from |cbs| and
|
||||
// advances |cbs|. It returns one on success and zero on error.
|
||||
OPENSSL_EXPORT int CBS_get_u16le(CBS *cbs, uint16_t *out);
|
||||
|
||||
// CBS_get_u24 sets |*out| to the next, big-endian 24-bit value from |cbs| and
|
||||
// advances |cbs|. It returns one on success and zero on error.
|
||||
OPENSSL_EXPORT int CBS_get_u24(CBS *cbs, uint32_t *out);
|
||||
@@ -110,10 +114,18 @@ OPENSSL_EXPORT int CBS_get_u24(CBS *cbs, uint32_t *out);
|
||||
// and advances |cbs|. It returns one on success and zero on error.
|
||||
OPENSSL_EXPORT int CBS_get_u32(CBS *cbs, uint32_t *out);
|
||||
|
||||
// CBS_get_u32le sets |*out| to the next, little-endian uint32_t value from
|
||||
// |cbs| and advances |cbs|. It returns one on success and zero on error.
|
||||
OPENSSL_EXPORT int CBS_get_u32le(CBS *cbs, uint32_t *out);
|
||||
|
||||
// CBS_get_u64 sets |*out| to the next, big-endian uint64_t value from |cbs|
|
||||
// and advances |cbs|. It returns one on success and zero on error.
|
||||
OPENSSL_EXPORT int CBS_get_u64(CBS *cbs, uint64_t *out);
|
||||
|
||||
// CBS_get_u64le sets |*out| to the next, little-endian uint64_t value from
|
||||
// |cbs| and advances |cbs|. It returns one on success and zero on error.
|
||||
OPENSSL_EXPORT int CBS_get_u64le(CBS *cbs, uint64_t *out);
|
||||
|
||||
// CBS_get_last_u8 sets |*out| to the last uint8_t from |cbs| and shortens
|
||||
// |cbs|. It returns one on success and zero on error.
|
||||
OPENSSL_EXPORT int CBS_get_last_u8(CBS *cbs, uint8_t *out);
|
||||
@@ -460,6 +472,10 @@ OPENSSL_EXPORT int CBB_add_u8(CBB *cbb, uint8_t value);
|
||||
// returns one on success and zero otherwise.
|
||||
OPENSSL_EXPORT int CBB_add_u16(CBB *cbb, uint16_t value);
|
||||
|
||||
// CBB_add_u16le appends a 16-bit, little-endian number from |value| to |cbb|.
|
||||
// It returns one on success and zero otherwise.
|
||||
OPENSSL_EXPORT int CBB_add_u16le(CBB *cbb, uint16_t value);
|
||||
|
||||
// CBB_add_u24 appends a 24-bit, big-endian number from |value| to |cbb|. It
|
||||
// returns one on success and zero otherwise.
|
||||
OPENSSL_EXPORT int CBB_add_u24(CBB *cbb, uint32_t value);
|
||||
@@ -468,10 +484,18 @@ OPENSSL_EXPORT int CBB_add_u24(CBB *cbb, uint32_t value);
|
||||
// returns one on success and zero otherwise.
|
||||
OPENSSL_EXPORT int CBB_add_u32(CBB *cbb, uint32_t value);
|
||||
|
||||
// CBB_add_u32le appends a 32-bit, little-endian number from |value| to |cbb|.
|
||||
// It returns one on success and zero otherwise.
|
||||
OPENSSL_EXPORT int CBB_add_u32le(CBB *cbb, uint32_t value);
|
||||
|
||||
// CBB_add_u64 appends a 64-bit, big-endian number from |value| to |cbb|. It
|
||||
// returns one on success and zero otherwise.
|
||||
OPENSSL_EXPORT int CBB_add_u64(CBB *cbb, uint64_t value);
|
||||
|
||||
// CBB_add_u64le appends a 64-bit, little-endian number from |value| to |cbb|.
|
||||
// It returns one on success and zero otherwise.
|
||||
OPENSSL_EXPORT int CBB_add_u64le(CBB *cbb, uint64_t value);
|
||||
|
||||
// CBB_discard_child discards the current unflushed child of |cbb|. Neither the
|
||||
// child's contents nor the length prefix will be included in the output.
|
||||
OPENSSL_EXPORT void CBB_discard_child(CBB *cbb);
|
||||
|
||||
@@ -60,10 +60,7 @@ OPENSSL_EXPORT int CRYPTO_has_asm(void);
|
||||
OPENSSL_EXPORT int FIPS_mode(void);
|
||||
|
||||
// BORINGSSL_self_test triggers the FIPS KAT-based self tests. It returns one on
|
||||
// success and zero on error. The argument is the integrity hash of the FIPS
|
||||
// module and may be used to check and write flag files to suppress duplicate
|
||||
// self-tests. If it is all zeros, no flag file will be checked nor written and
|
||||
// tests will always be run.
|
||||
// success and zero on error.
|
||||
OPENSSL_EXPORT int BORINGSSL_self_test(void);
|
||||
|
||||
|
||||
|
||||
@@ -106,6 +106,12 @@ OPENSSL_EXPORT ECDSA_SIG *ECDSA_SIG_new(void);
|
||||
// ECDSA_SIG_free frees |sig| its member |BIGNUM|s.
|
||||
OPENSSL_EXPORT void ECDSA_SIG_free(ECDSA_SIG *sig);
|
||||
|
||||
// ECDSA_SIG_get0_r returns the r component of |sig|.
|
||||
OPENSSL_EXPORT const BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig);
|
||||
|
||||
// ECDSA_SIG_get0_s returns the s component of |sig|.
|
||||
OPENSSL_EXPORT const BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig);
|
||||
|
||||
// ECDSA_SIG_get0 sets |*out_r| and |*out_s|, if non-NULL, to the two
|
||||
// components of |sig|.
|
||||
OPENSSL_EXPORT void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **out_r,
|
||||
|
||||
@@ -320,6 +320,7 @@ enum {
|
||||
ERR_LIB_CIPHER,
|
||||
ERR_LIB_HKDF,
|
||||
ERR_LIB_USER,
|
||||
ERR_LIB_TRUST_TOKEN,
|
||||
ERR_NUM_LIBS
|
||||
};
|
||||
|
||||
|
||||
@@ -812,6 +812,14 @@ OPENSSL_EXPORT int EVP_PKEY_CTX_set_ec_paramgen_curve_nid(EVP_PKEY_CTX *ctx,
|
||||
// 2.5.8.1.1), but is no longer accepted.
|
||||
#define EVP_PKEY_RSA2 NID_rsa
|
||||
|
||||
// EVP_PKEY_X448 is defined for OpenSSL compatibility, but we do not support
|
||||
// X448 and attempts to create keys will fail.
|
||||
#define EVP_PKEY_X448 NID_X448
|
||||
|
||||
// EVP_PKEY_ED448 is defined for OpenSSL compatibility, but we do not support
|
||||
// Ed448 and attempts to create keys will fail.
|
||||
#define EVP_PKEY_ED448 NID_ED448
|
||||
|
||||
// OpenSSL_add_all_algorithms does nothing.
|
||||
OPENSSL_EXPORT void OpenSSL_add_all_algorithms(void);
|
||||
|
||||
|
||||
@@ -4193,6 +4193,7 @@ extern "C" {
|
||||
|
||||
#define SN_X25519 "X25519"
|
||||
#define NID_X25519 948
|
||||
#define OBJ_X25519 1L, 3L, 101L, 110L
|
||||
|
||||
#define SN_ED25519 "ED25519"
|
||||
#define NID_ED25519 949
|
||||
@@ -4241,6 +4242,10 @@ extern "C" {
|
||||
#define NID_ED448 960
|
||||
#define OBJ_ED448 1L, 3L, 101L, 113L
|
||||
|
||||
#define SN_X448 "X448"
|
||||
#define NID_X448 961
|
||||
#define OBJ_X448 1L, 3L, 101L, 111L
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} /* extern C */
|
||||
|
||||
@@ -99,6 +99,36 @@ OPENSSL_EXPORT int RSA_up_ref(RSA *rsa);
|
||||
// RSA_bits returns the size of |rsa|, in bits.
|
||||
OPENSSL_EXPORT unsigned RSA_bits(const RSA *rsa);
|
||||
|
||||
// RSA_get0_n returns |rsa|'s public modulus.
|
||||
OPENSSL_EXPORT const BIGNUM *RSA_get0_n(const RSA *rsa);
|
||||
|
||||
// RSA_get0_e returns |rsa|'s public exponent.
|
||||
OPENSSL_EXPORT const BIGNUM *RSA_get0_e(const RSA *rsa);
|
||||
|
||||
// RSA_get0_d returns |rsa|'s private exponent. If |rsa| is a public key, this
|
||||
// value will be NULL.
|
||||
OPENSSL_EXPORT const BIGNUM *RSA_get0_d(const RSA *rsa);
|
||||
|
||||
// RSA_get0_p returns |rsa|'s first private prime factor. If |rsa| is a public
|
||||
// key or lacks its prime factors, this value will be NULL.
|
||||
OPENSSL_EXPORT const BIGNUM *RSA_get0_p(const RSA *rsa);
|
||||
|
||||
// RSA_get0_q returns |rsa|'s second private prime factor. If |rsa| is a public
|
||||
// key or lacks its prime factors, this value will be NULL.
|
||||
OPENSSL_EXPORT const BIGNUM *RSA_get0_q(const RSA *rsa);
|
||||
|
||||
// RSA_get0_dmp1 returns d (mod p-1) for |rsa|. If |rsa| is a public key or
|
||||
// lacks CRT parameters, this value will be NULL.
|
||||
OPENSSL_EXPORT const BIGNUM *RSA_get0_dmp1(const RSA *rsa);
|
||||
|
||||
// RSA_get0_dmq1 returns d (mod q-1) for |rsa|. If |rsa| is a public key or
|
||||
// lacks CRT parameters, this value will be NULL.
|
||||
OPENSSL_EXPORT const BIGNUM *RSA_get0_dmq1(const RSA *rsa);
|
||||
|
||||
// RSA_get0_iqmp returns q^-1 (mod p). If |rsa| is a public key or lacks CRT
|
||||
// parameters, this value will be NULL.
|
||||
OPENSSL_EXPORT const BIGNUM *RSA_get0_iqmp(const RSA *rsa);
|
||||
|
||||
// RSA_get0_key sets |*out_n|, |*out_e|, and |*out_d|, if non-NULL, to |rsa|'s
|
||||
// modulus, public exponent, and private exponent, respectively. If |rsa| is a
|
||||
// public key, the private exponent will be set to NULL.
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/* Copyright (c) 2019, Google Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
||||
|
||||
#ifndef OPENSSL_HEADER_TRUST_TOKEN_H
|
||||
#define OPENSSL_HEADER_TRUST_TOKEN_H
|
||||
|
||||
#include "CCryptoBoringSSL_base.h"
|
||||
#include "CCryptoBoringSSL_stack.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
// Trust Token implementation.
|
||||
//
|
||||
// Trust Token is an implementation of an experimental mechanism similar to
|
||||
// Privacy Pass which allows issuance and redemption of anonymized tokens with
|
||||
// limited private metadata.
|
||||
//
|
||||
// References:
|
||||
// https://eprint.iacr.org/2020/072.pdf
|
||||
// https://github.com/alxdavids/privacy-pass-ietf/tree/master/drafts
|
||||
// https://github.com/WICG/trust-token-api/blob/master/README.md
|
||||
//
|
||||
// WARNING: This API is unstable and subject to change.
|
||||
|
||||
#define TRUST_TOKEN_MAX_PRIVATE_KEY_SIZE 512
|
||||
#define TRUST_TOKEN_MAX_PUBLIC_KEY_SIZE 512
|
||||
|
||||
// TRUST_TOKEN_generate_key creates a new Trust Token keypair labeled with |id|
|
||||
// and serializes the private and public keys, writing the private key to
|
||||
// |out_priv_key| and setting |*out_priv_key_len| to the number of bytes
|
||||
// written, and writing the public key to |out_pub_key| and setting
|
||||
// |*out_pub_key_len| to the number of bytes written.
|
||||
//
|
||||
// At most |max_priv_key_len| and |max_pub_key_len| bytes are written. In order
|
||||
// to ensure success, these should be at least
|
||||
// |TRUST_TOKEN_MAX_PRIVATE_KEY_SIZE| and |TRUST_TOKEN_MAX_PUBLIC_KEY_SIZE|.
|
||||
//
|
||||
// WARNING: This API is unstable and the serializations of these keys are
|
||||
// subject to change. Keys generated with this function may not be persisted.
|
||||
//
|
||||
// This function returns one on success or zero on error.
|
||||
OPENSSL_EXPORT int TRUST_TOKEN_generate_key(
|
||||
uint8_t *out_priv_key, size_t *out_priv_key_len, size_t max_priv_key_len,
|
||||
uint8_t *out_pub_key, size_t *out_pub_key_len, size_t max_pub_key_len,
|
||||
uint32_t id);
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} // extern C
|
||||
#endif
|
||||
|
||||
#define TRUST_TOKEN_R_KEYGEN_FAILURE 100
|
||||
#define TRUST_TOKEN_R_BUFFER_TOO_SMALL 101
|
||||
|
||||
#endif // OPENSSL_HEADER_TRUST_TOKEN_H
|
||||
@@ -829,8 +829,10 @@ OPENSSL_EXPORT int X509_set_subject_name(X509 *x, X509_NAME *name);
|
||||
OPENSSL_EXPORT X509_NAME * X509_get_subject_name(X509 *a);
|
||||
OPENSSL_EXPORT int X509_set_notBefore(X509 *x, const ASN1_TIME *tm);
|
||||
OPENSSL_EXPORT const ASN1_TIME *X509_get0_notBefore(const X509 *x);
|
||||
OPENSSL_EXPORT ASN1_TIME *X509_getm_notBefore(X509 *x);
|
||||
OPENSSL_EXPORT int X509_set_notAfter(X509 *x, const ASN1_TIME *tm);
|
||||
OPENSSL_EXPORT const ASN1_TIME *X509_get0_notAfter(const X509 *x);
|
||||
OPENSSL_EXPORT ASN1_TIME *X509_getm_notAfter(X509 *x);
|
||||
OPENSSL_EXPORT int X509_set_pubkey(X509 *x, EVP_PKEY *pkey);
|
||||
OPENSSL_EXPORT EVP_PKEY * X509_get_pubkey(X509 *x);
|
||||
OPENSSL_EXPORT ASN1_BIT_STRING * X509_get0_pubkey_bitstr(const X509 *x);
|
||||
@@ -957,13 +959,13 @@ OPENSSL_EXPORT X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc)
|
||||
OPENSSL_EXPORT int X509_NAME_add_entry(X509_NAME *name,X509_NAME_ENTRY *ne,
|
||||
int loc, int set);
|
||||
OPENSSL_EXPORT int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type,
|
||||
unsigned char *bytes, int len, int loc, int set);
|
||||
const unsigned char *bytes, int len, int loc, int set);
|
||||
OPENSSL_EXPORT int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type,
|
||||
unsigned char *bytes, int len, int loc, int set);
|
||||
const unsigned char *bytes, int len, int loc, int set);
|
||||
OPENSSL_EXPORT X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne,
|
||||
const char *field, int type, const unsigned char *bytes, int len);
|
||||
OPENSSL_EXPORT X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid,
|
||||
int type,unsigned char *bytes, int len);
|
||||
int type, const unsigned char *bytes, int len);
|
||||
OPENSSL_EXPORT int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type,
|
||||
const unsigned char *bytes, int len, int loc, int set);
|
||||
OPENSSL_EXPORT X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne,
|
||||
|
||||
@@ -451,10 +451,13 @@
|
||||
%xdefine _CBB_add_space _ %+ BORINGSSL_PREFIX %+ _CBB_add_space
|
||||
%xdefine _CBB_add_u16 _ %+ BORINGSSL_PREFIX %+ _CBB_add_u16
|
||||
%xdefine _CBB_add_u16_length_prefixed _ %+ BORINGSSL_PREFIX %+ _CBB_add_u16_length_prefixed
|
||||
%xdefine _CBB_add_u16le _ %+ BORINGSSL_PREFIX %+ _CBB_add_u16le
|
||||
%xdefine _CBB_add_u24 _ %+ BORINGSSL_PREFIX %+ _CBB_add_u24
|
||||
%xdefine _CBB_add_u24_length_prefixed _ %+ BORINGSSL_PREFIX %+ _CBB_add_u24_length_prefixed
|
||||
%xdefine _CBB_add_u32 _ %+ BORINGSSL_PREFIX %+ _CBB_add_u32
|
||||
%xdefine _CBB_add_u32le _ %+ BORINGSSL_PREFIX %+ _CBB_add_u32le
|
||||
%xdefine _CBB_add_u64 _ %+ BORINGSSL_PREFIX %+ _CBB_add_u64
|
||||
%xdefine _CBB_add_u64le _ %+ BORINGSSL_PREFIX %+ _CBB_add_u64le
|
||||
%xdefine _CBB_add_u8 _ %+ BORINGSSL_PREFIX %+ _CBB_add_u8
|
||||
%xdefine _CBB_add_u8_length_prefixed _ %+ BORINGSSL_PREFIX %+ _CBB_add_u8_length_prefixed
|
||||
%xdefine _CBB_cleanup _ %+ BORINGSSL_PREFIX %+ _CBB_cleanup
|
||||
@@ -493,10 +496,13 @@
|
||||
%xdefine _CBS_get_optional_asn1_uint64 _ %+ BORINGSSL_PREFIX %+ _CBS_get_optional_asn1_uint64
|
||||
%xdefine _CBS_get_u16 _ %+ BORINGSSL_PREFIX %+ _CBS_get_u16
|
||||
%xdefine _CBS_get_u16_length_prefixed _ %+ BORINGSSL_PREFIX %+ _CBS_get_u16_length_prefixed
|
||||
%xdefine _CBS_get_u16le _ %+ BORINGSSL_PREFIX %+ _CBS_get_u16le
|
||||
%xdefine _CBS_get_u24 _ %+ BORINGSSL_PREFIX %+ _CBS_get_u24
|
||||
%xdefine _CBS_get_u24_length_prefixed _ %+ BORINGSSL_PREFIX %+ _CBS_get_u24_length_prefixed
|
||||
%xdefine _CBS_get_u32 _ %+ BORINGSSL_PREFIX %+ _CBS_get_u32
|
||||
%xdefine _CBS_get_u32le _ %+ BORINGSSL_PREFIX %+ _CBS_get_u32le
|
||||
%xdefine _CBS_get_u64 _ %+ BORINGSSL_PREFIX %+ _CBS_get_u64
|
||||
%xdefine _CBS_get_u64le _ %+ BORINGSSL_PREFIX %+ _CBS_get_u64le
|
||||
%xdefine _CBS_get_u8 _ %+ BORINGSSL_PREFIX %+ _CBS_get_u8
|
||||
%xdefine _CBS_get_u8_length_prefixed _ %+ BORINGSSL_PREFIX %+ _CBS_get_u8_length_prefixed
|
||||
%xdefine _CBS_init _ %+ BORINGSSL_PREFIX %+ _CBS_init
|
||||
@@ -693,6 +699,8 @@
|
||||
%xdefine _ECDSA_SIG_free _ %+ BORINGSSL_PREFIX %+ _ECDSA_SIG_free
|
||||
%xdefine _ECDSA_SIG_from_bytes _ %+ BORINGSSL_PREFIX %+ _ECDSA_SIG_from_bytes
|
||||
%xdefine _ECDSA_SIG_get0 _ %+ BORINGSSL_PREFIX %+ _ECDSA_SIG_get0
|
||||
%xdefine _ECDSA_SIG_get0_r _ %+ BORINGSSL_PREFIX %+ _ECDSA_SIG_get0_r
|
||||
%xdefine _ECDSA_SIG_get0_s _ %+ BORINGSSL_PREFIX %+ _ECDSA_SIG_get0_s
|
||||
%xdefine _ECDSA_SIG_marshal _ %+ BORINGSSL_PREFIX %+ _ECDSA_SIG_marshal
|
||||
%xdefine _ECDSA_SIG_max_len _ %+ BORINGSSL_PREFIX %+ _ECDSA_SIG_max_len
|
||||
%xdefine _ECDSA_SIG_new _ %+ BORINGSSL_PREFIX %+ _ECDSA_SIG_new
|
||||
@@ -1431,8 +1439,16 @@
|
||||
%xdefine _RSA_generate_key_ex _ %+ BORINGSSL_PREFIX %+ _RSA_generate_key_ex
|
||||
%xdefine _RSA_generate_key_fips _ %+ BORINGSSL_PREFIX %+ _RSA_generate_key_fips
|
||||
%xdefine _RSA_get0_crt_params _ %+ BORINGSSL_PREFIX %+ _RSA_get0_crt_params
|
||||
%xdefine _RSA_get0_d _ %+ BORINGSSL_PREFIX %+ _RSA_get0_d
|
||||
%xdefine _RSA_get0_dmp1 _ %+ BORINGSSL_PREFIX %+ _RSA_get0_dmp1
|
||||
%xdefine _RSA_get0_dmq1 _ %+ BORINGSSL_PREFIX %+ _RSA_get0_dmq1
|
||||
%xdefine _RSA_get0_e _ %+ BORINGSSL_PREFIX %+ _RSA_get0_e
|
||||
%xdefine _RSA_get0_factors _ %+ BORINGSSL_PREFIX %+ _RSA_get0_factors
|
||||
%xdefine _RSA_get0_iqmp _ %+ BORINGSSL_PREFIX %+ _RSA_get0_iqmp
|
||||
%xdefine _RSA_get0_key _ %+ BORINGSSL_PREFIX %+ _RSA_get0_key
|
||||
%xdefine _RSA_get0_n _ %+ BORINGSSL_PREFIX %+ _RSA_get0_n
|
||||
%xdefine _RSA_get0_p _ %+ BORINGSSL_PREFIX %+ _RSA_get0_p
|
||||
%xdefine _RSA_get0_q _ %+ BORINGSSL_PREFIX %+ _RSA_get0_q
|
||||
%xdefine _RSA_get_ex_data _ %+ BORINGSSL_PREFIX %+ _RSA_get_ex_data
|
||||
%xdefine _RSA_get_ex_new_index _ %+ BORINGSSL_PREFIX %+ _RSA_get_ex_new_index
|
||||
%xdefine _RSA_is_opaque _ %+ BORINGSSL_PREFIX %+ _RSA_is_opaque
|
||||
@@ -1516,6 +1532,7 @@
|
||||
%xdefine _SXNET_get_id_ulong _ %+ BORINGSSL_PREFIX %+ _SXNET_get_id_ulong
|
||||
%xdefine _SXNET_it _ %+ BORINGSSL_PREFIX %+ _SXNET_it
|
||||
%xdefine _SXNET_new _ %+ BORINGSSL_PREFIX %+ _SXNET_new
|
||||
%xdefine _TRUST_TOKEN_generate_key _ %+ BORINGSSL_PREFIX %+ _TRUST_TOKEN_generate_key
|
||||
%xdefine _USERNOTICE_free _ %+ BORINGSSL_PREFIX %+ _USERNOTICE_free
|
||||
%xdefine _USERNOTICE_it _ %+ BORINGSSL_PREFIX %+ _USERNOTICE_it
|
||||
%xdefine _USERNOTICE_new _ %+ BORINGSSL_PREFIX %+ _USERNOTICE_new
|
||||
@@ -1965,6 +1982,8 @@
|
||||
%xdefine _X509_get_serialNumber _ %+ BORINGSSL_PREFIX %+ _X509_get_serialNumber
|
||||
%xdefine _X509_get_signature_nid _ %+ BORINGSSL_PREFIX %+ _X509_get_signature_nid
|
||||
%xdefine _X509_get_subject_name _ %+ BORINGSSL_PREFIX %+ _X509_get_subject_name
|
||||
%xdefine _X509_getm_notAfter _ %+ BORINGSSL_PREFIX %+ _X509_getm_notAfter
|
||||
%xdefine _X509_getm_notBefore _ %+ BORINGSSL_PREFIX %+ _X509_getm_notBefore
|
||||
%xdefine _X509_gmtime_adj _ %+ BORINGSSL_PREFIX %+ _X509_gmtime_adj
|
||||
%xdefine _X509_issuer_and_serial_cmp _ %+ BORINGSSL_PREFIX %+ _X509_issuer_and_serial_cmp
|
||||
%xdefine _X509_issuer_and_serial_hash _ %+ BORINGSSL_PREFIX %+ _X509_issuer_and_serial_hash
|
||||
@@ -2355,11 +2374,13 @@
|
||||
%xdefine _ec_random_nonzero_scalar _ %+ BORINGSSL_PREFIX %+ _ec_random_nonzero_scalar
|
||||
%xdefine _ec_scalar_add _ %+ BORINGSSL_PREFIX %+ _ec_scalar_add
|
||||
%xdefine _ec_scalar_equal_vartime _ %+ BORINGSSL_PREFIX %+ _ec_scalar_equal_vartime
|
||||
%xdefine _ec_scalar_from_bytes _ %+ BORINGSSL_PREFIX %+ _ec_scalar_from_bytes
|
||||
%xdefine _ec_scalar_from_montgomery _ %+ BORINGSSL_PREFIX %+ _ec_scalar_from_montgomery
|
||||
%xdefine _ec_scalar_inv_montgomery _ %+ BORINGSSL_PREFIX %+ _ec_scalar_inv_montgomery
|
||||
%xdefine _ec_scalar_inv_montgomery_vartime _ %+ BORINGSSL_PREFIX %+ _ec_scalar_inv_montgomery_vartime
|
||||
%xdefine _ec_scalar_is_zero _ %+ BORINGSSL_PREFIX %+ _ec_scalar_is_zero
|
||||
%xdefine _ec_scalar_mul_montgomery _ %+ BORINGSSL_PREFIX %+ _ec_scalar_mul_montgomery
|
||||
%xdefine _ec_scalar_to_bytes _ %+ BORINGSSL_PREFIX %+ _ec_scalar_to_bytes
|
||||
%xdefine _ec_scalar_to_montgomery _ %+ BORINGSSL_PREFIX %+ _ec_scalar_to_montgomery
|
||||
%xdefine _ec_simple_scalar_inv_montgomery _ %+ BORINGSSL_PREFIX %+ _ec_simple_scalar_inv_montgomery
|
||||
%xdefine _ecp_nistz256_avx2_select_w7 _ %+ BORINGSSL_PREFIX %+ _ecp_nistz256_avx2_select_w7
|
||||
@@ -3110,10 +3131,13 @@
|
||||
%xdefine CBB_add_space BORINGSSL_PREFIX %+ _CBB_add_space
|
||||
%xdefine CBB_add_u16 BORINGSSL_PREFIX %+ _CBB_add_u16
|
||||
%xdefine CBB_add_u16_length_prefixed BORINGSSL_PREFIX %+ _CBB_add_u16_length_prefixed
|
||||
%xdefine CBB_add_u16le BORINGSSL_PREFIX %+ _CBB_add_u16le
|
||||
%xdefine CBB_add_u24 BORINGSSL_PREFIX %+ _CBB_add_u24
|
||||
%xdefine CBB_add_u24_length_prefixed BORINGSSL_PREFIX %+ _CBB_add_u24_length_prefixed
|
||||
%xdefine CBB_add_u32 BORINGSSL_PREFIX %+ _CBB_add_u32
|
||||
%xdefine CBB_add_u32le BORINGSSL_PREFIX %+ _CBB_add_u32le
|
||||
%xdefine CBB_add_u64 BORINGSSL_PREFIX %+ _CBB_add_u64
|
||||
%xdefine CBB_add_u64le BORINGSSL_PREFIX %+ _CBB_add_u64le
|
||||
%xdefine CBB_add_u8 BORINGSSL_PREFIX %+ _CBB_add_u8
|
||||
%xdefine CBB_add_u8_length_prefixed BORINGSSL_PREFIX %+ _CBB_add_u8_length_prefixed
|
||||
%xdefine CBB_cleanup BORINGSSL_PREFIX %+ _CBB_cleanup
|
||||
@@ -3152,10 +3176,13 @@
|
||||
%xdefine CBS_get_optional_asn1_uint64 BORINGSSL_PREFIX %+ _CBS_get_optional_asn1_uint64
|
||||
%xdefine CBS_get_u16 BORINGSSL_PREFIX %+ _CBS_get_u16
|
||||
%xdefine CBS_get_u16_length_prefixed BORINGSSL_PREFIX %+ _CBS_get_u16_length_prefixed
|
||||
%xdefine CBS_get_u16le BORINGSSL_PREFIX %+ _CBS_get_u16le
|
||||
%xdefine CBS_get_u24 BORINGSSL_PREFIX %+ _CBS_get_u24
|
||||
%xdefine CBS_get_u24_length_prefixed BORINGSSL_PREFIX %+ _CBS_get_u24_length_prefixed
|
||||
%xdefine CBS_get_u32 BORINGSSL_PREFIX %+ _CBS_get_u32
|
||||
%xdefine CBS_get_u32le BORINGSSL_PREFIX %+ _CBS_get_u32le
|
||||
%xdefine CBS_get_u64 BORINGSSL_PREFIX %+ _CBS_get_u64
|
||||
%xdefine CBS_get_u64le BORINGSSL_PREFIX %+ _CBS_get_u64le
|
||||
%xdefine CBS_get_u8 BORINGSSL_PREFIX %+ _CBS_get_u8
|
||||
%xdefine CBS_get_u8_length_prefixed BORINGSSL_PREFIX %+ _CBS_get_u8_length_prefixed
|
||||
%xdefine CBS_init BORINGSSL_PREFIX %+ _CBS_init
|
||||
@@ -3352,6 +3379,8 @@
|
||||
%xdefine ECDSA_SIG_free BORINGSSL_PREFIX %+ _ECDSA_SIG_free
|
||||
%xdefine ECDSA_SIG_from_bytes BORINGSSL_PREFIX %+ _ECDSA_SIG_from_bytes
|
||||
%xdefine ECDSA_SIG_get0 BORINGSSL_PREFIX %+ _ECDSA_SIG_get0
|
||||
%xdefine ECDSA_SIG_get0_r BORINGSSL_PREFIX %+ _ECDSA_SIG_get0_r
|
||||
%xdefine ECDSA_SIG_get0_s BORINGSSL_PREFIX %+ _ECDSA_SIG_get0_s
|
||||
%xdefine ECDSA_SIG_marshal BORINGSSL_PREFIX %+ _ECDSA_SIG_marshal
|
||||
%xdefine ECDSA_SIG_max_len BORINGSSL_PREFIX %+ _ECDSA_SIG_max_len
|
||||
%xdefine ECDSA_SIG_new BORINGSSL_PREFIX %+ _ECDSA_SIG_new
|
||||
@@ -4090,8 +4119,16 @@
|
||||
%xdefine RSA_generate_key_ex BORINGSSL_PREFIX %+ _RSA_generate_key_ex
|
||||
%xdefine RSA_generate_key_fips BORINGSSL_PREFIX %+ _RSA_generate_key_fips
|
||||
%xdefine RSA_get0_crt_params BORINGSSL_PREFIX %+ _RSA_get0_crt_params
|
||||
%xdefine RSA_get0_d BORINGSSL_PREFIX %+ _RSA_get0_d
|
||||
%xdefine RSA_get0_dmp1 BORINGSSL_PREFIX %+ _RSA_get0_dmp1
|
||||
%xdefine RSA_get0_dmq1 BORINGSSL_PREFIX %+ _RSA_get0_dmq1
|
||||
%xdefine RSA_get0_e BORINGSSL_PREFIX %+ _RSA_get0_e
|
||||
%xdefine RSA_get0_factors BORINGSSL_PREFIX %+ _RSA_get0_factors
|
||||
%xdefine RSA_get0_iqmp BORINGSSL_PREFIX %+ _RSA_get0_iqmp
|
||||
%xdefine RSA_get0_key BORINGSSL_PREFIX %+ _RSA_get0_key
|
||||
%xdefine RSA_get0_n BORINGSSL_PREFIX %+ _RSA_get0_n
|
||||
%xdefine RSA_get0_p BORINGSSL_PREFIX %+ _RSA_get0_p
|
||||
%xdefine RSA_get0_q BORINGSSL_PREFIX %+ _RSA_get0_q
|
||||
%xdefine RSA_get_ex_data BORINGSSL_PREFIX %+ _RSA_get_ex_data
|
||||
%xdefine RSA_get_ex_new_index BORINGSSL_PREFIX %+ _RSA_get_ex_new_index
|
||||
%xdefine RSA_is_opaque BORINGSSL_PREFIX %+ _RSA_is_opaque
|
||||
@@ -4175,6 +4212,7 @@
|
||||
%xdefine SXNET_get_id_ulong BORINGSSL_PREFIX %+ _SXNET_get_id_ulong
|
||||
%xdefine SXNET_it BORINGSSL_PREFIX %+ _SXNET_it
|
||||
%xdefine SXNET_new BORINGSSL_PREFIX %+ _SXNET_new
|
||||
%xdefine TRUST_TOKEN_generate_key BORINGSSL_PREFIX %+ _TRUST_TOKEN_generate_key
|
||||
%xdefine USERNOTICE_free BORINGSSL_PREFIX %+ _USERNOTICE_free
|
||||
%xdefine USERNOTICE_it BORINGSSL_PREFIX %+ _USERNOTICE_it
|
||||
%xdefine USERNOTICE_new BORINGSSL_PREFIX %+ _USERNOTICE_new
|
||||
@@ -4624,6 +4662,8 @@
|
||||
%xdefine X509_get_serialNumber BORINGSSL_PREFIX %+ _X509_get_serialNumber
|
||||
%xdefine X509_get_signature_nid BORINGSSL_PREFIX %+ _X509_get_signature_nid
|
||||
%xdefine X509_get_subject_name BORINGSSL_PREFIX %+ _X509_get_subject_name
|
||||
%xdefine X509_getm_notAfter BORINGSSL_PREFIX %+ _X509_getm_notAfter
|
||||
%xdefine X509_getm_notBefore BORINGSSL_PREFIX %+ _X509_getm_notBefore
|
||||
%xdefine X509_gmtime_adj BORINGSSL_PREFIX %+ _X509_gmtime_adj
|
||||
%xdefine X509_issuer_and_serial_cmp BORINGSSL_PREFIX %+ _X509_issuer_and_serial_cmp
|
||||
%xdefine X509_issuer_and_serial_hash BORINGSSL_PREFIX %+ _X509_issuer_and_serial_hash
|
||||
@@ -5014,11 +5054,13 @@
|
||||
%xdefine ec_random_nonzero_scalar BORINGSSL_PREFIX %+ _ec_random_nonzero_scalar
|
||||
%xdefine ec_scalar_add BORINGSSL_PREFIX %+ _ec_scalar_add
|
||||
%xdefine ec_scalar_equal_vartime BORINGSSL_PREFIX %+ _ec_scalar_equal_vartime
|
||||
%xdefine ec_scalar_from_bytes BORINGSSL_PREFIX %+ _ec_scalar_from_bytes
|
||||
%xdefine ec_scalar_from_montgomery BORINGSSL_PREFIX %+ _ec_scalar_from_montgomery
|
||||
%xdefine ec_scalar_inv_montgomery BORINGSSL_PREFIX %+ _ec_scalar_inv_montgomery
|
||||
%xdefine ec_scalar_inv_montgomery_vartime BORINGSSL_PREFIX %+ _ec_scalar_inv_montgomery_vartime
|
||||
%xdefine ec_scalar_is_zero BORINGSSL_PREFIX %+ _ec_scalar_is_zero
|
||||
%xdefine ec_scalar_mul_montgomery BORINGSSL_PREFIX %+ _ec_scalar_mul_montgomery
|
||||
%xdefine ec_scalar_to_bytes BORINGSSL_PREFIX %+ _ec_scalar_to_bytes
|
||||
%xdefine ec_scalar_to_montgomery BORINGSSL_PREFIX %+ _ec_scalar_to_montgomery
|
||||
%xdefine ec_simple_scalar_inv_montgomery BORINGSSL_PREFIX %+ _ec_simple_scalar_inv_montgomery
|
||||
%xdefine ecp_nistz256_avx2_select_w7 BORINGSSL_PREFIX %+ _ecp_nistz256_avx2_select_w7
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
@@ -120,7 +120,7 @@ extension AES.GCM {
|
||||
|
||||
@inlinable
|
||||
public init<D: DataProtocol>(combined: D) throws {
|
||||
// AES minumum nonce (12 bytes) + AES tag (16 bytes)
|
||||
// AES minimum nonce (12 bytes) + AES tag (16 bytes)
|
||||
// While we have these values in the internal APIs, we can't use it in inlinable code.
|
||||
let aesGCMOverhead = 12 + 16
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
@@ -48,7 +48,7 @@ protocol Cipher {
|
||||
/// - nonce: A Nonce used for sealing.
|
||||
/// - authenticatedData: Optional additional data to be authenticated.
|
||||
/// - Returns: The sealed box containing the ciphertext and authentication tag
|
||||
/// - Throws: An error occured while encrypting or authenticating.
|
||||
/// - Throws: An error occurred while encrypting or authenticating.
|
||||
static func seal<Plaintext: DataProtocol, AuthenticatedData: DataProtocol>
|
||||
(_ message: Plaintext, using key: SymmetricKey, nonce: Nonce?, authenticating: AuthenticatedData) throws -> SealedBox
|
||||
|
||||
@@ -61,7 +61,7 @@ protocol Cipher {
|
||||
/// - nonce: The nonce used for sealing
|
||||
/// - authenticatedData: The data that was authenticated.
|
||||
/// - Returns: Returns the data, if the correct key is used and the authenticated data matches the one from the seal operation.
|
||||
/// - Throws: An error occured while decrypting or authenticating.
|
||||
/// - Throws: An error occurred while decrypting or authenticating.
|
||||
static func open<AuthenticatedData: DataProtocol>
|
||||
(_ sealedBox: SealedBox, using key: Key, authenticating: AuthenticatedData) throws -> Data
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
@@ -15,7 +15,11 @@
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
import Foundation
|
||||
// MARK: - Generated file, do NOT edit
|
||||
// any edits of this file WILL be overwritten and thus discarded
|
||||
// see section `gyb` in `README` for details.
|
||||
|
||||
// MARK: - AES.GCM + Nonce
|
||||
extension AES.GCM {
|
||||
public struct Nonce: ContiguousBytes, Sequence {
|
||||
let bytes: Data
|
||||
@@ -45,6 +49,7 @@ extension AES.GCM {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - ChaChaPoly + Nonce
|
||||
extension ChaChaPoly {
|
||||
public struct Nonce: ContiguousBytes, Sequence {
|
||||
let bytes: Data
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
@@ -15,6 +15,9 @@
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
import Foundation
|
||||
// MARK: - Generated file, do NOT edit
|
||||
// any edits of this file WILL be overwritten and thus discarded
|
||||
// see section `gyb` in `README` for details.
|
||||
%{
|
||||
ciphers = [{"name": "AES.GCM", "recommendedNonceSize": "AES.GCM.defaultNonceByteCount", "nonceValidation": "< AES.GCM.defaultNonceByteCount"},{"name": "ChaChaPoly", "recommendedNonceSize": "ChaChaPoly.nonceByteCount", "nonceValidation": "!= ChaChaPoly.nonceByteCount"}]
|
||||
}%
|
||||
@@ -25,6 +28,7 @@ nonceSize = cipher["recommendedNonceSize"]
|
||||
nonceValidation = cipher["nonceValidation"]
|
||||
}%
|
||||
|
||||
// MARK: - ${name} + Nonce
|
||||
extension ${name} {
|
||||
public struct Nonce: ContiguousBytes, Sequence {
|
||||
let bytes: Data
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
@@ -14,7 +14,11 @@
|
||||
#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
// MARK: - Generated file, do NOT edit
|
||||
// any edits of this file WILL be overwritten and thus discarded
|
||||
// see section `gyb` in `README` for details.
|
||||
|
||||
// MARK: - SHA256Digest + DigestPrivate
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
|
||||
public struct SHA256Digest: DigestPrivate {
|
||||
let bytes: (UInt64, UInt64, UInt64, UInt64)
|
||||
@@ -61,6 +65,8 @@ public struct SHA256Digest: DigestPrivate {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - SHA384Digest + DigestPrivate
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
|
||||
public struct SHA384Digest: DigestPrivate {
|
||||
let bytes: (UInt64, UInt64, UInt64, UInt64, UInt64, UInt64)
|
||||
@@ -109,6 +115,8 @@ public struct SHA384Digest: DigestPrivate {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - SHA512Digest + DigestPrivate
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
|
||||
public struct SHA512Digest: DigestPrivate {
|
||||
let bytes: (UInt64, UInt64, UInt64, UInt64, UInt64, UInt64, UInt64, UInt64)
|
||||
@@ -160,6 +168,7 @@ public struct SHA512Digest: DigestPrivate {
|
||||
}
|
||||
|
||||
extension Insecure {
|
||||
// MARK: - SHA1Digest + DigestPrivate
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
|
||||
public struct SHA1Digest: DigestPrivate {
|
||||
let bytes: (UInt64, UInt64, UInt64)
|
||||
@@ -205,8 +214,8 @@ public struct SHA1Digest: DigestPrivate {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Insecure {
|
||||
// MARK: - MD5Digest + DigestPrivate
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
|
||||
public struct MD5Digest: DigestPrivate {
|
||||
let bytes: (UInt64, UInt64)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
@@ -14,28 +14,28 @@
|
||||
#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
|
||||
// MARK: - Generated file, do NOT edit
|
||||
// any edits of this file WILL be overwritten and thus discarded
|
||||
// see section `gyb` in `README` for details.
|
||||
%{
|
||||
digests_and_length = [{"name": "SHA256", "count": 32},{"name": "SHA384","count":48},{"name":"SHA512", "count": 64},{"name":"SHA1", "count":20, "prefix":"Insecure"},{"name":"MD5", "count":16, "prefix":"Insecure"}]
|
||||
}%
|
||||
|
||||
% for HF in digests_and_length:
|
||||
%{
|
||||
name = HF["name"]
|
||||
byteCount = HF["count"]
|
||||
wordsCount = (byteCount*8)/64 + (0 if ((byteCount*8)%64) == 0 else 1)
|
||||
}%
|
||||
|
||||
%{
|
||||
if "prefix" in HF.keys():
|
||||
protocol_prefix = "extension " + HF["prefix"] + "{"
|
||||
protocol_prefix = "extension " + HF["prefix"] + " {"
|
||||
protocol_suffix = "}"
|
||||
else:
|
||||
protocol_prefix = ""
|
||||
protocol_suffix = ""
|
||||
}%
|
||||
|
||||
${protocol_prefix}
|
||||
// MARK: - ${name}Digest + DigestPrivate
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
|
||||
public struct ${name}Digest: DigestPrivate {
|
||||
let bytes: (${(wordsCount-1)*"UInt64, "+"UInt64"})
|
||||
@@ -78,7 +78,7 @@ public struct ${name}Digest: DigestPrivate {
|
||||
}
|
||||
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
self.withUnsafeBytes {hasher.combine(bytes: $0)}
|
||||
self.withUnsafeBytes { hasher.combine(bytes: $0) }
|
||||
}
|
||||
}
|
||||
${protocol_suffix}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
@@ -24,8 +24,14 @@ typealias NISTCurvePrivateKeyImpl = OpenSSLNISTCurvePrivateKeyImpl
|
||||
|
||||
import Foundation
|
||||
|
||||
// MARK: - Generated file, do NOT edit
|
||||
// any edits of this file WILL be overwritten and thus discarded
|
||||
// see section `gyb` in `README` for details.
|
||||
|
||||
// MARK: - P256 + Signing
|
||||
extension P256 {
|
||||
public enum Signing {
|
||||
|
||||
public struct PublicKey: NISTECPublicKey {
|
||||
var impl: NISTCurvePublicKeyImpl<P256.CurveDetails>
|
||||
|
||||
@@ -78,9 +84,10 @@ extension P256 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - P256 + KeyAgreement
|
||||
extension P256 {
|
||||
public enum KeyAgreement {
|
||||
|
||||
public struct PublicKey: NISTECPublicKey {
|
||||
var impl: NISTCurvePublicKeyImpl<P256.CurveDetails>
|
||||
|
||||
@@ -133,9 +140,10 @@ extension P256 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - P384 + Signing
|
||||
extension P384 {
|
||||
public enum Signing {
|
||||
|
||||
public struct PublicKey: NISTECPublicKey {
|
||||
var impl: NISTCurvePublicKeyImpl<P384.CurveDetails>
|
||||
|
||||
@@ -188,9 +196,10 @@ extension P384 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - P384 + KeyAgreement
|
||||
extension P384 {
|
||||
public enum KeyAgreement {
|
||||
|
||||
public struct PublicKey: NISTECPublicKey {
|
||||
var impl: NISTCurvePublicKeyImpl<P384.CurveDetails>
|
||||
|
||||
@@ -243,9 +252,10 @@ extension P384 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - P521 + Signing
|
||||
extension P521 {
|
||||
public enum Signing {
|
||||
|
||||
public struct PublicKey: NISTECPublicKey {
|
||||
var impl: NISTCurvePublicKeyImpl<P521.CurveDetails>
|
||||
|
||||
@@ -298,9 +308,10 @@ extension P521 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - P521 + KeyAgreement
|
||||
extension P521 {
|
||||
public enum KeyAgreement {
|
||||
|
||||
public struct PublicKey: NISTECPublicKey {
|
||||
var impl: NISTCurvePublicKeyImpl<P521.CurveDetails>
|
||||
|
||||
@@ -354,12 +365,13 @@ extension P521 {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - P256 + DH
|
||||
extension P256.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement {
|
||||
/// Performs a key agreement with provided public key share.
|
||||
///
|
||||
/// - Parameter publicKeyShare: The public key to perform the ECDH with.
|
||||
/// - Returns: Returns a shared secret
|
||||
/// - Throws: An error occured while computing the shared secret
|
||||
/// - Throws: An error occurred while computing the shared secret
|
||||
public func sharedSecretFromKeyAgreement(with publicKeyShare: P256.KeyAgreement.PublicKey) throws -> SharedSecret {
|
||||
#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
return try self.coreCryptoSharedSecretFromKeyAgreement(with: publicKeyShare)
|
||||
@@ -368,12 +380,13 @@ extension P256.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// MARK: - P384 + DH
|
||||
extension P384.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement {
|
||||
/// Performs a key agreement with provided public key share.
|
||||
///
|
||||
/// - Parameter publicKeyShare: The public key to perform the ECDH with.
|
||||
/// - Returns: Returns a shared secret
|
||||
/// - Throws: An error occured while computing the shared secret
|
||||
/// - Throws: An error occurred while computing the shared secret
|
||||
public func sharedSecretFromKeyAgreement(with publicKeyShare: P384.KeyAgreement.PublicKey) throws -> SharedSecret {
|
||||
#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
return try self.coreCryptoSharedSecretFromKeyAgreement(with: publicKeyShare)
|
||||
@@ -382,12 +395,13 @@ extension P384.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// MARK: - P521 + DH
|
||||
extension P521.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement {
|
||||
/// Performs a key agreement with provided public key share.
|
||||
///
|
||||
/// - Parameter publicKeyShare: The public key to perform the ECDH with.
|
||||
/// - Returns: Returns a shared secret
|
||||
/// - Throws: An error occured while computing the shared secret
|
||||
/// - Throws: An error occurred while computing the shared secret
|
||||
public func sharedSecretFromKeyAgreement(with publicKeyShare: P521.KeyAgreement.PublicKey) throws -> SharedSecret {
|
||||
#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
return try self.coreCryptoSharedSecretFromKeyAgreement(with: publicKeyShare)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
@@ -24,17 +24,20 @@ typealias NISTCurvePrivateKeyImpl = OpenSSLNISTCurvePrivateKeyImpl
|
||||
|
||||
import Foundation
|
||||
|
||||
// MARK: - Generated file, do NOT edit
|
||||
// any edits of this file WILL be overwritten and thus discarded
|
||||
// see section `gyb` in `README` for details.
|
||||
|
||||
%{
|
||||
NIST_CURVES = ["P256", "P384", "P521"]
|
||||
CURVES_FUNC = ["Signing", "KeyAgreement"]
|
||||
}%
|
||||
|
||||
% for CURVE in NIST_CURVES:
|
||||
% for FUNC in CURVES_FUNC:
|
||||
|
||||
// MARK: - ${CURVE} + ${FUNC}
|
||||
extension ${CURVE} {
|
||||
public enum ${FUNC} {
|
||||
|
||||
public struct PublicKey: NISTECPublicKey {
|
||||
var impl: NISTCurvePublicKeyImpl<${CURVE}.CurveDetails>
|
||||
|
||||
@@ -90,14 +93,14 @@ extension ${CURVE} {
|
||||
% end
|
||||
% end
|
||||
|
||||
|
||||
% for CURVE in NIST_CURVES:
|
||||
// MARK: - ${CURVE} + DH
|
||||
extension ${CURVE}.KeyAgreement.PrivateKey: DiffieHellmanKeyAgreement {
|
||||
/// Performs a key agreement with provided public key share.
|
||||
///
|
||||
/// - Parameter publicKeyShare: The public key to perform the ECDH with.
|
||||
/// - Returns: Returns a shared secret
|
||||
/// - Throws: An error occured while computing the shared secret
|
||||
/// - Throws: An error occurred while computing the shared secret
|
||||
public func sharedSecretFromKeyAgreement(with publicKeyShare: ${CURVE}.KeyAgreement.PublicKey) throws -> SharedSecret {
|
||||
#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
|
||||
return try self.coreCryptoSharedSecretFromKeyAgreement(with: publicKeyShare)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
@@ -18,7 +18,7 @@ import Foundation
|
||||
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
|
||||
struct HKDF<H: HashFunction> {
|
||||
/// Computes an HKDF using the parametrized Hash Function.
|
||||
/// Computes an HKDF using the parameterized Hash Function.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - inputKeyMaterial: Input key material.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
@@ -63,7 +63,7 @@ extension BoringSSLEllipticCurveGroup {
|
||||
return try! ArbitraryPrecisionInteger(copying: baseOrder)
|
||||
}
|
||||
|
||||
/// An elliptic curve can be represented in a Weierstrass form: y² = x³ + ax + b. This
|
||||
/// An elliptic curve can be represented in a Weierstrass form: `y² = x³ + ax + b`. This
|
||||
/// property provides the values of a and b on the curve.
|
||||
@usableFromInline
|
||||
var weierstrassCoefficients: (field: ArbitraryPrecisionInteger, a: ArbitraryPrecisionInteger, b: ArbitraryPrecisionInteger) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
@@ -15,6 +15,9 @@
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
import Foundation
|
||||
// MARK: - Generated file, do NOT edit
|
||||
// any edits of this file WILL be overwritten and thus discarded
|
||||
// see section `gyb` in `README` for details.
|
||||
|
||||
protocol NISTECDSASignature {
|
||||
init<D: DataProtocol>(rawRepresentation: D) throws
|
||||
@@ -29,6 +32,7 @@ protocol NISTSigning {
|
||||
associatedtype ECDSASignature: NISTECDSASignature
|
||||
}
|
||||
|
||||
// MARK: - P256 + Signing
|
||||
/// An ECDSA (Elliptic Curve Digital Signature Algorithm) Signature
|
||||
extension P256.Signing {
|
||||
public struct ECDSASignature: ContiguousBytes, NISTECDSASignature {
|
||||
@@ -88,6 +92,7 @@ extension P256.Signing {
|
||||
|
||||
extension P256.Signing: NISTSigning {}
|
||||
|
||||
// MARK: - P256 + PrivateKey
|
||||
extension P256.Signing.PrivateKey: DigestSigner {
|
||||
/// Generates an ECDSA signature over the P256 elliptic curve.
|
||||
///
|
||||
@@ -144,6 +149,7 @@ extension P256.Signing.PublicKey: DigestValidator {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - P384 + Signing
|
||||
/// An ECDSA (Elliptic Curve Digital Signature Algorithm) Signature
|
||||
extension P384.Signing {
|
||||
public struct ECDSASignature: ContiguousBytes, NISTECDSASignature {
|
||||
@@ -203,6 +209,7 @@ extension P384.Signing {
|
||||
|
||||
extension P384.Signing: NISTSigning {}
|
||||
|
||||
// MARK: - P384 + PrivateKey
|
||||
extension P384.Signing.PrivateKey: DigestSigner {
|
||||
/// Generates an ECDSA signature over the P384 elliptic curve.
|
||||
///
|
||||
@@ -259,6 +266,7 @@ extension P384.Signing.PublicKey: DigestValidator {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - P521 + Signing
|
||||
/// An ECDSA (Elliptic Curve Digital Signature Algorithm) Signature
|
||||
extension P521.Signing {
|
||||
public struct ECDSASignature: ContiguousBytes, NISTECDSASignature {
|
||||
@@ -318,6 +326,7 @@ extension P521.Signing {
|
||||
|
||||
extension P521.Signing: NISTSigning {}
|
||||
|
||||
// MARK: - P521 + PrivateKey
|
||||
extension P521.Signing.PrivateKey: DigestSigner {
|
||||
/// Generates an ECDSA signature over the P521 elliptic curve.
|
||||
///
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
@@ -15,7 +15,9 @@
|
||||
@_exported import CryptoKit
|
||||
#else
|
||||
import Foundation
|
||||
|
||||
// MARK: - Generated file, do NOT edit
|
||||
// any edits of this file WILL be overwritten and thus discarded
|
||||
// see section `gyb` in `README` for details.
|
||||
%{
|
||||
NIST_CURVES_AND_HF = [{"curve": "P256", "hf": "SHA256"},{"curve": "P384", "hf": "SHA384"},{"curve": "P521", "hf": "SHA512"}]
|
||||
}%
|
||||
@@ -38,7 +40,7 @@ protocol NISTSigning {
|
||||
CURVE = CURVE_AND_HF["curve"]
|
||||
HF = CURVE_AND_HF["hf"]
|
||||
}%
|
||||
|
||||
// MARK: - ${CURVE} + Signing
|
||||
/// An ECDSA (Elliptic Curve Digital Signature Algorithm) Signature
|
||||
extension ${CURVE}.Signing {
|
||||
public struct ECDSASignature: ContiguousBytes, NISTECDSASignature {
|
||||
@@ -67,8 +69,8 @@ extension ${CURVE}.Signing {
|
||||
|
||||
var composite: (r: Data, s: Data) {
|
||||
let combined = rawRepresentation
|
||||
assert(combined.count%2 == 0)
|
||||
let half = combined.count/2
|
||||
assert(combined.count % 2 == 0)
|
||||
let half = combined.count / 2
|
||||
return (combined.prefix(upTo: half), combined.suffix(from: half))
|
||||
}
|
||||
|
||||
@@ -98,6 +100,7 @@ extension ${CURVE}.Signing {
|
||||
|
||||
extension ${CURVE}.Signing: NISTSigning {}
|
||||
|
||||
// MARK: - ${CURVE} + PrivateKey
|
||||
extension ${CURVE}.Signing.PrivateKey: DigestSigner {
|
||||
/// Generates an ECDSA signature over the ${CURVE} elliptic curve.
|
||||
///
|
||||
@@ -155,5 +158,4 @@ extension ${CURVE}.Signing.PublicKey: DigestValidator {
|
||||
}
|
||||
|
||||
% end
|
||||
|
||||
#endif // Linux or !SwiftPM
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
@@ -427,7 +427,7 @@ extension ArbitraryPrecisionInteger: CustomDebugStringConvertible {
|
||||
|
||||
// This line looks scary but it's actually pretty safe.
|
||||
//
|
||||
// String.init(decoding:as:) treates the first argument as a Collection of UInt8, and so does not require it to be
|
||||
// String.init(decoding:as:) treats the first argument as a Collection of UInt8, and so does not require it to be
|
||||
// null-terminated. It also doesn't take ownership of the data, instead copying the bytes in to its backing storage.
|
||||
//
|
||||
// The other note is that we don't need to free the pointer vended to us by BIO_mem_contents, as this is in fact an
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Licensed under Apache License v2.0
|
||||
//
|
||||
// See LICENSE.txt for license information
|
||||
// See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
|
||||
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
Loaded 100 of 141 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user