2222#define VPSM4_ASM
2323
2424#if defined(OPENSSL_CPUID_OBJ ) && (defined(__aarch64__ ) || defined(_M_ARM64 ))
25- # include "crypto/arm_arch.h"
25+ #include "crypto/arm_arch.h"
2626#endif
2727
28- # include "crypto/sm4.h"
29- # include "crypto/modes.h"
30- # include "crypto/sm4_platform.h"
28+ #include "crypto/sm4.h"
29+ #include "crypto/modes.h"
30+ #include "crypto/sm4_platform.h"
3131
3232static int test_sm4_ecb (void )
3333{
@@ -73,7 +73,7 @@ static int test_sm4_ecb(void)
7373 } else
7474#endif
7575#if defined(VPSM4_CAPABLE )
76- if (vpsm4_capable ()) {
76+ if (vpsm4_capable ()) {
7777 vpsm4_ecb_encrypt (block , block , sizeof (block ), & key , SM4_ENCRYPT );
7878 } else
7979#endif
@@ -90,7 +90,7 @@ static int test_sm4_ecb(void)
9090 } else
9191#endif
9292#if defined(VPSM4_CAPABLE )
93- if (vpsm4_capable ()) {
93+ if (vpsm4_capable ()) {
9494 vpsm4_ecb_encrypt (block , block , sizeof (block ), & key , SM4_ENCRYPT );
9595 } else
9696#endif
@@ -107,7 +107,7 @@ static int test_sm4_ecb(void)
107107 } else
108108#endif
109109#if defined(VPSM4_CAPABLE )
110- if (vpsm4_capable ()) {
110+ if (vpsm4_capable ()) {
111111 vpsm4_set_decrypt_key (k , & key );
112112 }
113113#endif
@@ -119,12 +119,12 @@ static int test_sm4_ecb(void)
119119 } else
120120#endif
121121#if defined(VPSM4_CAPABLE )
122- if (vpsm4_capable ()) {
122+ if (vpsm4_capable ()) {
123123 vpsm4_ecb_encrypt (block , block , sizeof (block ), & key , SM4_DECRYPT );
124124 } else
125125#endif
126126 {
127- ossl_sm4_decrypt (block , block , & key );
127+ ossl_sm4_decrypt (block , block , & key );
128128 }
129129 }
130130 if (!TEST_mem_eq (block , SM4_BLOCK_SIZE , input , SM4_BLOCK_SIZE ))
@@ -172,43 +172,43 @@ static int test_vpsm4_cbc(void)
172172#if defined(VPSM4_EX_CAPABLE )
173173 if (vpsm4_ex_capable ()) {
174174 vpsm4_ex_cbc_encrypt (plaintext , ciphertext , sizeof (plaintext ), & key , iv ,
175- SM4_ENCRYPT );
175+ SM4_ENCRYPT );
176176 } else
177177#endif
178178#if defined(VPSM4_CAPABLE )
179- if (vpsm4_capable ()) {
179+ if (vpsm4_capable ()) {
180180 vpsm4_cbc_encrypt (plaintext , ciphertext , sizeof (plaintext ), & key , iv ,
181- SM4_ENCRYPT );
181+ SM4_ENCRYPT );
182182 } else
183183#endif
184184 {
185185 CRYPTO_cbc128_encrypt (plaintext , ciphertext , sizeof (plaintext ), & key , iv ,
186- (block128_f )ossl_sm4_encrypt );
186+ (block128_f )ossl_sm4_encrypt );
187187 }
188188
189189 if (!TEST_mem_eq (ciphertext , sizeof (ciphertext ),
190- expected_ciphertext , sizeof (expected_ciphertext )))
190+ expected_ciphertext , sizeof (expected_ciphertext )))
191191 return 0 ;
192192
193193 /* --- Test Decryption --- */
194194 memcpy (iv , iv_bytes , SM4_BLOCK_SIZE ); /* Reset IV for decryption */
195195#if defined(VPSM4_EX_CAPABLE )
196196 if (vpsm4_ex_capable ()) {
197- vpsm4_ex_set_decrypt_key (key_bytes , & key );
197+ vpsm4_ex_set_decrypt_key (key_bytes , & key );
198198 vpsm4_ex_cbc_encrypt (ciphertext , decrypted , sizeof (ciphertext ), & key , iv ,
199- SM4_DECRYPT );
199+ SM4_DECRYPT );
200200 } else
201201#endif
202202#if defined(VPSM4_CAPABLE )
203- if (vpsm4_capable ()) {
204- vpsm4_set_decrypt_key (key_bytes , & key );
203+ if (vpsm4_capable ()) {
204+ vpsm4_set_decrypt_key (key_bytes , & key );
205205 vpsm4_cbc_encrypt (ciphertext , decrypted , sizeof (ciphertext ), & key , iv ,
206- SM4_DECRYPT );
206+ SM4_DECRYPT );
207207 } else
208208#endif
209209 {
210210 CRYPTO_cbc128_decrypt (ciphertext , decrypted , sizeof (ciphertext ), & key , iv ,
211- (block128_f )ossl_sm4_decrypt );
211+ (block128_f )ossl_sm4_decrypt );
212212 }
213213
214214 if (!TEST_mem_eq (decrypted , sizeof (decrypted ), plaintext , sizeof (plaintext )))
@@ -218,7 +218,7 @@ static int test_vpsm4_cbc(void)
218218}
219219
220220/*
221- * Internal SM4 CBC test - compiled C implementation.
221+ * Internal SM4 CBC test - compiled C implementation.
222222 */
223223static int test_sm4_cbc (void )
224224{
@@ -253,16 +253,16 @@ static int test_sm4_cbc(void)
253253 ossl_sm4_set_key (key_bytes , & key );
254254 memcpy (iv , iv_bytes , SM4_BLOCK_SIZE ); /* Use a working copy of the IV */
255255 CRYPTO_cbc128_encrypt (plaintext , ciphertext , sizeof (plaintext ), & key , iv ,
256- (block128_f )ossl_sm4_encrypt );
256+ (block128_f )ossl_sm4_encrypt );
257257
258258 if (!TEST_mem_eq (ciphertext , sizeof (ciphertext ),
259- expected_ciphertext , sizeof (expected_ciphertext )))
259+ expected_ciphertext , sizeof (expected_ciphertext )))
260260 return 0 ;
261261
262262 /* --- Test Decryption --- */
263263 memcpy (iv , iv_bytes , SM4_BLOCK_SIZE ); /* Reset IV for decryption */
264264 CRYPTO_cbc128_decrypt (ciphertext , decrypted , sizeof (ciphertext ), & key , iv ,
265- (block128_f )ossl_sm4_decrypt );
265+ (block128_f )ossl_sm4_decrypt );
266266
267267 if (!TEST_mem_eq (decrypted , sizeof (decrypted ), plaintext , sizeof (plaintext )))
268268 return 0 ;
0 commit comments