drivers/s390/crypto/zcrypt_msgtype6.c
Source file repositories/reference/linux-study-clean/drivers/s390/crypto/zcrypt_msgtype6.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/crypto/zcrypt_msgtype6.c- Extension
.c- Size
- 40150 bytes
- Lines
- 1404
- Domain
- Driver Families
- Bucket
- drivers/s390
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/init.hlinux/err.hlinux/delay.hlinux/slab.hlinux/atomic.hlinux/uaccess.hap_bus.hzcrypt_api.hzcrypt_error.hzcrypt_msgtype6.hzcrypt_cca_key.h
Detected Declarations
struct function_and_rules_blockstruct type86_fmt2_msgstruct pld_hdrstruct type86x_replystruct type86_ep11_replystruct pld_hdrfunction speed_idx_ccafunction speed_idx_ep11function icamex_msg_to_type6mex_msgxfunction icacrt_msg_to_type6crt_msgxfunction xcrb_msg_to_type6cprb_msgxfunction xcrb_msg_to_type6_ep11cprb_msgxfunction convert_type86_icafunction convert_type86_xcrbfunction convert_type86_ep11_xcrbfunction convert_type86_rngfunction convert_response_icafunction convert_response_xcrbfunction convert_response_ep11_xcrbfunction convert_response_rngfunction zcrypt_msgtype6_receivefunction zcrypt_msgtype6_receive_ep11function ap_init_apmsgfunction ap_init_apmsgfunction ap_init_apmsgfunction zcrypt_msgtype6_send_cprbfunction ap_init_apmsgfunction zcrypt_msgtype6_send_ep11_cprbfunction rng_type6cprb_msgxfunction ap_init_apmsgfunction zcrypt_msgtype6_rngfunction zcrypt_msgtype6_initfunction zcrypt_msgtype6_exit
Annotated Snippet
struct function_and_rules_block {
unsigned char function_code[2];
unsigned short ulen;
unsigned char only_rule[8];
} __packed;
/*
* The following is used to initialize the CPRBX passed to the CEXxC/CEXxP
* card in a type6 message. The 3 fields that must be filled in at execution
* time are req_parml, rpl_parml and usage_domain.
* Everything about this interface is ascii/big-endian, since the
* device does *not* have 'Intel inside'.
*
* The CPRBX is followed immediately by the parm block.
* The parm block contains:
* - function code ('PD' 0x5044 or 'PK' 0x504B)
* - rule block (one of:)
* + 0x000A 'PKCS-1.2' (MCL2 'PD')
* + 0x000A 'ZERO-PAD' (MCL2 'PK')
* + 0x000A 'ZERO-PAD' (MCL3 'PD' or CEX2C 'PD')
* + 0x000A 'MRP ' (MCL3 'PK' or CEX2C 'PK')
* - VUD block
*/
static const struct CPRBX static_cprbx = {
.cprb_len = 0x00DC,
.cprb_ver_id = 0x02,
.func_id = {'T', '2'},
};
int speed_idx_cca(int req_type)
{
switch (req_type) {
case 0x4142:
case 0x4149:
case 0x414D:
case 0x4341:
case 0x4344:
case 0x4354:
case 0x4358:
case 0x444B:
case 0x4558:
case 0x4643:
case 0x4651:
case 0x4C47:
case 0x4C4B:
case 0x4C51:
case 0x4F48:
case 0x504F:
case 0x5053:
case 0x5058:
case 0x5343:
case 0x5344:
case 0x5345:
case 0x5350:
return LOW;
case 0x414B:
case 0x4345:
case 0x4349:
case 0x434D:
case 0x4847:
case 0x4849:
case 0x484D:
case 0x4850:
case 0x4851:
case 0x4954:
case 0x4958:
case 0x4B43:
case 0x4B44:
case 0x4B45:
case 0x4B47:
case 0x4B48:
case 0x4B49:
case 0x4B4E:
case 0x4B50:
case 0x4B52:
case 0x4B54:
case 0x4B58:
case 0x4D50:
case 0x4D53:
case 0x4D56:
case 0x4D58:
case 0x5044:
case 0x5045:
case 0x5046:
case 0x5047:
case 0x5049:
case 0x504B:
case 0x504D:
case 0x5254:
case 0x5347:
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/err.h`, `linux/delay.h`, `linux/slab.h`, `linux/atomic.h`, `linux/uaccess.h`, `ap_bus.h`.
- Detected declarations: `struct function_and_rules_block`, `struct type86_fmt2_msg`, `struct pld_hdr`, `struct type86x_reply`, `struct type86_ep11_reply`, `struct pld_hdr`, `function speed_idx_cca`, `function speed_idx_ep11`, `function icamex_msg_to_type6mex_msgx`, `function icacrt_msg_to_type6crt_msgx`.
- Atlas domain: Driver Families / drivers/s390.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.