]> www.infradead.org Git - mtd-utils.git/commitdiff
mkfs.ubifs: Remove cipher implementations from public header
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Thu, 18 Oct 2018 14:37:03 +0000 (16:37 +0200)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Thu, 1 Nov 2018 11:40:38 +0000 (12:40 +0100)
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
ubifs-utils/mkfs.ubifs/crypto.c
ubifs-utils/mkfs.ubifs/crypto.h

index f249b49b5b592e1fc7c7ee4150e9d5f13e8c9f92..f7b51357c04adb7680f3bf997b2939a9bd1dc199 100644 (file)
 #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();
index 5bff70fea29e5f4914e9ffbb457dec34d1420aef..b6a1e004f46d61c2705df57a112e3163b6e3be1e 100644 (file)
@@ -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);