IBM 2 Computer Hardware User Manual


 
CCA Release 2.54
a. Move the rightmost 8 bytes of the current key serial number to a work area
(W
a
).
b. Move the rightmost 3 bytes of W
a
to another work area (C
a
).
c. Perform an AND operation with the rightmost 3 bytes of W
a
with
X'E00000'. This operation clears the encryption counter from W
a
.
d. Perform an AND operation with C
a
and X'1FFFFF'. This operation clears
the low-order bits of the initial serial number from the encryption counter.
e. Initialize a 3-byte area to X'100000'; name the result S
a
.
f. Initialize a 1-byte counter to X'00'; name the result B
a
.
g. Test each bit of the encryption counter, looking for B'1' bits by doing the
following loop:
When a B'1' bit is found, it ORs this bit into the initial serial number. It
then special encrypts the result with K
a
.
The result of this special encryption is the new K
a
.
When all B'1' bits are processed, a variant of the value in K
a
becomes
the current encrypting key.
Use the following procedure to do this loop:
DO i=1 to 21
a. IF (C
a
AND S
a
) is not equal to  THEN DO
1) ADD 1 to B
a
2) IF B
a
> 1 THEN exit algorithm with an error
indicating too many B'1' bits were set in the encryption
counter
3) OR S
a
into the rightmost 3 bytes of W
a
;
store the result in T
a
4) XOR T
a
and K
a
; store the result in T
b
5) Encrypt T
b
with K
a
; store the result in T
c
6) XOR T
c
with K
a
; store the result in K
a
b. END IF
c. Shift S
a
one bit to the right.
Fill in on the left with a B'' bit.
END DO
The value in K
a
is the current encrypting key.
Note: The CCA implementation does not adjust key parity on any of the
bytes of the derived encrypting key before encrypting them under its master
key. Parity adjustment is not done because the key value is used in two
XOR operations during the special decrypt process of recovering the clear
PIN-block.
The following is an example of calculating the initial PIN encrypting key:
Derivation key = X'5152 5457 585B 5D5E 6162 6467 686B 6D6E'
Current key serial number = X'123 4567 89AB CDF 1'
C
a
= X'123 4567 89AB CDE'
C
b
= X'6497 E2F4 C59D 952E'
C
c
= X'163 CE85 359F F599'
Initial PIN encrypting key = K
a
1
= C
d
= X'21EE 7C8 DBE8 2AB'
E-14 IBM 4758 CCA Basic Services, Release 2.54, February 2005