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