# Third-Party Notices & Conformance Vector Attributions

`CoolrfulDARkness/moonvoprf` is licensed under the **Apache License 2.0** (see [`LICENSE`](LICENSE)).

## 1. Runtime & Build Dependencies

- **External third-party MoonBit packages**: **None (`0` dependencies in `moon.mod`)** — the root module uses only `moonbitlang/core` and its own sub-packages.
- **Example sub-modules** (`examples/consumer` and `examples/async_auth_server`, each with its own `moon.mod`): pin the published `CoolrfulDARkness/moonvoprf@0.3.4` (this project) and, for `async_auth_server`, `moonbitlang/async@0.22.10` — Apache-2.0, Copyright International Digital Economy Academy (IDEA). `moonbitlang/async` ships **no NOTICE file**, so Apache-2.0 Section 4(d) imposes no additional attribution duty for it. None of these dependencies enter the GitHub Pages JS bundle (`opaque/js_api`); their vendored copies live only in git-ignored `.mooncakes/` directories.
- **Self-authored prior projects merged into this repository** (`opaque/`, `frost/`): the `opaque/` (RFC 9807) and `frost/` (RFC 9591) subtrees were merged and rewritten from the author's own earlier standalone projects — `moonopaque` (<https://github.com/CoolrfulDARkness/moonopaque>) and `moonfrost` (<https://github.com/CoolrfulDARkness/moonfrost>). Both are **first-party code owned by this repository's author: they are not third-party code and carry no third-party license, copyright or attribution obligation**. The merge unified the SHA-2, P-256, Ristretto255 and constant-time (CT) cores and deleted every duplicated implementation (deduplication audit: 32 duplicate source files / 9,613 LOC removed — see [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md)). Neither project was submitted as a separate entry in the 2026 MoonBit Hackathon.
- **Native / C / FFI libraries**: **None** — the project sources contain no `extern` declarations, no C/C++ sources, and link no third-party native library (`0` FFI bindings). Native builds link only the standard runtime shipped with the MoonBit toolchain, which is not vendored, modified or redistributed by this repository.
- **Standard Library**: Uses only the official MoonBit core standard library (`moonbitlang/core`, Apache-2.0).

---

## 2. Cryptographic Specifications & Official Test Vector Sources

All cryptographic algorithms and wire formats in this repository are clean-room pure MoonBit implementations of the following public IETF RFCs and NIST FIPS standards. Official published test vectors from these standards are embedded exclusively in `*_test.mbt` files to verify byte-for-byte specification conformance:

| Standard | Title | Usage in `moonvoprf` | Embedded Test Vectors |
| :--- | :--- | :--- | :--- |
| **IETF RFC 9497** | *Oblivious Pseudorandom Functions (OPRFs) Using Prime-Order Groups* (CFRG, Dec 2023) | `voprf/` (OPRF, VOPRF, POPRF, single & batched DLEQ) | Official IETF `allVectors.json` — all 16 vectors of the two implemented ciphersuites (Appendix A.1 & A.3) (`voprf/rfc9497_vectors_test.mbt`) |
| **IETF RFC 9576 / 9577 / 9578** | *The Privacy Pass Architecture, HTTP Authentication Scheme, and Issuance Protocols* (Jun 2024) | `privacypass/` (Token Type `0x0001` VOPRF Privately Verifiable Tokens) | Wire-format & redemption conformance tests (`privacypass/privacypass_test.mbt`) |
| **IETF RFC 9807** | *The OPAQUE Asymmetric Password-Authenticated Key Exchange (aPAKE) Protocol* (CFRG, Jul 2025) | `opaque/` & `opaque/js_api/` (OPAQUE-3DH across all 3 suites) | RFC 9807 Appendix C — all 9 official vectors (Real 1–6 & Fake 1–3, `opaque/rfc9807_vectors_test.mbt`) |
| **IETF RFC 9591** | *The Flexible Round-Optimized Schnorr Threshold (FROST) Protocol for Two-Round Schnorr Signatures* (CFRG, Jun 2024) | `frost/` (`FROST(ristretto255, SHA-512)` & `FROST(P-256, SHA-256)`, Pedersen DKG, Feldman VSS) | RFC 9591 Appendix E.3 & E.4 official vectors (`frost/rfc9591_vectors_test.mbt`) |
| **IETF RFC 9380** | *Hashing to Elliptic Curves* (CFRG, Aug 2023) | `crypto/sha2/xmd.mbt`, `crypto/p256/curve.mbt`, `crypto/ristretto255/` | `expand_message_xmd` (Appendix K.1/K.2/K.3) & `P256_XMD:SHA-256_SSWU_RO_` (Appendix J.1.1) |
| **IETF RFC 9496** | *The ristretto255 and decaf448 Groups* (CFRG, Dec 2023) | `crypto/ristretto255/` | Appendix A.1/A.2 canonical encode/decode and invalid-encoding rejection vectors (the from_uniform_bytes regression values are self-computed; the mapping is specified in §4.3.2) |
| **IETF RFC 7748** | *Elliptic Curves for Security* (CFRG, Jan 2016) | `crypto/x25519/` | §5.2 iterative scalar multiplication (including 1,000-iteration vector) & §6.1 ECDH vectors |
| **IETF RFC 9106** | *Argon2 Memory-Hard Function for Password Hashing and Proof-of-Work Applications* (Sep 2021) | `crypto/kdf/argon2id.mbt` | §5.3 Argon2id (v0x13) reference test vector |
| **IETF RFC 7914** | *The scrypt Password-Based Key Derivation Function* (Aug 2016) | `crypto/kdf/scrypt.mbt` | §12 official test vectors (including `N = 16384`) |
| **IETF RFC 2104 / 4231 / 5869 / 7693 / 8018** | HMAC, HKDF, BLAKE2b, and PBKDF2 | `crypto/kdf/` | RFC 4231 §4, RFC 5869 App. A, RFC 7693 App. A, RFC 9106 §5.3 official vectors plus published PBKDF2/BLAKE2b conformance data — per-source terms in the `crypto/kdf/kdf_test.mbt` header |
| **NIST FIPS 180-4** | *Secure Hash Standard (SHS)* — SHA-256 and SHA-512 | `crypto/sha2/` | NIST SHA-256 / SHA-512 reference vectors |

### 2.1 IETF Trust attribution for RFC-extracted test vectors (Revised BSD License)

Official test vectors from post-TLP IETF RFCs embedded in this repository's `*_test.mbt` files and the demo CLI are **Code Components extracted from the corresponding IETF RFC document** (every vector-bearing file carries a header identifying the exact RFC and section). Under Section 4.e of the IETF Trust's Legal Provisions (TLP), compliance is achieved either by reproducing the entire Revised BSD License text of Section 4.c or by including the Section 6.d notification. The per-file headers use the Section 6.d notification, and [`crypto/kdf/scrypt_test.mbt`](crypto/kdf/scrypt_test.mbt) reproduces the complete Section 4.c license text. The official license text (TLP-5.0 as corrected 2021-09-21; the license text has always been that of the Revised BSD License — the earlier name "Simplified BSD License" was an error the IETF Trust corrected, and the text is compatible with the BSD-3-Clause template) is:

> Copyright (c) &lt;year&gt; IETF Trust and the persons identified as authors of the code. All rights reserved.
>
> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
>
> 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
>
> 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
>
> 3. Neither the name of Internet Society, IETF or IETF Trust, nor the names of specific contributors, may be used to endorse or promote products derived from this software without specific prior written permission.
>
> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Per-RFC publication years are carried in each file header (RFC 7748: 2016; RFC 7914: 2016; RFC 5869: 2010; RFC 7693: 2015; RFC 9106: 2021; RFC 9380: 2023; RFC 9496: 2023; RFC 9497: 2023; RFC 9591: 2024; RFC 9807: 2025). This attribution applies in particular to the **RFC 7914 (scrypt) Section 12 official test vectors** embedded in [`crypto/kdf/scrypt_test.mbt`](crypto/kdf/scrypt_test.mbt) (source: <https://www.rfc-editor.org/rfc/rfc7914>), to the RFC-derived vector sets cited in the table above, to the RFC-derived self-check values in [`cmd/main/main.mbt`](cmd/main/main.mbt) (RFC 9496 generator and Appendix A.2 encodings, RFC 9380 J.1.1, RFC 7748 §5.2, RFC 7914 §12 output prefix — the Argon2id self-check value in the same file is a deterministic output of this implementation, verified against the RFC 9106 §5.3 official vector in `crypto/kdf/kdf_test.mbt`), to the RFC 6979 Appendix A.2.5 P-256 sample key used in [`harness/interop_cli/main.mbt`](harness/interop_cli/main.mbt) (August 2013, IETF Trust copyright per the TLP then in effect), and to the RFC 9496 Appendix A.2 invalid encodings reused in the security/adversarial test files (`opaque/security_test.mbt`, `frost/security_adversarial_test.mbt`, `voprf/adversarial_test.mbt`).

Exceptions with distinct upstream terms:

- **RFC 4231 (December 2005) HMAC vectors** (`crypto/kdf/kdf_test.mbt`): *Copyright (C) The Internet Society (2005). All rights reserved.* RFC 4231 is a Pre-Existing IETF Document; its redistribution terms are governed by the IETF copyright policy in effect at publication (BCP 78 / RFC 3978), preserved by TLP Section 2.c. No IETF Trust / Revised BSD License claim is made for these vectors.
- **BLAKE2b vectors** (`crypto/kdf/kdf_test.mbt`): only the BLAKE2b-512("abc") vector is published in RFC 7693 Appendix A; the remaining values are BLAKE2 reference published conformance (KAT) data for the algorithm specified in RFC 7693.
- **PBKDF2-HMAC-SHA256/512 values** (`crypto/kdf/kdf_test.mbt`): published conformance test data for the algorithm specified in RFC 8018; RFC 8018 itself contains no test vectors, and these deterministic algorithm outputs are not extracted from any RFC.
- **NIST FIPS 180-4 SHA-256/512 vectors** (`crypto/sha2/sha2_test.mbt`): works of the U.S. Government (NIST), not subject to copyright.

All embedded vectors are used exclusively for byte-for-byte specification conformance verification.

---

## 3. Cross-Language Interoperability Verification Baseline

- **OpenSSL 3.5.6** (Apache License 2.0, <https://www.openssl.org/>):
  - Invoked **strictly offline** via CLI subprocess in `harness/interop_openssl.py` (and GitHub Actions CI) to perform live bidirectional SHA-256, SHA-512, NIST P-256 compressed public key derivation, and P-256 ECDH cross-verification against `moonvoprf`.
  - No OpenSSL source code, headers, or binaries are bundled, linked, or required at runtime.

- **Node.js & WebCrypto** (MIT / W3C Web Cryptography API):
  - Used exclusively in `examples/web-demo/smoke.mjs` and `examples/web-demo/index.html` to exercise the compiled pure-MoonBit JavaScript ES Module (`opaque/js_api`).
