-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrypto.h
More file actions
24 lines (21 loc) · 801 Bytes
/
crypto.h
File metadata and controls
24 lines (21 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once
#include <openssl/evp.h>
#include <openssl/conf.h>
#include <openssl/err.h>
#include <string.h>
#include <stdint.h>
void crypto_init(void);
void crypto_deinit(void);
/**
* Decrypts a message which was encrypted using AES/CBC/PKCS5Padding and where the key was
* generated with PBKDF2WithHmacSHA1.
*
* \param message the ciphertext message prefixed with the IV
* \param message_size the size of the full message, including IV
* \param password the password used for the encryption
* \param plaintext where the resultant plaintext is placed on success.
* Must be at least message_size + 1 chars long.
*
* \return the size of plaintext message on success, or -1 otherwise
*/
int decrypt(char *message, uint32_t message_size, char *password, char *plaintext);