Skip to content

Commit 87d912e

Browse files
committed
Remove trailing whitespaces from bl602
1 parent c84915a commit 87d912e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1034
-1034
lines changed

components/bl602/bl602/evb/src/debug.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,10 @@ static char *cvt(double arg, int ndigits, int *decpt, int *sign, char *buf, int
222222
arg = modf(arg, &fi);
223223
p1 = &buf[CVTBUFSIZE];
224224

225-
if (fi != 0)
225+
if (fi != 0)
226226
{
227227
p1 = &buf[CVTBUFSIZE];
228-
while (fi != 0)
228+
while (fi != 0)
229229
{
230230
fj = modf(fi / 10, &fi);
231231
*--p1 = (int)((fj + 0.03) * 10) + '0';
@@ -235,7 +235,7 @@ static char *cvt(double arg, int ndigits, int *decpt, int *sign, char *buf, int
235235
}
236236
else if (arg > 0)
237237
{
238-
while ((fj = arg * 10) < 1)
238+
while ((fj = arg * 10) < 1)
239239
{
240240
arg = fj;
241241
r2--;
@@ -244,7 +244,7 @@ static char *cvt(double arg, int ndigits, int *decpt, int *sign, char *buf, int
244244
p1 = &buf[ndigits];
245245
if (eflag == 0) p1 += r2;
246246
*decpt = r2;
247-
if (p1 < &buf[0])
247+
if (p1 < &buf[0])
248248
{
249249
buf[0] = '\0';
250250
return buf;
@@ -255,7 +255,7 @@ static char *cvt(double arg, int ndigits, int *decpt, int *sign, char *buf, int
255255
arg = modf(arg, &fj);
256256
*p++ = (int) fj + '0';
257257
}
258-
if (p1 >= &buf[CVTBUFSIZE])
258+
if (p1 >= &buf[CVTBUFSIZE])
259259
{
260260
buf[CVTBUFSIZE - 1] = '\0';
261261
return buf;
@@ -292,8 +292,8 @@ char *fcvtbuf(double arg, int ndigits, int *decpt, int *sign, char *buf)
292292
return cvt(arg, ndigits, decpt, sign, buf, 0);
293293
}
294294

295-
static void ee_bufcpy(char *d, char *s, int count);
296-
295+
static void ee_bufcpy(char *d, char *s, int count);
296+
297297
void ee_bufcpy(char *pd, char *ps, int count) {
298298
char *pe=ps+count;
299299
while (ps!=pe)
@@ -415,7 +415,7 @@ static void decimal_point(char *buffer)
415415
if (*buffer)
416416
{
417417
int n = strnlen(buffer,256);
418-
while (n > 0)
418+
while (n > 0)
419419
{
420420
buffer[n + 1] = buffer[n];
421421
n--;

components/bl602/bl602_std/bl602_std/Common/cipher_suite/inc/bflb_hash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#define BFLB_HASH_TYPE_SHA256 2
2222
#define BFLB_HASH_TYPE_SHA384 3
2323
#define BFLB_HASH_TYPE_SHA512 4
24-
24+
2525
typedef struct tag_bflb_hash_handle_t
2626
{
2727
bflb_hash_ctx_t hash_ctx;

components/bl602/bl602_std/bl602_std/Common/cipher_suite/inc/bflb_rsa.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ enum BFLB_RSA_PARA
2727
BFLB_RSA_PARA_DQ,
2828
BFLB_RSA_PARA_QP,
2929
};
30-
30+
3131
typedef struct tag_bflb_rsa_handle_t
3232
{
3333
bflb_rsa_ctx_t rsa_ctx;
@@ -41,7 +41,7 @@ int32_t bflb_rsa_sign( bflb_rsa_handle_t *rsa_handle,const uint8_t *hash,
4141
uint8_t hashlen,uint8_t hashtype,uint8_t *sig,uint32_t *slen);
4242
int32_t bflb_rsa_verify( bflb_rsa_handle_t *rsa_handle,const uint8_t *hash,
4343
uint8_t hashlen,uint8_t hashtype,const uint8_t *sig,uint32_t slen);
44-
44+
4545
int32_t bflb_rsa_deinit( bflb_rsa_handle_t *rsa_handle);
4646

4747
#endif

components/bl602/bl602_std/bl602_std/Common/cipher_suite/src/bflb_crypt.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ int32_t bflb_crypt_deinit_do(bflb_crypt_handle_t *crypt_handle)
432432
int32_t bflb_crypt_init(bflb_crypt_handle_t *crypt_handle,uint8_t type)
433433
{
434434
int32_t result = bflb_crypt_init_do(crypt_handle,type);
435-
435+
436436
if(result==BFLB_CRYPT_OK){
437437
crypt_handle->crypt_cfg.type=type;
438438
}
@@ -491,7 +491,7 @@ int32_t bflb_crypt_encrypt_tag(bflb_crypt_handle_t *crypt_handle,const uint8_t *
491491
uint8_t *tag,uint8_t tag_len)
492492
{
493493
int32_t result;
494-
494+
495495
result= bflb_crypt_encrypt_tag_do(crypt_handle,in,in_len,add,add_len,offset,out,tag,tag_len);
496496

497497
if( result != BFLB_CRYPT_OK)
@@ -524,7 +524,7 @@ int32_t bflb_crypt_decrypt(bflb_crypt_handle_t *crypt_handle,const uint8_t *in,u
524524
size_t offset,uint8_t *out)
525525
{
526526
int32_t result;
527-
527+
528528
result=bflb_crypt_decrypt_do(crypt_handle,in,len,offset,out);
529529

530530
if( result != BFLB_CRYPT_OK)
@@ -541,9 +541,9 @@ int32_t bflb_crypt_auth_decrypt(bflb_crypt_handle_t *crypt_handle,const uint8_t
541541
const uint8_t *tag,uint8_t tag_len)
542542
{
543543
int32_t result;
544-
544+
545545
result= bflb_crypt_auth_decrypt_do(crypt_handle,in,in_len,add,add_len,offset,out,tag,tag_len);
546-
546+
547547
if( result != BFLB_CRYPT_OK)
548548
{
549549
bflb_crypt_printe("crypt auth and decrypt fail\r\n");
@@ -556,9 +556,9 @@ int32_t bflb_crypt_auth_decrypt(bflb_crypt_handle_t *crypt_handle,const uint8_t
556556
int32_t bflb_crypt_finish(bflb_crypt_handle_t *crypt_handle,uint8_t *tag,uint32_t len)
557557
{
558558
int32_t result;
559-
559+
560560
result=bflb_crypt_finish_do(crypt_handle,tag,len);
561-
561+
562562
if( result != BFLB_CRYPT_OK)
563563
{
564564
bflb_crypt_printe("crypt finish fail\r\n");

components/bl602/bl602_std/bl602_std/Common/cipher_suite/src/bflb_ecdsa.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ void bflb_ecdsa_point_add(uint8_t id)
249249
//2*V^2
250250
//PKA_MMUL(0,3,18,3, 9,3, 3,3,0);
251251
Sec_Eng_PKA_MMUL(3,18,3,9,3,3,3,0,0);
252-
252+
253253
//2*V^2*V2
254254
//PKA_MMUL(0,3,18,3,18,3,16,3,0);
255255
Sec_Eng_PKA_MMUL(3,18,3,18,3,16,3,0,0);
@@ -315,79 +315,79 @@ void bflb_ecdsa_point_double(uint8_t id)
315315
//X1^2-Z1^2
316316
//PKA_MSUB(0,3,13,3,13,3,14,3,0);
317317
Sec_Eng_PKA_MSUB(3,13,3,13,3,14,3,0,0);
318-
318+
319319
//W = 3*(X1^2-Z1^2)
320320
//PKA_MMUL(0,3,13,3,10,3,13,3,0);
321321
Sec_Eng_PKA_MMUL(3,13,3,10,3,13,3,0,0);
322-
322+
323323
//S = Y1*Z1
324324
//PKA_MMUL(0,3,14,3, 6,3, 7,3,0);
325325
Sec_Eng_PKA_MMUL(3,14,3,6,3,7,3,0,0);
326-
326+
327327
//X1*Y1
328328
//PKA_MMUL(0,3,15,3, 5,3, 6,3,0);
329329
Sec_Eng_PKA_MMUL(3,15,3,5,3,6,3,0,0);
330-
330+
331331
//W^2
332332
//PKA_MMUL(0,3, 7,3,13,3,13,3,0);
333333
Sec_Eng_PKA_MMUL(3,7,3,13,3,13,3,0,0);
334-
334+
335335
//B = X1*Y1*S
336336
//PKA_MMUL(0,3,15,3,15,3,14,3,0);
337337
Sec_Eng_PKA_MMUL(3,15,3,15,3,14,3,0,0);
338-
338+
339339
//8*B
340340
//PKA_MMUL(0,3, 5,3,12,3,15,3,0);
341341
Sec_Eng_PKA_MMUL(3,5,3,12,3,15,3,0,0);
342-
342+
343343
//H = W^2-8*B
344344
//PKA_MSUB(0,3, 7,3, 7,3, 5,3,0);
345345
Sec_Eng_PKA_MSUB(3,7,3,7,3,5,3,0,0);
346-
346+
347347
//2*H
348348
//PKA_MMUL(0,3, 5,3, 9,3, 7,3,0);
349349
Sec_Eng_PKA_MMUL(3, 5,3,9,3,7,3,0,0);
350-
350+
351351
//X2 = 2*H*S
352352
//PKA_MMUL(0,3, 5,3, 5,3,14,3,0);
353353
Sec_Eng_PKA_MMUL(3, 5,3,5,3,14,3,0,0);
354-
354+
355355
//4*B
356356
//PKA_MMUL(0,3,15,3,11,3,15,3,0);
357357
Sec_Eng_PKA_MMUL(3,15,3,11,3,15,3,0,0);
358-
358+
359359
//S^2
360360
//PKA_MMUL(0,3,16,3,14,3,14,3,0);
361361
Sec_Eng_PKA_MMUL(3,16,3,14,3,14,3,0,0);
362-
362+
363363
//4*B-H
364364
//PKA_MSUB(0,3,15,3,15,3, 7,3,0);
365365
Sec_Eng_PKA_MSUB(3,15,3,15,3,7,3,0,0);
366-
366+
367367
//Y1^2
368368
//PKA_MMUL(0,3, 6,3, 6,3, 6,3,0);
369369
Sec_Eng_PKA_MMUL(3,6,3,6,3,6,3,0,0);
370-
370+
371371
//W*(4*B-H)
372372
//PKA_MMUL(0,3,15,3,15,3,13,3,0);
373373
Sec_Eng_PKA_MMUL(3,15,3,15,3,13,3,0,0);
374-
374+
375375
//8*Y1^2
376376
//PKA_MMUL(0,3, 6,3,12,3, 6,3,0);
377377
Sec_Eng_PKA_MMUL(3,6,3,12,3,6,3,0,0);
378-
378+
379379
//8*Y1^2*S^2
380380
//PKA_MMUL(0,3, 6,3, 6,3,16,3,0);
381381
Sec_Eng_PKA_MMUL(3,6,3,6,3,16,3,0,0);
382-
382+
383383
//Y2 = W*(4*B-H)-8*Y1^2*S^2
384384
//PKA_MSUB(0,3, 6,3,15,3, 6,3,0);
385385
Sec_Eng_PKA_MSUB(3,6,3,15,3,6,3,0,0);
386-
386+
387387
//S^3
388388
//PKA_MMUL(0,3, 7,3,14,3,16,3,0);
389389
Sec_Eng_PKA_MMUL(3,7,3,14,3,16,3,0,0);
390-
390+
391391
//Z2 = 8*S^3
392392
//PKA_MMUL(1,3, 7,3,12,3, 7,3,0);
393393
Sec_Eng_PKA_MMUL(3,7,3,12,3,7,3,0,1);

components/bl602/bl602_std/bl602_std/Common/cipher_suite/src/bflb_hash.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ int32_t bflb_hash_init(bflb_hash_handle_t *hash_handle,uint8_t type)
5252
bflb_hash_printe("unsupported type\r\n");
5353
ret=BFLB_HASH_ERROR;
5454
break;
55-
55+
5656
}
5757
if(ret==BFLB_HASH_OK){
5858
hash_handle->type=type;
@@ -65,7 +65,7 @@ int32_t bflb_hash_start(bflb_hash_handle_t *hash_handle)
6565
int32_t ret = BFLB_HASH_OK;
6666

6767

68-
68+
6969
switch(hash_handle->type)
7070
{
7171
case BFLB_HASH_TYPE_SHA1:
@@ -83,7 +83,7 @@ int32_t bflb_hash_start(bflb_hash_handle_t *hash_handle)
8383
default:
8484
bflb_hash_printe("unsupported type\r\n");
8585
return BFLB_HASH_ERROR;
86-
86+
8787
}
8888
if(ret!=0){
8989
bflb_hash_printe("hash start fail\r\n");
@@ -113,7 +113,7 @@ int32_t bflb_hash_update(bflb_hash_handle_t *hash_handle,const uint8_t *in,uint3
113113
default:
114114
bflb_hash_printe("unsupported type\r\n");
115115
return BFLB_HASH_ERROR;
116-
116+
117117
}
118118
if(ret!=0){
119119
bflb_hash_printe("hash update fail\r\n");
@@ -144,7 +144,7 @@ int32_t bflb_hash_finish(bflb_hash_handle_t *hash_handle,uint8_t *out)
144144
default:
145145
bflb_hash_printe("unsupported type\r\n");
146146
return BFLB_HASH_ERROR;
147-
147+
148148
}
149149
if(ret!=0){
150150
bflb_hash_printe("hash finish fail\r\n");
@@ -171,7 +171,7 @@ int32_t bflb_hash_deinit(bflb_hash_handle_t *hash_handle)
171171
default:
172172
bflb_hash_printe("unsupported type\r\n");
173173
return BFLB_HASH_ERROR;
174-
174+
175175
}
176176
memset(hash_handle,0,sizeof(bflb_hash_handle_t));
177177

components/bl602/bl602_std/bl602_std/Common/cipher_suite/src/bflb_rsa.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ int32_t bflb_rsa_set_parameter(bflb_rsa_handle_t *rsa_handle,int type,uint8_t *v
1414
{
1515
int32_t ret = BFLB_RSA_OK;
1616
mbedtls_rsa_context* rsa=(mbedtls_rsa_context*)&rsa_handle->rsa_ctx;
17-
17+
1818
switch(type)
1919
{
2020
case BFLB_RSA_PARA_N:
@@ -46,15 +46,15 @@ int32_t bflb_rsa_set_parameter(bflb_rsa_handle_t *rsa_handle,int type,uint8_t *v
4646
ret=BFLB_RSA_ERROR;
4747
break;
4848
}
49-
49+
5050
return ret;
5151
}
5252

5353
int32_t bflb_rsa_check_private(bflb_rsa_handle_t *rsa_handle)
5454
{
5555
int32_t ret = BFLB_RSA_OK;
5656
mbedtls_rsa_context* rsa=(mbedtls_rsa_context*)&rsa_handle->rsa_ctx;
57-
57+
5858
if( ( ret = mbedtls_rsa_check_privkey( rsa ) ) != 0 )
5959
{
6060
bflb_rsa_printe("failed\r\n!rsa_check_privkey failed with -0x%0x\n", -ret );
@@ -74,7 +74,7 @@ int32_t bflb_rsa_check_public(bflb_rsa_handle_t *rsa_handle)
7474
bflb_rsa_printe("failed\r\n!rsa_check_privkey failed with -0x%0x\n", -ret );
7575
return BFLB_RSA_ERROR;
7676
}
77-
77+
7878
return BFLB_RSA_OK;
7979
}
8080

@@ -83,42 +83,42 @@ int32_t bflb_rsa_sign( bflb_rsa_handle_t *rsa_handle,const uint8_t *hash,
8383
{
8484
int32_t ret = BFLB_RSA_OK;
8585
mbedtls_rsa_context* rsa=(mbedtls_rsa_context*)&rsa_handle->rsa_ctx;
86-
86+
8787
ret = mbedtls_rsa_pkcs1_sign( rsa, NULL, NULL, MBEDTLS_RSA_PRIVATE,
8888
(mbedtls_md_type_t)bflb_hash_get_type(hashtype),
8989
hashlen, hash, sig );
9090
if( ret != 0 )
9191
{
9292
bflb_rsa_printe("failed\r\n!rsa_pkcs1_sign failed with -0x%0x\n", -ret );
9393
return BFLB_RSA_ERROR;
94-
}
94+
}
9595
*slen=rsa->len;
96-
return BFLB_RSA_OK;
96+
return BFLB_RSA_OK;
9797
}
9898

9999
int32_t bflb_rsa_verify( bflb_rsa_handle_t *rsa_handle,const uint8_t *hash,
100100
uint8_t hashlen,uint8_t hashtype,const uint8_t *sig,uint32_t slen)
101101
{
102102
int32_t ret = BFLB_RSA_OK;
103103
mbedtls_rsa_context* rsa=(mbedtls_rsa_context*)&rsa_handle->rsa_ctx;
104-
105-
ret = mbedtls_rsa_pkcs1_verify( rsa, NULL, NULL, MBEDTLS_RSA_PUBLIC,
104+
105+
ret = mbedtls_rsa_pkcs1_verify( rsa, NULL, NULL, MBEDTLS_RSA_PUBLIC,
106106
(mbedtls_md_type_t)bflb_hash_get_type(hashtype),
107107
hashlen, hash, sig );
108108
if( ret != 0 )
109109
{
110110
bflb_rsa_printe("failed\r\n!rsa_pkcs1_verify failed with -0x%0x\n", -ret );
111111
return BFLB_RSA_ERROR;
112-
}
113-
return BFLB_RSA_OK;
112+
}
113+
return BFLB_RSA_OK;
114114
}
115115

116116
int32_t bflb_rsa_deinit( bflb_rsa_handle_t *rsa_handle)
117117
{
118118
mbedtls_rsa_context* rsa=(mbedtls_rsa_context*)&rsa_handle->rsa_ctx;
119-
119+
120120
mbedtls_rsa_free( rsa );
121121
memset(rsa_handle,0,sizeof(bflb_rsa_handle_t));
122-
123-
return BFLB_RSA_OK;
122+
123+
return BFLB_RSA_OK;
124124
}

0 commit comments

Comments
 (0)