summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/e_sm4.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/evp/e_sm4.c')
-rw-r--r--src/lib/libcrypto/evp/e_sm4.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/lib/libcrypto/evp/e_sm4.c b/src/lib/libcrypto/evp/e_sm4.c
index fd9a9d04f7..c4bbe567c5 100644
--- a/src/lib/libcrypto/evp/e_sm4.c
+++ b/src/lib/libcrypto/evp/e_sm4.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_sm4.c,v 1.3 2022/09/04 13:17:18 jsing Exp $ */ 1/* $OpenBSD: e_sm4.c,v 1.4 2022/09/04 15:56:51 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2017, 2019 Ribose Inc 3 * Copyright (c) 2017, 2019 Ribose Inc
4 * 4 *
@@ -95,14 +95,11 @@ sm4_cfb128_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *
95{ 95{
96 size_t chunk = EVP_MAXCHUNK; 96 size_t chunk = EVP_MAXCHUNK;
97 97
98 if (128 == 1)
99 chunk >>= 3;
100
101 if (inl < chunk) 98 if (inl < chunk)
102 chunk = inl; 99 chunk = inl;
103 100
104 while (inl && inl >= chunk) { 101 while (inl && inl >= chunk) {
105 sm4_cfb128_encrypt(in, out, (long)((128 == 1) && !(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) ? inl * 8 : inl), &((EVP_SM4_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt); 102 sm4_cfb128_encrypt(in, out, (long)inl, &((EVP_SM4_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt);
106 inl -= chunk; 103 inl -= chunk;
107 in += chunk; 104 in += chunk;
108 out += chunk; 105 out += chunk;