Try to remove device even if it is busy (libdevmapper now handle retry).
[platform/upstream/cryptsetup.git] / lib / crypto_backend / crypto_backend.h
1 /*
2  * crypto backend implementation
3  *
4  * Copyright (C) 2010-2012, Red Hat, Inc. All rights reserved.
5  *
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.
9  *
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.
14  *
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.
18  */
19 #ifndef _CRYPTO_BACKEND_H
20 #define _CRYPTO_BACKEND_H
21
22 #include "libcryptsetup.h"
23 #include "internal.h"
24
25 struct crypt_hash;
26 struct crypt_hmac;
27
28 int crypt_backend_init(struct crypt_device *ctx);
29
30 #define CRYPT_BACKEND_KERNEL (1 << 0)   /* Crypto uses kernel part, for benchmark */
31
32 uint32_t crypt_backend_flags(void);
33
34 /* HASH */
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);
40
41 /* HMAC */
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);
48
49 #endif /* _CRYPTO_BACKEND_H */