Skip to content

Commit

Permalink
s390/zcrypt: fix wrong offset index for APKA master key valid state
Browse files Browse the repository at this point in the history
Tests showed a mismatch between what the CCA tool reports about
the APKA master key state and what's displayed by the zcrypt dd
in sysfs. After some investigation, we found out that the
documentation which was the source for the zcrypt dd implementation
lacks the listing of 3 fields. So this patch now moves the
evaluation of the APKA master key state to the correct offset.

Signed-off-by: Harald Freudenberger <[email protected]>
Signed-off-by: Vasily Gorbik <[email protected]>
  • Loading branch information
hfreude authored and Vasily Gorbik committed Aug 18, 2021
1 parent cf6031d commit 8617bb7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/s390/crypto/zcrypt_ccamisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1724,10 +1724,10 @@ static int fetch_cca_info(u16 cardnr, u16 domain, struct cca_info *ci)
rlen = vlen = PAGE_SIZE/2;
rc = cca_query_crypto_facility(cardnr, domain, "STATICSB",
rarray, &rlen, varray, &vlen);
if (rc == 0 && rlen >= 10*8 && vlen >= 240) {
ci->new_apka_mk_state = (char) rarray[7*8];
ci->cur_apka_mk_state = (char) rarray[8*8];
ci->old_apka_mk_state = (char) rarray[9*8];
if (rc == 0 && rlen >= 13*8 && vlen >= 240) {
ci->new_apka_mk_state = (char) rarray[10*8];
ci->cur_apka_mk_state = (char) rarray[11*8];
ci->old_apka_mk_state = (char) rarray[12*8];
if (ci->old_apka_mk_state == '2')
memcpy(&ci->old_apka_mkvp, varray + 208, 8);
if (ci->cur_apka_mk_state == '2')
Expand Down

0 comments on commit 8617bb7

Please sign in to comment.