-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAlqHLN8ACgkQONu9yGCS aT7eyQ/+NGK3/MPgoqRtg8sEvr1CVk8VhH1BiBfiQPGXe/D4nqPrKQzQBBzsW8QX 6Z9PY7wDz9RgFkw+FoOyG0eLuYdgNYOelASdQ4kJzteVH8pB2GxxTbX0drttzV+F liNy0w39YLYxbjR4FavOSuDekd46dNQsHBvzTawaFKh0BEtQO+1uUGMg1LjMKVPn F9ry0mEPrOoC2+nRvU6QXIUZy6y4+Pgdda0sfGcO3yXwQev9HoW5h9qMCnGah30J D3Glt86dtpQcuqeIaXrfX+HnkvAOxTHjP8uRn3O7A7h8+WYBWq5Xms6A7EE9duNV 0UA8OZpvq0r0YSTmBFzrDexAcf/cXW8ajd/VKseI/d53iIauLV5FUaGldLJ3IQMc gYZ2uNxGTI4z3V+nIiVQ0NCm4kmqogVY8PvMlgUwiFVG2B088iYGZ7iTOQ9b7wBO VgDo0ouC/yDA8Lmz/A0l3SuvkJDNIPJit5lWzqCGRjk1F8WdPpI5C3ONfp8R3Lko sTllldOo982KW5up/fg5HfuMg1OjgXZtzO+/NlTtyTpSr9bb1OoniSROG8eEcMqO lKI1MB8Xx/pqqW1E8OOtb7A/8JPCBFzVV9xVGKwI0uZa2XOQeAwGruOe8Ub6nEpU 8w30DlSgy8MB1BPL6UGC6k+001k8jkohdl/qjpYb6aK55CfbhlA= =a3k5 -----END PGP SIGNATURE----- Merge 4.4.116 into android-4.4 Changes in 4.4.116 powerpc/bpf/jit: Disable classic BPF JIT on ppc64le powerpc/64: Fix flush_(d|i)cache_range() called from modules powerpc: Fix VSX enabling/flushing to also test MSR_FP and MSR_VEC powerpc: Simplify module TOC handling powerpc/pseries: Add H_GET_CPU_CHARACTERISTICS flags & wrapper powerpc/64: Add macros for annotating the destination of rfid/hrfid powerpc/64s: Simple RFI macro conversions powerpc/64: Convert fast_exception_return to use RFI_TO_USER/KERNEL powerpc/64: Convert the syscall exit path to use RFI_TO_USER/KERNEL powerpc/64s: Convert slb_miss_common to use RFI_TO_USER/KERNEL powerpc/64s: Add support for RFI flush of L1-D cache powerpc/64s: Support disabling RFI flush with no_rfi_flush and nopti powerpc/pseries: Query hypervisor for RFI flush settings powerpc/powernv: Check device-tree for RFI flush settings powerpc/64s: Wire up cpu_show_meltdown() powerpc/64s: Allow control of RFI flush via debugfs ASoC: pcm512x: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE usbip: vhci_hcd: clear just the USB_PORT_STAT_POWER bit usbip: fix 3eee23c3ec14 tcp_socket address still in the status file net: cdc_ncm: initialize drvflags before usage ASoC: simple-card: Fix misleading error message ASoC: rsnd: don't call free_irq() on Parent SSI ASoC: rsnd: avoid duplicate free_irq() drm: rcar-du: Use the VBK interrupt for vblank events drm: rcar-du: Fix race condition when disabling planes at CRTC stop x86/asm: Fix inline asm call constraints for GCC 4.4 ip6mr: fix stale iterator net: igmp: add a missing rcu locking section qlcnic: fix deadlock bug r8169: fix RTL8168EP take too long to complete driver initialization. tcp: release sk_frag.page in tcp_disconnect vhost_net: stop device during reset owner media: soc_camera: soc_scale_crop: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE KEYS: encrypted: fix buffer overread in valid_master_desc() don't put symlink bodies in pagecache into highmem crypto: tcrypt - fix S/G table for test_aead_speed() x86/microcode/AMD: Do not load when running on a hypervisor x86/microcode: Do the family check first powerpc/pseries: include linux/types.h in asm/hvcall.h cifs: Fix missing put_xid in cifs_file_strict_mmap cifs: Fix autonegotiate security settings mismatch CIFS: zero sensitive data when freeing dmaengine: dmatest: fix container_of member in dmatest_callback x86/kaiser: fix build error with KASAN && !FUNCTION_GRAPH_TRACER kaiser: fix compile error without vsyscall netfilter: nf_queue: Make the queue_handler pernet posix-timer: Properly check sigevent->sigev_notify usb: gadget: uvc: Missing files for configfs interface sched/rt: Use container_of() to get root domain in rto_push_irq_work_func() sched/rt: Up the root domain ref count when passing it around via IPIs dccp: CVE-2017-8824: use-after-free in DCCP code media: dvb-usb-v2: lmedm04: Improve logic checking of warm start media: dvb-usb-v2: lmedm04: move ts2020 attach to dm04_lme2510_tuner mtd: cfi: convert inline functions to macros mtd: nand: brcmnand: Disable prefetch by default mtd: nand: Fix nand_do_read_oob() return value mtd: nand: sunxi: Fix ECC strength choice ubi: block: Fix locking for idr_alloc/idr_remove nfs/pnfs: fix nfs_direct_req ref leak when i/o falls back to the mds NFS: Add a cond_resched() to nfs_commit_release_pages() NFS: commit direct writes even if they fail partially NFS: reject request for id_legacy key without auxdata kernfs: fix regression in kernfs_fop_write caused by wrong type ahci: Annotate PCI ids for mobile Intel chipsets as such ahci: Add PCI ids for Intel Bay Trail, Cherry Trail and Apollo Lake AHCI ahci: Add Intel Cannon Lake PCH-H PCI ID crypto: hash - introduce crypto_hash_alg_has_setkey() crypto: cryptd - pass through absence of ->setkey() crypto: poly1305 - remove ->setkey() method nsfs: mark dentry with DCACHE_RCUACCESS media: v4l2-ioctl.c: don't copy back the result for -ENOTTY vb2: V4L2_BUF_FLAG_DONE is set after DQBUF media: v4l2-compat-ioctl32.c: add missing VIDIOC_PREPARE_BUF media: v4l2-compat-ioctl32.c: fix the indentation media: v4l2-compat-ioctl32.c: move 'helper' functions to __get/put_v4l2_format32 media: v4l2-compat-ioctl32.c: avoid sizeof(type) media: v4l2-compat-ioctl32.c: copy m.userptr in put_v4l2_plane32 media: v4l2-compat-ioctl32.c: fix ctrl_is_pointer media: v4l2-compat-ioctl32.c: make ctrl_is_pointer work for subdevs media: v4l2-compat-ioctl32: Copy v4l2_window->global_alpha media: v4l2-compat-ioctl32.c: copy clip list in put_v4l2_window32 media: v4l2-compat-ioctl32.c: drop pr_info for unknown buffer type media: v4l2-compat-ioctl32.c: don't copy back the result for certain errors media: v4l2-compat-ioctl32.c: refactor compat ioctl32 logic crypto: caam - fix endless loop when DECO acquire fails arm: KVM: Fix SMCCC handling of unimplemented SMC/HVC calls KVM: nVMX: Fix races when sending nested PI while dest enters/leaves L2 watchdog: imx2_wdt: restore previous timeout after suspend+resume media: ts2020: avoid integer overflows on 32 bit machines media: cxusb, dib0700: ignore XC2028_I2C_FLUSH kernel/async.c: revert "async: simplify lowest_in_progress()" HID: quirks: Fix keyboard + touchpad on Toshiba Click Mini not working Bluetooth: btsdio: Do not bind to non-removable BCM43341 Revert "Bluetooth: btusb: fix QCA Rome suspend/resume" Bluetooth: btusb: Restore QCA Rome suspend/resume fix with a "rewritten" version signal/openrisc: Fix do_unaligned_access to send the proper signal signal/sh: Ensure si_signo is initialized in do_divide_error alpha: fix crash if pthread_create races with signal delivery alpha: fix reboot on Avanti platform xtensa: fix futex_atomic_cmpxchg_inatomic EDAC, octeon: Fix an uninitialized variable warning pktcdvd: Fix pkt_setup_dev() error path btrfs: Handle btrfs_set_extent_delalloc failure in fixup worker nvme: Fix managing degraded controllers ACPI: sbshc: remove raw pointer from printk() message ovl: fix failure to fsync lower dir mn10300/misalignment: Use SIGSEGV SEGV_MAPERR to report a failed user copy ftrace: Remove incorrect setting of glob search field Linux 4.4.116 Change-Id: Id000cb8d59b74de063902e9ad24dd07fe1b1694b Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
275 lines
7.3 KiB
C
275 lines
7.3 KiB
C
/*
|
|
* Hash algorithms.
|
|
*
|
|
* Copyright (c) 2008 Herbert Xu <herbert@gondor.apana.org.au>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the Free
|
|
* Software Foundation; either version 2 of the License, or (at your option)
|
|
* any later version.
|
|
*
|
|
*/
|
|
|
|
#ifndef _CRYPTO_INTERNAL_HASH_H
|
|
#define _CRYPTO_INTERNAL_HASH_H
|
|
|
|
#include <crypto/algapi.h>
|
|
#include <crypto/hash.h>
|
|
|
|
struct ahash_request;
|
|
struct scatterlist;
|
|
|
|
struct crypto_hash_walk {
|
|
char *data;
|
|
|
|
unsigned int offset;
|
|
unsigned int alignmask;
|
|
|
|
struct page *pg;
|
|
unsigned int entrylen;
|
|
|
|
unsigned int total;
|
|
struct scatterlist *sg;
|
|
|
|
unsigned int flags;
|
|
};
|
|
|
|
struct ahash_instance {
|
|
struct ahash_alg alg;
|
|
};
|
|
|
|
struct shash_instance {
|
|
struct shash_alg alg;
|
|
};
|
|
|
|
struct crypto_ahash_spawn {
|
|
struct crypto_spawn base;
|
|
};
|
|
|
|
struct crypto_shash_spawn {
|
|
struct crypto_spawn base;
|
|
};
|
|
|
|
extern const struct crypto_type crypto_ahash_type;
|
|
|
|
int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err);
|
|
int crypto_hash_walk_first(struct ahash_request *req,
|
|
struct crypto_hash_walk *walk);
|
|
int crypto_ahash_walk_first(struct ahash_request *req,
|
|
struct crypto_hash_walk *walk);
|
|
int crypto_hash_walk_first_compat(struct hash_desc *hdesc,
|
|
struct crypto_hash_walk *walk,
|
|
struct scatterlist *sg, unsigned int len);
|
|
|
|
static inline int crypto_ahash_walk_done(struct crypto_hash_walk *walk,
|
|
int err)
|
|
{
|
|
return crypto_hash_walk_done(walk, err);
|
|
}
|
|
|
|
static inline int crypto_hash_walk_last(struct crypto_hash_walk *walk)
|
|
{
|
|
return !(walk->entrylen | walk->total);
|
|
}
|
|
|
|
static inline int crypto_ahash_walk_last(struct crypto_hash_walk *walk)
|
|
{
|
|
return crypto_hash_walk_last(walk);
|
|
}
|
|
|
|
int crypto_register_ahash(struct ahash_alg *alg);
|
|
int crypto_unregister_ahash(struct ahash_alg *alg);
|
|
int ahash_register_instance(struct crypto_template *tmpl,
|
|
struct ahash_instance *inst);
|
|
void ahash_free_instance(struct crypto_instance *inst);
|
|
|
|
int shash_no_setkey(struct crypto_shash *tfm, const u8 *key,
|
|
unsigned int keylen);
|
|
|
|
static inline bool crypto_shash_alg_has_setkey(struct shash_alg *alg)
|
|
{
|
|
return alg->setkey != shash_no_setkey;
|
|
}
|
|
|
|
bool crypto_hash_alg_has_setkey(struct hash_alg_common *halg);
|
|
|
|
int crypto_init_ahash_spawn(struct crypto_ahash_spawn *spawn,
|
|
struct hash_alg_common *alg,
|
|
struct crypto_instance *inst);
|
|
|
|
static inline void crypto_drop_ahash(struct crypto_ahash_spawn *spawn)
|
|
{
|
|
crypto_drop_spawn(&spawn->base);
|
|
}
|
|
|
|
struct hash_alg_common *ahash_attr_alg(struct rtattr *rta, u32 type, u32 mask);
|
|
|
|
int crypto_register_shash(struct shash_alg *alg);
|
|
int crypto_unregister_shash(struct shash_alg *alg);
|
|
int crypto_register_shashes(struct shash_alg *algs, int count);
|
|
int crypto_unregister_shashes(struct shash_alg *algs, int count);
|
|
int shash_register_instance(struct crypto_template *tmpl,
|
|
struct shash_instance *inst);
|
|
void shash_free_instance(struct crypto_instance *inst);
|
|
|
|
int crypto_grab_shash(struct crypto_shash_spawn *spawn,
|
|
const char *name, u32 type, u32 mask);
|
|
int crypto_init_shash_spawn(struct crypto_shash_spawn *spawn,
|
|
struct shash_alg *alg,
|
|
struct crypto_instance *inst);
|
|
|
|
static inline void crypto_drop_shash(struct crypto_shash_spawn *spawn)
|
|
{
|
|
crypto_drop_spawn(&spawn->base);
|
|
}
|
|
|
|
static inline struct shash_alg *crypto_spawn_shash_alg(
|
|
struct crypto_shash_spawn *spawn)
|
|
{
|
|
return container_of(spawn->base.alg, struct shash_alg, base);
|
|
}
|
|
|
|
struct shash_alg *shash_attr_alg(struct rtattr *rta, u32 type, u32 mask);
|
|
|
|
int shash_ahash_update(struct ahash_request *req, struct shash_desc *desc);
|
|
int shash_ahash_finup(struct ahash_request *req, struct shash_desc *desc);
|
|
int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc);
|
|
|
|
int shash_ahash_mcryptd_update(struct ahash_request *req,
|
|
struct shash_desc *desc);
|
|
int shash_ahash_mcryptd_final(struct ahash_request *req,
|
|
struct shash_desc *desc);
|
|
int shash_ahash_mcryptd_finup(struct ahash_request *req,
|
|
struct shash_desc *desc);
|
|
int shash_ahash_mcryptd_digest(struct ahash_request *req,
|
|
struct shash_desc *desc);
|
|
|
|
int crypto_init_shash_ops_async(struct crypto_tfm *tfm);
|
|
|
|
static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm)
|
|
{
|
|
return crypto_tfm_ctx(crypto_ahash_tfm(tfm));
|
|
}
|
|
|
|
static inline struct ahash_alg *__crypto_ahash_alg(struct crypto_alg *alg)
|
|
{
|
|
return container_of(__crypto_hash_alg_common(alg), struct ahash_alg,
|
|
halg);
|
|
}
|
|
|
|
static inline void crypto_ahash_set_reqsize(struct crypto_ahash *tfm,
|
|
unsigned int reqsize)
|
|
{
|
|
tfm->reqsize = reqsize;
|
|
}
|
|
|
|
static inline struct crypto_instance *ahash_crypto_instance(
|
|
struct ahash_instance *inst)
|
|
{
|
|
return container_of(&inst->alg.halg.base, struct crypto_instance, alg);
|
|
}
|
|
|
|
static inline struct ahash_instance *ahash_instance(
|
|
struct crypto_instance *inst)
|
|
{
|
|
return container_of(&inst->alg, struct ahash_instance, alg.halg.base);
|
|
}
|
|
|
|
static inline void *ahash_instance_ctx(struct ahash_instance *inst)
|
|
{
|
|
return crypto_instance_ctx(ahash_crypto_instance(inst));
|
|
}
|
|
|
|
static inline unsigned int ahash_instance_headroom(void)
|
|
{
|
|
return sizeof(struct ahash_alg) - sizeof(struct crypto_alg);
|
|
}
|
|
|
|
static inline struct ahash_instance *ahash_alloc_instance(
|
|
const char *name, struct crypto_alg *alg)
|
|
{
|
|
return crypto_alloc_instance2(name, alg, ahash_instance_headroom());
|
|
}
|
|
|
|
static inline void ahash_request_complete(struct ahash_request *req, int err)
|
|
{
|
|
req->base.complete(&req->base, err);
|
|
}
|
|
|
|
static inline u32 ahash_request_flags(struct ahash_request *req)
|
|
{
|
|
return req->base.flags;
|
|
}
|
|
|
|
static inline struct crypto_ahash *crypto_spawn_ahash(
|
|
struct crypto_ahash_spawn *spawn)
|
|
{
|
|
return crypto_spawn_tfm2(&spawn->base);
|
|
}
|
|
|
|
static inline int ahash_enqueue_request(struct crypto_queue *queue,
|
|
struct ahash_request *request)
|
|
{
|
|
return crypto_enqueue_request(queue, &request->base);
|
|
}
|
|
|
|
static inline struct ahash_request *ahash_dequeue_request(
|
|
struct crypto_queue *queue)
|
|
{
|
|
return ahash_request_cast(crypto_dequeue_request(queue));
|
|
}
|
|
|
|
static inline int ahash_tfm_in_queue(struct crypto_queue *queue,
|
|
struct crypto_ahash *tfm)
|
|
{
|
|
return crypto_tfm_in_queue(queue, crypto_ahash_tfm(tfm));
|
|
}
|
|
|
|
static inline void *crypto_shash_ctx(struct crypto_shash *tfm)
|
|
{
|
|
return crypto_tfm_ctx(&tfm->base);
|
|
}
|
|
|
|
static inline struct crypto_instance *shash_crypto_instance(
|
|
struct shash_instance *inst)
|
|
{
|
|
return container_of(&inst->alg.base, struct crypto_instance, alg);
|
|
}
|
|
|
|
static inline struct shash_instance *shash_instance(
|
|
struct crypto_instance *inst)
|
|
{
|
|
return container_of(__crypto_shash_alg(&inst->alg),
|
|
struct shash_instance, alg);
|
|
}
|
|
|
|
static inline void *shash_instance_ctx(struct shash_instance *inst)
|
|
{
|
|
return crypto_instance_ctx(shash_crypto_instance(inst));
|
|
}
|
|
|
|
static inline struct shash_instance *shash_alloc_instance(
|
|
const char *name, struct crypto_alg *alg)
|
|
{
|
|
return crypto_alloc_instance2(name, alg,
|
|
sizeof(struct shash_alg) - sizeof(*alg));
|
|
}
|
|
|
|
static inline struct crypto_shash *crypto_spawn_shash(
|
|
struct crypto_shash_spawn *spawn)
|
|
{
|
|
return crypto_spawn_tfm2(&spawn->base);
|
|
}
|
|
|
|
static inline void *crypto_shash_ctx_aligned(struct crypto_shash *tfm)
|
|
{
|
|
return crypto_tfm_ctx_aligned(&tfm->base);
|
|
}
|
|
|
|
static inline struct crypto_shash *__crypto_shash_cast(struct crypto_tfm *tfm)
|
|
{
|
|
return container_of(tfm, struct crypto_shash, base);
|
|
}
|
|
|
|
#endif /* _CRYPTO_INTERNAL_HASH_H */
|
|
|