Skip to content

Commit

Permalink
Merge pull request #54 from pennam/utilities_config
Browse files Browse the repository at this point in the history
Add library build configuration file
  • Loading branch information
facchinm authored Jan 9, 2024
2 parents a4b10fa + e83baeb commit 1f0e05d
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/utility/ASN1Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,4 +410,7 @@ int ASN1UtilsClass::appendEcdsaWithSHA256(byte out[])
return 12;
}

#include "ECCX08UtilsConfig.h"
#if defined(ECCX08_ENABLE_ASN1)
ASN1UtilsClass ASN1Utils;
#endif
4 changes: 3 additions & 1 deletion src/utility/ECCX08CSR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,5 +173,7 @@ void ECCX08CSRClass::setCommonName(const char* commonName)
_commonName = commonName;
}


#include "ECCX08UtilsConfig.h"
#if defined(ECCX08_ENABLE_CSR)
ECCX08CSRClass ECCX08CSR;
#endif
3 changes: 3 additions & 0 deletions src/utility/ECCX08JWS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,7 @@ String ECCX08JWSClass::sign(int slot, const String& header, const String& payloa
return sign(slot, header.c_str(), payload.c_str());
}

#include "ECCX08UtilsConfig.h"
#if defined(ECCX08_ENABLE_JWS)
ECCX08JWSClass ECCX08JWS;
#endif
3 changes: 3 additions & 0 deletions src/utility/ECCX08SelfSignedCert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,4 +406,7 @@ void ECCX08SelfSignedCertClass::appendCertInfo(uint8_t publicKey[], uint8_t buff
*out++ = 0x00;
}

#include "ECCX08UtilsConfig.h"
#if defined(ECCX08_ENABLE_SSC)
ECCX08SelfSignedCertClass ECCX08SelfSignedCert;
#endif
39 changes: 39 additions & 0 deletions src/utility/ECCX08UtilsConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
This file is part of the ArduinoECCX08 library.
Copyright (c) 2023 Arduino SA. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef _ECCX08_UTILS_CONFIG_H_
#define _ECCX08_UTILS_CONFIG_H_

#if defined __has_include
#if !__has_include ("ArduinoIoTCloud.h")
#define ECCX08_ENABLE_ASN1 1
#define ECCX08_ENABLE_CSR 1
#define ECCX08_ENABLE_JWS 1
#define ECCX08_ENABLE_SSC 1
#define ECCX08_ENABLE_PEM 1
#endif
#else
#define ECCX08_ENABLE_ASN1 1
#define ECCX08_ENABLE_CSR 1
#define ECCX08_ENABLE_JWS 1
#define ECCX08_ENABLE_SSC 1
#define ECCX08_ENABLE_PEM 1
#endif

#endif
3 changes: 3 additions & 0 deletions src/utility/PEMUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,7 @@ String PEMUtilsClass::base64Encode(const byte in[], unsigned int length, const c
return out;
}

#include "ECCX08UtilsConfig.h"
#if defined(ECCX08_ENABLE_PEM)
PEMUtilsClass PEMUtils;
#endif

0 comments on commit 1f0e05d

Please sign in to comment.