+bool cipher_encrypt(cipher_t *cipher, const void *indata, size_t inlen, void *outdata, size_t *outlen, bool oneshot) {
+ return cipher_encrypt_decrypt(cipher, indata, inlen, outdata, outlen, oneshot,
+ EVP_EncryptInit_ex, EVP_EncryptUpdate, EVP_EncryptFinal_ex);
+}
+
+bool cipher_decrypt(cipher_t *cipher, const void *indata, size_t inlen, void *outdata, size_t *outlen, bool oneshot) {
+ return cipher_encrypt_decrypt(cipher, indata, inlen, outdata, outlen, oneshot,
+ EVP_DecryptInit_ex, EVP_DecryptUpdate, EVP_DecryptFinal_ex);
+}
+
+nid_t cipher_get_nid(const cipher_t *cipher) {
+ if(!cipher || !cipher->cipher) {
+ return 0;
+ }
+
+ return EVP_CIPHER_nid(cipher->cipher);