linux/drivers/crypto/qce/cipher.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0-only */
   2/*
   3 * Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
   4 */
   5
   6#ifndef _CIPHER_H_
   7#define _CIPHER_H_
   8
   9#include "common.h"
  10#include "core.h"
  11
  12#define QCE_MAX_KEY_SIZE        64
  13
  14struct qce_cipher_ctx {
  15        u8 enc_key[QCE_MAX_KEY_SIZE];
  16        unsigned int enc_keylen;
  17        struct crypto_skcipher *fallback;
  18};
  19
  20/**
  21 * struct qce_cipher_reqctx - holds private cipher objects per request
  22 * @flags: operation flags
  23 * @iv: pointer to the IV
  24 * @ivsize: IV size
  25 * @src_nents: source entries
  26 * @dst_nents: destination entries
  27 * @result_sg: scatterlist used for result buffer
  28 * @dst_tbl: destination sg table
  29 * @dst_sg: destination sg pointer table beginning
  30 * @src_tbl: source sg table
  31 * @src_sg: source sg pointer table beginning;
  32 * @cryptlen: crypto length
  33 */
  34struct qce_cipher_reqctx {
  35        unsigned long flags;
  36        u8 *iv;
  37        unsigned int ivsize;
  38        int src_nents;
  39        int dst_nents;
  40        struct scatterlist result_sg;
  41        struct sg_table dst_tbl;
  42        struct scatterlist *dst_sg;
  43        struct scatterlist *src_sg;
  44        unsigned int cryptlen;
  45        struct skcipher_request fallback_req;   // keep at the end
  46};
  47
  48static inline struct qce_alg_template *to_cipher_tmpl(struct crypto_skcipher *tfm)
  49{
  50        struct skcipher_alg *alg = crypto_skcipher_alg(tfm);
  51        return container_of(alg, struct qce_alg_template, alg.skcipher);
  52}
  53
  54extern const struct qce_algo_ops skcipher_ops;
  55
  56#endif /* _CIPHER_H_ */
  57