diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2018-10-18 16:37:03 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2018-11-01 12:40:38 +0100 |
commit | 4daea8f302d3965ab86d649aeb2f7c8bdfeed2c3 (patch) | |
tree | bb82cd23a001de1e0f0db6c7c8ab4446136808c5 | |
parent | 9eb17250563c6cbc9a51ee4e8cc8725a53bcf688 (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>
-rw-r--r-- | ubifs-utils/mkfs.ubifs/crypto.c | 47 | ||||
-rw-r--r-- | ubifs-utils/mkfs.ubifs/crypto.h | 14 |
2 files changed, 22 insertions, 39 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(); diff --git a/ubifs-utils/mkfs.ubifs/crypto.h b/ubifs-utils/mkfs.ubifs/crypto.h index 5bff70f..b6a1e00 100644 --- a/ubifs-utils/mkfs.ubifs/crypto.h +++ b/ubifs-utils/mkfs.ubifs/crypto.h @@ -42,20 +42,6 @@ int crypto_init(void); void crypto_cleanup(void); -ssize_t encrypt_block_aes128_cbc(const void *plaintext, size_t size, - const void *key, uint64_t block_index, - void *ciphertext); - -ssize_t encrypt_block_aes256_xts(const void *plaintext, size_t size, - const void *key, uint64_t block_index, - void *ciphertext); - -ssize_t encrypt_aes128_cbc_cts(const void *plaintext, size_t size, - const void *key, void *ciphertext); - -ssize_t encrypt_aes256_cbc_cts(const void *plaintext, size_t size, - const void *key, void *ciphertext); - ssize_t derive_key_aes(const void *deriving_key, const void *source_key, size_t source_key_len, void *derived_key); |