linux/include/crypto/sm3.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Common values for SM3 algorithm
 *
 * Copyright (C) 2017 ARM Limited or its affiliates.
 * Copyright (C) 2017 Gilad Ben-Yossef <[email protected]>
 * Copyright (C) 2021 Tianjia Zhang <[email protected]>
 */

#ifndef _CRYPTO_SM3_H
#define _CRYPTO_SM3_H

#include <linux/types.h>

#define SM3_DIGEST_SIZE
#define SM3_BLOCK_SIZE

#define SM3_T1
#define SM3_T2

#define SM3_IVA
#define SM3_IVB
#define SM3_IVC
#define SM3_IVD
#define SM3_IVE
#define SM3_IVF
#define SM3_IVG
#define SM3_IVH

extern const u8 sm3_zero_message_hash[SM3_DIGEST_SIZE];

struct sm3_state {};

/*
 * Stand-alone implementation of the SM3 algorithm. It is designed to
 * have as little dependencies as possible so it can be used in the
 * kexec_file purgatory. In other cases you should generally use the
 * hash APIs from include/crypto/hash.h. Especially when hashing large
 * amounts of data as those APIs may be hw-accelerated.
 *
 * For details see lib/crypto/sm3.c
 */

static inline void sm3_init(struct sm3_state *sctx)
{}

void sm3_update(struct sm3_state *sctx, const u8 *data, unsigned int len);
void sm3_final(struct sm3_state *sctx, u8 *out);

#endif