drivers/crypto/cavium/nitrox/nitrox_aead.c
Source file repositories/reference/linux-study-clean/drivers/crypto/cavium/nitrox/nitrox_aead.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/cavium/nitrox/nitrox_aead.c- Extension
.c- Size
- 14279 bytes
- Lines
- 568
- Domain
- Driver Families
- Bucket
- drivers/crypto
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/printk.hlinux/crypto.hlinux/rtnetlink.hcrypto/aead.hcrypto/authenc.hcrypto/des.hcrypto/internal/aead.hcrypto/scatterwalk.hcrypto/gcm.hnitrox_dev.hnitrox_common.hnitrox_req.h
Detected Declarations
function nitrox_aes_gcm_setkeyfunction nitrox_aead_setauthsizefunction nitrox_aes_gcm_setauthsizefunction alloc_src_sglistfunction alloc_dst_sglistfunction free_src_sglistfunction free_dst_sglistfunction nitrox_set_creqfunction nitrox_aead_callbackfunction nitrox_aes_gcm_assoclen_supportedfunction nitrox_aes_gcm_encfunction nitrox_aes_gcm_decfunction nitrox_aead_initfunction nitrox_gcm_common_initfunction nitrox_aes_gcm_initfunction nitrox_aead_exitfunction nitrox_rfc4106_setkeyfunction nitrox_rfc4106_setauthsizefunction nitrox_rfc4106_set_aead_rctx_sglistfunction nitrox_rfc4106_callbackfunction nitrox_rfc4106_encfunction nitrox_rfc4106_decfunction nitrox_rfc4106_initfunction nitrox_register_aeadsfunction nitrox_unregister_aeads
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#include <linux/kernel.h>
#include <linux/printk.h>
#include <linux/crypto.h>
#include <linux/rtnetlink.h>
#include <crypto/aead.h>
#include <crypto/authenc.h>
#include <crypto/des.h>
#include <crypto/internal/aead.h>
#include <crypto/scatterwalk.h>
#include <crypto/gcm.h>
#include "nitrox_dev.h"
#include "nitrox_common.h"
#include "nitrox_req.h"
#define GCM_AES_SALT_SIZE 4
union gph_p3 {
struct {
#ifdef __BIG_ENDIAN_BITFIELD
u16 iv_offset : 8;
u16 auth_offset : 8;
#else
u16 auth_offset : 8;
u16 iv_offset : 8;
#endif
};
u16 param;
};
static int nitrox_aes_gcm_setkey(struct crypto_aead *aead, const u8 *key,
unsigned int keylen)
{
int aes_keylen;
struct nitrox_crypto_ctx *nctx = crypto_aead_ctx(aead);
struct flexi_crypto_context *fctx;
union fc_ctx_flags flags;
aes_keylen = flexi_aes_keylen(keylen);
if (aes_keylen < 0)
return -EINVAL;
/* fill crypto context */
fctx = nctx->u.fctx;
flags.fu = be64_to_cpu(fctx->flags.f);
flags.w0.aes_keylen = aes_keylen;
fctx->flags.f = cpu_to_be64(flags.fu);
/* copy enc key to context */
memset(&fctx->crypto, 0, sizeof(fctx->crypto));
memcpy(fctx->crypto.u.key, key, keylen);
return 0;
}
static int nitrox_aead_setauthsize(struct crypto_aead *aead,
unsigned int authsize)
{
struct nitrox_crypto_ctx *nctx = crypto_aead_ctx(aead);
struct flexi_crypto_context *fctx = nctx->u.fctx;
union fc_ctx_flags flags;
flags.fu = be64_to_cpu(fctx->flags.f);
flags.w0.mac_len = authsize;
fctx->flags.f = cpu_to_be64(flags.fu);
aead->authsize = authsize;
return 0;
}
static int nitrox_aes_gcm_setauthsize(struct crypto_aead *aead,
unsigned int authsize)
{
switch (authsize) {
case 4:
case 8:
case 12:
case 13:
case 14:
case 15:
case 16:
break;
default:
return -EINVAL;
}
return nitrox_aead_setauthsize(aead, authsize);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/printk.h`, `linux/crypto.h`, `linux/rtnetlink.h`, `crypto/aead.h`, `crypto/authenc.h`, `crypto/des.h`, `crypto/internal/aead.h`.
- Detected declarations: `function nitrox_aes_gcm_setkey`, `function nitrox_aead_setauthsize`, `function nitrox_aes_gcm_setauthsize`, `function alloc_src_sglist`, `function alloc_dst_sglist`, `function free_src_sglist`, `function free_dst_sglist`, `function nitrox_set_creq`, `function nitrox_aead_callback`, `function nitrox_aes_gcm_assoclen_supported`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.