1e1051a39Sopenharmony_ci/* 2e1051a39Sopenharmony_ci * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved. 3e1051a39Sopenharmony_ci * Copyright 2017 Ribose Inc. All Rights Reserved. 4e1051a39Sopenharmony_ci * 5e1051a39Sopenharmony_ci * Licensed under the Apache License 2.0 (the "License"). You may not use 6e1051a39Sopenharmony_ci * this file except in compliance with the License. You can obtain a copy 7e1051a39Sopenharmony_ci * in the file LICENSE in the source distribution or at 8e1051a39Sopenharmony_ci * https://www.openssl.org/source/license.html 9e1051a39Sopenharmony_ci */ 10e1051a39Sopenharmony_ci 11e1051a39Sopenharmony_ci/* This header can move into provider when legacy support is removed */ 12e1051a39Sopenharmony_ci#ifndef OSSL_INTERNAL_SM3_H 13e1051a39Sopenharmony_ci# define OSSL_INTERNAL_SM3_H 14e1051a39Sopenharmony_ci# pragma once 15e1051a39Sopenharmony_ci 16e1051a39Sopenharmony_ci# include <openssl/opensslconf.h> 17e1051a39Sopenharmony_ci 18e1051a39Sopenharmony_ci# ifdef OPENSSL_NO_SM3 19e1051a39Sopenharmony_ci# error SM3 is disabled. 20e1051a39Sopenharmony_ci# endif 21e1051a39Sopenharmony_ci 22e1051a39Sopenharmony_ci# define SM3_DIGEST_LENGTH 32 23e1051a39Sopenharmony_ci# define SM3_WORD unsigned int 24e1051a39Sopenharmony_ci 25e1051a39Sopenharmony_ci# define SM3_CBLOCK 64 26e1051a39Sopenharmony_ci# define SM3_LBLOCK (SM3_CBLOCK/4) 27e1051a39Sopenharmony_ci 28e1051a39Sopenharmony_citypedef struct SM3state_st { 29e1051a39Sopenharmony_ci SM3_WORD A, B, C, D, E, F, G, H; 30e1051a39Sopenharmony_ci SM3_WORD Nl, Nh; 31e1051a39Sopenharmony_ci SM3_WORD data[SM3_LBLOCK]; 32e1051a39Sopenharmony_ci unsigned int num; 33e1051a39Sopenharmony_ci} SM3_CTX; 34e1051a39Sopenharmony_ci 35e1051a39Sopenharmony_ciint ossl_sm3_init(SM3_CTX *c); 36e1051a39Sopenharmony_ciint ossl_sm3_update(SM3_CTX *c, const void *data, size_t len); 37e1051a39Sopenharmony_ciint ossl_sm3_final(unsigned char *md, SM3_CTX *c); 38e1051a39Sopenharmony_ci 39e1051a39Sopenharmony_ci#endif /* OSSL_INTERNAL_SM3_H */ 40