libsec: add secp384r1 curve parameters for tls

This commit is contained in:
cinap_lenrek 2016-10-30 02:15:40 +01:00
parent d5992857bb
commit c9d55cadb3
5 changed files with 17 additions and 1 deletions

View file

@ -535,6 +535,7 @@ char* X509ecdsaverify(uchar *sig, int siglen, ECdomain *dom, ECpub *pub);
/* curves */
void secp256r1(mpint *p, mpint *a, mpint *b, mpint *x, mpint *y, mpint *n, mpint *h);
void secp256k1(mpint *p, mpint *a, mpint *b, mpint *x, mpint *y, mpint *n, mpint *h);
void secp384r1(mpint *p, mpint *a, mpint *b, mpint *x, mpint *y, mpint *n, mpint *h);
DigestState* ripemd160(uchar *, ulong, uchar *, DigestState *);

View file

@ -33,9 +33,10 @@ CFILES = des.c desmodes.c desECB.c desCBC.c des3ECB.c des3CBC.c\
ccpoly.c\
tsmemcmp.c\
secp256r1.c\
secp384r1.c\
secp256k1.c\
CLEANFILES=secp256r1.c secp256k1.c jacobian.c
CLEANFILES=secp256r1.c secp384r1.c secp256k1.c jacobian.c
ALLOFILES=${CFILES:%.c=%.$O}

View file

@ -0,0 +1,10 @@
# E: y² = x³ + ax + b
secp384r1(p,a,b,x,y,n,h) {
p = 2^384 - 2^128 - 2^96 + 2^32 - 1;
a = p - 3;
b = 0xB3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF;
x = 0xAA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7;
y = 0x3617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A147CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F;
n = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973;
h = 1;
}

View file

@ -350,6 +350,7 @@ static uchar compressors[] = {
static Namedcurve namedcurves[] = {
0x0017, secp256r1,
0x0018, secp384r1,
};
static uchar pointformats[] = {

View file

@ -1696,13 +1696,16 @@ static DigestAlg *digestalg[NUMALGS+1] = {
};
static Ints15 oid_secp256r1 = {7, 1, 2, 840, 10045, 3, 1, 7};
static Ints15 oid_secp384r1 = {5, 1, 3, 132, 0, 34};
static Ints *namedcurves_oid_tab[] = {
(Ints*)&oid_secp256r1,
(Ints*)&oid_secp384r1,
nil,
};
static void (*namedcurves[])(mpint *p, mpint *a, mpint *b, mpint *x, mpint *y, mpint *n, mpint *h) = {
secp256r1,
secp384r1,
nil,
};