Path: blob/main/sys/compat/linuxkpi/common/include/crypto/hash.h
39604 views
/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2022 Bjoern A. Zeeb4*5* Redistribution and use in source and binary forms, with or without6* modification, are permitted provided that the following conditions7* are met:8* 1. Redistributions of source code must retain the above copyright9* notice, this list of conditions and the following disclaimer.10* 2. Redistributions in binary form must reproduce the above copyright11* notice, this list of conditions and the following disclaimer in the12* documentation and/or other materials provided with the distribution.13*14* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND15* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE16* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE17* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE18* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL19* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS20* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)21* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT22* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY23* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF24* SUCH DAMAGE.25*/2627#ifndef _LINUXKPI_CRYPTO_HASH_H28#define _LINUXKPI_CRYPTO_HASH_H2930#include <linux/kernel.h> /* for pr_debug */3132struct crypto_shash {33};3435struct shash_desc {36struct crypto_shash *tfm;37};3839static inline struct crypto_shash *40crypto_alloc_shash(const char *algostr, int x, int y)41{4243pr_debug("%s: TODO\n", __func__);44return (NULL);45}4647static inline void48crypto_free_shash(struct crypto_shash *csh)49{50pr_debug("%s: TODO\n", __func__);51}5253static inline int54crypto_shash_init(struct shash_desc *desc)55{56pr_debug("%s: TODO\n", __func__);57return (-ENXIO);58}5960static inline int61crypto_shash_final(struct shash_desc *desc, uint8_t *mic)62{63pr_debug("%s: TODO\n", __func__);64return (-ENXIO);65}6667static inline int68crypto_shash_setkey(struct crypto_shash *csh, const uint8_t *key, size_t keylen)69{70pr_debug("%s: TODO\n", __func__);71return (-ENXIO);72}7374static inline int75crypto_shash_update(struct shash_desc *desc, uint8_t *data, size_t datalen)76{77pr_debug("%s: TODO\n", __func__);78return (-ENXIO);79}8081static inline void82shash_desc_zero(struct shash_desc *desc)83{8485explicit_bzero(desc, sizeof(*desc));86}8788/* XXX review this. */89#define SHASH_DESC_ON_STACK(desc, tfm) \90uint8_t ___ ## desc ## _desc[sizeof(struct shash_desc)]; \91struct shash_desc *desc = (struct shash_desc *)___ ## desc ## _desc9293#endif /* _LINUXKPI_CRYPTO_HASH_H */949596