mirror of
https://github.com/morgan9e/UxPlay
synced 2026-04-14 00:04:13 +09:00
crypto.c: add AES GCM 128 en/decryption
This commit is contained in:
11
lib/crypto.h
11
lib/crypto.h
@@ -16,6 +16,8 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* modified by fduncanh 2023
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -64,9 +66,16 @@ x25519_key_t *x25519_key_generate(void);
|
||||
x25519_key_t *x25519_key_from_raw(const unsigned char data[X25519_KEY_SIZE]);
|
||||
void x25519_key_get_raw(unsigned char data[X25519_KEY_SIZE], const x25519_key_t *key);
|
||||
void x25519_key_destroy(x25519_key_t *key);
|
||||
|
||||
int get_random_bytes(unsigned char *buf, int num);
|
||||
|
||||
void x25519_derive_secret(unsigned char secret[X25519_KEY_SIZE], const x25519_key_t *ours, const x25519_key_t *theirs);
|
||||
|
||||
// GCM AES 128
|
||||
|
||||
int gcm_encrypt(const unsigned char *plaintext, int plaintext_len, unsigned char *ciphertext,
|
||||
unsigned char *key, unsigned char *iv, unsigned char *tag);
|
||||
int gcm_decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *plaintext,
|
||||
unsigned char *key, unsigned char *iv, unsigned char *tag);
|
||||
// ED25519
|
||||
|
||||
#define ED25519_KEY_SIZE 32
|
||||
|
||||
Reference in New Issue
Block a user