From e3a88dd8462dd6d2f8469da3d8c06acffb04ef94 Mon Sep 17 00:00:00 2001 From: Ian Haken Date: Fri, 10 Nov 2023 19:07:18 -0800 Subject: [PATCH] Fix test compilation. --- Makefile | 6 ++++-- aws_kms_pkcs11_test.c | 2 +- certificates.h | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 054faf3..c179663 100644 --- a/Makefile +++ b/Makefile @@ -163,10 +163,12 @@ test: aws_kms_pkcs11_test certificates_test AWS_KMS_PKCS11_DEBUG=1 ./aws_kms_pkcs11_test certificates_test: certificates.cpp certificates_test.cpp - g++ -g -Wall certificates.cpp certificates_test.cpp -o certificates_test -lcrypto + g++ -g -fPIC -Wall -I$(AWS_SDK_PATH)/include $(PKCS11_INC) $(JSON_C_INC) -fno-exceptions -std=c++17 \ + debug.cpp certificates.cpp certificates_test.cpp -o certificates_test $(STATIC_LIBS) $(LIBS) -lcrypto -ljson-c -lcurl aws_kms_pkcs11_test: aws_kms_pkcs11_test.c aws_kms_pkcs11.so - gcc -g -Wall $(PKCS11_INC) aws_kms_pkcs11_test.c -o aws_kms_pkcs11_test -ldl + g++ -g -fPIC -Wall -I$(AWS_SDK_PATH)/include $(PKCS11_INC) $(JSON_C_INC) -fno-exceptions -std=c++17 \ + aws_kms_pkcs11_test.c -o aws_kms_pkcs11_test -ldl aws_kms_pkcs11.so: aws_kms_pkcs11.cpp unsupported.cpp aws_kms_slot.cpp debug.cpp attributes.cpp certificates.cpp g++ -shared -fPIC -Wall -I$(AWS_SDK_PATH)/include $(PKCS11_INC) $(JSON_C_INC) -fno-exceptions -std=c++17 $(SRC) \ diff --git a/aws_kms_pkcs11_test.c b/aws_kms_pkcs11_test.c index 9beeb87..6cc5cad 100644 --- a/aws_kms_pkcs11_test.c +++ b/aws_kms_pkcs11_test.c @@ -210,7 +210,7 @@ int main(int argc, char** argv) { return 1; } - pSlotList = malloc(slotCount * sizeof(CK_SLOT_ID)); + pSlotList = (CK_SLOT_ID_PTR) malloc(slotCount * sizeof(CK_SLOT_ID)); if (pSlotList == NULL) { printf("Failed to allocate memory to store slot IDs."); return 1; diff --git a/certificates.h b/certificates.h index e08eb08..c2462c6 100644 --- a/certificates.h +++ b/certificates.h @@ -1,5 +1,6 @@ +#include #include X509* parseCertificateFromFile(const char* filename); X509* parseCertificateFromB64Der(const char* b64Der); -X509* parseCertificateFromARN(const string &ca_arn, const string &arn, const std::string ®ion); +X509* parseCertificateFromARN(const std::string &ca_arn, const std::string &arn, const std::string ®ion);