18a16b7a1SPedro F. Giffuni /*-
28a16b7a1SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause
38a16b7a1SPedro F. Giffuni *
458f0484fSRodney W. Grimes * Copyright (c) 1989 The Regents of the University of California.
558f0484fSRodney W. Grimes * All rights reserved.
658f0484fSRodney W. Grimes *
758f0484fSRodney W. Grimes * This code is derived from software contributed to Berkeley by
858f0484fSRodney W. Grimes * Tom Truscott.
958f0484fSRodney W. Grimes *
1058f0484fSRodney W. Grimes * Redistribution and use in source and binary forms, with or without
1158f0484fSRodney W. Grimes * modification, are permitted provided that the following conditions
1258f0484fSRodney W. Grimes * are met:
1358f0484fSRodney W. Grimes * 1. Redistributions of source code must retain the above copyright
1458f0484fSRodney W. Grimes * notice, this list of conditions and the following disclaimer.
1558f0484fSRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright
1658f0484fSRodney W. Grimes * notice, this list of conditions and the following disclaimer in the
1758f0484fSRodney W. Grimes * documentation and/or other materials provided with the distribution.
18fbbd9655SWarner Losh * 3. Neither the name of the University nor the names of its contributors
1958f0484fSRodney W. Grimes * may be used to endorse or promote products derived from this software
2058f0484fSRodney W. Grimes * without specific prior written permission.
2158f0484fSRodney W. Grimes *
2258f0484fSRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2358f0484fSRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2458f0484fSRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2558f0484fSRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2658f0484fSRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2758f0484fSRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2858f0484fSRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2958f0484fSRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3058f0484fSRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3158f0484fSRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3258f0484fSRodney W. Grimes * SUCH DAMAGE.
3358f0484fSRodney W. Grimes */
3458f0484fSRodney W. Grimes
3558f0484fSRodney W. Grimes #include <stdio.h>
368b102407SPoul-Henning Kamp #include <string.h>
376b83b5cdSMark Murray #include <unistd.h>
3858f0484fSRodney W. Grimes
3958f0484fSRodney W. Grimes /*
4058f0484fSRodney W. Grimes * UNIX password, and DES, encryption.
4158f0484fSRodney W. Grimes *
4258f0484fSRodney W. Grimes * since this is non-exportable, this is just a dummy. if you want real
4358f0484fSRodney W. Grimes * encryption, make sure you've got libcrypt.a around.
4458f0484fSRodney W. Grimes */
4558f0484fSRodney W. Grimes
46*d14f60e9SAlan Somers int __freebsd11_des_setkey(const char *key);
47*d14f60e9SAlan Somers int __freebsd11_des_cipher(const char *in, char *out, long salt, int num_iter);
48*d14f60e9SAlan Somers int __freebsd11_setkey(const char *key);
49*d14f60e9SAlan Somers int __freebsd11_encrypt(char *block, int flag);
50*d14f60e9SAlan Somers
5108076c08SMark Murray /* ARGSUSED */
528b102407SPoul-Henning Kamp int
__freebsd11_des_setkey(const char * key __unused)531a466ddcSEd Schouten __freebsd11_des_setkey(const char *key __unused)
5458f0484fSRodney W. Grimes {
5558f0484fSRodney W. Grimes fprintf(stderr, "WARNING! des_setkey(3) not present in the system!\n");
5658f0484fSRodney W. Grimes return (0);
5758f0484fSRodney W. Grimes }
5858f0484fSRodney W. Grimes
5908076c08SMark Murray /* ARGSUSED */
608b102407SPoul-Henning Kamp int
__freebsd11_des_cipher(const char * in,char * out,long salt __unused,int num_iter __unused)611a466ddcSEd Schouten __freebsd11_des_cipher(const char *in, char *out, long salt __unused,
621a466ddcSEd Schouten int num_iter __unused)
6358f0484fSRodney W. Grimes {
6458f0484fSRodney W. Grimes fprintf(stderr, "WARNING! des_cipher(3) not present in the system!\n");
6558f0484fSRodney W. Grimes bcopy(in, out, 8);
6658f0484fSRodney W. Grimes return (0);
6758f0484fSRodney W. Grimes }
6858f0484fSRodney W. Grimes
6908076c08SMark Murray /* ARGSUSED */
708b102407SPoul-Henning Kamp int
__freebsd11_setkey(const char * key __unused)711a466ddcSEd Schouten __freebsd11_setkey(const char *key __unused)
7258f0484fSRodney W. Grimes {
7358f0484fSRodney W. Grimes fprintf(stderr, "WARNING! setkey(3) not present in the system!\n");
7458f0484fSRodney W. Grimes return (0);
7558f0484fSRodney W. Grimes }
7658f0484fSRodney W. Grimes
7708076c08SMark Murray /* ARGSUSED */
788b102407SPoul-Henning Kamp int
__freebsd11_encrypt(char * block __unused,int flag __unused)791a466ddcSEd Schouten __freebsd11_encrypt(char *block __unused, int flag __unused)
8058f0484fSRodney W. Grimes {
8158f0484fSRodney W. Grimes fprintf(stderr, "WARNING! encrypt(3) not present in the system!\n");
8258f0484fSRodney W. Grimes return (0);
8358f0484fSRodney W. Grimes }
841a466ddcSEd Schouten
851a466ddcSEd Schouten __sym_compat(des_setkey, __freebsd11_des_setkey, FBSD_1.0);
861a466ddcSEd Schouten __sym_compat(des_cipher, __freebsd11_des_cipher, FBSD_1.0);
871a466ddcSEd Schouten __sym_compat(setkey, __freebsd11_setkey, FBSD_1.0);
881a466ddcSEd Schouten __sym_compat(encrypt, __freebsd11_encrypt, FBSD_1.0);
89