diff options
author | Dominik Sliwa <dominik.sliwa@toradex.com> | 2017-12-22 12:07:34 +0000 |
---|---|---|
committer | Dominik Sliwa <dominik.sliwa@toradex.com> | 2017-12-22 16:46:44 +0100 |
commit | 198e79f0e8f0b24c1e36ab6032d348f40de20262 (patch) | |
tree | d8dd6411978560fd0b6832761b085ac431253389 /backport-include | |
parent | c8beff5117bd4614be26bf28e97b885e8af42a67 (diff) |
backports: bluetooth: Support 4.9 kernelsColibri-iMX7_LXDE-Image_2.8b3.111-20180627Colibri-iMX7_LXDE-Image_2.8b2.97-20180331Colibri-iMX7_LXDE-Image_2.8b1.64-20171229Colibri-iMX6_LXDE-Image_2.8b3.111-20180627Colibri-iMX6_LXDE-Image_2.8b2.97-20180331Colibri-iMX6_LXDE-Image_2.8b1.64-20171229Colibri-iMX6ULL_LXDE-Image_2.8b3.111-20180627Colibri-iMX6ULL_LXDE-Image_2.8b2.97-20180331Colibri-iMX6ULL_LXDE-Image_2.8b1.64-20171229Colibri-VF_LXDE-Image_2.8b3.111-20180626Colibri-VF_LXDE-Image_2.8b2.97-20180331Colibri-VF_LXDE-Image_2.8b1.64-20171229Colibri-T30_LXDE-Image_2.8b3.111-20180627Colibri-T30_LXDE-Image_2.8b2.97-20180331Colibri-T30_LXDE-Image_2.8b1.64-20171229Colibri-T20_LXDE-Image_2.8b3.111-20180626Colibri-T20_LXDE-Image_2.8b2.97-20180331Colibri-T20_LXDE-Image_2.8b1.64-20171229Apalis-iMX6_LXDE-Image_2.8b3.111-20180626Apalis-iMX6_LXDE-Image_2.8b2.97-20180331Apalis-iMX6_LXDE-Image_2.8b1.64-20171229Apalis-TK1_LXDE-Image_2.8b3.111-20180626Apalis-TK1_LXDE-Image_2.8b2.97-20180331Apalis-TK1_LXDE-Image_2.8b1.64-20171229Apalis-TK1-Mainline_LXDE-Image_2.8b3.111-20180627Apalis-TK1-Mainline_LXDE-Image_2.8b2.97-20180331Apalis-TK1-Mainline_LXDE-Image_2.8b1.64-20171229Apalis-T30_LXDE-Image_2.8b3.111-20180626Apalis-T30_LXDE-Image_2.8b2.97-20180331Apalis-T30_LXDE-Image_2.8b1.64-20171229toradex-4.14
Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Diffstat (limited to 'backport-include')
-rw-r--r-- | backport-include/crypto/skcipher.h | 99 | ||||
-rw-r--r-- | backport-include/linux/kernel.h | 4 | ||||
-rw-r--r-- | backport-include/linux/kref.h | 13 | ||||
-rw-r--r-- | backport-include/linux/skbuff.h | 17 | ||||
-rw-r--r-- | backport-include/linux/string.h | 4 | ||||
-rw-r--r-- | backport-include/linux/uio.h | 7 | ||||
-rw-r--r-- | backport-include/net/sock.h | 10 | ||||
-rw-r--r-- | backport-include/uapi/linux/cryptouser.h | 12 |
8 files changed, 166 insertions, 0 deletions
diff --git a/backport-include/crypto/skcipher.h b/backport-include/crypto/skcipher.h index 73ba783..900c359 100644 --- a/backport-include/crypto/skcipher.h +++ b/backport-include/crypto/skcipher.h @@ -441,6 +441,105 @@ static inline void skcipher_request_set_crypt( } #endif /* < 4.3 */ +#if LINUX_VERSION_IS_LESS(4,8,0) +#define skcipher_walk LINUX_BACKPORT(skcipher_walk) +struct skcipher_walk { + union { + struct { + struct page *page; + unsigned long offset; + } phys; + + struct { + u8 *page; + void *addr; + } virt; + } src, dst; + + struct scatter_walk in; + unsigned int nbytes; + + struct scatter_walk out; + unsigned int total; + + struct list_head buffers; + + u8 *page; + u8 *buffer; + u8 *oiv; + void *iv; + + unsigned int ivsize; + + int flags; + unsigned int blocksize; + unsigned int stride; + unsigned int alignmask; +}; + +struct skcipher_alg { + int (*setkey)(struct crypto_skcipher *tfm, const u8 *key, + unsigned int keylen); + int (*encrypt)(struct skcipher_request *req); + int (*decrypt)(struct skcipher_request *req); + int (*init)(struct crypto_skcipher *tfm); + void (*exit)(struct crypto_skcipher *tfm); + + unsigned int min_keysize; + unsigned int max_keysize; + unsigned int ivsize; + unsigned int chunksize; + unsigned int walksize; + + struct crypto_alg base; +}; + +struct skcipher_instance { + void (*free)(struct skcipher_instance *inst); + union { + struct { + char head[offsetof(struct skcipher_alg, base)]; + struct crypto_instance base; + } s; + struct skcipher_alg alg; + }; +}; + +static inline unsigned int crypto_skcipher_alg_walksize( + struct skcipher_alg *alg) +{ + if ((alg->base.cra_flags & CRYPTO_ALG_TYPE_MASK) == + CRYPTO_ALG_TYPE_BLKCIPHER) + return alg->base.cra_blocksize; + + if (alg->base.cra_ablkcipher.encrypt) + return alg->base.cra_blocksize; + + return alg->walksize; +} + +static inline struct skcipher_alg *crypto_skcipher_alg( + struct crypto_skcipher *tfm) +{ + return container_of(crypto_skcipher_tfm(tfm)->__crt_alg, + struct skcipher_alg, base); +} + +static inline unsigned int crypto_skcipher_walksize( + struct crypto_skcipher *tfm) +{ + return crypto_skcipher_alg_walksize(crypto_skcipher_alg(tfm)); +} + +static inline struct crypto_instance *skcipher_crypto_instance( + struct skcipher_instance *inst) +{ + return &inst->s.base; +} + +#define CRYPTO_ALG_TYPE_SKCIPHER CRYPTO_ALG_TYPE_ABLKCIPHER +#endif /* < 4.8 */ + #if LINUX_VERSION_IS_LESS(4,6,0) #define skcipher_request_zero LINUX_BACKPORT(skcipher_request_zero) static inline void skcipher_request_zero(struct skcipher_request *req) diff --git a/backport-include/linux/kernel.h b/backport-include/linux/kernel.h index 3ddeb13..4b2f153 100644 --- a/backport-include/linux/kernel.h +++ b/backport-include/linux/kernel.h @@ -206,6 +206,10 @@ int __must_check kstrtobool_from_user(const char __user *s, size_t count, bool * #endif +#if LINUX_VERSION_IS_LESS(4,5,0) +const char *kvasprintf_const(gfp_t gfp, const char *fmt, va_list args); +#endif /* < 4.4 */ + #if LINUX_VERSION_IS_LESS(3,14,0) static inline u32 reciprocal_scale(u32 val, u32 ep_ro) { diff --git a/backport-include/linux/kref.h b/backport-include/linux/kref.h new file mode 100644 index 0000000..631488f --- /dev/null +++ b/backport-include/linux/kref.h @@ -0,0 +1,13 @@ +#ifndef __BACKPORT_LINUX_KREF_H +#define __BACKPORT_LINUX_KREF_H +#include_next <linux/kref.h> + +#if LINUX_VERSION_IS_LESS(4,11,0) +#include <linux/refcount.h> +static inline unsigned int kref_read(const struct kref *kref) +{ + return refcount_read((const refcount_t *)&kref->refcount); +} +#endif /* < 4.11 */ + +#endif /* __BACKPORT_LINUX_KREF_H */ diff --git a/backport-include/linux/skbuff.h b/backport-include/linux/skbuff.h index 034206b..af40b8d 100644 --- a/backport-include/linux/skbuff.h +++ b/backport-include/linux/skbuff.h @@ -371,6 +371,23 @@ static inline void skb_put_u8(struct sk_buff *skb, u8 val) { *(u8 *)skb_put(skb, 1) = val; } + +static inline void *__skb_put_zero(struct sk_buff *skb, unsigned int len) +{ + void *tmp = __skb_put(skb, len); + + memset(tmp, 0, len); + return tmp; +} + +static inline void *__skb_put_data(struct sk_buff *skb, const void *data, + unsigned int len) +{ + void *tmp = __skb_put(skb, len); + + memcpy(tmp, data, len); + return tmp; +} #endif #endif /* __BACKPORT_SKBUFF_H */ diff --git a/backport-include/linux/string.h b/backport-include/linux/string.h index b85d9c7..b1d26d1 100644 --- a/backport-include/linux/string.h +++ b/backport-include/linux/string.h @@ -29,4 +29,8 @@ void memzero_explicit(void *s, size_t count); ssize_t strscpy(char *dest, const char *src, size_t count); #endif +#if LINUX_VERSION_IS_LESS(4,0,0) +extern void kfree_const(const void *x); +extern const char *kstrdup_const(const char *s, gfp_t gfp); +#endif #endif /* __BACKPORT_LINUX_STRING_H */ diff --git a/backport-include/linux/uio.h b/backport-include/linux/uio.h new file mode 100644 index 0000000..fe27e68 --- /dev/null +++ b/backport-include/linux/uio.h @@ -0,0 +1,7 @@ +#ifndef _BP_LINUX_UIO_H +#define _BP_LINUX_UIO_H +#include_next <linux/uio.h> + +bool _copy_from_iter_full(void *addr, size_t bytes, struct iov_iter *i); + +#endif /* _BP_LINUX_UIO_H */ diff --git a/backport-include/net/sock.h b/backport-include/net/sock.h index 89191f3..ea3c474 100644 --- a/backport-include/net/sock.h +++ b/backport-include/net/sock.h @@ -63,4 +63,14 @@ static inline void sk_clear_bit(int nr, struct sock *sk) } #endif /* < 4.5 */ +#if LINUX_VERSION_IS_LESS(4,7,0) +/* no reclassification while locks are held */ +static inline bool sock_allow_reclassification(const struct sock *csk) +{ + struct sock *sk = (struct sock *)csk; + + return !sk->sk_lock.owned && !spin_is_locked(&sk->sk_lock.slock); +} +#endif /* < 4.7 */ + #endif /* __BACKPORT_NET_SOCK_H */ diff --git a/backport-include/uapi/linux/cryptouser.h b/backport-include/uapi/linux/cryptouser.h new file mode 100644 index 0000000..ea4a9a5 --- /dev/null +++ b/backport-include/uapi/linux/cryptouser.h @@ -0,0 +1,12 @@ +#ifndef __BACKPORT_LINUX_CRYPTOUSER_H +#define __BACKPORT_LINUX_CRYPTOUSER_H +#include_next <linux/cryptouser.h> +#include <linux/version.h> + +#if LINUX_VERSION_IS_LESS(4,8,0) +struct crypto_report_kpp { + char type[CRYPTO_MAX_NAME]; +}; +#endif /* < 4.8 */ + +#endif |