mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-31 06:53:58 +08:00
Update v3 API
This commit is contained in:
@@ -64,6 +64,11 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define BLOCK_CIPHER_BLOCK_SIZE 16
|
||||
#define BLOCK_CIPHER_MIN_KEY_SIZE 16
|
||||
#define BLOCK_CIPHER_MAX_KEY_SIZE 32
|
||||
|
||||
|
||||
typedef struct BLOCK_CIPHER BLOCK_CIPHER;
|
||||
typedef struct BLOCK_CIPHER_KEY BLOCK_CIPHER_KEY;
|
||||
|
||||
@@ -81,6 +86,7 @@ typedef void (*block_cipher_encrypt_func)(const BLOCK_CIPHER_KEY *key, const uin
|
||||
typedef void (*block_cipher_decrypt_func)(const BLOCK_CIPHER_KEY *key, const uint8_t *in, uint8_t *out);
|
||||
|
||||
struct BLOCK_CIPHER {
|
||||
int oid;
|
||||
size_t key_size;
|
||||
size_t block_size;
|
||||
block_cipher_set_encrypt_key_func set_encrypt_key;
|
||||
@@ -89,15 +95,16 @@ struct BLOCK_CIPHER {
|
||||
block_cipher_decrypt_func decrypt;
|
||||
};
|
||||
|
||||
const BLOCK_CIPHER *BLOCK_CIPHER_sm4(void);
|
||||
const BLOCK_CIPHER *BLOCK_CIPHER_aes128(void);
|
||||
|
||||
const BLOCK_CIPHER *block_cipher_from_name(const char *name);
|
||||
const char *block_cipher_name(const BLOCK_CIPHER *cipher);
|
||||
int block_cipher_set_encrypt_key(BLOCK_CIPHER_KEY *key, const BLOCK_CIPHER *cipher, const uint8_t *raw_key);
|
||||
int block_cipher_set_decrypt_key(BLOCK_CIPHER_KEY *key, const BLOCK_CIPHER *cipher, const uint8_t *raw_key);
|
||||
int block_cipher_encrypt(const BLOCK_CIPHER_KEY *key, const uint8_t *in, uint8_t *out);
|
||||
int block_cipher_decrypt(const BLOCK_CIPHER_KEY *key, const uint8_t *in, uint8_t *out);
|
||||
|
||||
const BLOCK_CIPHER *BLOCK_CIPHER_sm4(void);
|
||||
const BLOCK_CIPHER *BLOCK_CIPHER_aes128(void);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user