| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * AMD Cryptographic Coprocessor (CCP) AES GCM crypto API support |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2016,2017 Advanced Micro Devices, Inc. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Author: Gary R Hook <gary.hook@amd.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 10 | | - * published by the Free Software Foundation. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | |
|---|
| 13 | 10 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 45 | 42 | ctx->u.aes.type = CCP_AES_TYPE_256; |
|---|
| 46 | 43 | break; |
|---|
| 47 | 44 | default: |
|---|
| 48 | | - crypto_aead_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); |
|---|
| 49 | 45 | return -EINVAL; |
|---|
| 50 | 46 | } |
|---|
| 51 | 47 | |
|---|
| .. | .. |
|---|
| 175 | 171 | .ivsize = GCM_AES_IV_SIZE, |
|---|
| 176 | 172 | .maxauthsize = AES_BLOCK_SIZE, |
|---|
| 177 | 173 | .base = { |
|---|
| 178 | | - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | |
|---|
| 179 | | - CRYPTO_ALG_ASYNC | |
|---|
| 174 | + .cra_flags = CRYPTO_ALG_ASYNC | |
|---|
| 175 | + CRYPTO_ALG_ALLOCATES_MEMORY | |
|---|
| 180 | 176 | CRYPTO_ALG_KERN_DRIVER_ONLY | |
|---|
| 181 | 177 | CRYPTO_ALG_NEED_FALLBACK, |
|---|
| 182 | 178 | .cra_blocksize = AES_BLOCK_SIZE, |
|---|
| 183 | 179 | .cra_ctxsize = sizeof(struct ccp_ctx), |
|---|
| 184 | 180 | .cra_priority = CCP_CRA_PRIORITY, |
|---|
| 185 | | - .cra_type = &crypto_ablkcipher_type, |
|---|
| 186 | 181 | .cra_exit = ccp_aes_gcm_cra_exit, |
|---|
| 187 | 182 | .cra_module = THIS_MODULE, |
|---|
| 188 | 183 | }, |
|---|
| .. | .. |
|---|
| 232 | 227 | snprintf(alg->base.cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s", |
|---|
| 233 | 228 | def->driver_name); |
|---|
| 234 | 229 | alg->base.cra_blocksize = def->blocksize; |
|---|
| 235 | | - alg->base.cra_ablkcipher.ivsize = def->ivsize; |
|---|
| 236 | 230 | |
|---|
| 237 | 231 | ret = crypto_register_aead(alg); |
|---|
| 238 | 232 | if (ret) { |
|---|
| 239 | | - pr_err("%s ablkcipher algorithm registration error (%d)\n", |
|---|
| 233 | + pr_err("%s aead algorithm registration error (%d)\n", |
|---|
| 240 | 234 | alg->base.cra_name, ret); |
|---|
| 241 | 235 | kfree(ccp_aead); |
|---|
| 242 | 236 | return ret; |
|---|