summaryrefslogtreecommitdiff
path: root/ubifs-utils/mkfs.ubifs/crypto.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2018-10-18 16:37:03 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2018-11-01 12:40:38 +0100
commit4daea8f302d3965ab86d649aeb2f7c8bdfeed2c3 (patch)
treebb82cd23a001de1e0f0db6c7c8ab4446136808c5 /ubifs-utils/mkfs.ubifs/crypto.c
parent9eb17250563c6cbc9a51ee4e8cc8725a53bcf688 (diff)
mkfs.ubifs: Remove cipher implementations from public header
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'ubifs-utils/mkfs.ubifs/crypto.c')
-rw-r--r--ubifs-utils/mkfs.ubifs/crypto.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/ubifs-utils/mkfs.ubifs/crypto.c b/ubifs-utils/mkfs.ubifs/crypto.c
index f249b49..f7b5135 100644
--- a/ubifs-utils/mkfs.ubifs/crypto.c
+++ b/ubifs-utils/mkfs.ubifs/crypto.c
@@ -27,21 +27,6 @@
#include "common.h"
#include "mtd_swab.h"
-
-static struct cipher ciphers[] = {
- {
- .name = "AES-128-CBC",
- .encrypt_block = encrypt_block_aes128_cbc,
- .encrypt_fname = encrypt_aes128_cbc_cts,
- }, {
- .name = "AES-256-XTS",
- .encrypt_block = encrypt_block_aes256_xts,
- .encrypt_fname = encrypt_aes256_cbc_cts,
- }
-};
-
-
-
static int do_sha256(const unsigned char *in, size_t len, unsigned char *out)
{
unsigned int out_len;
@@ -168,9 +153,9 @@ static ssize_t encrypt_block(const void *plaintext, size_t size,
return ret;
}
-ssize_t encrypt_block_aes128_cbc(const void *plaintext, size_t size,
- const void *key, uint64_t block_index,
- void *ciphertext)
+static ssize_t encrypt_block_aes128_cbc(const void *plaintext, size_t size,
+ const void *key, uint64_t block_index,
+ void *ciphertext)
{
const EVP_CIPHER *cipher = EVP_aes_128_cbc();
@@ -182,9 +167,9 @@ ssize_t encrypt_block_aes128_cbc(const void *plaintext, size_t size,
ciphertext, cipher);
}
-ssize_t encrypt_block_aes256_xts(const void *plaintext, size_t size,
- const void *key, uint64_t block_index,
- void *ciphertext)
+static ssize_t encrypt_block_aes256_xts(const void *plaintext, size_t size,
+ const void *key, uint64_t block_index,
+ void *ciphertext)
{
const EVP_CIPHER *cipher = EVP_aes_256_xts();
@@ -252,8 +237,8 @@ static ssize_t encrypt_cbc_cts(const void *plaintext, size_t size,
return size;
}
-ssize_t encrypt_aes128_cbc_cts(const void *plaintext, size_t size,
- const void *key, void *ciphertext)
+static ssize_t encrypt_aes128_cbc_cts(const void *plaintext, size_t size,
+ const void *key, void *ciphertext)
{
const EVP_CIPHER *cipher = EVP_aes_128_cbc();
if (!cipher) {
@@ -264,8 +249,8 @@ ssize_t encrypt_aes128_cbc_cts(const void *plaintext, size_t size,
return encrypt_cbc_cts(plaintext, size, key, ciphertext, cipher);
}
-ssize_t encrypt_aes256_cbc_cts(const void *plaintext, size_t size,
- const void *key, void *ciphertext)
+static ssize_t encrypt_aes256_cbc_cts(const void *plaintext, size_t size,
+ const void *key, void *ciphertext)
{
const EVP_CIPHER *cipher = EVP_aes_256_cbc();
if (!cipher) {
@@ -293,6 +278,18 @@ ssize_t derive_key_aes(const void *deriving_key, const void *source_key,
aes_key_len, NULL, 0, derived_key);
}
+static struct cipher ciphers[] = {
+ {
+ .name = "AES-128-CBC",
+ .encrypt_block = encrypt_block_aes128_cbc,
+ .encrypt_fname = encrypt_aes128_cbc_cts,
+ }, {
+ .name = "AES-256-XTS",
+ .encrypt_block = encrypt_block_aes256_xts,
+ .encrypt_fname = encrypt_aes256_cbc_cts,
+ }
+};
+
int crypto_init(void)
{
ERR_load_crypto_strings();