18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * sm2.h - SM2 asymmetric public-key algorithm
48c2ecf20Sopenharmony_ci * as specified by OSCCA GM/T 0003.1-2012 -- 0003.5-2012 SM2 and
58c2ecf20Sopenharmony_ci * described at https://tools.ietf.org/html/draft-shen-sm2-ecdsa-02
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (c) 2020, Alibaba Group.
88c2ecf20Sopenharmony_ci * Written by Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifndef _CRYPTO_SM2_H
128c2ecf20Sopenharmony_ci#define _CRYPTO_SM2_H
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <crypto/sm3.h>
158c2ecf20Sopenharmony_ci#include <crypto/akcipher.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/* The default user id as specified in GM/T 0009-2012 */
188c2ecf20Sopenharmony_ci#define SM2_DEFAULT_USERID "1234567812345678"
198c2ecf20Sopenharmony_ci#define SM2_DEFAULT_USERID_LEN 16
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciextern int sm2_compute_z_digest(struct crypto_akcipher *tfm,
228c2ecf20Sopenharmony_ci			const unsigned char *id, size_t id_len,
238c2ecf20Sopenharmony_ci			unsigned char dgst[SM3_DIGEST_SIZE]);
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#endif /* _CRYPTO_SM2_H */
26