mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-08-07 21:53:41 +08:00
SM4/CTR
This commit is contained in:
@@ -17,8 +17,8 @@ TEST=
|
||||
APPS=
|
||||
|
||||
LIB=$(TOP)/libcrypto.a
|
||||
LIBSRC=sms4_cbc.c sms4_cfb.c sms4_ecb.c sms4_ofb.c sms4.c
|
||||
LIBOBJ=sms4_cbc.o sms4_cfb.o sms4_ecb.o sms4_ofb.o sms4.o
|
||||
LIBSRC=sms4_cbc.c sms4_cfb.c sms4_ecb.c sms4_ofb.c sms4_ctr.c sms4_wrap.c sms4.c
|
||||
LIBOBJ=sms4_cbc.o sms4_cfb.o sms4_ecb.o sms4_ofb.o sms4_ctr.o sms4_wrap.o sms4.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ void sms4_ctr128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const sms4_key_t *key, unsigned char *iv,
|
||||
unsigned char ecount_buf[SMS4_BLOCK_SIZE], unsigned int *num)
|
||||
{
|
||||
/* this should be replaced with a parallelized version */
|
||||
/* TODO: this should be replaced with a parallelized version */
|
||||
CRYPTO_ctr128_encrypt(in, out, len, key, iv, ecount_buf, num, (block128_f)sms4_encrypt);
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,6 @@ int sms4_wrap_key(sms4_key_t *key, const unsigned char *iv,
|
||||
int sms4_unwrap_key(sms4_key_t *key, const unsigned char *iv,
|
||||
unsigned char *out, const unsigned char *in, unsigned int inlen)
|
||||
{
|
||||
return CRYPTO_128_unwrap(key, iv, out, in, inlen, (block128_f)sms4_decrypt);
|
||||
return CRYPTO_128_unwrap(key, iv, out, in, inlen, (block128_f)sms4_encrypt);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user