#ifndef _CRYPTO_XTS_H #define _CRYPTO_XTS_H #include #include #include struct scatterlist; struct blkcipher_desc; #define XTS_BLOCK_SIZE 16 struct xts_crypt_req { be128 *tbuf; unsigned int tbuflen; void *tweak_ctx; void (*tweak_fn)(void *ctx, u8* dst, const u8* src); void *crypt_ctx; void (*crypt_fn)(void *ctx, u8 *blks, unsigned int nbytes); }; #define XTS_TWEAK_CAST(x) ((void (*)(void *, u8*, const u8*))(x)) int xts_crypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes, struct xts_crypt_req *req); static inline int xts_check_key(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) { u32 *flags = &tfm->crt_flags; /* * key consists of keys of equal size concatenated, therefore * the length must be even. */ if (keylen % 2) { *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; return -EINVAL; } /* ensure that the AES and tweak key are not identical */ if (fips_enabled && !crypto_memneq(key, key + (keylen / 2), keylen / 2)) { *flags |= CRYPTO_TFM_RES_WEAK_KEY; return -EINVAL; } return 0; } static inline int xts_verify_key(struct crypto_skcipher *tfm, const u8 *key, unsigned int keylen) { /* * key consists of keys of equal size concatenated, therefore * the length must be even. */ if (keylen % 2) { crypto_skcipher_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); return -EINVAL; } /* ensure that the AES and tweak key are not identical */ if ((fips_enabled || crypto_skcipher_get_flags(tfm) & CRYPTO_TFM_REQ_WEAK_KEY) && !crypto_memneq(key, key + (keylen / 2), keylen / 2)) { crypto_skcipher_set_flags(tfm, CRYPTO_TFM_RES_WEAK_KEY); return -EINVAL; } return 0; } #endif /* _CRYPTO_XTS_H */ 9b2cf75058b7'>treecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-02-03 11:32:25 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-03 11:32:25 -0800
commit79c9089f97d37ffac88c3ddb6d359b2cf75058b7 (patch)
treefe92f453481db4e67a9e4be2a95b42686b98b7e1
parent57480b98af696795ab0daff0a6ed572172060a0f (diff)
parentf63cf464fc379382a271f94ddef36e8c5a0628eb (diff)
Merge tag 'drm-fixes-for-v4.10-rc7' of git://people.freedesktop.org/~airlied/linux
Pull drm fixes from Dave Airlie: "Another fixes pull for v4.10, it's a bit big due to the backport of the VMA fixes for i915 that should fix the oops on shutdown problems that you've worked around. There are also two drm core connector registration fixes, a bunch of nouveau regression fixes and two AMD fixes" * tag 'drm-fixes-for-v4.10-rc7' of git://people.freedesktop.org/~airlied/linux: drm/radeon: Fix vram_size/visible values in DRM_RADEON_GEM_INFO ioctl drm/amdgpu/si: fix crash on headless asics drm/i915: Track pinned vma in intel_plane_state drm/atomic: Unconditionally call prepare_fb. drm/atomic: Fix double free in drm_atomic_state_default_clear drm/nouveau/kms/nv50: request vblank events for commits that send completion events drm/nouveau/nv1a,nv1f/disp: fix memory clock rate retrieval drm/nouveau/disp/gt215: Fix HDA ELD handling (thus, HDMI audio) on gt215 drm/nouveau/nouveau/led: prevent compiling the led-code if nouveau=y and leds=m drm/nouveau/disp/mcp7x: disable dptmds workaround drm/nouveau: prevent userspace from deleting client object drm/nouveau/fence/g84-: protect against concurrent access to semaphore buffers drm: Don't race connector registration drm: prevent double-(un)registration for connectors