Changeset View
Changeset View
Standalone View
Standalone View
sys/crypto/ccp/ccp_hardware.c
Show First 20 Lines • Show All 988 Lines • ▼ Show 20 Lines | |||||
#if 0 | #if 0 | ||||
CTASSERT(PAGE_SIZE - ((uintptr_t)&SHA_H % PAGE_SIZE) >= sizeof(SHA_H)); | CTASSERT(PAGE_SIZE - ((uintptr_t)&SHA_H % PAGE_SIZE) >= sizeof(SHA_H)); | ||||
#endif | #endif | ||||
const struct SHA_Defn { | const struct SHA_Defn { | ||||
enum sha_version version; | enum sha_version version; | ||||
const void *H_vectors; | const void *H_vectors; | ||||
size_t H_size; | size_t H_size; | ||||
struct auth_hash *axf; | const struct auth_hash *axf; | ||||
enum ccp_sha_type engine_type; | enum ccp_sha_type engine_type; | ||||
} SHA_definitions[] = { | } SHA_definitions[] = { | ||||
{ | { | ||||
.version = SHA1, | .version = SHA1, | ||||
.H_vectors = SHA_H.SHA1, | .H_vectors = SHA_H.SHA1, | ||||
.H_size = sizeof(SHA_H.SHA1), | .H_size = sizeof(SHA_H.SHA1), | ||||
.axf = &auth_hash_hmac_sha1, | .axf = &auth_hash_hmac_sha1, | ||||
.engine_type = CCP_SHA_TYPE_1, | .engine_type = CCP_SHA_TYPE_1, | ||||
▲ Show 20 Lines • Show All 195 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static void | static void | ||||
ccp_do_hmac_done(struct ccp_queue *qp, struct ccp_session *s, | ccp_do_hmac_done(struct ccp_queue *qp, struct ccp_session *s, | ||||
struct cryptop *crp, int error) | struct cryptop *crp, int error) | ||||
{ | { | ||||
char ihash[SHA2_512_HASH_LEN /* max hash len */]; | char ihash[SHA2_512_HASH_LEN /* max hash len */]; | ||||
union authctx auth_ctx; | union authctx auth_ctx; | ||||
struct auth_hash *axf; | const struct auth_hash *axf; | ||||
axf = s->hmac.auth_hash; | axf = s->hmac.auth_hash; | ||||
s->pending--; | s->pending--; | ||||
if (error != 0) { | if (error != 0) { | ||||
crp->crp_etype = error; | crp->crp_etype = error; | ||||
goto out; | goto out; | ||||
Show All 37 Lines | ccp_hmac_done(struct ccp_queue *qp, struct ccp_session *s, void *vcrp, | ||||
ccp_do_hmac_done(qp, s, crp, error); | ccp_do_hmac_done(qp, s, crp, error); | ||||
} | } | ||||
static int __must_check | static int __must_check | ||||
ccp_do_hmac(struct ccp_queue *qp, struct ccp_session *s, struct cryptop *crp, | ccp_do_hmac(struct ccp_queue *qp, struct ccp_session *s, struct cryptop *crp, | ||||
const struct ccp_completion_ctx *cctx) | const struct ccp_completion_ctx *cctx) | ||||
{ | { | ||||
device_t dev; | device_t dev; | ||||
struct auth_hash *axf; | const struct auth_hash *axf; | ||||
int error; | int error; | ||||
dev = qp->cq_softc->dev; | dev = qp->cq_softc->dev; | ||||
axf = s->hmac.auth_hash; | axf = s->hmac.auth_hash; | ||||
/* | /* | ||||
* Populate the SGL describing inside hash contents. We want to hash | * Populate the SGL describing inside hash contents. We want to hash | ||||
* the ipad (key XOR fixed bit pattern) concatenated with the user | * the ipad (key XOR fixed bit pattern) concatenated with the user | ||||
▲ Show 20 Lines • Show All 836 Lines • Show Last 20 Lines |