ccp-crypto.h (ccebcf3f224a44ec8e9c5bfca9d8e5d29298a5a8) | ccp-crypto.h (990672d48515ce09c76fcf1ceccee48b0dd1942b) |
---|---|
1/* 2 * AMD Cryptographic Coprocessor (CCP) crypto API support 3 * 4 * Copyright (C) 2013 Advanced Micro Devices, Inc. 5 * 6 * Author: Tom Lendacky <thomas.lendacky@amd.com> 7 * 8 * This program is free software; you can redistribute it and/or modify --- 9 unchanged lines hidden (view full) --- 18#include <linux/pci.h> 19#include <linux/ccp.h> 20#include <crypto/algapi.h> 21#include <crypto/aes.h> 22#include <crypto/ctr.h> 23#include <crypto/hash.h> 24#include <crypto/sha.h> 25 | 1/* 2 * AMD Cryptographic Coprocessor (CCP) crypto API support 3 * 4 * Copyright (C) 2013 Advanced Micro Devices, Inc. 5 * 6 * Author: Tom Lendacky <thomas.lendacky@amd.com> 7 * 8 * This program is free software; you can redistribute it and/or modify --- 9 unchanged lines hidden (view full) --- 18#include <linux/pci.h> 19#include <linux/ccp.h> 20#include <crypto/algapi.h> 21#include <crypto/aes.h> 22#include <crypto/ctr.h> 23#include <crypto/hash.h> 24#include <crypto/sha.h> 25 |
26#define CCP_LOG_LEVEL KERN_INFO 27 |
|
26#define CCP_CRA_PRIORITY 300 27 28struct ccp_crypto_ablkcipher_alg { 29 struct list_head entry; 30 31 u32 mode; 32 33 struct crypto_alg alg; --- 98 unchanged lines hidden (view full) --- 132 unsigned int null_msg; 133 134 u8 iv[AES_BLOCK_SIZE]; 135 136 unsigned int buf_count; 137 u8 buf[AES_BLOCK_SIZE]; 138}; 139 | 28#define CCP_CRA_PRIORITY 300 29 30struct ccp_crypto_ablkcipher_alg { 31 struct list_head entry; 32 33 u32 mode; 34 35 struct crypto_alg alg; --- 98 unchanged lines hidden (view full) --- 134 unsigned int null_msg; 135 136 u8 iv[AES_BLOCK_SIZE]; 137 138 unsigned int buf_count; 139 u8 buf[AES_BLOCK_SIZE]; 140}; 141 |
142/***** 3DES related defines *****/ 143struct ccp_des3_ctx { 144 enum ccp_engine engine; 145 enum ccp_des3_type type; 146 enum ccp_des3_mode mode; 147 148 struct scatterlist key_sg; 149 unsigned int key_len; 150 u8 key[AES_MAX_KEY_SIZE]; 151}; 152 153struct ccp_des3_req_ctx { 154 struct scatterlist iv_sg; 155 u8 iv[AES_BLOCK_SIZE]; 156 157 struct ccp_cmd cmd; 158}; 159 |
|
140/* SHA-related defines 141 * These values must be large enough to accommodate any variant 142 */ 143#define MAX_SHA_CONTEXT_SIZE SHA512_DIGEST_SIZE 144#define MAX_SHA_BLOCK_SIZE SHA512_BLOCK_SIZE 145 146struct ccp_sha_ctx { 147 struct scatterlist opad_sg; --- 48 unchanged lines hidden (view full) --- 196 197/***** Common Context Structure *****/ 198struct ccp_ctx { 199 int (*complete)(struct crypto_async_request *req, int ret); 200 201 union { 202 struct ccp_aes_ctx aes; 203 struct ccp_sha_ctx sha; | 160/* SHA-related defines 161 * These values must be large enough to accommodate any variant 162 */ 163#define MAX_SHA_CONTEXT_SIZE SHA512_DIGEST_SIZE 164#define MAX_SHA_BLOCK_SIZE SHA512_BLOCK_SIZE 165 166struct ccp_sha_ctx { 167 struct scatterlist opad_sg; --- 48 unchanged lines hidden (view full) --- 216 217/***** Common Context Structure *****/ 218struct ccp_ctx { 219 int (*complete)(struct crypto_async_request *req, int ret); 220 221 union { 222 struct ccp_aes_ctx aes; 223 struct ccp_sha_ctx sha; |
224 struct ccp_des3_ctx des3; |
|
204 } u; 205}; 206 207int ccp_crypto_enqueue_request(struct crypto_async_request *req, 208 struct ccp_cmd *cmd); 209struct scatterlist *ccp_crypto_sg_table_add(struct sg_table *table, 210 struct scatterlist *sg_add); 211 212int ccp_register_aes_algs(struct list_head *head); 213int ccp_register_aes_cmac_algs(struct list_head *head); 214int ccp_register_aes_xts_algs(struct list_head *head); 215int ccp_register_sha_algs(struct list_head *head); | 225 } u; 226}; 227 228int ccp_crypto_enqueue_request(struct crypto_async_request *req, 229 struct ccp_cmd *cmd); 230struct scatterlist *ccp_crypto_sg_table_add(struct sg_table *table, 231 struct scatterlist *sg_add); 232 233int ccp_register_aes_algs(struct list_head *head); 234int ccp_register_aes_cmac_algs(struct list_head *head); 235int ccp_register_aes_xts_algs(struct list_head *head); 236int ccp_register_sha_algs(struct list_head *head); |
237int ccp_register_des3_algs(struct list_head *head); |
|
216 217#endif | 238 239#endif |