mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-25 05:34:00 +08:00
b24413180f
Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
592 lines
14 KiB
C
592 lines
14 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* CAAM Protocol Data Block (PDB) definition header file
|
|
*
|
|
* Copyright 2008-2016 Freescale Semiconductor, Inc.
|
|
*
|
|
*/
|
|
|
|
#ifndef CAAM_PDB_H
|
|
#define CAAM_PDB_H
|
|
#include "compat.h"
|
|
|
|
/*
|
|
* PDB- IPSec ESP Header Modification Options
|
|
*/
|
|
#define PDBHMO_ESP_DECAP_SHIFT 28
|
|
#define PDBHMO_ESP_ENCAP_SHIFT 28
|
|
/*
|
|
* Encap and Decap - Decrement TTL (Hop Limit) - Based on the value of the
|
|
* Options Byte IP version (IPvsn) field:
|
|
* if IPv4, decrement the inner IP header TTL field (byte 8);
|
|
* if IPv6 decrement the inner IP header Hop Limit field (byte 7).
|
|
*/
|
|
#define PDBHMO_ESP_DECAP_DEC_TTL (0x02 << PDBHMO_ESP_DECAP_SHIFT)
|
|
#define PDBHMO_ESP_ENCAP_DEC_TTL (0x02 << PDBHMO_ESP_ENCAP_SHIFT)
|
|
/*
|
|
* Decap - DiffServ Copy - Copy the IPv4 TOS or IPv6 Traffic Class byte
|
|
* from the outer IP header to the inner IP header.
|
|
*/
|
|
#define PDBHMO_ESP_DIFFSERV (0x01 << PDBHMO_ESP_DECAP_SHIFT)
|
|
/*
|
|
* Encap- Copy DF bit -if an IPv4 tunnel mode outer IP header is coming from
|
|
* the PDB, copy the DF bit from the inner IP header to the outer IP header.
|
|
*/
|
|
#define PDBHMO_ESP_DFBIT (0x04 << PDBHMO_ESP_ENCAP_SHIFT)
|
|
|
|
#define PDBNH_ESP_ENCAP_SHIFT 16
|
|
#define PDBNH_ESP_ENCAP_MASK (0xff << PDBNH_ESP_ENCAP_SHIFT)
|
|
|
|
#define PDBHDRLEN_ESP_DECAP_SHIFT 16
|
|
#define PDBHDRLEN_MASK (0x0fff << PDBHDRLEN_ESP_DECAP_SHIFT)
|
|
|
|
#define PDB_NH_OFFSET_SHIFT 8
|
|
#define PDB_NH_OFFSET_MASK (0xff << PDB_NH_OFFSET_SHIFT)
|
|
|
|
/*
|
|
* PDB - IPSec ESP Encap/Decap Options
|
|
*/
|
|
#define PDBOPTS_ESP_ARSNONE 0x00 /* no antireplay window */
|
|
#define PDBOPTS_ESP_ARS32 0x40 /* 32-entry antireplay window */
|
|
#define PDBOPTS_ESP_ARS128 0x80 /* 128-entry antireplay window */
|
|
#define PDBOPTS_ESP_ARS64 0xc0 /* 64-entry antireplay window */
|
|
#define PDBOPTS_ESP_ARS_MASK 0xc0 /* antireplay window mask */
|
|
#define PDBOPTS_ESP_IVSRC 0x20 /* IV comes from internal random gen */
|
|
#define PDBOPTS_ESP_ESN 0x10 /* extended sequence included */
|
|
#define PDBOPTS_ESP_OUTFMT 0x08 /* output only decapsulation (decap) */
|
|
#define PDBOPTS_ESP_IPHDRSRC 0x08 /* IP header comes from PDB (encap) */
|
|
#define PDBOPTS_ESP_INCIPHDR 0x04 /* Prepend IP header to output frame */
|
|
#define PDBOPTS_ESP_IPVSN 0x02 /* process IPv6 header */
|
|
#define PDBOPTS_ESP_AOFL 0x04 /* adjust out frame len (decap, SEC>=5.3)*/
|
|
#define PDBOPTS_ESP_TUNNEL 0x01 /* tunnel mode next-header byte */
|
|
#define PDBOPTS_ESP_IPV6 0x02 /* ip header version is V6 */
|
|
#define PDBOPTS_ESP_DIFFSERV 0x40 /* copy TOS/TC from inner iphdr */
|
|
#define PDBOPTS_ESP_UPDATE_CSUM 0x80 /* encap-update ip header checksum */
|
|
#define PDBOPTS_ESP_VERIFY_CSUM 0x20 /* decap-validate ip header checksum */
|
|
|
|
/*
|
|
* General IPSec encap/decap PDB definitions
|
|
*/
|
|
|
|
/**
|
|
* ipsec_encap_cbc - PDB part for IPsec CBC encapsulation
|
|
* @iv: 16-byte array initialization vector
|
|
*/
|
|
struct ipsec_encap_cbc {
|
|
u8 iv[16];
|
|
};
|
|
|
|
/**
|
|
* ipsec_encap_ctr - PDB part for IPsec CTR encapsulation
|
|
* @ctr_nonce: 4-byte array nonce
|
|
* @ctr_initial: initial count constant
|
|
* @iv: initialization vector
|
|
*/
|
|
struct ipsec_encap_ctr {
|
|
u8 ctr_nonce[4];
|
|
u32 ctr_initial;
|
|
u64 iv;
|
|
};
|
|
|
|
/**
|
|
* ipsec_encap_ccm - PDB part for IPsec CCM encapsulation
|
|
* @salt: 3-byte array salt (lower 24 bits)
|
|
* @ccm_opt: CCM algorithm options - MSB-LSB description:
|
|
* b0_flags (8b) - CCM B0; use 0x5B for 8-byte ICV, 0x6B for 12-byte ICV,
|
|
* 0x7B for 16-byte ICV (cf. RFC4309, RFC3610)
|
|
* ctr_flags (8b) - counter flags; constant equal to 0x3
|
|
* ctr_initial (16b) - initial count constant
|
|
* @iv: initialization vector
|
|
*/
|
|
struct ipsec_encap_ccm {
|
|
u8 salt[4];
|
|
u32 ccm_opt;
|
|
u64 iv;
|
|
};
|
|
|
|
/**
|
|
* ipsec_encap_gcm - PDB part for IPsec GCM encapsulation
|
|
* @salt: 3-byte array salt (lower 24 bits)
|
|
* @rsvd: reserved, do not use
|
|
* @iv: initialization vector
|
|
*/
|
|
struct ipsec_encap_gcm {
|
|
u8 salt[4];
|
|
u32 rsvd1;
|
|
u64 iv;
|
|
};
|
|
|
|
/**
|
|
* ipsec_encap_pdb - PDB for IPsec encapsulation
|
|
* @options: MSB-LSB description
|
|
* hmo (header manipulation options) - 4b
|
|
* reserved - 4b
|
|
* next header - 8b
|
|
* next header offset - 8b
|
|
* option flags (depend on selected algorithm) - 8b
|
|
* @seq_num_ext_hi: (optional) IPsec Extended Sequence Number (ESN)
|
|
* @seq_num: IPsec sequence number
|
|
* @spi: IPsec SPI (Security Parameters Index)
|
|
* @ip_hdr_len: optional IP Header length (in bytes)
|
|
* reserved - 16b
|
|
* Opt. IP Hdr Len - 16b
|
|
* @ip_hdr: optional IP Header content
|
|
*/
|
|
struct ipsec_encap_pdb {
|
|
u32 options;
|
|
u32 seq_num_ext_hi;
|
|
u32 seq_num;
|
|
union {
|
|
struct ipsec_encap_cbc cbc;
|
|
struct ipsec_encap_ctr ctr;
|
|
struct ipsec_encap_ccm ccm;
|
|
struct ipsec_encap_gcm gcm;
|
|
};
|
|
u32 spi;
|
|
u32 ip_hdr_len;
|
|
u32 ip_hdr[0];
|
|
};
|
|
|
|
/**
|
|
* ipsec_decap_cbc - PDB part for IPsec CBC decapsulation
|
|
* @rsvd: reserved, do not use
|
|
*/
|
|
struct ipsec_decap_cbc {
|
|
u32 rsvd[2];
|
|
};
|
|
|
|
/**
|
|
* ipsec_decap_ctr - PDB part for IPsec CTR decapsulation
|
|
* @ctr_nonce: 4-byte array nonce
|
|
* @ctr_initial: initial count constant
|
|
*/
|
|
struct ipsec_decap_ctr {
|
|
u8 ctr_nonce[4];
|
|
u32 ctr_initial;
|
|
};
|
|
|
|
/**
|
|
* ipsec_decap_ccm - PDB part for IPsec CCM decapsulation
|
|
* @salt: 3-byte salt (lower 24 bits)
|
|
* @ccm_opt: CCM algorithm options - MSB-LSB description:
|
|
* b0_flags (8b) - CCM B0; use 0x5B for 8-byte ICV, 0x6B for 12-byte ICV,
|
|
* 0x7B for 16-byte ICV (cf. RFC4309, RFC3610)
|
|
* ctr_flags (8b) - counter flags; constant equal to 0x3
|
|
* ctr_initial (16b) - initial count constant
|
|
*/
|
|
struct ipsec_decap_ccm {
|
|
u8 salt[4];
|
|
u32 ccm_opt;
|
|
};
|
|
|
|
/**
|
|
* ipsec_decap_gcm - PDB part for IPsec GCN decapsulation
|
|
* @salt: 4-byte salt
|
|
* @rsvd: reserved, do not use
|
|
*/
|
|
struct ipsec_decap_gcm {
|
|
u8 salt[4];
|
|
u32 resvd;
|
|
};
|
|
|
|
/**
|
|
* ipsec_decap_pdb - PDB for IPsec decapsulation
|
|
* @options: MSB-LSB description
|
|
* hmo (header manipulation options) - 4b
|
|
* IP header length - 12b
|
|
* next header offset - 8b
|
|
* option flags (depend on selected algorithm) - 8b
|
|
* @seq_num_ext_hi: (optional) IPsec Extended Sequence Number (ESN)
|
|
* @seq_num: IPsec sequence number
|
|
* @anti_replay: Anti-replay window; size depends on ARS (option flags)
|
|
*/
|
|
struct ipsec_decap_pdb {
|
|
u32 options;
|
|
union {
|
|
struct ipsec_decap_cbc cbc;
|
|
struct ipsec_decap_ctr ctr;
|
|
struct ipsec_decap_ccm ccm;
|
|
struct ipsec_decap_gcm gcm;
|
|
};
|
|
u32 seq_num_ext_hi;
|
|
u32 seq_num;
|
|
__be32 anti_replay[4];
|
|
};
|
|
|
|
/*
|
|
* IPSec ESP Datapath Protocol Override Register (DPOVRD)
|
|
*/
|
|
struct ipsec_deco_dpovrd {
|
|
#define IPSEC_ENCAP_DECO_DPOVRD_USE 0x80
|
|
u8 ovrd_ecn;
|
|
u8 ip_hdr_len;
|
|
u8 nh_offset;
|
|
u8 next_header; /* reserved if decap */
|
|
};
|
|
|
|
/*
|
|
* IEEE 802.11i WiFi Protocol Data Block
|
|
*/
|
|
#define WIFI_PDBOPTS_FCS 0x01
|
|
#define WIFI_PDBOPTS_AR 0x40
|
|
|
|
struct wifi_encap_pdb {
|
|
u16 mac_hdr_len;
|
|
u8 rsvd;
|
|
u8 options;
|
|
u8 iv_flags;
|
|
u8 pri;
|
|
u16 pn1;
|
|
u32 pn2;
|
|
u16 frm_ctrl_mask;
|
|
u16 seq_ctrl_mask;
|
|
u8 rsvd1[2];
|
|
u8 cnst;
|
|
u8 key_id;
|
|
u8 ctr_flags;
|
|
u8 rsvd2;
|
|
u16 ctr_init;
|
|
};
|
|
|
|
struct wifi_decap_pdb {
|
|
u16 mac_hdr_len;
|
|
u8 rsvd;
|
|
u8 options;
|
|
u8 iv_flags;
|
|
u8 pri;
|
|
u16 pn1;
|
|
u32 pn2;
|
|
u16 frm_ctrl_mask;
|
|
u16 seq_ctrl_mask;
|
|
u8 rsvd1[4];
|
|
u8 ctr_flags;
|
|
u8 rsvd2;
|
|
u16 ctr_init;
|
|
};
|
|
|
|
/*
|
|
* IEEE 802.16 WiMAX Protocol Data Block
|
|
*/
|
|
#define WIMAX_PDBOPTS_FCS 0x01
|
|
#define WIMAX_PDBOPTS_AR 0x40 /* decap only */
|
|
|
|
struct wimax_encap_pdb {
|
|
u8 rsvd[3];
|
|
u8 options;
|
|
u32 nonce;
|
|
u8 b0_flags;
|
|
u8 ctr_flags;
|
|
u16 ctr_init;
|
|
/* begin DECO writeback region */
|
|
u32 pn;
|
|
/* end DECO writeback region */
|
|
};
|
|
|
|
struct wimax_decap_pdb {
|
|
u8 rsvd[3];
|
|
u8 options;
|
|
u32 nonce;
|
|
u8 iv_flags;
|
|
u8 ctr_flags;
|
|
u16 ctr_init;
|
|
/* begin DECO writeback region */
|
|
u32 pn;
|
|
u8 rsvd1[2];
|
|
u16 antireplay_len;
|
|
u64 antireplay_scorecard;
|
|
/* end DECO writeback region */
|
|
};
|
|
|
|
/*
|
|
* IEEE 801.AE MacSEC Protocol Data Block
|
|
*/
|
|
#define MACSEC_PDBOPTS_FCS 0x01
|
|
#define MACSEC_PDBOPTS_AR 0x40 /* used in decap only */
|
|
|
|
struct macsec_encap_pdb {
|
|
u16 aad_len;
|
|
u8 rsvd;
|
|
u8 options;
|
|
u64 sci;
|
|
u16 ethertype;
|
|
u8 tci_an;
|
|
u8 rsvd1;
|
|
/* begin DECO writeback region */
|
|
u32 pn;
|
|
/* end DECO writeback region */
|
|
};
|
|
|
|
struct macsec_decap_pdb {
|
|
u16 aad_len;
|
|
u8 rsvd;
|
|
u8 options;
|
|
u64 sci;
|
|
u8 rsvd1[3];
|
|
/* begin DECO writeback region */
|
|
u8 antireplay_len;
|
|
u32 pn;
|
|
u64 antireplay_scorecard;
|
|
/* end DECO writeback region */
|
|
};
|
|
|
|
/*
|
|
* SSL/TLS/DTLS Protocol Data Blocks
|
|
*/
|
|
|
|
#define TLS_PDBOPTS_ARS32 0x40
|
|
#define TLS_PDBOPTS_ARS64 0xc0
|
|
#define TLS_PDBOPTS_OUTFMT 0x08
|
|
#define TLS_PDBOPTS_IV_WRTBK 0x02 /* 1.1/1.2/DTLS only */
|
|
#define TLS_PDBOPTS_EXP_RND_IV 0x01 /* 1.1/1.2/DTLS only */
|
|
|
|
struct tls_block_encap_pdb {
|
|
u8 type;
|
|
u8 version[2];
|
|
u8 options;
|
|
u64 seq_num;
|
|
u32 iv[4];
|
|
};
|
|
|
|
struct tls_stream_encap_pdb {
|
|
u8 type;
|
|
u8 version[2];
|
|
u8 options;
|
|
u64 seq_num;
|
|
u8 i;
|
|
u8 j;
|
|
u8 rsvd1[2];
|
|
};
|
|
|
|
struct dtls_block_encap_pdb {
|
|
u8 type;
|
|
u8 version[2];
|
|
u8 options;
|
|
u16 epoch;
|
|
u16 seq_num[3];
|
|
u32 iv[4];
|
|
};
|
|
|
|
struct tls_block_decap_pdb {
|
|
u8 rsvd[3];
|
|
u8 options;
|
|
u64 seq_num;
|
|
u32 iv[4];
|
|
};
|
|
|
|
struct tls_stream_decap_pdb {
|
|
u8 rsvd[3];
|
|
u8 options;
|
|
u64 seq_num;
|
|
u8 i;
|
|
u8 j;
|
|
u8 rsvd1[2];
|
|
};
|
|
|
|
struct dtls_block_decap_pdb {
|
|
u8 rsvd[3];
|
|
u8 options;
|
|
u16 epoch;
|
|
u16 seq_num[3];
|
|
u32 iv[4];
|
|
u64 antireplay_scorecard;
|
|
};
|
|
|
|
/*
|
|
* SRTP Protocol Data Blocks
|
|
*/
|
|
#define SRTP_PDBOPTS_MKI 0x08
|
|
#define SRTP_PDBOPTS_AR 0x40
|
|
|
|
struct srtp_encap_pdb {
|
|
u8 x_len;
|
|
u8 mki_len;
|
|
u8 n_tag;
|
|
u8 options;
|
|
u32 cnst0;
|
|
u8 rsvd[2];
|
|
u16 cnst1;
|
|
u16 salt[7];
|
|
u16 cnst2;
|
|
u32 rsvd1;
|
|
u32 roc;
|
|
u32 opt_mki;
|
|
};
|
|
|
|
struct srtp_decap_pdb {
|
|
u8 x_len;
|
|
u8 mki_len;
|
|
u8 n_tag;
|
|
u8 options;
|
|
u32 cnst0;
|
|
u8 rsvd[2];
|
|
u16 cnst1;
|
|
u16 salt[7];
|
|
u16 cnst2;
|
|
u16 rsvd1;
|
|
u16 seq_num;
|
|
u32 roc;
|
|
u64 antireplay_scorecard;
|
|
};
|
|
|
|
/*
|
|
* DSA/ECDSA Protocol Data Blocks
|
|
* Two of these exist: DSA-SIGN, and DSA-VERIFY. They are similar
|
|
* except for the treatment of "w" for verify, "s" for sign,
|
|
* and the placement of "a,b".
|
|
*/
|
|
#define DSA_PDB_SGF_SHIFT 24
|
|
#define DSA_PDB_SGF_MASK (0xff << DSA_PDB_SGF_SHIFT)
|
|
#define DSA_PDB_SGF_Q (0x80 << DSA_PDB_SGF_SHIFT)
|
|
#define DSA_PDB_SGF_R (0x40 << DSA_PDB_SGF_SHIFT)
|
|
#define DSA_PDB_SGF_G (0x20 << DSA_PDB_SGF_SHIFT)
|
|
#define DSA_PDB_SGF_W (0x10 << DSA_PDB_SGF_SHIFT)
|
|
#define DSA_PDB_SGF_S (0x10 << DSA_PDB_SGF_SHIFT)
|
|
#define DSA_PDB_SGF_F (0x08 << DSA_PDB_SGF_SHIFT)
|
|
#define DSA_PDB_SGF_C (0x04 << DSA_PDB_SGF_SHIFT)
|
|
#define DSA_PDB_SGF_D (0x02 << DSA_PDB_SGF_SHIFT)
|
|
#define DSA_PDB_SGF_AB_SIGN (0x02 << DSA_PDB_SGF_SHIFT)
|
|
#define DSA_PDB_SGF_AB_VERIFY (0x01 << DSA_PDB_SGF_SHIFT)
|
|
|
|
#define DSA_PDB_L_SHIFT 7
|
|
#define DSA_PDB_L_MASK (0x3ff << DSA_PDB_L_SHIFT)
|
|
|
|
#define DSA_PDB_N_MASK 0x7f
|
|
|
|
struct dsa_sign_pdb {
|
|
u32 sgf_ln; /* Use DSA_PDB_ defintions per above */
|
|
u8 *q;
|
|
u8 *r;
|
|
u8 *g; /* or Gx,y */
|
|
u8 *s;
|
|
u8 *f;
|
|
u8 *c;
|
|
u8 *d;
|
|
u8 *ab; /* ECC only */
|
|
u8 *u;
|
|
};
|
|
|
|
struct dsa_verify_pdb {
|
|
u32 sgf_ln;
|
|
u8 *q;
|
|
u8 *r;
|
|
u8 *g; /* or Gx,y */
|
|
u8 *w; /* or Wx,y */
|
|
u8 *f;
|
|
u8 *c;
|
|
u8 *d;
|
|
u8 *tmp; /* temporary data block */
|
|
u8 *ab; /* only used if ECC processing */
|
|
};
|
|
|
|
/* RSA Protocol Data Block */
|
|
#define RSA_PDB_SGF_SHIFT 28
|
|
#define RSA_PDB_E_SHIFT 12
|
|
#define RSA_PDB_E_MASK (0xFFF << RSA_PDB_E_SHIFT)
|
|
#define RSA_PDB_D_SHIFT 12
|
|
#define RSA_PDB_D_MASK (0xFFF << RSA_PDB_D_SHIFT)
|
|
#define RSA_PDB_Q_SHIFT 12
|
|
#define RSA_PDB_Q_MASK (0xFFF << RSA_PDB_Q_SHIFT)
|
|
|
|
#define RSA_PDB_SGF_F (0x8 << RSA_PDB_SGF_SHIFT)
|
|
#define RSA_PDB_SGF_G (0x4 << RSA_PDB_SGF_SHIFT)
|
|
#define RSA_PRIV_PDB_SGF_F (0x4 << RSA_PDB_SGF_SHIFT)
|
|
#define RSA_PRIV_PDB_SGF_G (0x8 << RSA_PDB_SGF_SHIFT)
|
|
|
|
#define RSA_PRIV_KEY_FRM_1 0
|
|
#define RSA_PRIV_KEY_FRM_2 1
|
|
#define RSA_PRIV_KEY_FRM_3 2
|
|
|
|
/**
|
|
* RSA Encrypt Protocol Data Block
|
|
* @sgf: scatter-gather field
|
|
* @f_dma: dma address of input data
|
|
* @g_dma: dma address of encrypted output data
|
|
* @n_dma: dma address of RSA modulus
|
|
* @e_dma: dma address of RSA public exponent
|
|
* @f_len: length in octets of the input data
|
|
*/
|
|
struct rsa_pub_pdb {
|
|
u32 sgf;
|
|
dma_addr_t f_dma;
|
|
dma_addr_t g_dma;
|
|
dma_addr_t n_dma;
|
|
dma_addr_t e_dma;
|
|
u32 f_len;
|
|
} __packed;
|
|
|
|
/**
|
|
* RSA Decrypt PDB - Private Key Form #1
|
|
* @sgf: scatter-gather field
|
|
* @g_dma: dma address of encrypted input data
|
|
* @f_dma: dma address of output data
|
|
* @n_dma: dma address of RSA modulus
|
|
* @d_dma: dma address of RSA private exponent
|
|
*/
|
|
struct rsa_priv_f1_pdb {
|
|
u32 sgf;
|
|
dma_addr_t g_dma;
|
|
dma_addr_t f_dma;
|
|
dma_addr_t n_dma;
|
|
dma_addr_t d_dma;
|
|
} __packed;
|
|
|
|
/**
|
|
* RSA Decrypt PDB - Private Key Form #2
|
|
* @sgf : scatter-gather field
|
|
* @g_dma : dma address of encrypted input data
|
|
* @f_dma : dma address of output data
|
|
* @d_dma : dma address of RSA private exponent
|
|
* @p_dma : dma address of RSA prime factor p of RSA modulus n
|
|
* @q_dma : dma address of RSA prime factor q of RSA modulus n
|
|
* @tmp1_dma: dma address of temporary buffer. CAAM uses this temporary buffer
|
|
* as internal state buffer. It is assumed to be as long as p.
|
|
* @tmp2_dma: dma address of temporary buffer. CAAM uses this temporary buffer
|
|
* as internal state buffer. It is assumed to be as long as q.
|
|
* @p_q_len : length in bytes of first two prime factors of the RSA modulus n
|
|
*/
|
|
struct rsa_priv_f2_pdb {
|
|
u32 sgf;
|
|
dma_addr_t g_dma;
|
|
dma_addr_t f_dma;
|
|
dma_addr_t d_dma;
|
|
dma_addr_t p_dma;
|
|
dma_addr_t q_dma;
|
|
dma_addr_t tmp1_dma;
|
|
dma_addr_t tmp2_dma;
|
|
u32 p_q_len;
|
|
} __packed;
|
|
|
|
/**
|
|
* RSA Decrypt PDB - Private Key Form #3
|
|
* This is the RSA Chinese Reminder Theorem (CRT) form for two prime factors of
|
|
* the RSA modulus.
|
|
* @sgf : scatter-gather field
|
|
* @g_dma : dma address of encrypted input data
|
|
* @f_dma : dma address of output data
|
|
* @c_dma : dma address of RSA CRT coefficient
|
|
* @p_dma : dma address of RSA prime factor p of RSA modulus n
|
|
* @q_dma : dma address of RSA prime factor q of RSA modulus n
|
|
* @dp_dma : dma address of RSA CRT exponent of RSA prime factor p
|
|
* @dp_dma : dma address of RSA CRT exponent of RSA prime factor q
|
|
* @tmp1_dma: dma address of temporary buffer. CAAM uses this temporary buffer
|
|
* as internal state buffer. It is assumed to be as long as p.
|
|
* @tmp2_dma: dma address of temporary buffer. CAAM uses this temporary buffer
|
|
* as internal state buffer. It is assumed to be as long as q.
|
|
* @p_q_len : length in bytes of first two prime factors of the RSA modulus n
|
|
*/
|
|
struct rsa_priv_f3_pdb {
|
|
u32 sgf;
|
|
dma_addr_t g_dma;
|
|
dma_addr_t f_dma;
|
|
dma_addr_t c_dma;
|
|
dma_addr_t p_dma;
|
|
dma_addr_t q_dma;
|
|
dma_addr_t dp_dma;
|
|
dma_addr_t dq_dma;
|
|
dma_addr_t tmp1_dma;
|
|
dma_addr_t tmp2_dma;
|
|
u32 p_q_len;
|
|
} __packed;
|
|
|
|
#endif
|