Set the algorithm member on cipher_t when allocating AES crypto instance. Apply same fix to NULL cipher.