2 * crypto backend implementation
4 * Copyright (C) 2010-2012, Red Hat, Inc. All rights reserved.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef _CRYPTO_BACKEND_H
20 #define _CRYPTO_BACKEND_H
22 #include "libcryptsetup.h"
28 int crypt_backend_init(struct crypt_device *ctx);
30 #define CRYPT_BACKEND_KERNEL (1 << 0) /* Crypto uses kernel part, for benchmark */
32 uint32_t crypt_backend_flags(void);
35 int crypt_hash_size(const char *name);
36 int crypt_hash_init(struct crypt_hash **ctx, const char *name);
37 int crypt_hash_write(struct crypt_hash *ctx, const char *buffer, size_t length);
38 int crypt_hash_final(struct crypt_hash *ctx, char *buffer, size_t length);
39 int crypt_hash_destroy(struct crypt_hash *ctx);
42 int crypt_hmac_size(const char *name);
43 int crypt_hmac_init(struct crypt_hmac **ctx, const char *name,
44 const void *buffer, size_t length);
45 int crypt_hmac_write(struct crypt_hmac *ctx, const char *buffer, size_t length);
46 int crypt_hmac_final(struct crypt_hmac *ctx, char *buffer, size_t length);
47 int crypt_hmac_destroy(struct crypt_hmac *ctx);
49 /* RNG (must be usable in FIPS mode) */
50 int crypt_backend_fips_rng(char *buffer, size_t length, int quality);
52 #endif /* _CRYPTO_BACKEND_H */