Skip to content

Commit

Permalink
PKCS11: Test: Skip meta_object test for OpenSSL version less than 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
aveenismail committed Sep 26, 2023
1 parent 13f7a69 commit 81b37dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
22 changes: 10 additions & 12 deletions pkcs11/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ set (
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
add_executable (aes_encrypt_test ${SOURCE_AES_ENCRYPT})
add_executable (ecdh_derive_test ${SOURCE_ECDH_DERIVE})
add_executable (meta_object_test ${SOURCE_META_OBJECT})

target_link_libraries(
aes_encrypt_test
Expand All @@ -279,34 +278,33 @@ target_link_libraries (
${LIBCRYPTO_LDFLAGS}
"-ldl")

target_link_libraries (
meta_object_test
${LIBCRYPTO_LDFLAGS}
yubihsm
"-ldl")

add_test (
NAME ecdh_derive_test
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/ecdh_derive_test ${CMAKE_CURRENT_BINARY_DIR}/../yubihsm_pkcs11.${LIBEXT}
)

add_test (
NAME meta_object_test
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/meta_object_test ${CMAKE_CURRENT_BINARY_DIR}/../yubihsm_pkcs11.${LIBEXT}
)

if (NOT ${LIBCRYPTO_VERSION} VERSION_LESS 1.1)
add_executable (rsa_enc_test ${SOURCE_RSA_ENC_TEST})
add_executable (meta_object_test ${SOURCE_META_OBJECT})

target_link_libraries (
rsa_enc_test
${LIBCRYPTO_LDFLAGS}
"-ldl")
target_link_libraries (
meta_object_test
${LIBCRYPTO_LDFLAGS}
yubihsm
"-ldl")

add_test (
NAME rsa_enc_test
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/rsa_enc_test ${CMAKE_CURRENT_BINARY_DIR}/../yubihsm_pkcs11.${LIBEXT}
)
add_test (
NAME meta_object_test
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/meta_object_test ${CMAKE_CURRENT_BINARY_DIR}/../yubihsm_pkcs11.${LIBEXT}
)
endif(NOT ${LIBCRYPTO_VERSION} VERSION_LESS 1.1)

endif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
6 changes: 2 additions & 4 deletions pkcs11/tests/meta_object_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/bn.h>
#include <openssl/rsa.h>
#include <openssl/rand.h>
#include <openssl/ec.h>
#include <openssl/x509.h>
Expand Down Expand Up @@ -119,13 +117,13 @@ static void import_ec_key(CK_OBJECT_HANDLE_PTR publicKeyPtr,
char *label_public, char *label_private) {

int curve = NID_secp384r1;
int key_len = 48;
CK_ULONG key_len = 48;

CK_ULONG class_k = CKO_PRIVATE_KEY;
CK_ULONG class_c = CKO_CERTIFICATE;
CK_ULONG kt = CKK_EC;
CK_BYTE value_c[3100] = {0};
CK_BYTE *pvt = malloc(48);
CK_CHAR *pvt = malloc(48);

CK_ATTRIBUTE privateKeyTemplate[] =
{{CKA_CLASS, &class_k, sizeof(class_k)},
Expand Down

0 comments on commit 81b37dc

Please sign in to comment.