Skip to content

Commit 12bbe85

Browse files
Add OQS boilerplate (#2)
* Add OQS boilerplate * Update README.md with Thom's grants Co-authored-by: Thom Wiggers <[email protected]> * Wording change * Add license and update my bits Co-authored-by: Thom Wiggers <[email protected]> Co-authored-by: Thom Wiggers <[email protected]>
1 parent 43fefb5 commit 12bbe85

File tree

3 files changed

+186
-13
lines changed

3 files changed

+186
-13
lines changed

LICENSE-APACHE2

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
Apache License
2+
Version 2.0, January 2004
3+
http://www.apache.org/licenses/
4+
5+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6+
7+
1. Definitions.
8+
9+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
10+
11+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
12+
13+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
14+
15+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
16+
17+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
18+
19+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
20+
21+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
22+
23+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
24+
25+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
26+
27+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
28+
29+
2. Grant of Copyright License.
30+
31+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
32+
33+
3. Grant of Patent License.
34+
35+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
36+
37+
4. Redistribution.
38+
39+
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
40+
41+
You must give any other recipients of the Work or Derivative Works a copy of this License; and
42+
You must cause any modified files to carry prominent notices stating that You changed the files; and
43+
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
44+
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
45+
46+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
47+
48+
5. Submission of Contributions.
49+
50+
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
51+
52+
6. Trademarks.
53+
54+
This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
55+
56+
7. Disclaimer of Warranty.
57+
58+
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
59+
60+
8. Limitation of Liability.
61+
62+
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
63+
64+
9. Accepting Warranty or Additional Liability.
65+
66+
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
67+
68+
END OF TERMS AND CONDITIONS

LICENSE-MIT

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2020 Thom Wiggers and liboqs-rust contributors
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+111-13
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,122 @@
1-
# Rust binding to [Open Quantum Safe][oqs]'s [liboqs][]
1+
liboqs-rust: Rust bindings for liboqs
2+
=====================================
23

3-
This crate provides bindings to [liboqs][]. It provides unsafe `ffi` bindings in the `oqs-sys` crate.
4-
Safe wrappers are offered via the `oqs` crate.
4+
[![Build status](https://github.com/dstebila/oqs-rs/workflows/Continuous%20integration/badge.svg)](https://github.com/dstebila/oqs-rs/actions?query=workflow%3A"Continuous+integration")
55

6+
**liboqs-rust** offers two Rust wrappers for the [Open Quantum Safe](https://openquantumsafe.org/) [liboqs](https://github.com/open-quantum-safe/liboqs/) C library, which is a C library for quantum-resistant cryptographic algorithms.
67

7-
## Adding new algorithms
8+
* The ``oqs-rs`` crate compiles and builds ``liboqs`` and generates ``unsafe`` bindings to the C library.
9+
* The ``oqs`` crate offers a Rust-style safe interface to the schemes included in ``liboqs``.
810

9-
### KEMs:
11+
Pre-requisites
12+
--------------
13+
14+
``oqs-sys`` depends on the [liboqs](https://github.com/open-quantum-safe/liboqs) C library.
15+
It will build ``liboqs`` automatically.
16+
17+
Contents
18+
--------
19+
20+
This crate provides unsafe `ffi` bindings in the `oqs-sys` crate, and safe wrappers are offered via the `oqs` crate.
21+
22+
Usage
23+
-----
24+
25+
Update your ``Cargo.toml`` and include ``oqs``:
26+
27+
```toml
28+
[dependencies]
29+
oqs = { git = "https://github.com/Open-Quantum-Safe/liboqs-rs" }
30+
```
31+
32+
``oqs-sys`` can be specified equivalently.
33+
34+
Running
35+
-------
36+
37+
```rust
38+
/// # Example: Some signed KEX
39+
/// This protocol has no replay protection!
40+
///
41+
use oqs::*;
42+
fn main() -> Result<()> {
43+
let sigalg = sig::Sig::new(sig::Algorithm::Dilithium2)?;
44+
let kemalg = kem::Kem::new(kem::Algorithm::Kyber512)?;
45+
// A's long-term secrets
46+
let (a_sig_pk, a_sig_sk) = sigalg.keypair()?;
47+
// B's long-term secrets
48+
let (b_sig_pk, b_sig_sk) = sigalg.keypair()?;
49+
50+
// assumption: A has (a_sig_sk, a_sig_pk, b_sig_pk)
51+
// assumption: B has (b_sig_sk, b_sig_pk, a_sig_pk)
52+
53+
// A -> B: kem_pk, signature
54+
let (kem_pk, kem_sk) = kemalg.keypair()?;
55+
let signature = sigalg.sign(kem_pk.as_ref(), &a_sig_sk)?;
56+
57+
// B -> A: kem_ct, signature
58+
sigalg.verify(kem_pk.as_ref(), &signature, &a_sig_pk)?;
59+
let (kem_ct, b_kem_ss) = kemalg.encapsulate(&kem_pk)?;
60+
let signature = sigalg.sign(kem_ct.as_ref(), &b_sig_sk)?;
61+
62+
// A verifies, decapsulates, now both have kem_ss
63+
sigalg.verify(kem_ct.as_ref(), &signature, &b_sig_pk)?;
64+
let a_kem_ss = kemalg.decapsulate(&kem_sk, &kem_ct)?;
65+
assert_eq!(a_kem_ss, b_kem_ss);
66+
67+
Ok(())
68+
}
69+
```
70+
71+
72+
Adding new algorithms
73+
---------------------
74+
75+
### KEMs
1076

1177
1. Update the Git submodule
12-
1. `oqs-sys` will now update when you build again
13-
1. Add it to the ``implement_kems!`` macro call in ``oqs/src/kem.rs``:
14-
* The structure is a name for the algorithm in CamelCase, and the name of the constant of the algorithm (``OQS_KEM_alg_...``)
78+
2. `oqs-sys` will now update when you build again
79+
3. Add it to the ``implement_kems!`` macro call in ``oqs/src/kem.rs``:
80+
- The structure is a name for the algorithm in CamelCase, and the name of the constant of the algorithm (``OQS_KEM_alg_...``)
1581

1682
### Signature schemes:
1783

1884
1. Update the Git submodule
19-
1. `oqs-sys` is now up-to-date when you build again
20-
1. Add it to ``implement_sigs!`` macro call in ``oqs/src/sig.rs``.
21-
* The structure is a name for the algorithm in CamelCase, and the name of the constant of the algorithm (``OQS_SIG_alg_...``)
85+
2. `oqs-sys` is now up-to-date when you build again
86+
3. Add it to ``implement_sigs!`` macro call in ``oqs/src/sig.rs``.
87+
- The structure is a name for the algorithm in CamelCase, and the name of the constant of the algorithm (``OQS_SIG_alg_...``)
88+
89+
Limitations and security
90+
------------------------
91+
92+
liboqs is designed for prototyping and evaluating quantum-resistant cryptography. Security of proposed quantum-resistant algorithms may rapidly change as research advances, and may ultimately be completely insecure against either classical or quantum computers.
93+
94+
We believe that the NIST Post-Quantum Cryptography standardization project is currently the best avenue to identifying potentially quantum-resistant algorithms. liboqs does not intend to "pick winners", and we strongly recommend that applications and protocols rely on the outcomes of the NIST standardization project when deploying post-quantum cryptography.
95+
96+
We acknowledge that some parties may want to begin deploying post-quantum cryptography prior to the conclusion of the NIST standardization project. We strongly recommend that any attempts to do make use of so-called **hybrid cryptography**, in which post-quantum public-key algorithms are used alongside traditional public key algorithms (like RSA or elliptic curves) so that the solution is at least no less secure than existing traditional cryptography.
97+
98+
Just like liboqs, liboqs-rust is provided "as is", without warranty of any kind. See [LICENSE.txt](https://github.com/open-quantum-safe/liboqs-rust/blob/master/LICENSE.txt) for the full disclaimer.
99+
100+
License
101+
-------
102+
103+
liboqs-rust is dual-licensed under the MIT and Apache-2.0 licenses.
104+
105+
The included library ``liboqs`` is covered by the [``liboqs`` license](https://github.com/open-quantum-safe/liboqs/blob/master/LICENSE.txt).
106+
107+
Team
108+
----
109+
110+
The Open Quantum Safe project is led by [Douglas Stebila](https://www.douglas.stebila.ca/research/) and [Michele Mosca](http://faculty.iqc.uwaterloo.ca/mmosca/) at the University of Waterloo.
111+
112+
liboqs-rust was developed by [Thom Wiggers](https://thomwiggers.nl) at Radboud University.
113+
114+
### Support
115+
116+
Financial support for the development of Open Quantum Safe has been provided by Amazon Web Services and the Tutte Institute for Mathematics and Computing.
117+
118+
We'd like to make a special acknowledgement to the companies who have dedicated programmer time to contribute source code to OQS, including Amazon Web Services, Cisco Systems, evolutionQ, IBM Research, and Microsoft Research.
119+
120+
Research projects which developed specific components of OQS have been supported by various research grants, including funding from the Natural Sciences and Engineering Research Council of Canada (NSERC); see the source papers for funding acknowledgments.
22121

23-
[oqs]: https://openquantumsafe.org
24-
[liboqs]: https://github.com/Open-Quantum-Safe/liboqs
122+
Thom Wiggers was supported by the European Research Council through Starting Grant No. 805031 (EPOQUE).

0 commit comments

Comments
 (0)