title: OpenSSL EVP_CIPHER_CTX_set_padding not working
body: <p>I am trying to encrypt/decrypt using AES, CBC and PKCS#7 padding using the EVP interface. I am using the <a href="https://wiki.openssl.org/index.php/EVP_Symmetric_Encryption_and_Decryption" rel="nofollow noreferrer">example found on the Wiki</a>.</p>
  
  <p>I am doing <code>EVP_CIPHER_CTX_set_padding(ctx, 0)</code> after creating and initializing the context which should not add padding and fail if the plaintext is not a multiple of 16 bytes. Despite this the ciphertext always contains an extra block made up of padding only.</p>
  
  <p>The code I am using is literally copied and pasted from the tutorial, I am only adding <code>EVP_CIPHER_CTX_set_padding(ctx, 0)</code> in both encrypt and decrypt like so:</p>
  
  <pre><code>/* Create and initialise the context */
  if (!(ctx = EVP_CIPHER_CTX_new())) handleErrors();
  EVP_CIPHER_CTX_set_padding(ctx, 0);
  </code></pre>
  
  <p>Am I doing something wrong?</p>