p256verify

package
v1.13.14-0.3.0.rc.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2025 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package p256verify implements an EVM precompile to verify P256 ECDSA signatures, as described in RIP-7212.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pack

func Pack(hash [32]byte, r, s *big.Int, key *ecdsa.PublicKey) []byte

Pack packs the arguments into a byte slice compatible with Precompile.Run. It does NOT perform any validation on its inputs and therefore may panic if, for example, a big.Int with >256 bits is received. Keys and signatures generated with elliptic.GenerateKey and ecdsa.Sign are valid inputs.

Types

type Precompile

type Precompile struct{}

Precompile implements ECDSA verification on the P256 curve, as defined by RIP-7212.

func (Precompile) RequiredGas

func (Precompile) RequiredGas([]byte) uint64

RequiredGas returns params.P256VerifyGas.

func (Precompile) Run

func (Precompile) Run(sig []byte) ([]byte, error)

Run parses and verifies the signature. On success it returns a 32-byte big-endian representation of the number 1, otherwise it returns an empty slice. The returned error is always nil.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL