Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add library build configuration file #54

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading