CryptoLib icon indicating copy to clipboard operation
CryptoLib copied to clipboard

Crypto_Key_OTAR - Fixed IV length

Open Peco602 opened this issue 3 years ago • 2 comments

Currently, the Crypto_Key_OTAR works only with an IV with length 12 bytes.

As you can see below, the value 30 is calculating by summing the Session Key ID (2 bytes), the IV len (12 bytes) and the MAC len (16 bytes):

int pdu_keys = (sdls_frame.pdu.pdu_len - 30) / (2 + KEY_SIZE);

Moreover, keys are extracted from the 14th byte (2 bytes for Session Key ID and 12 bytes for IV):

    gcry_error = gcry_cipher_decrypt(
        tmp_hd,
        &(sdls_frame.pdu.data[14]),                     // plaintext output
        pdu_keys * (2 + KEY_SIZE),   			 		// length of data
        NULL,                                           // in place decryption
        0                                               // in data length
    );
for (int count = 14; x < pdu_keys; x++)

The IV len for OTAR should be a managed parameter so I suggest to add it as a DEFINE.

Peco602 avatar Dec 30 '21 10:12 Peco602

Actual data needs to be extracted from the SA, rather than the hard-coding happening above.

rjbrown2 avatar Oct 18 '23 16:10 rjbrown2

Currently attached to #147 Donnie-Ice is currently working this now.

rjbrown2 avatar Sep 04 '24 17:09 rjbrown2