~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/soc/fsl/caam-blob.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/soc/fsl/caam-blob.h (Version linux-6.11.5) and /include/soc/fsl/caam-blob.h (Version linux-5.19.17)


  1 /* SPDX-License-Identifier: GPL-2.0-only */         1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*                                                  2 /*
  3  * Copyright (C) 2020 Pengutronix, Ahmad Fatou      3  * Copyright (C) 2020 Pengutronix, Ahmad Fatoum <kernel@pengutronix.de>
  4  */                                                 4  */
  5                                                     5 
  6 #ifndef __CAAM_BLOB_GEN                             6 #ifndef __CAAM_BLOB_GEN
  7 #define __CAAM_BLOB_GEN                             7 #define __CAAM_BLOB_GEN
  8                                                     8 
  9 #include <linux/types.h>                            9 #include <linux/types.h>
 10 #include <linux/errno.h>                           10 #include <linux/errno.h>
 11                                                    11 
 12 #define CAAM_BLOB_KEYMOD_LENGTH         16         12 #define CAAM_BLOB_KEYMOD_LENGTH         16
 13 #define CAAM_BLOB_OVERHEAD              (32 +      13 #define CAAM_BLOB_OVERHEAD              (32 + 16)
 14 #define CAAM_BLOB_MAX_LEN               4096       14 #define CAAM_BLOB_MAX_LEN               4096
 15                                                    15 
 16 struct caam_blob_priv;                             16 struct caam_blob_priv;
 17                                                    17 
 18 /**                                                18 /**
 19  * struct caam_blob_info - information for CAA     19  * struct caam_blob_info - information for CAAM blobbing
 20  * @input:       pointer to input buffer (must     20  * @input:       pointer to input buffer (must be DMAable)
 21  * @input_len:   length of @input buffer in by     21  * @input_len:   length of @input buffer in bytes.
 22  * @output:      pointer to output buffer (mus     22  * @output:      pointer to output buffer (must be DMAable)
 23  * @output_len:  length of @output buffer in b     23  * @output_len:  length of @output buffer in bytes.
 24  * @key_mod:     key modifier                      24  * @key_mod:     key modifier
 25  * @key_mod_len: length of @key_mod in bytes.      25  * @key_mod_len: length of @key_mod in bytes.
 26  *               May not exceed %CAAM_BLOB_KEY     26  *               May not exceed %CAAM_BLOB_KEYMOD_LENGTH
 27  */                                                27  */
 28 struct caam_blob_info {                            28 struct caam_blob_info {
 29         void *input;                               29         void *input;
 30         size_t input_len;                          30         size_t input_len;
 31                                                    31 
 32         void *output;                              32         void *output;
 33         size_t output_len;                         33         size_t output_len;
 34                                                    34 
 35         const void *key_mod;                       35         const void *key_mod;
 36         size_t key_mod_len;                        36         size_t key_mod_len;
 37 };                                                 37 };
 38                                                    38 
 39 /**                                                39 /**
 40  * caam_blob_gen_init - initialize blob genera     40  * caam_blob_gen_init - initialize blob generation
 41  * Return: pointer to new &struct caam_blob_pr     41  * Return: pointer to new &struct caam_blob_priv instance on success
 42  * and ``ERR_PTR(-ENODEV)`` if CAAM has no har     42  * and ``ERR_PTR(-ENODEV)`` if CAAM has no hardware blobbing support
 43  * or no job ring could be allocated.              43  * or no job ring could be allocated.
 44  */                                                44  */
 45 struct caam_blob_priv *caam_blob_gen_init(void     45 struct caam_blob_priv *caam_blob_gen_init(void);
 46                                                    46 
 47 /**                                                47 /**
 48  * caam_blob_gen_exit - free blob generation r     48  * caam_blob_gen_exit - free blob generation resources
 49  * @priv: instance returned by caam_blob_gen_i     49  * @priv: instance returned by caam_blob_gen_init()
 50  */                                                50  */
 51 void caam_blob_gen_exit(struct caam_blob_priv      51 void caam_blob_gen_exit(struct caam_blob_priv *priv);
 52                                                    52 
 53 /**                                                53 /**
 54  * caam_process_blob - encapsulate or decapsul     54  * caam_process_blob - encapsulate or decapsulate blob
 55  * @priv:   instance returned by caam_blob_gen     55  * @priv:   instance returned by caam_blob_gen_init()
 56  * @info:   pointer to blobbing info describin     56  * @info:   pointer to blobbing info describing key, blob and
 57  *          key modifier buffers.                  57  *          key modifier buffers.
 58  * @encap:  true for encapsulation, false for      58  * @encap:  true for encapsulation, false for decapsulation
 59  *                                                 59  *
 60  * Return: %0 and sets ``info->output_len`` on     60  * Return: %0 and sets ``info->output_len`` on success and a negative
 61  * error code otherwise.                           61  * error code otherwise.
 62  */                                                62  */
 63 int caam_process_blob(struct caam_blob_priv *p     63 int caam_process_blob(struct caam_blob_priv *priv,
 64                       struct caam_blob_info *i     64                       struct caam_blob_info *info, bool encap);
 65                                                    65 
 66 /**                                                66 /**
 67  * caam_encap_blob - encapsulate blob              67  * caam_encap_blob - encapsulate blob
 68  * @priv:   instance returned by caam_blob_gen     68  * @priv:   instance returned by caam_blob_gen_init()
 69  * @info:   pointer to blobbing info describin     69  * @info:   pointer to blobbing info describing input key,
 70  *          output blob and key modifier buffe     70  *          output blob and key modifier buffers.
 71  *                                                 71  *
 72  * Return: %0 and sets ``info->output_len`` on     72  * Return: %0 and sets ``info->output_len`` on success and
 73  * a negative error code otherwise.                73  * a negative error code otherwise.
 74  */                                                74  */
 75 static inline int caam_encap_blob(struct caam_     75 static inline int caam_encap_blob(struct caam_blob_priv *priv,
 76                                   struct caam_     76                                   struct caam_blob_info *info)
 77 {                                                  77 {
 78         if (info->output_len < info->input_len     78         if (info->output_len < info->input_len + CAAM_BLOB_OVERHEAD)
 79                 return -EINVAL;                    79                 return -EINVAL;
 80                                                    80 
 81         return caam_process_blob(priv, info, t     81         return caam_process_blob(priv, info, true);
 82 }                                                  82 }
 83                                                    83 
 84 /**                                                84 /**
 85  * caam_decap_blob - decapsulate blob              85  * caam_decap_blob - decapsulate blob
 86  * @priv:   instance returned by caam_blob_gen     86  * @priv:   instance returned by caam_blob_gen_init()
 87  * @info:   pointer to blobbing info describin     87  * @info:   pointer to blobbing info describing output key,
 88  *          input blob and key modifier buffer     88  *          input blob and key modifier buffers.
 89  *                                                 89  *
 90  * Return: %0 and sets ``info->output_len`` on     90  * Return: %0 and sets ``info->output_len`` on success and
 91  * a negative error code otherwise.                91  * a negative error code otherwise.
 92  */                                                92  */
 93 static inline int caam_decap_blob(struct caam_     93 static inline int caam_decap_blob(struct caam_blob_priv *priv,
 94                                   struct caam_     94                                   struct caam_blob_info *info)
 95 {                                                  95 {
 96         if (info->input_len < CAAM_BLOB_OVERHE     96         if (info->input_len < CAAM_BLOB_OVERHEAD ||
 97             info->output_len < info->input_len     97             info->output_len < info->input_len - CAAM_BLOB_OVERHEAD)
 98                 return -EINVAL;                    98                 return -EINVAL;
 99                                                    99 
100         return caam_process_blob(priv, info, f    100         return caam_process_blob(priv, info, false);
101 }                                                 101 }
102                                                   102 
103 #endif                                            103 #endif
104                                                   104 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php