I'm trying to manually decrypt DTLS traffic using OpenSSL and TLS 1.2. The cipher suite im using is AES256-SHA256 as listed here. Im able to decrypt the packets with the key that the server and the client negotiate during the handshake without issues, but what i don't understand is that i can set the initialization vector to any value or even null and still i can decrypt the packets.
Here is a code snippet from the program that receives the packet:
EVP_CIPHER_CTX *ctc = EVP_CIPHER_CTX_new();
EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, (const unsigned char)"not a real iv");
...
EVP_DecryptUpdate(ctx, (unsigned char*)payload, &len, (unsigned char*)payload, len);
EVP_DecryptFinal_ex(ctx, (unsigned char*)payload + len, &len);
And that decrypts the data fine with the bogus IV.
So apparently either the encryption / decryption is not done in CBC mode. Or does OpenSSL derive the IV by the decryption key somehow from the packet ?
What i am missing or/and not understanding here ? The DTLS rfc did not talk about this either.