The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/random.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * random.h -- A strong random number generator
    3  *
    4  * $FreeBSD: src/sys/sys/random.h,v 1.19.2.2 2002/09/17 17:11:54 sam Exp $
    5  *
    6  * Version 0.95, last modified 18-Oct-95
    7  * 
    8  * Copyright Theodore Ts'o, 1994, 1995.  All rights reserved.
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, and the entire permission notice in its entirety,
   15  *    including the disclaimer of warranties.
   16  * 2. Redistributions in binary form must reproduce the above copyright
   17  *    notice, this list of conditions and the following disclaimer in the
   18  *    documentation and/or other materials provided with the distribution.
   19  * 3. The name of the author may not be used to endorse or promote
   20  *    products derived from this software without specific prior
   21  *    written permission.
   22  * 
   23  * ALTERNATIVELY, this product may be distributed under the terms of
   24  * the GNU Public License, in which case the provisions of the GPL are
   25  * required INSTEAD OF the above restrictions.  (This clause is
   26  * necessary due to a potential bad interaction between the GPL and
   27  * the restrictions contained in a BSD-style copyright.)
   28  * 
   29  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
   30  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   31  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   32  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
   33  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   34  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   35  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   36  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   37  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   38  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   39  * OF THE POSSIBILITY OF SUCH DAMAGE.
   40  *
   41  */
   42 
   43 /*
   44  * Many kernel routines will have a use for good random numbers,
   45  * for example, for truely random TCP sequence numbers, which prevent
   46  * certain forms of TCP spoofing attacks.
   47  * 
   48  */
   49 
   50 #ifndef _SYS_RANDOM_H_
   51 #define _SYS_RANDOM_H_
   52 
   53 #ifndef _SYS_TYPES_H_
   54 #include <sys/types.h>
   55 #endif
   56 #ifndef _SYS_INTERRUPT_H_
   57 #include <sys/interrupt.h>
   58 #endif
   59 #ifndef _SYS_IOCCOM_H_
   60 #include <sys/ioccom.h>
   61 #endif
   62 
   63 #define MEM_SETIRQ      _IOW('r', 1, u_int16_t) /* set interrupt */
   64 #define MEM_CLEARIRQ    _IOW('r', 2, u_int16_t) /* clear interrupt */
   65 #define MEM_RETURNIRQ   _IOR('r', 3, u_int16_t) /* obsolete */
   66 #define MEM_FINDIRQ     _IOWR('r', 4, u_int16_t) /* next interrupt */
   67 
   68 #ifdef _KERNEL
   69 
   70 /* Type of the cookie passed to add_interrupt_randomness. */
   71 
   72 struct random_softc {
   73         int             sc_intr;
   74         int             sc_enabled;
   75 };
   76 
   77 /* Exported functions */
   78 
   79 void rand_initialize(void);
   80 void add_keyboard_randomness(u_char scancode);
   81 void add_interrupt_randomness(int intr);
   82 #ifdef notused
   83 void add_blkdev_randomness(int major);
   84 #endif
   85 void add_true_randomness(int);
   86 int add_buffer_randomness(const char *, int);
   87 
   88 #ifdef notused
   89 void get_random_bytes(void *buf, u_int nbytes);
   90 #endif
   91 u_int read_random(void *buf, u_int size);
   92 u_int read_random_unlimited(void *buf, u_int size);
   93 #ifdef notused
   94 u_int write_random(const char *buf, u_int nbytes);
   95 #endif
   96 struct thread;
   97 struct knote;
   98 int random_filter_read(struct knote *kn, long hint);
   99 
  100 #endif /* _KERNEL */
  101 
  102 #endif /* !_SYS_RANDOM_H_ */

Cache object: fca8bfcb145e7948735460b5257a9e6c


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.