Loading crypto/evp/build.info +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ SOURCE[../../libcrypto]=\ e_rc4.c e_aes.c names.c e_seed.c e_aria.c e_sm4.c \ e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \ m_null.c m_md2.c m_md4.c m_md5.c m_sha1.c m_wp.c \ m_md5_sha1.c m_mdc2.c m_ripemd.c m_sha3.c m_sm3.c \ m_md5_sha1.c m_mdc2.c m_ripemd.c m_sha3.c \ p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c \ bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c \ c_allc.c c_alld.c evp_lib.c bio_ok.c \ Loading include/openssl/sm3.h→crypto/include/internal/sm3.h +7 −15 Original line number Diff line number Diff line /* * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved. * Copyright 2017 [Ribose Inc.](https://www.ribose.com). All Rights Reserved. * Copyright 2017 Ribose Inc. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy Loading @@ -17,10 +17,6 @@ # error SM3 is disabled. # endif # ifdef __cplusplus extern "C" { # endif # define SM3_DIGEST_LENGTH 32 # define SM3_WORD unsigned int Loading @@ -34,14 +30,10 @@ typedef struct SM3state_st { unsigned int num; } SM3_CTX; int SM3_Init(SM3_CTX *c); int SM3_Update(SM3_CTX *c, const void *data, size_t len); int SM3_Final(unsigned char *md, SM3_CTX *c); void SM3_Transform(SM3_CTX *c, const unsigned char *data); unsigned char *SM3(const unsigned char *d, size_t n, unsigned char *md); int sm3_init(SM3_CTX *c); int sm3_update(SM3_CTX *c, const void *data, size_t len); int sm3_final(unsigned char *md, SM3_CTX *c); # ifdef __cplusplus } # endif void sm3_block_data_order(SM3_CTX *c, const void *p, size_t num); #endif crypto/sm3/build.info +1 −1 Original line number Diff line number Diff line LIBS=../../libcrypto SOURCE[../../libcrypto]=sm3.c SOURCE[../../libcrypto]=sm3.c m_sm3.c crypto/evp/m_sm3.c→crypto/sm3/m_sm3.c +5 −8 Original line number Diff line number Diff line Loading @@ -8,29 +8,26 @@ * https://www.openssl.org/source/license.html */ #include <stdio.h> #include "internal/cryptlib.h" #ifndef OPENSSL_NO_SM3 # include <openssl/evp.h> # include <openssl/objects.h> # include <openssl/sm3.h> # include "internal/evp_int.h" # include "internal/sm3.h" static int init(EVP_MD_CTX *ctx) { return SM3_Init(EVP_MD_CTX_md_data(ctx)); return sm3_init(EVP_MD_CTX_md_data(ctx)); } static int update(EVP_MD_CTX *ctx, const void *data, size_t count) { return SM3_Update(EVP_MD_CTX_md_data(ctx), data, count); return sm3_update(EVP_MD_CTX_md_data(ctx), data, count); } static int final(EVP_MD_CTX *ctx, unsigned char *md) { return SM3_Final(md, EVP_MD_CTX_md_data(ctx)); return sm3_final(md, EVP_MD_CTX_md_data(ctx)); } static const EVP_MD sm3_md = { Loading @@ -51,5 +48,5 @@ const EVP_MD *EVP_sm3(void) { return &sm3_md; } #endif #endif crypto/sm3/sm3.c +3 −22 Original line number Diff line number Diff line Loading @@ -9,14 +9,10 @@ * https://www.openssl.org/source/license.html */ #include <stdio.h> #ifndef OPENSSL_NO_SM3 #include <openssl/e_os2.h> #include "sm3_locl.h" #include <openssl/opensslv.h> int SM3_Init(SM3_CTX *c) int sm3_init(SM3_CTX *c) { memset(c, 0, sizeof(*c)); c->A = SM3_A; Loading @@ -30,21 +26,6 @@ int SM3_Init(SM3_CTX *c) return 1; } unsigned char *SM3(const unsigned char *d, size_t n, unsigned char *md) { SM3_CTX c; static unsigned char m[SM3_DIGEST_LENGTH]; if (md == NULL) md = m; if (!SM3_Init(&c)) return NULL; SM3_Update(&c, d, n); SM3_Final(md, &c); OPENSSL_cleanse(&c, sizeof(c)); /* security consideration */ return md; } void sm3_block_data_order(SM3_CTX *ctx, const void *p, size_t num) { const unsigned char *data = p; Loading Loading @@ -212,4 +193,4 @@ void sm3_block_data_order(SM3_CTX *ctx, const void *p, size_t num) ctx->H ^= H; } } #endif Loading
crypto/evp/build.info +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ SOURCE[../../libcrypto]=\ e_rc4.c e_aes.c names.c e_seed.c e_aria.c e_sm4.c \ e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \ m_null.c m_md2.c m_md4.c m_md5.c m_sha1.c m_wp.c \ m_md5_sha1.c m_mdc2.c m_ripemd.c m_sha3.c m_sm3.c \ m_md5_sha1.c m_mdc2.c m_ripemd.c m_sha3.c \ p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c \ bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c \ c_allc.c c_alld.c evp_lib.c bio_ok.c \ Loading
include/openssl/sm3.h→crypto/include/internal/sm3.h +7 −15 Original line number Diff line number Diff line /* * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved. * Copyright 2017 [Ribose Inc.](https://www.ribose.com). All Rights Reserved. * Copyright 2017 Ribose Inc. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy Loading @@ -17,10 +17,6 @@ # error SM3 is disabled. # endif # ifdef __cplusplus extern "C" { # endif # define SM3_DIGEST_LENGTH 32 # define SM3_WORD unsigned int Loading @@ -34,14 +30,10 @@ typedef struct SM3state_st { unsigned int num; } SM3_CTX; int SM3_Init(SM3_CTX *c); int SM3_Update(SM3_CTX *c, const void *data, size_t len); int SM3_Final(unsigned char *md, SM3_CTX *c); void SM3_Transform(SM3_CTX *c, const unsigned char *data); unsigned char *SM3(const unsigned char *d, size_t n, unsigned char *md); int sm3_init(SM3_CTX *c); int sm3_update(SM3_CTX *c, const void *data, size_t len); int sm3_final(unsigned char *md, SM3_CTX *c); # ifdef __cplusplus } # endif void sm3_block_data_order(SM3_CTX *c, const void *p, size_t num); #endif
crypto/sm3/build.info +1 −1 Original line number Diff line number Diff line LIBS=../../libcrypto SOURCE[../../libcrypto]=sm3.c SOURCE[../../libcrypto]=sm3.c m_sm3.c
crypto/evp/m_sm3.c→crypto/sm3/m_sm3.c +5 −8 Original line number Diff line number Diff line Loading @@ -8,29 +8,26 @@ * https://www.openssl.org/source/license.html */ #include <stdio.h> #include "internal/cryptlib.h" #ifndef OPENSSL_NO_SM3 # include <openssl/evp.h> # include <openssl/objects.h> # include <openssl/sm3.h> # include "internal/evp_int.h" # include "internal/sm3.h" static int init(EVP_MD_CTX *ctx) { return SM3_Init(EVP_MD_CTX_md_data(ctx)); return sm3_init(EVP_MD_CTX_md_data(ctx)); } static int update(EVP_MD_CTX *ctx, const void *data, size_t count) { return SM3_Update(EVP_MD_CTX_md_data(ctx), data, count); return sm3_update(EVP_MD_CTX_md_data(ctx), data, count); } static int final(EVP_MD_CTX *ctx, unsigned char *md) { return SM3_Final(md, EVP_MD_CTX_md_data(ctx)); return sm3_final(md, EVP_MD_CTX_md_data(ctx)); } static const EVP_MD sm3_md = { Loading @@ -51,5 +48,5 @@ const EVP_MD *EVP_sm3(void) { return &sm3_md; } #endif #endif
crypto/sm3/sm3.c +3 −22 Original line number Diff line number Diff line Loading @@ -9,14 +9,10 @@ * https://www.openssl.org/source/license.html */ #include <stdio.h> #ifndef OPENSSL_NO_SM3 #include <openssl/e_os2.h> #include "sm3_locl.h" #include <openssl/opensslv.h> int SM3_Init(SM3_CTX *c) int sm3_init(SM3_CTX *c) { memset(c, 0, sizeof(*c)); c->A = SM3_A; Loading @@ -30,21 +26,6 @@ int SM3_Init(SM3_CTX *c) return 1; } unsigned char *SM3(const unsigned char *d, size_t n, unsigned char *md) { SM3_CTX c; static unsigned char m[SM3_DIGEST_LENGTH]; if (md == NULL) md = m; if (!SM3_Init(&c)) return NULL; SM3_Update(&c, d, n); SM3_Final(md, &c); OPENSSL_cleanse(&c, sizeof(c)); /* security consideration */ return md; } void sm3_block_data_order(SM3_CTX *ctx, const void *p, size_t num) { const unsigned char *data = p; Loading Loading @@ -212,4 +193,4 @@ void sm3_block_data_order(SM3_CTX *ctx, const void *p, size_t num) ctx->H ^= H; } } #endif