Skip to content

Commit

Permalink
fix static analyzer warning
Browse files Browse the repository at this point in the history
  • Loading branch information
merlokk committed Jun 14, 2021
1 parent f840491 commit bbd2e19
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions src/applications/openpgp/openpgpstruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ struct RSAAlgorithmAttr {

// Open PGP 3.3.1 page 31
struct ECDSAAlgorithmAttr {
uint8_t bOID[PGPConst::AlgoritmAttrMaxOIDSize];
uint8_t bOID[PGPConst::AlgoritmAttrMaxOIDSize] = {0};
bstr OID{bOID, sizeof(bOID)};
uint8_t KeyFormat; // Import-Format of private key, optional. if Format byte is not present `FF` = standard with public key
uint8_t KeyFormat = 0; // Import-Format of private key, optional. if Format byte is not present `FF` = standard with public key

void clear() {
OID.clear();
Expand All @@ -92,12 +92,12 @@ struct ECDSAAlgorithmAttr {

// Open PGP 3.3.1 page 31
struct AlgoritmAttr {
uint8_t _data[PGPConst::AlgoritmAttrMaxFileSize];
uint8_t _data[PGPConst::AlgoritmAttrMaxFileSize] = {0};
bstr data{_data, sizeof(_data)};

uint8_t AlgorithmID; // Crypto::AlgoritmID
RSAAlgorithmAttr RSAa;
ECDSAAlgorithmAttr ECDSAa;
uint8_t AlgorithmID = 0; // Crypto::AlgoritmID
RSAAlgorithmAttr RSAa = {0};
ECDSAAlgorithmAttr ECDSAa = {0};

void Clear();
Util::Error DecodeData(bstr &vdata, KeyID_t key_id);
Expand All @@ -111,7 +111,7 @@ struct DSCounter {
uint8_t _dsdata[PGPConst::DSCounterMaxFileSize] = {0};
bstr dsdata{_dsdata, 0, sizeof(_dsdata)};
public:
uint32_t Counter;
uint32_t Counter = 0;

Util::Error Load(File::FileSystem &fs);
Util::Error Save(File::FileSystem &fs);
Expand All @@ -136,9 +136,9 @@ struct KDFDO {
uint8_t _kdfdata[PGPConst::KDFDOMaxFileSize] = {0};
bstr kdfdata{_kdfdata, 0, sizeof(_kdfdata)};
public:
uint8_t bKDFAlgorithm;
uint8_t bHashAlgorithm;
uint32_t IterationCount;
uint8_t bKDFAlgorithm = 0;
uint8_t bHashAlgorithm = 0;
uint32_t IterationCount = 0;

bstr SaltPW1;
bstr SaltRC;
Expand Down
4 changes: 2 additions & 2 deletions stm32l432/openpgplib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ void OpenpgpInit() {
Factory::SoloFactory &factory = Factory::SoloFactory::GetSoloFactory();
factory.Init();

Application::APDUExecutor executor = factory.GetAPDUExecutor();
static Application::APDUExecutor &executor = factory.GetAPDUExecutor();
fexecutor = &executor;

OpenPGP::OpenPGPFactory &opgp_factory = factory.GetOpenPGPFactory();
OpenPGP::Security &security = opgp_factory.GetSecurity();
static OpenPGP::Security &security = opgp_factory.GetSecurity();
fsecurity = &security;
printf_device("OpenPGP init: ok.\n");

Expand Down

0 comments on commit bbd2e19

Please sign in to comment.