2 * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
11 * DES low level APIs are deprecated for public use, but still ok for internal
14 #include "internal/deprecated.h"
16 #include "des_local.h"
18 void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output,
19 long length, DES_key_schedule *schedule,
20 DES_cblock *ivec, int enc)
22 register DES_LONG sin0, sin1, xor0, xor1, tout0, tout1;
24 const unsigned char *in;
25 unsigned char *out, *iv;
34 for (; length > 0; length -= 8) {
39 c2ln(in, sin0, sin1, length);
42 DES_encrypt1((DES_LONG *)tin, schedule, DES_ENCRYPT);
53 for (; length > 0; length -= 8) {
58 DES_encrypt1((DES_LONG *)tin, schedule, DES_DECRYPT);
59 tout0 = tin[0] ^ xor0;
60 tout1 = tin[1] ^ xor1;
65 l2cn(tout0, tout1, out, length);
71 sin0 = sin1 = xor0 = xor1 = tout0 = tout1 = 0;