mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-06-27 15:43:42 +08:00
Add SM4-FF1, update socket API
This commit is contained in:
41
include/gmssl/ff1.h
Normal file
41
include/gmssl/ff1.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2014-2026 The GmSSL Project. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
#ifndef GMSSL_FF1_H
|
||||
#define GMSSL_FF1_H
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <gmssl/block_cipher.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define FF1_MIN_DIGITS 8
|
||||
#define FF1_MAX_DIGITS 18
|
||||
#define FF1_MIN_TWEAK_SIZE 0
|
||||
#define FF1_MAX_TWEAK_SIZE 11
|
||||
#define FF1_NUM_ROUNDS 10
|
||||
|
||||
|
||||
int ff1_init(BLOCK_CIPHER_KEY *key, const BLOCK_CIPHER *cipher, const uint8_t *raw_key);
|
||||
int ff1_encrypt(const BLOCK_CIPHER_KEY *key, const char *in, size_t inlen,
|
||||
const uint8_t *tweak, size_t tweaklen, char *out);
|
||||
int ff1_decrypt(const BLOCK_CIPHER_KEY *key, const char *in, size_t inlen,
|
||||
const uint8_t *tweak, size_t tweaklen, char *out);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -75,6 +75,7 @@ int tls_socket_set_nonblocking(tls_socket_t sock, int nonblock);
|
||||
tls_socket_t tls_socket_invalid(void);
|
||||
int tls_socket_is_valid(tls_socket_t sock);
|
||||
int tls_socket_create(tls_socket_t *sock, int af, int type, int protocl);
|
||||
int tls_socket_get_addr(const char *host, int port, struct sockaddr_in *addr);
|
||||
int tls_socket_connect(tls_socket_t sock, const struct sockaddr_in *addr);
|
||||
int tls_socket_bind(tls_socket_t sock, const struct sockaddr_in *addr);
|
||||
int tls_socket_listen(tls_socket_t sock, int backlog);
|
||||
|
||||
@@ -18,7 +18,7 @@ extern "C" {
|
||||
|
||||
|
||||
#define GMSSL_VERSION_NUM 30300
|
||||
#define GMSSL_VERSION_STR "GmSSL 3.3.0-dev.1154"
|
||||
#define GMSSL_VERSION_STR "GmSSL 3.3.0-dev.1155"
|
||||
|
||||
int gmssl_version_num(void);
|
||||
const char *gmssl_version_str(void);
|
||||
|
||||
Reference in New Issue
Block a user