Creating customized device nodes
![]()
The cryptographic device driver can provide and maintain multiple zcrypt device nodes. These nodes can be restricted in terms of cryptographic adapters, usage domains, control domains, and available IOCTLs.
About this task
You can create device nodes with access to a subset of the AP queues that are available to the
Linux® instance and that can perform a subset of the
functions. Such a device node can be used for access control to cryptographic resources:
- Selective assignment of device nodes to Linux containers.
- Linux file permissions for the device nodes can be used to restrict the access for users and groups.
Procedure
Results
Changes to the masks are instantly applied and affect all applications with an open file descriptor for this zcrypt node immediately.
Example
0x05,
0x06, 0x07, 0x0a with domain
0x0006 as both a usage and control domain.
Using the zcryptctl command:
# zcryptctl create node_1
# zcryptctl addap node_1 0x05,0x06,0x07,0x0a
# zcryptctl adddom node_1 0x0006
# zcryptctl addcrtl node_1 0x0006
# zcryptctl adioctl node_1 ZSECSENDCPRBIt is equivalent to using the
zcryptctl config command with the following configuration file
entry:
# node 1 for CCA requests on domain 6 - hexadecimal notation
node = node_1
aps = 0x05,0x06,0x07,0x0a
doms = 0x0006
crtls = 0x0006
ioctls = ZSECSENDCPRB The following equivalent configuration file uses decimal notation
for adapters and domains:# node 1 for CCA requests on domain 6 - decimal notation
node = node_1
aps = 5,6,7,10
doms = 6
crtls = 6
ioctls = ZSECSENDCPRBAlternatively, you can use sysfs attributes to obtain the same
results:
# echo node_1 > /sys/class/zcrypt/create # echo +0x05,+0x06,+0x07,+0x0a > /sys/devices/virtual/zcrypt/node_1/apmask # echo +0x0006 > /sys/devices/virtual/zcrypt/node_1/aqmask # echo +0x0006 > /sys/devices/virtual/zcrypt/node_1/admask # echo +0x81 > /sys/devices/virtual/zcrypt/node_1/ioctlmaskThe apmask, aqmask, and admask attributes in the node directory follow the same syntax as the apmask and aqmask attributes at /sys/bus/ap (see Freeing AP queues for KVM guests). The admask attribute, which specifies the control domains for the device node, does not have an equivalent at /sys/bus/ap.
Relative values require a plus (+) or minus (-) prefix, can use decimal or hexadecimal notation, and can address individual bits or ranges. You can also specify the complete hexadecimal mask as an absolute value. The sysfs interface requires numeric values for the IOCTLs as listed in arch/s390/include/uapi/asm/zcrypt.h.
What to do next
You can delete the device node with zcryptctl destroy
<name>.