Blame sunrpc/des_soft.c

Packit Service 82fcde
#if !defined(lint) && defined(SCCSIDS)
Packit Service 82fcde
static char sccsid[] = "@(#)des_soft.c	2.2 88/08/10 4.0 RPCSRC; from 1.13 88/02/08 SMI";
Packit Service 82fcde
#endif
Packit Service 82fcde
/*
Packit Service 82fcde
 * Copyright (c) 2010, Oracle America, Inc.
Packit Service 82fcde
 * Redistribution and use in source and binary forms, with or without
Packit Service 82fcde
 * modification, are permitted provided that the following conditions are
Packit Service 82fcde
 * met:
Packit Service 82fcde
 *
Packit Service 82fcde
 *     * Redistributions of source code must retain the above copyright
Packit Service 82fcde
 *       notice, this list of conditions and the following disclaimer.
Packit Service 82fcde
 *     * Redistributions in binary form must reproduce the above
Packit Service 82fcde
 *       copyright notice, this list of conditions and the following
Packit Service 82fcde
 *       disclaimer in the documentation and/or other materials
Packit Service 82fcde
 *       provided with the distribution.
Packit Service 82fcde
 *     * Neither the name of the "Oracle America, Inc." nor the names of its
Packit Service 82fcde
 *       contributors may be used to endorse or promote products derived
Packit Service 82fcde
 *       from this software without specific prior written permission.
Packit Service 82fcde
 *
Packit Service 82fcde
 *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit Service 82fcde
 *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit Service 82fcde
 *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
Packit Service 82fcde
 *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
Packit Service 82fcde
 *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
Packit Service 82fcde
 *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit Service 82fcde
 *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
Packit Service 82fcde
 *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
Packit Service 82fcde
 *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
Packit Service 82fcde
 *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
Packit Service 82fcde
 *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit Service 82fcde
 *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit Service 82fcde
 */
Packit Service 82fcde
Packit Service 82fcde
#include <rpc/des_crypt.h>
Packit Service 82fcde
#include <shlib-compat.h>
Packit Service 82fcde
Packit Service 82fcde
/*
Packit Service 82fcde
 * Table giving odd parity in the low bit for ASCII characters
Packit Service 82fcde
 */
Packit Service 82fcde
static const char partab[128] =
Packit Service 82fcde
{
Packit Service 82fcde
  0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x07, 0x07,
Packit Service 82fcde
  0x08, 0x08, 0x0b, 0x0b, 0x0d, 0x0d, 0x0e, 0x0e,
Packit Service 82fcde
  0x10, 0x10, 0x13, 0x13, 0x15, 0x15, 0x16, 0x16,
Packit Service 82fcde
  0x19, 0x19, 0x1a, 0x1a, 0x1c, 0x1c, 0x1f, 0x1f,
Packit Service 82fcde
  0x20, 0x20, 0x23, 0x23, 0x25, 0x25, 0x26, 0x26,
Packit Service 82fcde
  0x29, 0x29, 0x2a, 0x2a, 0x2c, 0x2c, 0x2f, 0x2f,
Packit Service 82fcde
  0x31, 0x31, 0x32, 0x32, 0x34, 0x34, 0x37, 0x37,
Packit Service 82fcde
  0x38, 0x38, 0x3b, 0x3b, 0x3d, 0x3d, 0x3e, 0x3e,
Packit Service 82fcde
  0x40, 0x40, 0x43, 0x43, 0x45, 0x45, 0x46, 0x46,
Packit Service 82fcde
  0x49, 0x49, 0x4a, 0x4a, 0x4c, 0x4c, 0x4f, 0x4f,
Packit Service 82fcde
  0x51, 0x51, 0x52, 0x52, 0x54, 0x54, 0x57, 0x57,
Packit Service 82fcde
  0x58, 0x58, 0x5b, 0x5b, 0x5d, 0x5d, 0x5e, 0x5e,
Packit Service 82fcde
  0x61, 0x61, 0x62, 0x62, 0x64, 0x64, 0x67, 0x67,
Packit Service 82fcde
  0x68, 0x68, 0x6b, 0x6b, 0x6d, 0x6d, 0x6e, 0x6e,
Packit Service 82fcde
  0x70, 0x70, 0x73, 0x73, 0x75, 0x75, 0x76, 0x76,
Packit Service 82fcde
  0x79, 0x79, 0x7a, 0x7a, 0x7c, 0x7c, 0x7f, 0x7f,
Packit Service 82fcde
};
Packit Service 82fcde
Packit Service 82fcde
/*
Packit Service 82fcde
 * Add odd parity to low bit of 8 byte key
Packit Service 82fcde
 */
Packit Service 82fcde
void
Packit Service 82fcde
des_setparity (char *p)
Packit Service 82fcde
{
Packit Service 82fcde
  int i;
Packit Service 82fcde
Packit Service 82fcde
  for (i = 0; i < 8; i++)
Packit Service 82fcde
    {
Packit Service 82fcde
      *p = partab[*p & 0x7f];
Packit Service 82fcde
      p++;
Packit Service 82fcde
    }
Packit Service 82fcde
}
Packit Service 82fcde
hidden_nolink (des_setparity, libc, GLIBC_2_1)