#pragma once
#include "uefi.h"

/* P-256 point (affine coordinates, projective z) */
typedef struct {
    uint64_t x[4]; /* 256-bit */
    uint64_t y[4];
    uint64_t z[4]; /* 1 for affine */
} ec_point_t;

/* P-256 curve parameters (NIST) */
void ec_p256_init(void);

/* ECDHE: generate ephemeral keypair, compute shared secret */
int  ecdhe_generate_key(uint8_t pubkey[64], uint8_t privkey[32]);
int  ecdhe_compute_shared(const uint8_t privkey[32],
                          const uint8_t peer_pubkey[64],
                          uint8_t shared[32]);

/* ECDSA: verify signature */
int  ecdsa_verify(const uint8_t pubkey[64],
                  const uint8_t *msg, uint32_t msg_len,
                  const uint8_t sig_r[32], const uint8_t sig_s[32]);

/* Self-test */
int ecc_self_test(void);
