xref: /openbmc/linux/include/crypto/sm2.h (revision 842ed298)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * sm2.h - SM2 asymmetric public-key algorithm
4  * as specified by OSCCA GM/T 0003.1-2012 -- 0003.5-2012 SM2 and
5  * described at https://tools.ietf.org/html/draft-shen-sm2-ecdsa-02
6  *
7  * Copyright (c) 2020, Alibaba Group.
8  * Written by Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
9  */
10 
11 #ifndef _CRYPTO_SM2_H
12 #define _CRYPTO_SM2_H
13 
14 #include <crypto/sm3.h>
15 #include <crypto/akcipher.h>
16 
17 /* The default user id as specified in GM/T 0009-2012 */
18 #define SM2_DEFAULT_USERID "1234567812345678"
19 #define SM2_DEFAULT_USERID_LEN 16
20 
21 extern int sm2_compute_z_digest(struct crypto_akcipher *tfm,
22 			const unsigned char *id, size_t id_len,
23 			unsigned char dgst[SM3_DIGEST_SIZE]);
24 
25 #endif /* _CRYPTO_SM2_H */
26