My usb HSM came initialized and now I do not know how to use it - pkcs#11

I am new to HSM and seems like working with pkcs11 is the most popular approach.
I plugged in a USB HSM and when I listed it, it shows it was already initialized. How can I log into it without knowing the user and SO pins ?
Slot 18446744073709551610
Slot info:
Description: Virtual hotplug slot
Manufacturer ID: OpenSC (www.opensc-project.org)
Hardware version: 0.0
Firmware version: 0.0
Token present: no
Slot 1
Slot info:
Description: Identiv uTrust 3512 SAM slot Token [CCID Interface] (55511725602
Manufacturer ID: OpenSC (www.opensc-project.org)
Hardware version: 0.0
Firmware version: 0.0
Token present: yes
Token info:
Manufacturer ID: www.CardContact.de
Model: PKCS#15 emulated
Hardware version: 24.13
Firmware version: 2.5
Serial number: DECC0300697
Initialized: yes
User PIN init.: yes
Label: SmartCard-HSM (UserPIN)
Can I get help for this ?

You need to contact your HSM supplier and ask him to provide you PIN values.

Related

UEFI Shell: Access disabled device

Is there any way (by UEFI Shell commands or UEFI app) to access a device which was disabled in the "BIOS" menu?
Long Story:
When I enable the UART in the "BIOS" menu I get the following lines when calling devices:
78 R - - - 1 1 Serial(0x1)
…
15A D - - 1 - - Serial(0x1)/Uart(115200,8,N,1)/UartFlowCtrl(Hardware)
The corresponding driver looks like this (output shortened)
Handle B5 (D40B5D18) ...
Driver Name : <NONE>
Image Name : FvFile(54891A9E-763E-4377-8841-8D5C90D88CDE)
Driver Type : BUS
Managing :
Ctrl[78] : Serial(0x1)
Child[15A] : Serial(0x1)/Uart(115200,8,N,1)/UartFlowCtrl(Hardware)
Ctrl[14E] : PciRoot(0x0)/Pci(0x1C,0x0)/Pci(0x0,0x0)
Child[158] : PciRoot(0x0)/Pci(0x1C,0x0)/Pci(0x0,0x0)/Uart(115200,8,N,1)/UartFlowCtrl(Hardware)
If the UART is disabled I do not get the device entries and the driver drives only the PciRoot.
I thought I might get the device by reinitialize the driver. But as it has no name I have no idea how to do so.
No, if the device is disabled in the BIOS settings, then it is literally turned off, so it’s not just a question of loading a driver for it. Hardware configurations set by the BIOS are locked after the BIOS writes to them, so they cannot be changed by software later without a reboot. You have to change the BIOS setting to enable the device.

Logitech keyboard on linux, could not set config as device or resource is busy

I have a Logitech G613 keyboard for linux. It works fine except that the G(1-6) keys are mapped to F(1-6) by default and there is no way to remap them without remapping the F keys.
So, I went through a lot of resources on the internet and found g15daemon and libg15. Unfortunately, libg15 does not support G613 but I found a way for the library to detect my keyboard by adding the following line
DEVICE("Logitech G613",0x46d,0xc53d,G15_KEYS),
The only issue now is, libg15 detaches the kernerl driver from the device with usb_detach_kernel_driver_np(), which is successful. But after that, the call to usb_set_configuration() fails with
USB error: could not set config 1: Device or resource busy
Output of hwinfo before detaching kernel driver
38: USB 00.0: 10800 Keyboard
[Created at usb.122]
Unique ID: ADDn.IsFhTXWBs20
Parent ID: k4bc.2DFUsyrieMD
SysFS ID: /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0
SysFS BusID: 1-1:1.0
Hardware Class: keyboard
Model: "Logitech USB Receiver"
Hotplug: USB
Vendor: usb 0x046d "Logitech, Inc."
Device: usb 0xc53d "USB Receiver"
Revision: "43.00"
Driver: "usbhid"
Driver Modules: "usbhid"
Speed: 12 Mbps
Module Alias: "usb:v046DpC53Dd4300dc00dsc00dp00ic03isc01ip01in00"
Driver Info #0:
XkbRules: xfree86
XkbModel: pc104
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #37 (Hub)
and after detaching the kernel driver
38: USB 00.0: 10800 Keyboard
[Created at usb.122]
Unique ID: ADDn.IsFhTXWBs20
Parent ID: k4bc.2DFUsyrieMD
SysFS ID: /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0
SysFS BusID: 1-1:1.0
Hardware Class: keyboard
Model: "Logitech USB Receiver"
Hotplug: USB
Vendor: usb 0x046d "Logitech, Inc."
Device: usb 0xc53d "USB Receiver"
Revision: "43.00"
Speed: 12 Mbps
Module Alias: "usb:v046DpC53Dd4300dc00dsc00dp00ic03isc01ip01in00"
Driver Info #0:
XkbRules: xfree86
XkbModel: pc104
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #37 (Hub)
Also, once the driver is detached, the keyboard stops functioning. It has to be reconnected again to be functional.
Can anyone please help me understand why usb_set_configuration() is failing?

pkcs#11 CKR_DEVICE_REMOVED error logging in to HSM

I have the SmartCard HSM usb plugged in to my laptop. I can see it when I run a command thru an application using the PKCS#11 API:
Slot 0
Slot info:
Description: Identiv uTrust 3512 SAM slot Token [CCID Interface] (55511725602
Manufacturer ID: Identiv
Hardware version: 2.2
Firmware version: 0.0
Token present: yes
Token info:
Manufacturer ID: www.CardContact.de
Model: PKCS#15 emulated
Hardware version: 24.13
Firmware version: 2.5
Serial number: DECC0300697
Initialized: yes
User PIN init.: yes
Label: UserPIN (SmartCard-HSM)
Its been initialized with a SO-PIN and USER-PIN.
When I try to login in to the HSM using C_Login, I get a CKR_DEVICE_REMOVED error back. The usb HSM is still plugged in. I have googled the error but nothing fruitful came up.
login_token -LOGIN user -SLOT 0 -UPIN user-pin
EROR: rv=0x00000032: Could not log in on the token.
How can I login to the HSM ?
Following text is the description of CKR_DEVICE_REMOVED error from PKCS#11 v2.20 specification:
CKR_DEVICE_REMOVED: The token was removed from its slot during the
execution of the function.
If you did not attach/detach new reader and did not insert/remove smartcard once the PKCS#11 library was loaded then I don't see any obvious reason why you are receiving this error.
However you are using PKCS#11 library provided by OpenSC project so you can enable its debugging via environment variable or configuration file. You may be able to find the cause of the error by exploring the debug output yourself. If not, then your best bet is to open new OpenSC issue and discuss your problem with OpenSC project members.

ath9k_htc (Atheros) TL-WN722N WiFi dongle on Angstrom

I am trying to interface the TL-WN722N to a Altera Cyclone SoC. I have taken the following approach:
Downloaded the open firmware ath9k_htc and try integrating it to my linux kernel image to be loaded.
a. https://wiki.debian.org/ath9k_htc/open_firmware: The steps here mention to build the toolchain and the firmware and then place it in /lib/firmware.
b. Built the linux kernel using the steps mentioned here : https://rocketboards.org/foswiki/Documentation/GSRDCompilingLinux
The firmware obtained in step a. was placed into /linux-socfpga/firmware , since there was no firmware folder in directory /lib/.
c. The image created was flashed and the wifi dongle was plugged in.
2.Here is a dmesg output for the cyclone board :
[ 2.223039] usb 1-1: New USB device found, idVendor=0cf3, idProduct=9271
[ 2.229735] usb 1-1: New USB device strings: Mfr=16, Product=32, SerialNumber=48
[ 2.237129] usb 1-1: Product: USB2.0 WLAN
[ 2.241124] usb 1-1: Manufacturer: ATHEROS
[ 2.245215] usb 1-1: SerialNumber: 12345
[ 5.351145] EXT4-fs (mmcblk0p2): recovery complete
[ 5.359958] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 5.368058] VFS: Mounted root (ext3 filesystem) on device 179:2.
[ 5.375560] devtmpfs: mounted
[ 5.379310] Freeing unused kernel memory: 1024K (c0900000 - c0a00000)
**[ 5.670820] systemd[1]: Failed to insert module 'autofs4': No such file or directory**
[ 5.722709] systemd[1]: systemd 226 running in system mode. (+PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT +GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD +IDN)
The linux is able to identify the Atheros usb device. However the driver module is not loaded. I have verified this using lsmod and it returns nothing. The commands ifconfig and ip a also returns no wireless connection.
Also when I see the path /lib/modules/.../kernel/drivers/net I observe only 2 modules ethernet and mdio.ko
Kernel version : 4.1.33-ltsi-altera
Does that mean that my driver is missing in the image? What could be the possible reasons for this issue? Does anyone have any other solution to this issue?
Edit:
I could find the linux drivers in /sys/bus/usb/drivers/ath9k_htc and the corresponding modules in /sys/module/ath9k_htc
So basically, the modules are configured static.
Now when I boot up the system, I find an error saying that the requested firmware is not found.
I have already placed the required firmware(htc_9271-1.4.0.fw & htc_9271.fw) in /lib/firmware/ath9k_htc
Here is the error :
[ 2.002205] usb 1-1: new high-speed USB device number 2 using dwc2
[ 2.262666] usb 1-1: New USB device found, idVendor=0cf3, idProduct=9271
[ 2.269348] usb 1-1: New USB device strings: Mfr=16, Product=32, SerialNumber=48
[ 2.276730] usb 1-1: Product: USB2.0 WLAN
[ 2.280724] usb 1-1: Manufacturer: ATHEROS
[ 2.284815] usb 1-1: SerialNumber: 12345
[ 2.289370] usb 1-1: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw requested
[ 2.297203] usb 1-1: Direct firmware load for ath9k_htc/htc_9271-1.4.0.fw failed with error -2
[ 2.305811] usb 1-1: ath9k_htc: Firmware htc_9271.fw requested
[ 2.311658] usb 1-1: Direct firmware load for htc_9271.fw failed with error -2
[ 2.318867] usb 1-1: no suitable firmware found!
[ 2.323478] usb 1-1: ath9k_htc: Failed to get firmware htc_9271.fw
[ 2.329951] usb 1-1: ath9k_htc: USB layer deinitialized
I have also followed the steps mentioned here :
https://unix.stackexchange.com/questions/21903/custom-kernel-fails-to-load-firmware-when-module-built-in
which explains how to provide configuration for the path for loading the firmware.
A quick grep for /proc/config.gz reveals this:
$zcat /proc/config.gz | grep CONFIG_ATH
CONFIG_ATH_COMMON=y
#CONFIG_ATH_DEBUG is not set
#CONFIG_ATH5K is not set
#CONFIG_ATH5K_PCI is not set
CONFIG_ATH9K_HW=y
CONFIG_ATH9K_COMMON=y
CONFIG_ATH9K_BTCOEX_SUPPORT=y
CONFIG_ATH9K=y
CONFIG_ATH9K_PCI=y
CONFIG_ATH9K_AHB=y
#CONFIG_ATH9K_DEBUGFS is not set
#CONFIG_ATH9K_DYNACK is not set
CONFIG_ATH9K_WOW=y
#CONFIG_ATH9K_CHANNEL_CONTEXT is not set
CONFIG_ATH9K_PCOEM=y
CONFIG_ATH9K_HTC=y
CONFIG_ATH9K_HTC_DEBUGFS=y
#CONFIG_ATH6KL is not set
#CONFIG_ATH10K is not set
$zcat /proc/config.gz | grep CONFIG_EXT
CONFIG_EXTRA_FIRMWARE="htc_9271-1.4.0.fw"
CONFIG_EXTRA_FIRMWARE_DIR="/lib/firmware/ath9k_htc"
#CONFIG_EXTCON is not set
zcat /proc/config.gz | grep CONFIG_FIRMW
CONFIG_FIRMWARE_IN_KERNEL=y
# CONFIG_FIRMWARE_MEMMAP is not set
Is there any other way to notify the kernel to load the firmware? I think I might be missing out some configuration.
Edit 2 :
I resolved the issue of firmware load failure by enabling the option Fallback user-help invocation for firmware loading. Now the device is initialised, but the driver seems to not support the device. Here is the dmesg log :
[ 14.568484] usb 1-1: ath9k_htc: Transferred FW: ath9k_htc/htc_9271-1.4.0.fw, size: 51008
[ 14.820407] ath9k_htc 1-1:1.0: ath9k_htc: HTC initialized with 33 credits
[ 15.852173] ath: phy0: Mac Chip Rev 0x0f.3 is not supported by this driver
[ 15.859064] ath: phy0: Unable to initialize hardware; initialization status: -95
[ 15.866512] ath: phy0: Unable to initialize hardware; initialization status: -95
[ 15.873973] ath9k_htc: Failed to initialize the device
A quick research on the device, I found that the official website of TP-Link states that the linux drivers are available for version 2, and not for version 1. My device is a version 1 device and I think because of this the driver does not support.

Can't register rteth0 for FEC Ethernet card on SabreLite iMX6Q

I'm a new user on RTnet and try to make Rtnet work on Freescale Sabre Lite iMX6Q board. But I got an issue, RTnet can't use rt_fec.ko module driver to register rt_eth0 even though non real time driver is disable.
I'm using:
Linux kernel 3.0.43 download from Xenomai git://git.xenomai.org/ipipe-gch.git/?h=ipipe-3.0-imx6q
Xenomai 2.6 download from git.xenomai.org/xenomai-2.6.git/
RTnet 0.9.13 download from rtnet.org/download.html
Please see my kernel configuration and boot log in attached link.
Xenomai is loaded:
"*I-pipe: Domain Xenomai registered.
Xenomai: hal/arm started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.6.3 (Lies and Truths) loaded.
Xenomai: debug mode enabled.
Xenomai: starting native API services.
Xenomai: starting POSIX services.
Xenomai: starting RTDM services.* "
And FEC ethernet driver (non real-time driver) is loaded when kernel is booting
*"FEC Ethernet Driver
fec_enet_mii_bus: probed "*
Xenomai is built following install guideline for ARM platform from Xenomai:
http://xenomai.org/installing-xenomai-2-x/
RTnet is built by below command, because SABRE Lite use FEC ethernet card with Micrel KSZ9021 Gigabit chip so I put "--enable-fec" in configure command to build real-time driver for FEC ethernet card:
"./configure --host=armv7l-timesys-linux-gnueabi --with-rtext-config=/home/sonnguyen/rtnet-xenomai-rootfs/usr/xenomai/bin/xeno-config --with-linux=/home/sonnguyen/build/rtnet-xenomai-ipipe-imx6q --enable-rtcfg-dbg --enable-rtwlan --enable-net-routing --enable-router --enable-nomac --enable-rtcap --enable-proxy --enable-checks --enable-fec "
Then
"make DESTDIR=/home/sonnguyen/rtnet-xenomai-rootfs install"
I also changed RT_DRIVER from default value to "rt_fec" in rtnet.conf.
After kernel is booted, I ran "./rtnet start" and got this:
"RTnet: initialising real-time networking
RT FEC Ethernet Driver
./rtnet: line 385: can't create /sys/bus/pci/drivers/rt_fec/bind: nonexistent directory
initializing loopback...
RTnet: registered rtlo
RTcap: real-time capturing interface
ifconfig: SIOCGIFFLAGS: No such device
ifconfig: SIOCGIFFLAGS: No such device
RTcfg: init real-time configuration distribution protocol
RTmac: init realtime media access control
RTmac/TDMA: init time division multiple access control mechanism
ioctl: No such device
ioctl: No such device
ioctl: No such device
ioctl: No such device
ioctl (add): No such device
ioctl (add): No such device
ioctl (add): No such device
ifconfig: SIOCGIFFLAGS: No such device
Waiting for all slaves...ioctl: No such device
ioctl: No such device "
Then I tried:
"# lspci
lspci: /sys/bus/pci/devices: No such file or directory
ls /sys/bus/
ac97 hid mdio_bus platform sdio spi
event_source i2c mmc scsi serio usb "
No pci directory under /sys/bus/. Then I thought because the script can't find the ethernet physical bus, it can't register rteth0.
Then I looked into rtnet script and did some minor change. In the script it requires physical ethernet device ID (mentioned in REBIND_RT_NICS), so I tried to find out what it is and got this when make eth0 up with non real-time driver:
"eth0: Freescale FEC PHY driver [Micrel KSZ9021 Gigabit PHY] (mii_bus:phy_addr=1:06, irq=-1)
PHY: 1:06 - Link is Up - 1000/Full "
I think 1:06 is my physical bus ID, then I change the code in rtnet from:
for dev in $REBIND_RT_NICS; do
if [ -d /sys/bus/pci/devices/$dev/driver ]; then
echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
fi
echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
done
To
echo 1:06 > /sys/bus/mdio_bus/drivers/Micrel\ KSZ9021\ Gigabit\ PHY/unbind
echo 1:06 > /sys/bus/platform/drivers/rt_fec/bind
And I tried again with "./rtnet start", this time I got this:
RTnet: initialising real-time networking
RT FEC Ethernet Driver
sh: write error: No such device
initializing loopback...
RTnet: registered rtlo
RTcap: real-time capturing interface
ifconfig: SIOCGIFFLAGS: No such device
ifconfig: SIOCGIFFLAGS: No such device
RTcfg: init real-time configuration distribution protocol
RTmac: init realtime media access control
RTmac/TDMA: init time division multiple access control mechanism
ioctl: No such device
ioctl: No such device
ioctl: No such device
ioctl: No such device
ioctl (add): No such device
ioctl (add): No such device
ioctl (add): No such device
ifconfig: SIOCGIFFLAGS: No such device
Waiting for all slaves...ioctl: No such device
ioctl: No such device
But it still said "No such device"
This is lsmod after I ran ./rtnet start
lsmod
Module Size Used by Not tainted
tdma 25691 0
rtmac 9724 1 tdma
rtcfg 58071 0
rtcap 7151 0
rt_loopback 1279 2
rtpacket 6365 0
rtudp 10738 0
rt_fec 12742 0
rtipv4 29987 2 rtcfg,rtudp
rtnet 40746 9 tdma,rtmac,rtcfg,rtcap,rt_loopback,rtpacket,rtudp,rt_fec,rtipv4
./rtifconfig
rtlo Medium: Local Loopback
IP address: 127.0.0.1
UP LOOPBACK RUNNING MTU: 1500
Only rtlo is registered.
I also tried with kernel linux without non real-time FEC driver (please refer in another config file in attached Skydrive link), but still the same issue happened.
Do you have any idea how to solve this issue? I did many search but still can not figure out how to fix it.
Because I can't attach the files to my post, so I put all of my configuration files in the link below:
https://onedrive.live.com/redir?resid=162EDF85AEBD2EFE!717&authkey=!AJ1Fjd_XiohUwes&ithint=file%2czip
Best Regards,
Nguyen Hung Son