Skip to content

Commit ea7ecb6

Browse files
uudiinherbertx
authored andcommitted
crypto: sm2 - introduce OSCCA SM2 asymmetric cipher algorithm
This new module implement the SM2 public key algorithm. It was published by State Encryption Management Bureau, China. List of specifications for SM2 elliptic curve public key cryptography: * GM/T 0003.1-2012 * GM/T 0003.2-2012 * GM/T 0003.3-2012 * GM/T 0003.4-2012 * GM/T 0003.5-2012 IETF: https://tools.ietf.org/html/draft-shen-sm2-ecdsa-02 oscca: http://www.oscca.gov.cn/sca/xxgk/2010-12/17/content_1002386.shtml scctc: http://www.gmbz.org.cn/main/bzlb.html Signed-off-by: Tianjia Zhang <[email protected]> Tested-by: Xufeng Zhang <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent d58bb7e commit ea7ecb6

File tree

5 files changed

+535
-0
lines changed

5 files changed

+535
-0
lines changed

crypto/Kconfig

+17
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,23 @@ config CRYPTO_ECRDSA
260260
standard algorithms (called GOST algorithms). Only signature verification
261261
is implemented.
262262

263+
config CRYPTO_SM2
264+
tristate "SM2 algorithm"
265+
select CRYPTO_SM3
266+
select CRYPTO_AKCIPHER
267+
select CRYPTO_MANAGER
268+
select MPILIB
269+
select ASN1
270+
help
271+
Generic implementation of the SM2 public key algorithm. It was
272+
published by State Encryption Management Bureau, China.
273+
as specified by OSCCA GM/T 0003.1-2012 -- 0003.5-2012.
274+
275+
References:
276+
https://tools.ietf.org/html/draft-shen-sm2-ecdsa-02
277+
http://www.oscca.gov.cn/sca/xxgk/2010-12/17/content_1002386.shtml
278+
http://www.gmbz.org.cn/main/bzlb.html
279+
263280
config CRYPTO_CURVE25519
264281
tristate "Curve25519 algorithm"
265282
select CRYPTO_KPP

crypto/Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ rsa_generic-y += rsa_helper.o
4242
rsa_generic-y += rsa-pkcs1pad.o
4343
obj-$(CONFIG_CRYPTO_RSA) += rsa_generic.o
4444

45+
$(obj)/sm2signature.asn1.o: $(obj)/sm2signature.asn1.c $(obj)/sm2signature.asn1.h
46+
$(obj)/sm2.o: $(obj)/sm2signature.asn1.h
47+
48+
sm2_generic-y += sm2signature.asn1.o
49+
sm2_generic-y += sm2.o
50+
51+
obj-$(CONFIG_CRYPTO_SM2) += sm2_generic.o
52+
4553
crypto_acompress-y := acompress.o
4654
crypto_acompress-y += scompress.o
4755
obj-$(CONFIG_CRYPTO_ACOMP2) += crypto_acompress.o

0 commit comments

Comments
 (0)