I'm assuming that OpenSSL is just using these functions here. page 66 is CBC


Can I just generate a key/iv randomly and pass data off with these functions to encrypt/decrypt data? If so, how come the decrypt function is larger or even different than the encrypt? Shouldn't they be the same? I have a C program that does symmetric encryption with the EVP functions and works normally but I want to write an embedded program without OpenSSL or any other libraries. I've done this for key derivation (traditional method is MD5) and that took me a long time. This is for data specifically AES 256. Does it encrypt in 256 bytes or is it 16? Im highly confused about that.

  • 1
    AES256 uses a key of 256 bits to encrypt blocks of 128 bits, or 16 bytes.
    – Sjoerd
    Jan 26 at 10:01

1 Answer 1


Generate random keys & IVs for AES-256 encryption/decryption using fixed 16-byte blocks, despite encrypt/decrypt function size differences due to internal implementation variations.

  • can I just use the aesni_cbc_encrypt assembly functions to encrypt/decrypt data?
    – shawnixer
    Jan 26 at 4:55
  • AES-256 key is 32 bytes actually, but sometimes encoded in longer forms. (Regardless of key size) IV is 16 bytes for CBC CFB OFB, but often less for CTR, standardly 12 bytes for GCM, and less than 15 usually about 11 for CCM. Jan 30 at 7:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .