mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-07 00:46:17 +08:00
Adjust SM3 SM4 API
Remove sm3_digest. Use more _gmssl_export
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <gmssl/api.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -70,11 +71,24 @@ void sm3_kdf(const uint8_t *in, size_t inlen, size_t outlen, uint8_t *out);
|
||||
#define SM3_PBKDF2_MAX_SALT_SIZE 64
|
||||
#define SM3_PBKDF2_DEFAULT_SALT_SIZE 8
|
||||
|
||||
int sm3_pbkdf2(const char *pass, size_t passlen,
|
||||
_gmssl_export int sm3_pbkdf2(const char *pass, size_t passlen,
|
||||
const uint8_t *salt, size_t saltlen, size_t count,
|
||||
size_t outlen, uint8_t *out);
|
||||
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
SM3_CTX sm3_ctx;
|
||||
SM3_HMAC_CTX hmac_ctx;
|
||||
void *handle;
|
||||
};
|
||||
int state;
|
||||
} SM3_DIGEST_CTX;
|
||||
|
||||
_gmssl_export int sm3_digest_init(SM3_DIGEST_CTX *ctx, const uint8_t *key, size_t keylen);
|
||||
_gmssl_export int sm3_digest_update(SM3_DIGEST_CTX *ctx, const uint8_t *data, size_t datalen);
|
||||
_gmssl_export int sm3_digest_finish(SM3_DIGEST_CTX *ctx, uint8_t dgst[SM3_DIGEST_SIZE]);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user