Deleted Added
full compact
nehemiah.c (128368) nehemiah.c (143063)
1/*-
2 * Copyright (c) 2004 Mark R V Murray
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 */
27
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2004 Mark R V Murray
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/dev/random/nehemiah.c 128368 2004-04-17 19:26:53Z markm $");
29__FBSDID("$FreeBSD: head/sys/dev/random/nehemiah.c 143063 2005-03-02 21:33:29Z joerg $");
30
31#include <sys/param.h>
32#include <sys/time.h>
33#include <sys/lock.h>
34#include <sys/mutex.h>
35#include <sys/selinfo.h>
36#include <sys/systm.h>
37

--- 42 unchanged lines hidden (view full) ---

80static uint8_t out[RANDOM_BLOCK_SIZE+7] __aligned(16);
81
82static union VIA_ACE_CW acw __aligned(16);
83
84/* ARGSUSED */
85static __inline size_t
86VIA_RNG_store(void *buf)
87{
30
31#include <sys/param.h>
32#include <sys/time.h>
33#include <sys/lock.h>
34#include <sys/mutex.h>
35#include <sys/selinfo.h>
36#include <sys/systm.h>
37

--- 42 unchanged lines hidden (view full) ---

80static uint8_t out[RANDOM_BLOCK_SIZE+7] __aligned(16);
81
82static union VIA_ACE_CW acw __aligned(16);
83
84/* ARGSUSED */
85static __inline size_t
86VIA_RNG_store(void *buf)
87{
88#if defined(__GNUC__) || defined(__INTEL_COMPILER)
88#ifdef __GNUCLIKE_ASM
89 uint32_t retval = 0;
90 uint32_t rate = 0;
91
92 /* The .byte line is really VIA C3 "xstore" instruction */
93 __asm __volatile(
94 "movl $0,%%edx \n\t"
95 ".byte 0x0f, 0xa7, 0xc0"
96 : "=a" (retval), "+d" (rate), "+D" (buf)

--- 5 unchanged lines hidden (view full) ---

102#endif
103 return (0);
104}
105
106/* ARGSUSED */
107static __inline void
108VIA_ACE_cbc(void *in, void *out, size_t count, void *key, union VIA_ACE_CW *cw, void *iv)
109{
89 uint32_t retval = 0;
90 uint32_t rate = 0;
91
92 /* The .byte line is really VIA C3 "xstore" instruction */
93 __asm __volatile(
94 "movl $0,%%edx \n\t"
95 ".byte 0x0f, 0xa7, 0xc0"
96 : "=a" (retval), "+d" (rate), "+D" (buf)

--- 5 unchanged lines hidden (view full) ---

102#endif
103 return (0);
104}
105
106/* ARGSUSED */
107static __inline void
108VIA_ACE_cbc(void *in, void *out, size_t count, void *key, union VIA_ACE_CW *cw, void *iv)
109{
110#if defined(__GNUC__) || defined(__INTEL_COMPILER)
110#ifdef __GNUCLIKE_ASM
111 /* The .byte line is really VIA C3 "xcrypt-cbc" instruction */
112 __asm __volatile(
113 "pushf \n\t"
114 "popf \n\t"
115 "rep \n\t"
116 ".byte 0x0f, 0xa7, 0xc8"
117 : "+a" (iv), "+c" (count), "+D" (out), "+S" (in)
118 : "b" (key), "d" (cw)

--- 60 unchanged lines hidden ---
111 /* The .byte line is really VIA C3 "xcrypt-cbc" instruction */
112 __asm __volatile(
113 "pushf \n\t"
114 "popf \n\t"
115 "rep \n\t"
116 ".byte 0x0f, 0xa7, 0xc8"
117 : "+a" (iv), "+c" (count), "+D" (out), "+S" (in)
118 : "b" (key), "d" (cw)

--- 60 unchanged lines hidden ---