Skip to content

Commit 14a6714

Browse files
pennamgiulcioffi
authored andcommitted
SE05X: rename LOG_E macro in SE05X_PRINT_ERROR
1 parent 5863e50 commit 14a6714

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

libraries/SE05X/src/SE05X.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,17 @@ int SE05XClass::begin()
107107
se05x_ic_power_on();
108108

109109
if (nLog_Init() != 0) {
110-
LOG_E("Lock initialisation failed");
110+
SE05X_PRINT_ERROR("Lock initialisation failed");
111111
return 0;
112112
}
113113

114114
if (kStatus_SSS_Success != ex_sss_boot_open(&_boot_ctx, "portName")) {
115-
LOG_E("ex_sss_session_open Failed");
115+
SE05X_PRINT_ERROR("ex_sss_session_open Failed");
116116
return 0;
117117
}
118118

119119
if (kStatus_SSS_Success != ex_sss_key_store_and_object_init(&_boot_ctx)) {
120-
LOG_E("ex_sss_key_store_and_object_init Failed");
120+
SE05X_PRINT_ERROR("ex_sss_key_store_and_object_init Failed");
121121
return 0;
122122
}
123123

@@ -231,7 +231,7 @@ int SE05XClass::generatePrivateKey(int keyId, byte pubKeyDer[], size_t pubKeyDer
231231
}
232232

233233
if (status != kStatus_SSS_Success) {
234-
LOG_E("sss_key_store_get_key Failed");
234+
SE05X_PRINT_ERROR("sss_key_store_get_key Failed");
235235
return 0;
236236
}
237237

@@ -270,7 +270,7 @@ int SE05XClass::generatePublicKey(int keyId, byte pubKeyDer[], size_t pubKeyDerM
270270
status = sss_key_store_get_key(&_boot_ctx.ks, &keyObject, pubKeyDer, pubKeyDerlen, &derSzBits);
271271

272272
if (status != kStatus_SSS_Success) {
273-
LOG_E("sss_key_store_get_key Failed");
273+
SE05X_PRINT_ERROR("sss_key_store_get_key Failed");
274274
return 0;
275275
}
276276

@@ -306,7 +306,7 @@ int SE05XClass::importPublicKey(int keyId, const byte pubKeyDer[], size_t pubKey
306306
status = sss_key_store_set_key(&_boot_ctx.ks, &keyObject, pubKeyDer, pubKeyDerLen, _key_size_bits, NULL, 0);
307307

308308
if(status != kStatus_SSS_Success ) {
309-
LOG_E("sss_key_store_set_key Failed");
309+
SE05X_PRINT_ERROR("sss_key_store_set_key Failed");
310310
return 0;
311311
}
312312

@@ -320,7 +320,7 @@ int SE05XClass::beginSHA256()
320320
status = sss_digest_context_init(&_digest_ctx, &_boot_ctx.session, kAlgorithm_SSS_SHA256, kMode_SSS_Digest);
321321

322322
if (status != kStatus_SSS_Success) {
323-
LOG_E("sss_digest_context_init Failed!!!");
323+
SE05X_PRINT_ERROR("sss_digest_context_init Failed!!!");
324324
return 0;
325325
}
326326

@@ -334,7 +334,7 @@ int SE05XClass::updateSHA256(const byte in[], size_t inLen)
334334
status = sss_digest_update(&_digest_ctx, in, inLen);
335335

336336
if (status != kStatus_SSS_Success) {
337-
LOG_E("sss_digest_update Failed!!!");
337+
SE05X_PRINT_ERROR("sss_digest_update Failed!!!");
338338
return 0;
339339
}
340340

@@ -360,15 +360,15 @@ int SE05XClass::SHA256(const byte in[], size_t inLen, byte out[], size_t outMaxL
360360

361361
status = sss_digest_context_init(&_digest_ctx, &_boot_ctx.session, kAlgorithm_SSS_SHA256, kMode_SSS_Digest);
362362
if (status != kStatus_SSS_Success) {
363-
LOG_E("sss_digest_context_init Failed!!!");
363+
SE05X_PRINT_ERROR("sss_digest_context_init Failed!!!");
364364
return 0;
365365
}
366366

367367
* outLen = outMaxLen;
368368
status = sss_digest_one_go(&_digest_ctx, in, inLen, out, outLen);
369369
sss_digest_context_free(&_digest_ctx);
370370
if (status != kStatus_SSS_Success) {
371-
LOG_E("sss_digest_one_go Failed!!!");
371+
SE05X_PRINT_ERROR("sss_digest_one_go Failed!!!");
372372
return 0;
373373
}
374374

@@ -392,13 +392,13 @@ int SE05XClass::Sign(int keyId, const byte hash[], size_t hashLen, byte sig[], s
392392
kMode_SSS_Sign);
393393

394394
if(status != kStatus_SSS_Success) {
395-
LOG_E("sss_asymmetric_context_init Failed");
395+
SE05X_PRINT_ERROR("sss_asymmetric_context_init Failed");
396396
return 0;
397397
}
398398

399399
* sigLen = sigMaxLen;
400400
if(kStatus_SSS_Success != sss_asymmetric_sign_digest(&ctx_asymm, (uint8_t *)hash, hashLen, (uint8_t *)sig, sigLen)) {
401-
LOG_E("sss_asymmetric_sign_digest Failed");
401+
SE05X_PRINT_ERROR("sss_asymmetric_sign_digest Failed");
402402
return 0;
403403
}
404404

@@ -440,12 +440,12 @@ int SE05XClass::Verify(int keyId, const byte hash[], size_t hashLen, const byte
440440
kMode_SSS_Verify);
441441

442442
if(status != kStatus_SSS_Success) {
443-
LOG_E("sss_asymmetric_context_init Failed");
443+
SE05X_PRINT_ERROR("sss_asymmetric_context_init Failed");
444444
return 0;
445445
}
446446

447447
if(kStatus_SSS_Success != sss_asymmetric_verify_digest(&ctx_asymm, (uint8_t *)hash, hashLen, (uint8_t *)sig, sigLen)) {
448-
LOG_E("sss_asymmetric_verify_digest Failed");
448+
SE05X_PRINT_ERROR("sss_asymmetric_verify_digest Failed");
449449
return 0;
450450
}
451451

@@ -490,7 +490,7 @@ int SE05XClass::readBinaryObject(int objectId, byte data[], size_t dataMaxLen, s
490490
* length = dataMaxLen;
491491
status = sss_key_store_get_key(&_boot_ctx.ks, &binObject, data, length, &binSizeBits);
492492
if(status != kStatus_SSS_Success ) {
493-
LOG_E("sss_key_store_get_key Failed");
493+
SE05X_PRINT_ERROR("sss_key_store_get_key Failed");
494494
return 0;
495495
}
496496

@@ -514,7 +514,7 @@ int SE05XClass::writeBinaryObject(int objectId, const byte data[], size_t length
514514

515515
status = sss_key_store_set_key(&_boot_ctx.ks, &binObject, data, length, length * 8, NULL, 0);
516516
if(status != kStatus_SSS_Success ) {
517-
LOG_E("sss_key_store_set_key Failed");
517+
SE05X_PRINT_ERROR("sss_key_store_set_key Failed");
518518
return 0;
519519
}
520520

@@ -553,7 +553,7 @@ int SE05XClass::deleteBinaryObject(int objectId)
553553

554554
status = sss_key_store_erase_key(&_boot_ctx.ks, &binObject);
555555
if(status != kStatus_SSS_Success ) {
556-
LOG_E("sss_key_store_erase_key Failed");
556+
SE05X_PRINT_ERROR("sss_key_store_erase_key Failed");
557557
return 0;
558558
}
559559

@@ -576,12 +576,12 @@ int SE05XClass::getObjectHandle(int objectId, sss_object_t * object)
576576
sss_status_t status;
577577

578578
if(kStatus_SSS_Success != sss_key_object_init(object, &_boot_ctx.ks)) {
579-
LOG_E("sss_key_object_init Failed");
579+
SE05X_PRINT_ERROR("sss_key_object_init Failed");
580580
return 0;
581581
}
582582

583583
if(kStatus_SSS_Success != sss_key_object_get_handle(object, objectId)) {
584-
LOG_E("sss_key_object_get_handle Failed");
584+
SE05X_PRINT_ERROR("sss_key_object_get_handle Failed");
585585
return 0;
586586
}
587587

@@ -597,14 +597,14 @@ int SE05XClass::initObject(size_t objectId, sss_object_t * object, sss_key_part_
597597
sss_status_t status;
598598

599599
if(kStatus_SSS_Success != sss_key_object_init(object, &_boot_ctx.ks)) {
600-
LOG_E("sss_key_object_init Failed");
600+
SE05X_PRINT_ERROR("sss_key_object_init Failed");
601601
return 0;
602602
}
603603

604604
status = sss_key_object_get_handle(object, objectId);
605605

606606
if(status != kStatus_SSS_Success ) {
607-
LOG_E("sss_key_object_get_handle Failed");
607+
SE05X_PRINT_ERROR("sss_key_object_get_handle Failed");
608608
status = sss_key_object_allocate_handle(object,
609609
objectId,
610610
objectPart,
@@ -614,7 +614,7 @@ int SE05XClass::initObject(size_t objectId, sss_object_t * object, sss_key_part_
614614
}
615615

616616
if(status != kStatus_SSS_Success) {
617-
LOG_E("sss_key_object_allocate_handle Failed");
617+
SE05X_PRINT_ERROR("sss_key_object_allocate_handle Failed");
618618
return 0;
619619
}
620620

libraries/SE05X/src/SE05X.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
#include "se05x_apis.h"
2727
#include "se05x_APDU.h"
2828

29-
#if defined SE05X_PRINT_ERROR
30-
#define LOG_E Serial.println
29+
#if defined SE05X_PRINT_ERROR_ENABLE
30+
#define SE05X_PRINT_ERROR Serial.println
3131
#else
32-
#define LOG_E
32+
#define SE05X_PRINT_ERROR
3333
#endif
3434

3535
class SE05XClass

0 commit comments

Comments
 (0)