summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/amd64/amd64/aes_intel.S18
-rw-r--r--sys/arch/amd64/amd64/aesni.c34
2 files changed, 27 insertions, 25 deletions
diff --git a/sys/arch/amd64/amd64/aes_intel.S b/sys/arch/amd64/amd64/aes_intel.S
index f958913fec5..013e8e8b000 100644
--- a/sys/arch/amd64/amd64/aes_intel.S
+++ b/sys/arch/amd64/amd64/aes_intel.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: aes_intel.S,v 1.3 2010/11/10 17:05:39 mikeb Exp $ */
+/* $OpenBSD: aes_intel.S,v 1.4 2010/11/15 14:48:17 mikeb Exp $ */
/*
* Implement AES algorithm in Intel AES-NI instructions.
@@ -151,7 +151,7 @@ _key_expansion_256b:
ret
/*
- * void aesni_set_key(struct aesni_sess *ses, uint8_t *key, size_t len)
+ * void aesni_set_key(struct aesni_session *ses, uint8_t *key, size_t len)
*/
ENTRY(aesni_set_key)
movups (%rsi), %xmm0 # user key (first 16 bytes)
@@ -252,7 +252,7 @@ ENTRY(aesni_set_key)
ret
/*
- * void aesni_enc(struct aesni_sess *ses, uint8_t *dst, uint8_t *src)
+ * void aesni_enc(struct aesni_session *ses, uint8_t *dst, uint8_t *src)
*/
ENTRY(aesni_enc)
movl 480(KEYP), KLEN # key length
@@ -425,7 +425,7 @@ _aesni_enc4:
ret
/*
- * void aesni_dec(struct aesni_sess *ses, uint8_t *dst, uint8_t *src)
+ * void aesni_dec(struct aesni_session *ses, uint8_t *dst, uint8_t *src)
*/
ENTRY(aesni_dec)
mov 480(KEYP), KLEN # key length
@@ -600,7 +600,7 @@ _aesni_dec4:
#if 0
/*
- * void aesni_ecb_enc(struct aesni_sess *ses, uint8_t *dst, uint8_t *src,
+ * void aesni_ecb_enc(struct aesni_session *ses, uint8_t *dst, uint8_t *src,
* size_t len)
*/
ENTRY(aesni_ecb_enc)
@@ -643,7 +643,7 @@ ENTRY(aesni_ecb_enc)
ret
/*
- * void aesni_ecb_dec(struct aesni_sess *ses, uint8_t *dst, uint8_t *src,
+ * void aesni_ecb_dec(struct aesni_session *ses, uint8_t *dst, uint8_t *src,
* size_t len);
*/
ENTRY(aesni_ecb_dec)
@@ -688,7 +688,7 @@ ENTRY(aesni_ecb_dec)
#endif
/*
- * void aesni_cbc_enc(struct aesni_sess *ses, uint8_t *dst, uint8_t *src,
+ * void aesni_cbc_enc(struct aesni_session *ses, uint8_t *dst, uint8_t *src,
* size_t len, uint8_t *iv)
*/
ENTRY(aesni_cbc_enc)
@@ -712,7 +712,7 @@ ENTRY(aesni_cbc_enc)
ret
/*
- * void aesni_cbc_dec(struct aesni_sess *ses, uint8_t *dst, uint8_t *src,
+ * void aesni_cbc_dec(struct aesni_session *ses, uint8_t *dst, uint8_t *src,
* size_t len, uint8_t *iv)
*/
ENTRY(aesni_cbc_dec)
@@ -818,7 +818,7 @@ _aesni_inc:
ret
/*
- * void aesni_ctr_enc(struct aesni_sess *ses, uint8_t *dst, uint8_t *src,
+ * void aesni_ctr_enc(struct aesni_session *ses, uint8_t *dst, uint8_t *src,
* size_t len, uint8_t *icb)
*/
ENTRY(aesni_ctr_enc)
diff --git a/sys/arch/amd64/amd64/aesni.c b/sys/arch/amd64/amd64/aesni.c
index 41ed7cf042b..5823e55bb18 100644
--- a/sys/arch/amd64/amd64/aesni.c
+++ b/sys/arch/amd64/amd64/aesni.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aesni.c,v 1.15 2010/11/15 14:41:41 mikeb Exp $ */
+/* $OpenBSD: aesni.c,v 1.16 2010/11/15 14:48:17 mikeb Exp $ */
/*-
* Copyright (c) 2003 Jason Wright
* Copyright (c) 2003, 2004 Theo de Raadt
@@ -41,7 +41,7 @@
#define AESCTR_IVSIZE 8
#define AESCTR_BLOCKSIZE 16
-struct aesni_sess {
+struct aesni_session {
uint32_t ses_ekey[4 * (AES_MAXROUNDS + 1)];
uint32_t ses_dkey[4 * (AES_MAXROUNDS + 1)];
uint32_t ses_klen;
@@ -49,7 +49,8 @@ struct aesni_sess {
uint8_t ses_iv[EALG_MAX_BLOCK_LEN];
int ses_sid;
struct swcr_data *ses_swd;
- LIST_ENTRY(aesni_sess) ses_entries;
+ LIST_ENTRY(aesni_session)
+ ses_entries;
};
struct aesni_softc {
@@ -57,7 +58,8 @@ struct aesni_softc {
size_t sc_buflen;
int32_t sc_cid;
uint32_t sc_sid;
- LIST_HEAD(, aesni_sess) sc_sessions;
+ LIST_HEAD(, aesni_session)
+ sc_sessions;
} *aesni_sc;
struct pool aesnipl;
@@ -65,20 +67,20 @@ struct pool aesnipl;
uint32_t aesni_ops;
/* assembler-assisted key setup */
-extern void aesni_set_key(struct aesni_sess *ses, uint8_t *key, size_t len);
+extern void aesni_set_key(struct aesni_session *ses, uint8_t *key, size_t len);
/* aes encryption/decryption */
-extern void aesni_enc(struct aesni_sess *ses, uint8_t *dst, uint8_t *src);
-extern void aesni_dec(struct aesni_sess *ses, uint8_t *dst, uint8_t *src);
+extern void aesni_enc(struct aesni_session *ses, uint8_t *dst, uint8_t *src);
+extern void aesni_dec(struct aesni_session *ses, uint8_t *dst, uint8_t *src);
/* assembler-assisted CBC mode */
-extern void aesni_cbc_enc(struct aesni_sess *ses, uint8_t *dst,
+extern void aesni_cbc_enc(struct aesni_session *ses, uint8_t *dst,
uint8_t *src, size_t len, uint8_t *iv);
-extern void aesni_cbc_dec(struct aesni_sess *ses, uint8_t *dst,
+extern void aesni_cbc_dec(struct aesni_session *ses, uint8_t *dst,
uint8_t *src, size_t len, uint8_t *iv);
/* assembler-assisted CTR mode */
-extern void aesni_ctr_enc(struct aesni_sess *ses, uint8_t *dst,
+extern void aesni_ctr_enc(struct aesni_session *ses, uint8_t *dst,
uint8_t *src, size_t len, uint8_t *icb);
void aesni_setup(void);
@@ -90,7 +92,7 @@ int aesni_swauth(struct cryptop *, struct cryptodesc *, struct swcr_data *,
caddr_t);
int aesni_encdec(struct cryptop *, struct cryptodesc *,
- struct aesni_sess *);
+ struct aesni_session *);
void
aesni_setup(void)
@@ -123,7 +125,7 @@ aesni_setup(void)
return;
}
- pool_init(&aesnipl, sizeof(struct aesni_sess), 16, 0, 0,
+ pool_init(&aesnipl, sizeof(struct aesni_session), 16, 0, 0,
"aesnipl", NULL);
pool_prime(&aesnipl, 2);
@@ -134,8 +136,8 @@ aesni_setup(void)
int
aesni_newsession(u_int32_t *sidp, struct cryptoini *cri)
{
+ struct aesni_session *ses = NULL;
struct cryptoini *c;
- struct aesni_sess *ses = NULL;
struct auth_hash *axf;
struct swcr_data *swd;
int i;
@@ -246,7 +248,7 @@ aesni_newsession(u_int32_t *sidp, struct cryptoini *cri)
int
aesni_freesession(u_int64_t tid)
{
- struct aesni_sess *ses;
+ struct aesni_session *ses;
struct swcr_data *swd;
struct auth_hash *axf;
u_int32_t sid = (u_int32_t)tid;
@@ -298,7 +300,7 @@ aesni_swauth(struct cryptop *crp, struct cryptodesc *crd,
int
aesni_encdec(struct cryptop *crp, struct cryptodesc *crd,
- struct aesni_sess *ses)
+ struct aesni_session *ses)
{
uint8_t iv[EALG_MAX_BLOCK_LEN];
uint8_t icb[AESCTR_BLOCKSIZE];
@@ -425,7 +427,7 @@ out:
int
aesni_process(struct cryptop *crp)
{
- struct aesni_sess *ses;
+ struct aesni_session *ses;
struct cryptodesc *crd;
int err = 0;