Skip to content

Commit

Permalink
PKCS11: Fix populating metaobjects at login (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
aveenismail committed Aug 8, 2024
1 parent e22085c commit c02539c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ jobs:
working-directory: yubihsm-shell/resources/tests/bash
run: ./cmdline_test.sh $GITHUB_WORKSPACE/yubihsm-shell/build/src/yubihsm-shell $DEFAULT_CONNECTOR_URL

# - name: run pkcs11-tool tests
# working-directory: yubihsm-shell/resources/tests/bash
# run: |
# echo "connector=$DEFAULT_CONNECTOR_URL" > yubihsm_pkcs11.conf
# export YUBIHSM_PKCS11_CONF=`pwd`/yubihsm_pkcs11.conf
# ./opensc_test.sh $GITHUB_WORKSPACE/yubihsm-shell/build/pkcs11/yubihsm_pkcs11.so
- name: run pkcs11-tool tests
working-directory: yubihsm-shell/resources/tests/bash
run: |
echo "connector=$DEFAULT_CONNECTOR_URL" > yubihsm_pkcs11.conf
export YUBIHSM_PKCS11_CONF=`pwd`/yubihsm_pkcs11.conf
./opensc_test.sh $GITHUB_WORKSPACE/yubihsm-shell/build/pkcs11/yubihsm_pkcs11.so
- name: clone the YubicoLabs/yubihsm_sunpkcs11_tests repository
uses: actions/checkout@v4
Expand Down
9 changes: 9 additions & 0 deletions pkcs11/yubihsm_pkcs11.c
Original file line number Diff line number Diff line change
Expand Up @@ -6380,6 +6380,15 @@ CK_DEFINE_FUNCTION(CK_RV, C_LoginUser)
}

list_iterate(&session->slot->pkcs11_sessions, login_sessions);
populate_cache_with_data_opaques(session->slot);

yubihsm_pkcs11_object_desc *authkey_desc =
_get_object_desc(session->slot, key_id, YH_AUTHENTICATION_KEY, 0xffff);
if (authkey_desc == NULL) {
DBG_ERR("Failed to read authentication key info.");
goto c_l_out;
}
session->slot->authkey_domains = authkey_desc->object.domains;

DOUT;

Expand Down
4 changes: 2 additions & 2 deletions resources/tests/bash/opensc_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ set -e
echo "******************* Generation Tests ********************* "
pkcs11-tool --module $MODULE --login --pin 0001password --keypairgen --id 100 --key-type EC:secp384r1
pkcs11-tool --module $MODULE --login --pin 0001password --keypairgen --id 2 --key-type EC:prime256v1
pkcs11-tool --module $MODULE --login --pin 0001password --keypairgen --id 4 --key-type rsa:2048
pkcs11-tool --module $MODULE --login --pin 0001password --keypairgen --id 5 --key-type rsa:3072
pkcs11-tool --module $MODULE --login --pin 0001password --keypairgen --id 4 --key-type rsa:2048 --usage-sign
pkcs11-tool --module $MODULE --login --pin 0001password --keypairgen --id 5 --key-type rsa:3072 --usage-sign

echo "******************* Signing Tests ********************* "
echo "this is test data" > data.txt
Expand Down

0 comments on commit c02539c

Please sign in to comment.