linux/lib/crypto/des.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Cryptographic API.
 *
 * DES & Triple DES EDE Cipher Algorithms.
 *
 * Copyright (c) 2005 Dag Arne Osvik <[email protected]>
 */

#include <linux/bitops.h>
#include <linux/compiler.h>
#include <linux/crypto.h>
#include <linux/errno.h>
#include <linux/fips.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/types.h>

#include <asm/unaligned.h>

#include <crypto/des.h>
#include <crypto/internal/des.h>

#define ROL(x, r)
#define ROR(x, r)

/* Lookup tables for key expansion */

static const u8 pc1[256] =;

static const u8 rs[256] =;

static const u32 pc2[1024] =;

/* S-box lookup tables */

static const u32 S1[64] =;

static const u32 S2[64] =;

static const u32 S3[64] =;

static const u32 S4[64] =;

static const u32 S5[64] =;

static const u32 S6[64] =;

static const u32 S7[64] =;

static const u32 S8[64] =;

/* Encryption components: IP, FP, and round function */

#define IP(L, R, T)

#define FP(L, R, T)

#define ROUND(L, R, A, B, K, d)

/*
 * PC2 lookup tables are organized as 2 consecutive sets of 4 interleaved
 * tables of 128 elements.  One set is for C_i and the other for D_i, while
 * the 4 interleaved tables correspond to four 7-bit subsets of C_i or D_i.
 *
 * After PC1 each of the variables a,b,c,d contains a 7 bit subset of C_i
 * or D_i in bits 7-1 (bit 0 being the least significant).
 */

#define T1(x)
#define T2(x)
#define T3(x)
#define T4(x)

#define DES_PC2(a, b, c, d)

/*
 * Encryption key expansion
 *
 * RFC2451: Weak key checks SHOULD be performed.
 *
 * FIPS 74:
 *
 *   Keys having duals are keys which produce all zeros, all ones, or
 *   alternating zero-one patterns in the C and D registers after Permuted
 *   Choice 1 has operated on the key.
 *
 */
static unsigned long des_ekey(u32 *pe, const u8 *k)
{}

int des_expand_key(struct des_ctx *ctx, const u8 *key, unsigned int keylen)
{}
EXPORT_SYMBOL_GPL();

/*
 * Decryption key expansion
 *
 * No weak key checking is performed, as this is only used by triple DES
 *
 */
static void dkey(u32 *pe, const u8 *k)
{}

void des_encrypt(const struct des_ctx *ctx, u8 *dst, const u8 *src)
{}
EXPORT_SYMBOL_GPL();

void des_decrypt(const struct des_ctx *ctx, u8 *dst, const u8 *src)
{}
EXPORT_SYMBOL_GPL();

int des3_ede_expand_key(struct des3_ede_ctx *ctx, const u8 *key,
			unsigned int keylen)
{}
EXPORT_SYMBOL_GPL();

void des3_ede_encrypt(const struct des3_ede_ctx *dctx, u8 *dst, const u8 *src)
{}
EXPORT_SYMBOL_GPL();

void des3_ede_decrypt(const struct des3_ede_ctx *dctx, u8 *dst, const u8 *src)
{}
EXPORT_SYMBOL_GPL();

MODULE_DESCRIPTION();
MODULE_LICENSE();