// Generated by Lisette bindgen
// Source: crypto/elliptic (Go stdlib)
// Go: 1.25.10
// Lisette: 0.2.1

import "go:io"
import "go:math/big"

/// GenerateKey returns a public/private key pair. The private key is
/// generated using the given reader, which must return random data.
/// 
/// Deprecated: for ECDH, use the GenerateKey methods of the [crypto/ecdh] package;
/// for ECDSA, use the GenerateKey function of the crypto/ecdsa package.
pub fn GenerateKey(curve: Curve, rand: io.Reader) -> Result<(Slice<byte>, Ref<big.Int>, Ref<big.Int>), error>

/// Marshal converts a point on the curve into the uncompressed form specified in
/// SEC 1, Version 2.0, Section 2.3.3. If the point is not on the curve (or is
/// the conventional point at infinity), the behavior is undefined.
/// 
/// Deprecated: for ECDH, use the crypto/ecdh package. This function returns an
/// encoding equivalent to that of PublicKey.Bytes in crypto/ecdh.
pub fn Marshal(curve: Curve, x: Ref<big.Int>, y: Ref<big.Int>) -> Slice<byte>

/// MarshalCompressed converts a point on the curve into the compressed form
/// specified in SEC 1, Version 2.0, Section 2.3.3. If the point is not on the
/// curve (or is the conventional point at infinity), the behavior is undefined.
pub fn MarshalCompressed(curve: Curve, x: Ref<big.Int>, y: Ref<big.Int>) -> Slice<byte>

/// P224 returns a [Curve] which implements NIST P-224 (FIPS 186-3, section D.2.2),
/// also known as secp224r1. The CurveParams.Name of this [Curve] is "P-224".
/// 
/// Multiple invocations of this function will return the same value, so it can
/// be used for equality checks and switch statements.
/// 
/// The cryptographic operations are implemented using constant-time algorithms.
pub fn P224() -> Curve

/// P256 returns a [Curve] which implements NIST P-256 (FIPS 186-3, section D.2.3),
/// also known as secp256r1 or prime256v1. The CurveParams.Name of this [Curve] is
/// "P-256".
/// 
/// Multiple invocations of this function will return the same value, so it can
/// be used for equality checks and switch statements.
/// 
/// The cryptographic operations are implemented using constant-time algorithms.
pub fn P256() -> Curve

/// P384 returns a [Curve] which implements NIST P-384 (FIPS 186-3, section D.2.4),
/// also known as secp384r1. The CurveParams.Name of this [Curve] is "P-384".
/// 
/// Multiple invocations of this function will return the same value, so it can
/// be used for equality checks and switch statements.
/// 
/// The cryptographic operations are implemented using constant-time algorithms.
pub fn P384() -> Curve

/// P521 returns a [Curve] which implements NIST P-521 (FIPS 186-3, section D.2.5),
/// also known as secp521r1. The CurveParams.Name of this [Curve] is "P-521".
/// 
/// Multiple invocations of this function will return the same value, so it can
/// be used for equality checks and switch statements.
/// 
/// The cryptographic operations are implemented using constant-time algorithms.
pub fn P521() -> Curve

/// Unmarshal converts a point, serialized by [Marshal], into an x, y pair. It is
/// an error if the point is not in uncompressed form, is not on the curve, or is
/// the point at infinity. On error, x = nil.
/// 
/// Deprecated: for ECDH, use the crypto/ecdh package. This function accepts an
/// encoding equivalent to that of the NewPublicKey methods in crypto/ecdh.
pub fn Unmarshal(curve: Curve, data: Slice<byte>) -> (Ref<big.Int>, Ref<big.Int>)

/// UnmarshalCompressed converts a point, serialized by [MarshalCompressed], into
/// an x, y pair. It is an error if the point is not in compressed form, is not
/// on the curve, or is the point at infinity. On error, x = nil.
pub fn UnmarshalCompressed(curve: Curve, data: Slice<byte>) -> (Ref<big.Int>, Ref<big.Int>)

/// A Curve represents a short-form Weierstrass curve with a=-3.
/// 
/// The behavior of Add, Double, and ScalarMult when the input is not a point on
/// the curve is undefined.
/// 
/// Note that the conventional point at infinity (0, 0) is not considered on the
/// curve, although it can be returned by Add, Double, ScalarMult, or
/// ScalarBaseMult (but not the [Unmarshal] or [UnmarshalCompressed] functions).
/// 
/// Using Curve implementations besides those returned by [P224], [P256], [P384],
/// and [P521] is deprecated.
pub interface Curve {
  fn Add(x1: Ref<big.Int>, y1: Ref<big.Int>, x2: Ref<big.Int>, y2: Ref<big.Int>) -> (Ref<big.Int>, Ref<big.Int>)
  fn Double(x1: Ref<big.Int>, y1: Ref<big.Int>) -> (Ref<big.Int>, Ref<big.Int>)
  fn IsOnCurve(x: Ref<big.Int>, y: Ref<big.Int>) -> bool
  fn Params() -> Ref<CurveParams>
  fn ScalarBaseMult(k: Slice<byte>) -> (Ref<big.Int>, Ref<big.Int>)
  fn ScalarMult(x1: Ref<big.Int>, y1: Ref<big.Int>, k: Slice<byte>) -> (Ref<big.Int>, Ref<big.Int>)
}

/// CurveParams contains the parameters of an elliptic curve and also provides
/// a generic, non-constant time implementation of [Curve].
/// 
/// The generic Curve implementation is deprecated, and using custom curves
/// (those not returned by [P224], [P256], [P384], and [P521]) is not guaranteed
/// to provide any security property.
pub struct CurveParams {
  pub P: Option<Ref<big.Int>>,
  pub N: Option<Ref<big.Int>>,
  pub B: Option<Ref<big.Int>>,
  pub Gx: Option<Ref<big.Int>>,
  pub Gy: Option<Ref<big.Int>>,
  pub BitSize: int,
  pub Name: string,
}

impl CurveParams {
  /// Add implements [Curve.Add].
  /// 
  /// Deprecated: the [CurveParams] methods are deprecated and are not guaranteed to
  /// provide any security property. For ECDH, use the [crypto/ecdh] package.
  /// For ECDSA, use the [crypto/ecdsa] package with a [Curve] value returned directly
  /// from [P224], [P256], [P384], or [P521].
  fn Add(
    self: Ref<CurveParams>,
    x1: Ref<big.Int>,
    y1: Ref<big.Int>,
    x2: Ref<big.Int>,
    y2: Ref<big.Int>,
  ) -> (Ref<big.Int>, Ref<big.Int>)

  /// Double implements [Curve.Double].
  /// 
  /// Deprecated: the [CurveParams] methods are deprecated and are not guaranteed to
  /// provide any security property. For ECDH, use the [crypto/ecdh] package.
  /// For ECDSA, use the [crypto/ecdsa] package with a [Curve] value returned directly
  /// from [P224], [P256], [P384], or [P521].
  fn Double(self: Ref<CurveParams>, x1: Ref<big.Int>, y1: Ref<big.Int>) -> (Ref<big.Int>, Ref<big.Int>)

  /// IsOnCurve implements [Curve.IsOnCurve].
  /// 
  /// Deprecated: the [CurveParams] methods are deprecated and are not guaranteed to
  /// provide any security property. For ECDH, use the [crypto/ecdh] package.
  /// For ECDSA, use the [crypto/ecdsa] package with a [Curve] value returned directly
  /// from [P224], [P256], [P384], or [P521].
  fn IsOnCurve(self: Ref<CurveParams>, x: Ref<big.Int>, y: Ref<big.Int>) -> bool

  fn Params(self: Ref<CurveParams>) -> Ref<CurveParams>

  /// ScalarBaseMult implements [Curve.ScalarBaseMult].
  /// 
  /// Deprecated: the [CurveParams] methods are deprecated and are not guaranteed to
  /// provide any security property. For ECDH, use the [crypto/ecdh] package.
  /// For ECDSA, use the [crypto/ecdsa] package with a [Curve] value returned directly
  /// from [P224], [P256], [P384], or [P521].
  fn ScalarBaseMult(self: Ref<CurveParams>, k: Slice<byte>) -> (Ref<big.Int>, Ref<big.Int>)

  /// ScalarMult implements [Curve.ScalarMult].
  /// 
  /// Deprecated: the [CurveParams] methods are deprecated and are not guaranteed to
  /// provide any security property. For ECDH, use the [crypto/ecdh] package.
  /// For ECDSA, use the [crypto/ecdsa] package with a [Curve] value returned directly
  /// from [P224], [P256], [P384], or [P521].
  fn ScalarMult(
    self: Ref<CurveParams>,
    bx: Ref<big.Int>,
    by: Ref<big.Int>,
    k: Slice<byte>,
  ) -> (Ref<big.Int>, Ref<big.Int>)
}
