Skip to content

Commit

Permalink
N-02: make state variables private
Browse files Browse the repository at this point in the history
  • Loading branch information
dcposch committed Jul 30, 2024
1 parent 4075232 commit 7178382
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
5 changes: 3 additions & 2 deletions src/P256.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ pragma solidity 0.8.21;
* @custom:security-contact [email protected]
**/
library P256 {
address constant PRECOMPILE = address(0x100);
address constant VERIFIER = 0xc2b78104907F722DABAc4C69f826a522B2754De4;
address public constant PRECOMPILE = address(0x100);
address public constant VERIFIER =
0xc2b78104907F722DABAc4C69f826a522B2754De4;

function verifySignatureAllowMalleability(
bytes32 message_hash,
Expand Down
16 changes: 8 additions & 8 deletions src/P256Verifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,27 @@ contract P256Verifier {

// Parameters for the sec256r1 (P256) elliptic curve
// Curve prime field modulus
uint256 constant p =
uint256 private constant p =
0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;
// Short weierstrass first coefficient
uint256 constant a = // The assumption a == -3 (mod p) is used throughout the codebase
uint256 private constant a = // The assumption a == -3 (mod p) is used throughout the codebase
0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;
// Short weierstrass second coefficient
uint256 constant b =
uint256 private constant b =
0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;
// Generating point affine coordinates
uint256 constant GX =
uint256 private constant GX =
0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;
uint256 constant GY =
uint256 private constant GY =
0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;
// Curve order (number of points)
uint256 constant n =
uint256 private constant n =
0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;
// -2 mod p constant, used to speed up inversion and doubling (avoid negation)
uint256 constant minus_2modp =
uint256 private constant minus_2modp =
0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFD;
// -2 mod n constant, used to speed up inversion
uint256 constant minus_2modn =
uint256 private constant minus_2modn =
0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC63254F;

/**
Expand Down
8 changes: 4 additions & 4 deletions src/WebAuthn.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ library WebAuthn {
return true;
}

bytes1 constant AUTH_DATA_FLAGS_UP = 0x01; // Bit 0
bytes1 constant AUTH_DATA_FLAGS_UV = 0x04; // Bit 2
bytes1 constant AUTH_DATA_FLAGS_BE = 0x08; // Bit 3
bytes1 constant AUTH_DATA_FLAGS_BS = 0x10; // Bit 4
bytes1 private constant AUTH_DATA_FLAGS_UP = 0x01; // Bit 0
bytes1 private constant AUTH_DATA_FLAGS_UV = 0x04; // Bit 2
bytes1 private constant AUTH_DATA_FLAGS_BE = 0x08; // Bit 3
bytes1 private constant AUTH_DATA_FLAGS_BS = 0x10; // Bit 4

/// Verifies the authFlags in authenticatorData. Numbers in inline comment
/// correspond to the same numbered bullets in
Expand Down

0 comments on commit 7178382

Please sign in to comment.