File: crypt.h

package info (click to toggle)
rauc 1.15.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,348 kB
  • sloc: ansic: 37,058; python: 3,354; sh: 1,393; xml: 53; makefile: 41
file content (40 lines) | stat: -rw-r--r-- 1,160 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once

#include <glib.h>

#define R_CRYPT_ERROR r_crypt_error_quark()
GQuark r_crypt_error_quark(void);

typedef enum {
	R_CRYPT_ERROR_FAILED,
} RCryptError;

/**
 * Creates AES-encrypted image.
 *
 * Creates image to be used with dm-crypt in aes-cbc-plain64 mode.
 *
 * @param in input (source) filename
 * @param out output (encrypted) filename
 * @param key AES key to use for encryption
 * @param error Return location for a GError, or NULL
 *
 * @return TRUE on success, FALSE on error
 */
gboolean r_crypt_encrypt(const gchar *in, const gchar *out, const guint8 *key, GError **error);

/**
 * Decrypts AES-encrypted image.
 *
 * Manually decrypts image to be used with dm-crypt in aes-cbc-plain64 mode.
 *
 * @param in input (source) filename
 * @param out output (decrypted) filename
 * @param key AES key to use for encryption
 * @param maxsize limits decryption of input file to maxsize bytes.
 *        0 means no limitation.
 * @param error Return location for a GError, or NULL
 *
 * @return TRUE on success, FALSE on error
 */
gboolean r_crypt_decrypt(const gchar *in, const gchar *out, const guint8 *key, goffset maxsize, GError **error);