Blame sunrpc/rpc/rpc_des.h

Packit 6c4009
/*
Packit 6c4009
 * Generic DES driver interface
Packit 6c4009
 * Keep this file hardware independent!
Packit 6c4009
 * Copyright (c) 2010, Oracle America, Inc.
Packit 6c4009
 *
Packit 6c4009
 * Redistribution and use in source and binary forms, with or without
Packit 6c4009
 * modification, are permitted provided that the following conditions are
Packit 6c4009
 * met:
Packit 6c4009
 *
Packit 6c4009
 *     * Redistributions of source code must retain the above copyright
Packit 6c4009
 *       notice, this list of conditions and the following disclaimer.
Packit 6c4009
 *     * Redistributions in binary form must reproduce the above
Packit 6c4009
 *       copyright notice, this list of conditions and the following
Packit 6c4009
 *       disclaimer in the documentation and/or other materials
Packit 6c4009
 *       provided with the distribution.
Packit 6c4009
 *     * Neither the name of the "Oracle America, Inc." nor the names of its
Packit 6c4009
 *       contributors may be used to endorse or promote products derived
Packit 6c4009
 *       from this software without specific prior written permission.
Packit 6c4009
 *
Packit 6c4009
 *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit 6c4009
 *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit 6c4009
 *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
Packit 6c4009
 *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
Packit 6c4009
 *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
Packit 6c4009
 *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit 6c4009
 *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
Packit 6c4009
 *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
Packit 6c4009
 *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
Packit 6c4009
 *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
Packit 6c4009
 *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit 6c4009
 *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#ifndef _DES_H
Packit 6c4009
#define _DES_H
Packit 6c4009
Packit 6c4009
#include <sys/types.h>
Packit 6c4009
Packit 6c4009
#define DES_MAXLEN	65536	/* maximum # of bytes to encrypt  */
Packit 6c4009
#define DES_QUICKLEN	16	/* maximum # of bytes to encrypt quickly */
Packit 6c4009
Packit 6c4009
enum desdir
Packit 6c4009
  {
Packit 6c4009
    ENCRYPT, DECRYPT
Packit 6c4009
  };
Packit 6c4009
enum desmode
Packit 6c4009
  {
Packit 6c4009
    CBC, ECB
Packit 6c4009
  };
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * parameters to ioctl call
Packit 6c4009
 */
Packit 6c4009
struct desparams
Packit 6c4009
  {
Packit 6c4009
    unsigned char des_key[8];	/* key (with low bit parity) */
Packit 6c4009
    enum desdir des_dir;	/* direction */
Packit 6c4009
    enum desmode des_mode;	/* mode */
Packit 6c4009
    unsigned char des_ivec[8];	/* input vector */
Packit 6c4009
    unsigned des_len;		/* number of bytes to crypt */
Packit 6c4009
    union
Packit 6c4009
      {
Packit 6c4009
	unsigned char UDES_data[DES_QUICKLEN];
Packit 6c4009
	unsigned char *UDES_buf;
Packit 6c4009
      }
Packit 6c4009
    UDES;
Packit 6c4009
#define des_data UDES.UDES_data	/* direct data here if quick */
Packit 6c4009
#define des_buf	UDES.UDES_buf	/* otherwise, pointer to data */
Packit 6c4009
  };
Packit 6c4009
Packit 6c4009
#endif