mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 06:31:52 +00:00
af5034e8e4
The CRYPTO_TFM_RES_* flags were apparently meant as a way to make the ->setkey() functions provide more information about errors. But these flags weren't actually being used or tested, and in many cases they weren't being set correctly anyway. So they've now been removed. Also, if someone ever actually needs to start better distinguishing ->setkey() errors (which is somewhat unlikely, as this has been unneeded for a long time), we'd be much better off just defining different return values, like -EINVAL if the key is invalid for the algorithm vs. -EKEYREJECTED if the key was rejected by a policy like "no weak keys". That would be much simpler, less error-prone, and easier to test. So just remove CRYPTO_TFM_RES_MASK and all the unneeded logic that propagates these flags around. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
53 lines
1.6 KiB
C
53 lines
1.6 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* API for Atmel Secure Protocol Layers Improved Performances (SPLIP)
|
|
*
|
|
* Copyright (C) 2016 Atmel Corporation
|
|
*
|
|
* Author: Cyrille Pitchen <cyrille.pitchen@atmel.com>
|
|
*
|
|
* This driver is based on drivers/mtd/spi-nor/fsl-quadspi.c from Freescale.
|
|
*/
|
|
|
|
#ifndef __ATMEL_AUTHENC_H__
|
|
#define __ATMEL_AUTHENC_H__
|
|
|
|
#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
|
|
|
|
#include <crypto/authenc.h>
|
|
#include <crypto/hash.h>
|
|
#include <crypto/sha.h>
|
|
#include "atmel-sha-regs.h"
|
|
|
|
struct atmel_aes_dev;
|
|
typedef int (*atmel_aes_authenc_fn_t)(struct atmel_aes_dev *, int, bool);
|
|
|
|
struct atmel_sha_authenc_ctx;
|
|
|
|
bool atmel_sha_authenc_is_ready(void);
|
|
unsigned int atmel_sha_authenc_get_reqsize(void);
|
|
|
|
struct atmel_sha_authenc_ctx *atmel_sha_authenc_spawn(unsigned long mode);
|
|
void atmel_sha_authenc_free(struct atmel_sha_authenc_ctx *auth);
|
|
int atmel_sha_authenc_setkey(struct atmel_sha_authenc_ctx *auth,
|
|
const u8 *key, unsigned int keylen, u32 flags);
|
|
|
|
int atmel_sha_authenc_schedule(struct ahash_request *req,
|
|
struct atmel_sha_authenc_ctx *auth,
|
|
atmel_aes_authenc_fn_t cb,
|
|
struct atmel_aes_dev *dd);
|
|
int atmel_sha_authenc_init(struct ahash_request *req,
|
|
struct scatterlist *assoc, unsigned int assoclen,
|
|
unsigned int textlen,
|
|
atmel_aes_authenc_fn_t cb,
|
|
struct atmel_aes_dev *dd);
|
|
int atmel_sha_authenc_final(struct ahash_request *req,
|
|
u32 *digest, unsigned int digestlen,
|
|
atmel_aes_authenc_fn_t cb,
|
|
struct atmel_aes_dev *dd);
|
|
void atmel_sha_authenc_abort(struct ahash_request *req);
|
|
|
|
#endif /* CONFIG_CRYPTO_DEV_ATMEL_AUTHENC */
|
|
|
|
#endif /* __ATMEL_AUTHENC_H__ */
|