Skip to content

Commit 4075232

Browse files
committed
N-01: add security contact
1 parent 8279636 commit 4075232

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ jobs:
2323

2424
- run: |
2525
forge --version
26-
forge build --sizes
26+
forge build --via-ir --sizes
2727
id: build
2828
2929
- run: |
30-
forge test -vv
30+
forge test --via-ir -vv
3131
forge coverage --ir-minimum --report lcov
3232
git diff --exit-code
3333
id: test

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Our implementation was inspired by [Renaud Dubois/Ledger's FCL library](https://
2020
Available on any chain. If missing, see `deploy.sh`.
2121

2222
Install with:
23+
2324
- `forge install daimo-eth/p256-verifier`
2425
- add `p256-verifier/=lib/p256-verifier/src/` to remappings.txt
2526

@@ -33,7 +34,7 @@ uint256 x, y; // public key
3334
bool valid = P256.verifySignature(hash, r, s, x, y);
3435
```
3536

36-
Alternately, calling `P256.verifySignatureAllowMalleability` ignores
37+
Alternately, calling `P256.verifySignatureAllowMalleability` ignores
3738
malleability of signatures, matching the behavior specified by the NIST standard
3839
exactly.
3940

@@ -51,7 +52,7 @@ Run `foundryup` to ensure you have the latest foundry. Then,
5152
```
5253
git clone --recurse-submodules [email protected]:daimo-eth/p256-verifier
5354
cd p256-verifier
54-
forge test -vv
55+
forge test --via-ir -vv
5556
```
5657

5758
This runs test input and output handling as well as all applicable Wycheproof
@@ -87,7 +88,7 @@ npm test
8788
# Validate that all vectors also work with EIP-7212
8889
# Test the fallback contract...
8990
cd ..
90-
forge test -vv
91+
forge test --via-ir -vv
9192
9293
# In future, execution spec and clients can test against the same clean vectors
9394
```

src/P256.sol

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
pragma solidity 0.8.21;
33

44
/**
5-
* Helper library for external contracts to verify P256 signatures.
6-
* Tries to use RIP-7212 precompile if available on the chain, and if not falls
7-
* back to more expensive Solidity implementation.
5+
* @dev Helper library to verify P256 signatures. Uses the RIP-7212 precompile
6+
* if available. If unavailable (or if the signature is invalid), falls back to
7+
* a more expensive Solidity implementation.
8+
* @custom:security-contact [email protected]
89
**/
910
library P256 {
1011
address constant PRECOMPILE = address(0x100);

src/P256Verifier.sol

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
pragma solidity 0.8.21;
44

55
/**
6-
* This contract verifies P256 (secp256r1) signatures. It matches the exact
6+
* @dev This contract verifies P256 (secp256r1) signatures. It matches the exact
77
* interface specified in the EIP-7212 precompile, allowing it to be used as a
88
* fallback. It's based on Ledger's optimized implementation:
99
* https://github.com/rdubois-crypto/FreshCryptoLib/tree/master/solidity
10-
**/
10+
* @custom:security-contact [email protected]
11+
*/
1112
contract P256Verifier {
1213
/**
13-
* Precompiles don't use a function signature. The first byte of callldata
14-
* is the first byte of an input argument. In this case:
14+
* @dev Precompiles don't use a function signature. The first byte of
15+
* calldata is the first byte of an input argument. In this case:
1516
*
1617
* input[ 0: 32] = signed data hash
1718
* input[ 32: 64] = signature r

src/WebAuthn.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import "./utils/Base64URL.sol";
55
import "./P256.sol";
66

77
/**
8-
* Helper library for external contracts to verify WebAuthn signatures.
9-
**/
8+
* @dev Helper library for verify WebAuthn (aka passkey) signatures.
9+
* @custom:security-contact [email protected]
10+
*/
1011
library WebAuthn {
1112
/// Checks whether prefix occurs in the beginning of str.
1213
function startsWith(

0 commit comments

Comments
 (0)