History

crypto: ecrdsa - add EC-RDSA (GOST 34.10) algorithm

Add Elliptic Curve Russian Digital Signature Algorithm (GOST R 34.10-2012, RFC 7091, ISO/IEC 14888-3) is one of the Russian (and since 2018 the CIS countries) cryptographic standard algorithms (called GOST algorithms). Only signature verification is supported, with intent to be used in the IMA. Summary of the changes: * crypto/Kconfig: - EC-RDSA is added into Public-key cryptography section. * crypto/Makefile: - ecrdsa objects are added. * crypto/asymmetric_keys/x509_cert_parser.c: - Recognize EC-RDSA and Streebog OIDs. * include/linux/oid_registry.h: - EC-RDSA OIDs are added to the enum. Also, a two currently not implemented curve OIDs are added for possible extension later (to not change numbering and grouping). * crypto/ecc.c: - Kenneth MacKay copyright date is updated to 2014, because vli_mmod_slow, ecc_point_add, ecc_point_mult_shamir are based on his code from micro-ecc. - Functions needed for ecrdsa are EXPORT_SYMBOL'ed. - New functions: vli_is_negative - helper to determine sign of vli; vli_from_be64 - unpack big-endian array into vli (used for a signature); vli_from_le64 - unpack little-endian array into vli (used for a public key); vli_uadd, vli_usub - add/sub u64 value to/from vli (used for increment/decrement); mul_64_64 - optimized to use __int128 where appropriate, this speeds up point multiplication (and as a consequence signature verification) by the factor of 1.5-2; vli_umult - multiply vli by a small value (speeds up point multiplication by another factor of 1.5-2, depending on vli sizes); vli_mmod_special - module reduction for some form of Pseudo-Mersenne primes (used for the curves A); vli_mmod_special2 - module reduction for another form of Pseudo-Mersenne primes (used for the curves B); vli_mmod_barrett - module reduction using pre-computed value (used for the curve C); vli_mmod_slow - more general module reduction which is much slower (used when the modulus is subgroup order); vli_mod_mult_slow - modular multiplication; ecc_point_add - add two points; ecc_point_mult_shamir - add two points multiplied by scalars in one combined multiplication (this gives speed up by another factor 2 in compare to two separate multiplications). ecc_is_pubkey_valid_partial - additional samity check is added. - Updated vli_mmod_fast with non-strict heuristic to call optimal module reduction function depending on the prime value; - All computations for the previously defined (two NIST) curves should not unaffected. * crypto/ecc.h: - Newly exported functions are documented. * crypto/ecrdsa_defs.h - Five curves are defined. * crypto/ecrdsa.c: - Signature verification is implemented. * crypto/ecrdsa_params.asn1, crypto/ecrdsa_pub_key.asn1: - Templates for BER decoder for EC-RDSA parameters and public key.

Vitaly Chikunov committed 7 years ago

Commit 0d7a7861 parent 4a2289d10 files · +1022 −13Browse files

Showing the changes to include/linux (1 of 10 files). Show all

Unified · Split

include/linux/oid_registry.h+18−0
@@ -93,6 +93,24 @@ enum OID { · 92 unmodified lines
93 OID_authorityKeyIdentifier, /* 2.5.29.35 */93 OID_authorityKeyIdentifier, /* 2.5.29.35 */
94 OID_extKeyUsage, /* 2.5.29.37 */94 OID_extKeyUsage, /* 2.5.29.37 */
95 95
96 /* EC-RDSA */
97 OID_gostCPSignA, /* 1.2.643.2.2.35.1 */
98 OID_gostCPSignB, /* 1.2.643.2.2.35.2 */
99 OID_gostCPSignC, /* 1.2.643.2.2.35.3 */
100 OID_gost2012PKey256, /* 1.2.643.7.1.1.1.1 */
101 OID_gost2012PKey512, /* 1.2.643.7.1.1.1.2 */
102 OID_gost2012Digest256, /* 1.2.643.7.1.1.2.2 */
103 OID_gost2012Digest512, /* 1.2.643.7.1.1.2.3 */
104 OID_gost2012Signature256, /* 1.2.643.7.1.1.3.2 */
105 OID_gost2012Signature512, /* 1.2.643.7.1.1.3.3 */
106 OID_gostTC26Sign256A, /* 1.2.643.7.1.2.1.1.1 */
107 OID_gostTC26Sign256B, /* 1.2.643.7.1.2.1.1.2 */
108 OID_gostTC26Sign256C, /* 1.2.643.7.1.2.1.1.3 */
109 OID_gostTC26Sign256D, /* 1.2.643.7.1.2.1.1.4 */
110 OID_gostTC26Sign512A, /* 1.2.643.7.1.2.1.2.1 */
111 OID_gostTC26Sign512B, /* 1.2.643.7.1.2.1.2.2 */
112 OID_gostTC26Sign512C, /* 1.2.643.7.1.2.1.2.3 */
113
96 OID__NR114 OID__NR
97};115};
98 116

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t