"Fossies" - the Fresh Open Source Software Archive

Member "cryptsetup-2.4.3/lib/crypto_backend/crypto_backend_internal.h" (13 Jan 2022, 2312 Bytes) of package /linux/misc/cryptsetup-2.4.3.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "crypto_backend_internal.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 2.3.6_vs_2.4.0.

    1 /*
    2  * crypto backend implementation
    3  *
    4  * Copyright (C) 2010-2021 Red Hat, Inc. All rights reserved.
    5  * Copyright (C) 2010-2021 Milan Broz
    6  *
    7  * This file is free software; you can redistribute it and/or
    8  * modify it under the terms of the GNU Lesser General Public
    9  * License as published by the Free Software Foundation; either
   10  * version 2.1 of the License, or (at your option) any later version.
   11  *
   12  * This file is distributed in the hope that it will be useful,
   13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   15  * Lesser General Public License for more details.
   16  *
   17  * You should have received a copy of the GNU Lesser General Public
   18  * License along with this file; if not, write to the Free Software
   19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
   20  */
   21 #ifndef _CRYPTO_BACKEND_INTERNAL_H
   22 #define _CRYPTO_BACKEND_INTERNAL_H
   23 
   24 #include "crypto_backend.h"
   25 
   26 /* internal PBKDF2 implementation */
   27 int pkcs5_pbkdf2(const char *hash,
   28          const char *P, size_t Plen,
   29          const char *S, size_t Slen,
   30          unsigned int c,
   31          unsigned int dkLen, char *DK,
   32          unsigned int hash_block_size);
   33 
   34 /* Argon2 implementation wrapper */
   35 int argon2(const char *type, const char *password, size_t password_length,
   36        const char *salt, size_t salt_length,
   37        char *key, size_t key_length,
   38        uint32_t iterations, uint32_t memory, uint32_t parallel);
   39 
   40 /* Block ciphers: fallback to kernel crypto API */
   41 
   42 struct crypt_cipher_kernel {
   43     int tfmfd;
   44     int opfd;
   45 };
   46 
   47 int crypt_cipher_init_kernel(struct crypt_cipher_kernel *ctx, const char *name,
   48                  const char *mode, const void *key, size_t key_length);
   49 int crypt_cipher_encrypt_kernel(struct crypt_cipher_kernel *ctx,
   50                 const char *in, char *out, size_t length,
   51                 const char *iv, size_t iv_length);
   52 int crypt_cipher_decrypt_kernel(struct crypt_cipher_kernel *ctx,
   53                 const char *in, char *out, size_t length,
   54                 const char *iv, size_t iv_length);
   55 void crypt_cipher_destroy_kernel(struct crypt_cipher_kernel *ctx);
   56 int crypt_bitlk_decrypt_key_kernel(const void *key, size_t key_length,
   57                    const char *in, char *out, size_t length,
   58                    const char *iv, size_t iv_length,
   59                    const char *tag, size_t tag_length);
   60 
   61 #endif /* _CRYPTO_BACKEND_INTERNAL_H */