/** * mapping for the cca private ME key token. * Three parts of interest here: the header, the private section and * the public section. * * mapping for the cca key token header
*/ struct cca_token_hdr { unsignedchar token_identifier; unsignedchar version; unsignedshort token_length; unsignedchar reserved[4];
} __packed;
#define CCA_TKN_HDR_ID_EXT 0x1E
#define CCA_PVT_USAGE_ALL 0x80
/** * mapping for the cca public section * In a private key, the modulus doesn't appear in the public * section. So, an arbitrary public exponent of 0x010001 will be * used, for a section length of 0x0F always.
*/ struct cca_public_sec { unsignedchar section_identifier; unsignedchar version; unsignedshort section_length; unsignedchar reserved[2]; unsignedshort exponent_len; unsignedshort modulus_bit_len; unsignedshort modulus_byte_len; /* In a private key, this is 0 */
} __packed;
/** * mapping for the cca private CRT key 'token' * The first three parts (the only parts considered in this release) * are: the header, the private section and the public section. * The header and public section are the same as for the * struct cca_private_ext_ME * * Following the structure are the quantities p, q, dp, dq, u, pad, * and modulus, in that order, where pad_len is the modulo 8 * complement of the residue modulo 8 of the sum of * (p_len + q_len + dp_len + dq_len + u_len).
*/ struct cca_pvt_ext_crt_sec { unsignedchar section_identifier; unsignedchar version; unsignedshort section_length; unsignedchar private_key_hash[20]; unsignedchar reserved1[4]; unsignedchar key_format; unsignedchar reserved2; unsignedchar key_name_hash[20]; unsignedchar key_use_flags[4]; unsignedshort p_len; unsignedshort q_len; unsignedshort dp_len; unsignedshort dq_len; unsignedshort u_len; unsignedshort mod_len; unsignedchar reserved3[4]; unsignedshort pad_len; unsignedchar reserved4[52]; unsignedchar confounder[8];
} __packed;
/** * Set up private key fields of a type6 MEX message. * * @mex: pointer to user input data * @p: pointer to memory area for the key * * Returns the size of the key area or negative errno value.
*/ staticinlineint zcrypt_type6_mex_key_en(struct ica_rsa_modexpo *mex, void *p)
{ staticstruct cca_token_hdr static_pub_hdr = {
.token_identifier = 0x1E,
}; staticstruct cca_public_sec static_pub_sec = {
.section_identifier = 0x04,
}; struct { struct t6_keyblock_hdr t6_hdr; struct cca_token_hdr pubhdr; struct cca_public_sec pubsec; char exponent[];
} __packed *key = p; unsignedchar *ptr;
/* * The inputdatalength was a selection criteria in the dispatching * function zcrypt_rsa_modexpo(). However, do a plausibility check * here to make sure the following copy_from_user() can't be utilized * to compromise the system.
*/ if (WARN_ON_ONCE(mex->inputdatalength > 512)) return -EINVAL;
/** * Set up private key fields of a type6 CRT message. * * @mex: pointer to user input data * @p: pointer to memory area for the key * * Returns the size of the key area or -EFAULT
*/ staticinlineint zcrypt_type6_crt_key(struct ica_rsa_modexpo_crt *crt, void *p)
{ staticstruct cca_public_sec static_cca_pub_sec = {
.section_identifier = 4,
.section_length = 0x000f,
.exponent_len = 0x0003,
}; staticchar pk_exponent[3] = { 0x01, 0x00, 0x01 }; struct { struct t6_keyblock_hdr t6_hdr; struct cca_token_hdr token; struct cca_pvt_ext_crt_sec pvt; char key_parts[];
} __packed *key = p; struct cca_public_sec *pub; int short_len, long_len, pad_len, key_len, size;
/* * The inputdatalength was a selection criteria in the dispatching * function zcrypt_rsa_crt(). However, do a plausibility check * here to make sure the following copy_from_user() can't be utilized * to compromise the system.
*/ if (WARN_ON_ONCE(crt->inputdatalength > 512)) return -EINVAL;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.