11cb0ef41Sopenharmony_ci/* 21cb0ef41Sopenharmony_ci * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved. 31cb0ef41Sopenharmony_ci * Copyright 2017 Ribose Inc. All Rights Reserved. 41cb0ef41Sopenharmony_ci * 51cb0ef41Sopenharmony_ci * Licensed under the Apache License 2.0 (the "License"). You may not use 61cb0ef41Sopenharmony_ci * this file except in compliance with the License. You can obtain a copy 71cb0ef41Sopenharmony_ci * in the file LICENSE in the source distribution or at 81cb0ef41Sopenharmony_ci * https://www.openssl.org/source/license.html 91cb0ef41Sopenharmony_ci */ 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci/* This header can move into provider when legacy support is removed */ 121cb0ef41Sopenharmony_ci#ifndef OSSL_INTERNAL_SM3_H 131cb0ef41Sopenharmony_ci# define OSSL_INTERNAL_SM3_H 141cb0ef41Sopenharmony_ci# pragma once 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ci# include <openssl/opensslconf.h> 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ci# ifdef OPENSSL_NO_SM3 191cb0ef41Sopenharmony_ci# error SM3 is disabled. 201cb0ef41Sopenharmony_ci# endif 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ci# define SM3_DIGEST_LENGTH 32 231cb0ef41Sopenharmony_ci# define SM3_WORD unsigned int 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ci# define SM3_CBLOCK 64 261cb0ef41Sopenharmony_ci# define SM3_LBLOCK (SM3_CBLOCK/4) 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_citypedef struct SM3state_st { 291cb0ef41Sopenharmony_ci SM3_WORD A, B, C, D, E, F, G, H; 301cb0ef41Sopenharmony_ci SM3_WORD Nl, Nh; 311cb0ef41Sopenharmony_ci SM3_WORD data[SM3_LBLOCK]; 321cb0ef41Sopenharmony_ci unsigned int num; 331cb0ef41Sopenharmony_ci} SM3_CTX; 341cb0ef41Sopenharmony_ci 351cb0ef41Sopenharmony_ciint ossl_sm3_init(SM3_CTX *c); 361cb0ef41Sopenharmony_ciint ossl_sm3_update(SM3_CTX *c, const void *data, size_t len); 371cb0ef41Sopenharmony_ciint ossl_sm3_final(unsigned char *md, SM3_CTX *c); 381cb0ef41Sopenharmony_ci 391cb0ef41Sopenharmony_ci#endif /* OSSL_INTERNAL_SM3_H */ 40