usched: Allow process to change self cpu affinity
[dragonfly.git] / lib / libtcplay / generic_xts.h
blob1c31450b80d3c4ec9137c7dcd62614621f569d03
1 /*
2 * Copyright (C) 2008, Damien Miller
3 * Copyright (C) 2011, Alex Hornung
5 * Permission to use, copy, and modify this software with or without fee
6 * is hereby granted, provided that this entire notice is included in
7 * all copies of any software which is or includes a copy or
8 * modification of this software.
9 * You may use this code under the GNU public license if you so wish. Please
10 * contribute changes back to the authors under this freer than GPL license
11 * so that we may further the use of strong encryption without limitations to
12 * all.
14 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
15 * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
16 * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
17 * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
18 * PURPOSE.
21 #include <inttypes.h>
22 #define XTS_MAX_BLOCKSIZE 16
23 #define XTS_IVSIZE 8
24 #define XTS_ALPHA 0x87 /* GF(2^128) generator polynomial */
26 typedef int (*encrypt_decrypt_fn)(void *, size_t, const uint8_t *, uint8_t *);
27 typedef int (*set_key_fn)(void **, void *, void *, const uint8_t *, int);
28 typedef int (*zero_key_fn)(void **);
31 struct xts_ctx {
32 encrypt_decrypt_fn encrypt_fn;
33 encrypt_decrypt_fn decrypt_fn;
34 set_key_fn set_key_fn;
35 zero_key_fn zero_key_fn;
37 void *ctx1;
38 void *ctx2;
39 uint8_t tweak[XTS_MAX_BLOCKSIZE];
40 uint32_t blk_sz;
43 int xts_init(struct xts_ctx *ctxp, void *arg1, void *arg2, set_key_fn set_key_fn,
44 zero_key_fn zero_key_fn, encrypt_decrypt_fn encrypt_fn,
45 encrypt_decrypt_fn decrypt_fn, uint32_t blk_sz, uint8_t *key, int len);
46 int xts_encrypt(struct xts_ctx *ctx, uint8_t *data, size_t len, uint8_t *iv);
47 int xts_decrypt(struct xts_ctx *ctx, uint8_t *data, size_t len, uint8_t *iv);
48 int xts_uninit(struct xts_ctx *ctxp);