]>
git.ipfire.org Git - thirdparty/openssl.git/blob - crypto/des/pcbc_enc.c
2 * Copyright 1995-2016 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
10 #include "des_local.h"
12 void DES_pcbc_encrypt(const unsigned char *input
, unsigned char *output
,
13 long length
, DES_key_schedule
*schedule
,
14 DES_cblock
*ivec
, int enc
)
16 register DES_LONG sin0
, sin1
, xor0
, xor1
, tout0
, tout1
;
18 const unsigned char *in
;
19 unsigned char *out
, *iv
;
28 for (; length
> 0; length
-= 8) {
33 c2ln(in
, sin0
, sin1
, length
);
36 DES_encrypt1((DES_LONG
*)tin
, schedule
, DES_ENCRYPT
);
47 for (; length
> 0; length
-= 8) {
52 DES_encrypt1((DES_LONG
*)tin
, schedule
, DES_DECRYPT
);
53 tout0
= tin
[0] ^ xor0
;
54 tout1
= tin
[1] ^ xor1
;
59 l2cn(tout0
, tout1
, out
, length
);
65 sin0
= sin1
= xor0
= xor1
= tout0
= tout1
= 0;