#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 */ rda/irnet/Kconfig?h=nds-private-remove'>logtreecommitdiff
diff options
context:
space:
mode:
authorDexuan Cui <decui@microsoft.com>2017-01-28 11:46:02 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-31 10:59:48 +0100
commit433e19cf33d34bb6751c874a9c00980552fe508c (patch)
treece6547ef2987fbb289fa28f03536328a42781651 /net/irda/irnet/Kconfig
parent191e885a2e130e639bb0c8ee350d7047294f2ce6 (diff)
Drivers: hv: vmbus: finally fix hv_need_to_signal_on_read()
Commit a389fcfd2cb5 ("Drivers: hv: vmbus: Fix signaling logic in hv_need_to_signal_on_read()") added the proper mb(), but removed the test "prev_write_sz < pending_sz" when making the signal decision. As a result, the guest can signal the host unnecessarily, and then the host can throttle the guest because the host thinks the guest is buggy or malicious; finally the user running stress test can perceive intermittent freeze of the guest. This patch brings back the test, and properly handles the in-place consumption APIs used by NetVSC (see get_next_pkt_raw(), put_pkt_raw() and commit_rd_index()). Fixes: a389fcfd2cb5 ("Drivers: hv: vmbus: Fix signaling logic in hv_need_to_signal_on_read()") Signed-off-by: Dexuan Cui <decui@microsoft.com> Reported-by: Rolf Neugebauer <rolf.neugebauer@docker.com> Tested-by: Rolf Neugebauer <rolf.neugebauer@docker.com> Cc: "K. Y. Srinivasan" <kys@microsoft.com> Cc: Haiyang Zhang <haiyangz@microsoft.com> Cc: Stephen Hemminger <sthemmin@microsoft.com> Cc: <stable@vger.kernel.org> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/irda/irnet/Kconfig')