mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 05:27:07 +02:00
s390/zcrypt: Remove unused functions from cca misc
The static function findcard() and the zcrypt cca_findcard() function are both not used any more. Remove this outdated code and an internal function only called by these. Signed-off-by: Harald Freudenberger <freude@linux.ibm.com> Reviewed-by: Holger Dengler <dengler@linux.ibm.com> Link: https://lore.kernel.org/r/20250424133619.16495-12-freude@linux.ibm.com Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
d2fd25b390
commit
02383ef93e
|
|
@ -1680,22 +1680,6 @@ static void cca_info_cache_update(u16 cardnr, u16 domain,
|
|||
spin_unlock_bh(&cca_info_list_lock);
|
||||
}
|
||||
|
||||
static void cca_info_cache_scrub(u16 cardnr, u16 domain)
|
||||
{
|
||||
struct cca_info_list_entry *ptr;
|
||||
|
||||
spin_lock_bh(&cca_info_list_lock);
|
||||
list_for_each_entry(ptr, &cca_info_list, list) {
|
||||
if (ptr->cardnr == cardnr &&
|
||||
ptr->domain == domain) {
|
||||
list_del(&ptr->list);
|
||||
kfree(ptr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
spin_unlock_bh(&cca_info_list_lock);
|
||||
}
|
||||
|
||||
static void __exit mkvp_cache_free(void)
|
||||
{
|
||||
struct cca_info_list_entry *ptr, *pnext;
|
||||
|
|
@ -1800,132 +1784,6 @@ int cca_get_info(u16 card, u16 dom, struct cca_info *ci, int verify)
|
|||
}
|
||||
EXPORT_SYMBOL(cca_get_info);
|
||||
|
||||
/*
|
||||
* Search for a matching crypto card based on the
|
||||
* Master Key Verification Pattern given.
|
||||
*/
|
||||
static int findcard(u64 mkvp, u16 *pcardnr, u16 *pdomain,
|
||||
int verify, int minhwtype)
|
||||
{
|
||||
struct zcrypt_device_status_ext *device_status;
|
||||
u16 card, dom;
|
||||
struct cca_info ci;
|
||||
int i, rc, oi = -1;
|
||||
|
||||
/* mkvp must not be zero, minhwtype needs to be >= 0 */
|
||||
if (mkvp == 0 || minhwtype < 0)
|
||||
return -EINVAL;
|
||||
|
||||
/* fetch status of all crypto cards */
|
||||
device_status = kvcalloc(MAX_ZDEV_ENTRIES_EXT,
|
||||
sizeof(struct zcrypt_device_status_ext),
|
||||
GFP_KERNEL);
|
||||
if (!device_status)
|
||||
return -ENOMEM;
|
||||
|
||||
zcrypt_device_status_mask_ext(device_status,
|
||||
MAX_ZDEV_CARDIDS_EXT,
|
||||
MAX_ZDEV_DOMAINS_EXT);
|
||||
|
||||
/* walk through all crypto cards */
|
||||
for (i = 0; i < MAX_ZDEV_ENTRIES_EXT; i++) {
|
||||
card = AP_QID_CARD(device_status[i].qid);
|
||||
dom = AP_QID_QUEUE(device_status[i].qid);
|
||||
if (device_status[i].online &&
|
||||
device_status[i].functions & 0x04) {
|
||||
/* enabled CCA card, check current mkvp from cache */
|
||||
if (cca_info_cache_fetch(card, dom, &ci) == 0 &&
|
||||
ci.hwtype >= minhwtype &&
|
||||
ci.cur_aes_mk_state == '2' &&
|
||||
ci.cur_aes_mkvp == mkvp) {
|
||||
if (!verify)
|
||||
break;
|
||||
/* verify: refresh card info */
|
||||
if (fetch_cca_info(card, dom, &ci) == 0) {
|
||||
cca_info_cache_update(card, dom, &ci);
|
||||
if (ci.hwtype >= minhwtype &&
|
||||
ci.cur_aes_mk_state == '2' &&
|
||||
ci.cur_aes_mkvp == mkvp)
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Card is offline and/or not a CCA card. */
|
||||
/* del mkvp entry from cache if it exists */
|
||||
cca_info_cache_scrub(card, dom);
|
||||
}
|
||||
}
|
||||
if (i >= MAX_ZDEV_ENTRIES_EXT) {
|
||||
/* nothing found, so this time without cache */
|
||||
for (i = 0; i < MAX_ZDEV_ENTRIES_EXT; i++) {
|
||||
if (!(device_status[i].online &&
|
||||
device_status[i].functions & 0x04))
|
||||
continue;
|
||||
card = AP_QID_CARD(device_status[i].qid);
|
||||
dom = AP_QID_QUEUE(device_status[i].qid);
|
||||
/* fresh fetch mkvp from adapter */
|
||||
if (fetch_cca_info(card, dom, &ci) == 0) {
|
||||
cca_info_cache_update(card, dom, &ci);
|
||||
if (ci.hwtype >= minhwtype &&
|
||||
ci.cur_aes_mk_state == '2' &&
|
||||
ci.cur_aes_mkvp == mkvp)
|
||||
break;
|
||||
if (ci.hwtype >= minhwtype &&
|
||||
ci.old_aes_mk_state == '2' &&
|
||||
ci.old_aes_mkvp == mkvp &&
|
||||
oi < 0)
|
||||
oi = i;
|
||||
}
|
||||
}
|
||||
if (i >= MAX_ZDEV_ENTRIES_EXT && oi >= 0) {
|
||||
/* old mkvp matched, use this card then */
|
||||
card = AP_QID_CARD(device_status[oi].qid);
|
||||
dom = AP_QID_QUEUE(device_status[oi].qid);
|
||||
}
|
||||
}
|
||||
if (i < MAX_ZDEV_ENTRIES_EXT || oi >= 0) {
|
||||
if (pcardnr)
|
||||
*pcardnr = card;
|
||||
if (pdomain)
|
||||
*pdomain = dom;
|
||||
rc = (i < MAX_ZDEV_ENTRIES_EXT ? 0 : 1);
|
||||
} else {
|
||||
rc = -ENODEV;
|
||||
}
|
||||
|
||||
kvfree(device_status);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* Search for a matching crypto card based on the Master Key
|
||||
* Verification Pattern provided inside a secure key token.
|
||||
*/
|
||||
int cca_findcard(const u8 *key, u16 *pcardnr, u16 *pdomain, int verify)
|
||||
{
|
||||
u64 mkvp;
|
||||
int minhwtype = 0;
|
||||
const struct keytoken_header *hdr = (struct keytoken_header *)key;
|
||||
|
||||
if (hdr->type != TOKTYPE_CCA_INTERNAL)
|
||||
return -EINVAL;
|
||||
|
||||
switch (hdr->version) {
|
||||
case TOKVER_CCA_AES:
|
||||
mkvp = ((struct secaeskeytoken *)key)->mkvp;
|
||||
break;
|
||||
case TOKVER_CCA_VLSC:
|
||||
mkvp = ((struct cipherkeytoken *)key)->mkvp0;
|
||||
minhwtype = AP_DEVICE_TYPE_CEX6;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return findcard(mkvp, pcardnr, pdomain, verify, minhwtype);
|
||||
}
|
||||
EXPORT_SYMBOL(cca_findcard);
|
||||
|
||||
int cca_findcard2(u32 **apqns, u32 *nr_apqns, u16 cardnr, u16 domain,
|
||||
int minhwtype, int mktype, u64 cur_mkvp, u64 old_mkvp,
|
||||
int verify)
|
||||
|
|
|
|||
|
|
@ -207,15 +207,6 @@ int cca_query_crypto_facility(u16 cardnr, u16 domain,
|
|||
u8 *rarray, size_t *rarraylen,
|
||||
u8 *varray, size_t *varraylen);
|
||||
|
||||
/*
|
||||
* Search for a matching crypto card based on the Master Key
|
||||
* Verification Pattern provided inside a secure key.
|
||||
* Works with CCA AES data and cipher keys.
|
||||
* Returns < 0 on failure, 0 if CURRENT MKVP matches and
|
||||
* 1 if OLD MKVP matches.
|
||||
*/
|
||||
int cca_findcard(const u8 *key, u16 *pcardnr, u16 *pdomain, int verify);
|
||||
|
||||
/*
|
||||
* Build a list of cca apqns meeting the following constrains:
|
||||
* - apqn is online and is in fact a CCA apqn
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user