mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-06-01 15:40:28 +00:00
Remove struct curve entirely
This commit is contained in:
parent
677b7f6c42
commit
bc3f49011a
|
@ -120,12 +120,11 @@ typedef uint64_t uECC_dword_t;
|
||||||
#define NUM_ECC_BYTES (uECC_WORD_SIZE*NUM_ECC_WORDS)
|
#define NUM_ECC_BYTES (uECC_WORD_SIZE*NUM_ECC_WORDS)
|
||||||
#define NUM_ECC_BITS 256
|
#define NUM_ECC_BITS 256
|
||||||
|
|
||||||
/* structure that represents an elliptic curve (e.g. p256):*/
|
/* curve identifier (for API compatility - only P-256 is supported) */
|
||||||
struct uECC_Curve_t;
|
typedef enum {
|
||||||
typedef const struct uECC_Curve_t * uECC_Curve;
|
curve_invalid = 0,
|
||||||
struct uECC_Curve_t {
|
curve_secp256r1 = 0xff
|
||||||
unsigned char dummy;
|
} uECC_Curve;
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief computes doubling of point ion jacobian coordinates, in place.
|
* @brief computes doubling of point ion jacobian coordinates, in place.
|
||||||
|
@ -157,11 +156,6 @@ extern const uECC_word_t curve_n[NUM_ECC_WORDS];
|
||||||
extern const uECC_word_t curve_G[2 * NUM_ECC_WORDS];
|
extern const uECC_word_t curve_G[2 * NUM_ECC_WORDS];
|
||||||
extern const uECC_word_t curve_b[NUM_ECC_WORDS];
|
extern const uECC_word_t curve_b[NUM_ECC_WORDS];
|
||||||
|
|
||||||
/* definition of curve NIST p-256: */
|
|
||||||
static const struct uECC_Curve_t curve_secp256r1 = {
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
uECC_Curve uECC_secp256r1(void);
|
uECC_Curve uECC_secp256r1(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -679,7 +679,7 @@ static void x_side_default(uECC_word_t *result,
|
||||||
|
|
||||||
uECC_Curve uECC_secp256r1(void)
|
uECC_Curve uECC_secp256r1(void)
|
||||||
{
|
{
|
||||||
return &curve_secp256r1;
|
return curve_secp256r1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vli_mmod_fast_secp256r1(unsigned int *result, unsigned int*product)
|
void vli_mmod_fast_secp256r1(unsigned int *result, unsigned int*product)
|
||||||
|
@ -827,9 +827,6 @@ static void XYcZ_add_rnd(uECC_word_t * X1, uECC_word_t * Y1,
|
||||||
{
|
{
|
||||||
/* t1 = X1, t2 = Y1, t3 = X2, t4 = Y2 */
|
/* t1 = X1, t2 = Y1, t3 = X2, t4 = Y2 */
|
||||||
uECC_word_t t5[NUM_ECC_WORDS];
|
uECC_word_t t5[NUM_ECC_WORDS];
|
||||||
const uECC_Curve curve = &curve_secp256r1;
|
|
||||||
|
|
||||||
(void) curve;
|
|
||||||
|
|
||||||
uECC_vli_modSub(t5, X2, X1, curve_p); /* t5 = x2 - x1 */
|
uECC_vli_modSub(t5, X2, X1, curve_p); /* t5 = x2 - x1 */
|
||||||
uECC_vli_modMult_rnd(t5, t5, t5, s); /* t5 = (x2 - x1)^2 = A */
|
uECC_vli_modMult_rnd(t5, t5, t5, s); /* t5 = (x2 - x1)^2 = A */
|
||||||
|
@ -869,9 +866,6 @@ static void XYcZ_addC_rnd(uECC_word_t * X1, uECC_word_t * Y1,
|
||||||
uECC_word_t t5[NUM_ECC_WORDS];
|
uECC_word_t t5[NUM_ECC_WORDS];
|
||||||
uECC_word_t t6[NUM_ECC_WORDS];
|
uECC_word_t t6[NUM_ECC_WORDS];
|
||||||
uECC_word_t t7[NUM_ECC_WORDS];
|
uECC_word_t t7[NUM_ECC_WORDS];
|
||||||
const uECC_Curve curve = &curve_secp256r1;
|
|
||||||
|
|
||||||
(void) curve;
|
|
||||||
|
|
||||||
uECC_vli_modSub(t5, X2, X1, curve_p); /* t5 = x2 - x1 */
|
uECC_vli_modSub(t5, X2, X1, curve_p); /* t5 = x2 - x1 */
|
||||||
uECC_vli_modMult_rnd(t5, t5, t5, s); /* t5 = (x2 - x1)^2 = A */
|
uECC_vli_modMult_rnd(t5, t5, t5, s); /* t5 = (x2 - x1)^2 = A */
|
||||||
|
|
Loading…
Reference in a new issue