Add curve secp256K1

pull/99/head
Charles-Edouard de la Vergne 6 months ago
parent d080e4f1db
commit 9f917865c4
No known key found for this signature in database
GPG Key ID: F12296941B7BB9C6

@ -12,9 +12,9 @@ This specification is available in *doc* directory and at <https://g10code.com/p
The application supports:
- RSA with key up to 3072 bits
- ECDSA with secp256k1
- ECDSA with secp256R1 and secp256K1
- EDDSA with Ed25519 curve
- ECDH with secp256k1 and curve25519 curves
- ECDH with secp256R1, secp256K1 and curve25519 curves
## Installation and Usage

Binary file not shown.

@ -51,9 +51,9 @@ This specification is available in doc directory at [G10CODE]_.
The application supports:
- RSA with key up to 3072 bits
- ECDSA with secp256R1
- ECDSA with secp256R1 and secp256K1
- EDDSA with Ed25519 curve
- ECDH with secp256R1 and curve25519 curves
- ECDH with secp256R1, secp256K1 and curve25519 curves
This release has known missing parts (see also [GPGADD]_):
@ -290,6 +290,7 @@ This 3 commands fix, in that order, the template for Signature, Decryption, Auth
Supported curve name are:
- secp256k1 with tag 19
- secp256r1 with tag 19
- nistp256 with tag 19
- cv25519 (only for key 2)
- ed25519 with tag 22 (only for key 1 and 3)

@ -40,12 +40,9 @@ const unsigned char C_OID_SECP384R1[5] = {
const unsigned char C_OID_SECP521R1[5] = {
0x2B, 0x81, 0x04, 0x00, 0x23
};
//secp256k1: 1.3.132.0.10
const unsigned char C_OID_SECP256K1[5] = {
0x2B, 0x81, 0x04, 0x00, 0x0A
};
*/
// secp256k1: 1.3.132.0.10
const unsigned char C_OID_SECP256K1[5] = {0x2B, 0x81, 0x04, 0x00, 0x0A};
/*
//brainpool 256t1: 1.3.36.3.3.2.8.1.1.8
@ -97,20 +94,23 @@ unsigned int gpg_oid2curve(unsigned char *oid, unsigned int len) {
if ((len == sizeof(C_OID_SECP256R1)) && (memcmp(oid, C_OID_SECP256R1, len) == 0)) {
return CX_CURVE_SECP256R1;
}
/*
if ( (len == sizeof(C_OID_SECP256K1)) && (memcmp(oid, C_OID_SECP256K1, len)==0) ) {
return CX_CURVE_SECP256K1;
}
if ((len == sizeof(C_OID_SECP256K1)) && (memcmp(oid, C_OID_SECP256K1, len) == 0)) {
return CX_CURVE_SECP256K1;
}
/*
if ( (len == sizeof(C_OID_SECP384R1)) && (memcmp(oid, C_OID_SECP384R1, len)==0) ) {
return CX_CURVE_SECP384R1;
}
if ( (len == sizeof(C_OID_SECP521R1)) && (memcmp(oid, C_OID_SECP521R1, len)==0) ) {
return CX_CURVE_SECP521R1;
}
*/
*/
/*
if ( (len == sizeof(C_OID_BRAINPOOL256T1)) && (memcmp(oid, C_OID_BRAINPOOL256T1, len)==0) ) {
return CX_CURVE_BrainPoolP256T1;
}
if ( (len == sizeof(C_OID_BRAINPOOL256R1)) && (memcmp(oid, C_OID_BRAINPOOL256R1, len)==0) ) {
return CX_CURVE_BrainPoolP256R1;
}
@ -120,7 +120,7 @@ unsigned int gpg_oid2curve(unsigned char *oid, unsigned int len) {
if ( (len == sizeof(C_OID_BRAINPOOL512R1)) && (memcmp(oid, C_OID_BRAINPOOL512R1, len)==0) ) {
return CX_CURVE_BrainPoolP512R1;
}
*/
*/
if ((len == sizeof(C_OID_Ed25519)) && (memcmp(oid, C_OID_Ed25519, len) == 0)) {
return CX_CURVE_Ed25519;
}
@ -129,14 +129,6 @@ unsigned int gpg_oid2curve(unsigned char *oid, unsigned int len) {
return CX_CURVE_Curve25519;
}
/*
if ( (len == sizeof(C_OID_SECP256K1)) && (memcmp(oid, C_OID_SECP256K1, len)==0) ) {
return CX_CURVE_256K1;
}
if ( (len == sizeof(C_OID_BRAINPOOL256T1)) && (memcmp(oid, C_OID_BRAINPOOL256T1, len)==0) ) {
return CX_CURVE_BrainPoolP256T1;
}
*/
return CX_CURVE_NONE;
}
@ -146,11 +138,11 @@ unsigned char *gpg_curve2oid(unsigned int cv, unsigned int *len) {
*len = sizeof(C_OID_SECP256R1);
return (unsigned char *) PIC(C_OID_SECP256R1);
/*
case CX_CURVE_SECP256K1:
*len = sizeof(C_OID_SECP256K1);
return (unsigned char*)PIC(C_OID_SECP256K1);
*len = sizeof(C_OID_SECP256K1);
return (unsigned char *) PIC(C_OID_SECP256K1);
/*
case CX_CURVE_SECP384R1:
*len = sizeof(C_OID_SECP384R1);
return (unsigned char*)PIC(C_OID_SECP384R1);
@ -188,6 +180,7 @@ unsigned char *gpg_curve2oid(unsigned int cv, unsigned int *len) {
unsigned int gpg_curve2domainlen(unsigned int cv) {
switch (cv) {
case CX_CURVE_SECP256K1:
case CX_CURVE_SECP256R1:
case CX_CURVE_Ed25519:
case CX_CURVE_Curve25519:

Loading…
Cancel
Save