Home | History | Annotate | Line # | Download | only in include
via_padlock.h revision 1.1.46.1
      1       1.1  daniel /*	$NetBSD: via_padlock.h,v 1.1.46.1 2008/06/02 13:22:50 mjf Exp $	*/
      2       1.1  daniel 
      3       1.1  daniel /*-
      4       1.1  daniel  * Copyright (c) 2003 Jason Wright
      5       1.1  daniel  * Copyright (c) 2003, 2004 Theo de Raadt
      6       1.1  daniel  * All rights reserved.
      7       1.1  daniel  *
      8       1.1  daniel  * Permission to use, copy, modify, and distribute this software for any
      9       1.1  daniel  * purpose with or without fee is hereby granted, provided that the above
     10       1.1  daniel  * copyright notice and this permission notice appear in all copies.
     11       1.1  daniel  *
     12       1.1  daniel  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     13       1.1  daniel  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     14       1.1  daniel  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     15       1.1  daniel  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     16       1.1  daniel  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     17       1.1  daniel  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     18       1.1  daniel  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     19       1.1  daniel  */
     20       1.1  daniel 
     21       1.1  daniel #ifndef _X86_VIA_PADLOCK_H_
     22       1.1  daniel #define _X86_VIA_PADLOCK_H_
     23       1.1  daniel 
     24       1.1  daniel #ifdef _KERNEL
     25       1.1  daniel 
     26       1.1  daniel #include <crypto/rijndael/rijndael.h>
     27       1.1  daniel 
     28       1.1  daniel /* VIA C3 xcrypt-* instruction context control options */
     29       1.1  daniel #define C3_CRYPT_CWLO_ROUND_M		0x0000000f
     30       1.1  daniel #define C3_CRYPT_CWLO_ALG_M		0x00000070
     31       1.1  daniel #define C3_CRYPT_CWLO_ALG_AES		0x00000000
     32       1.1  daniel #define C3_CRYPT_CWLO_KEYGEN_M		0x00000080
     33       1.1  daniel #define C3_CRYPT_CWLO_KEYGEN_HW		0x00000000
     34       1.1  daniel #define C3_CRYPT_CWLO_KEYGEN_SW		0x00000080
     35       1.1  daniel #define C3_CRYPT_CWLO_NORMAL		0x00000000
     36       1.1  daniel #define C3_CRYPT_CWLO_INTERMEDIATE	0x00000100
     37       1.1  daniel #define C3_CRYPT_CWLO_ENCRYPT		0x00000000
     38       1.1  daniel #define C3_CRYPT_CWLO_DECRYPT		0x00000200
     39       1.1  daniel #define C3_CRYPT_CWLO_KEY128		0x0000000a      /* 128bit, 10 rds */
     40       1.1  daniel #define C3_CRYPT_CWLO_KEY192		0x0000040c      /* 192bit, 12 rds */
     41       1.1  daniel #define C3_CRYPT_CWLO_KEY256		0x0000080e      /* 256bit, 15 rds */
     42       1.1  daniel 
     43       1.1  daniel struct via_padlock_session {
     44  1.1.46.1     mjf         uint32_t	ses_ekey[4 * (RIJNDAEL_MAXNR + 1) + 4];	/* 128 bit aligned */
     45  1.1.46.1     mjf         uint32_t	ses_dkey[4 * (RIJNDAEL_MAXNR + 1) + 4];	/* 128 bit aligned */
     46  1.1.46.1     mjf         uint8_t	ses_iv[16];				/* 128 bit aligned */
     47  1.1.46.1     mjf         uint32_t	ses_cw0;
     48       1.1  daniel         struct swcr_data	*swd;
     49       1.1  daniel         int	ses_klen;
     50       1.1  daniel         int	ses_used;
     51       1.1  daniel };
     52       1.1  daniel 
     53       1.1  daniel struct via_padlock_softc {
     54  1.1.46.1     mjf 	uint32_t	op_cw[4];	/* 128 bit aligned */
     55  1.1.46.1     mjf 	uint8_t	op_iv[16];	/* 128 bit aligned */
     56       1.1  daniel 	void		*op_buf;
     57       1.1  daniel 
     58       1.1  daniel 	/* normal softc stuff */
     59       1.1  daniel 	int32_t		sc_cid;
     60       1.1  daniel 	int		sc_nsessions;
     61       1.1  daniel 	struct via_padlock_session *sc_sessions;
     62       1.1  daniel };
     63       1.1  daniel 
     64       1.1  daniel #define VIAC3_SESSION(sid)	((sid) & 0x0fffffff)
     65       1.1  daniel #define VIAC3_SID(crd,ses)	(((crd) << 28) | ((ses) & 0x0fffffff))
     66       1.1  daniel 
     67       1.1  daniel struct cpu_info;
     68       1.1  daniel 
     69       1.1  daniel struct via_padlock {
     70       1.1  daniel 	struct cpu_info		*vp_ci;
     71       1.1  daniel 	int			vp_freq;
     72       1.1  daniel };
     73       1.1  daniel 
     74       1.1  daniel void	via_padlock_attach(void);
     75       1.1  daniel 
     76       1.1  daniel #endif /* _KERNEL */
     77       1.1  daniel #endif /* _X86_VIA_PADLOCK_H_ */
     78