Deleted Added
full compact
cbc.c (300322) cbc.c (300340)
1/* cbc.c: This file contains the encryption routines for the ed line editor */
2/*-
3 * Copyright (c) 1993 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * Copyright (c) 1993 Andrew Moore, Talke Studio.
7 * All rights reserved.
8 *

--- 18 unchanged lines hidden (view full) ---

27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
1/* cbc.c: This file contains the encryption routines for the ed line editor */
2/*-
3 * Copyright (c) 1993 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * Copyright (c) 1993 Andrew Moore, Talke Studio.
7 * All rights reserved.
8 *

--- 18 unchanged lines hidden (view full) ---

27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/bin/ed/cbc.c 300322 2016-05-20 19:10:29Z pfg $");
35__FBSDID("$FreeBSD: head/bin/ed/cbc.c 300340 2016-05-21 00:45:42Z pfg $");
36
37#include <sys/types.h>
38#include <errno.h>
39#include <pwd.h>
40#ifdef DES
41#include <time.h>
42#include <openssl/des.h>
43#define ED_DES_INCLUDES

--- 41 unchanged lines hidden (view full) ---

85static int des_n = 0; /* index for put_des_char/get_des_char */
86#endif
87
88/* init_des_cipher: initialize DES */
89void
90init_des_cipher(void)
91{
92#ifdef DES
36
37#include <sys/types.h>
38#include <errno.h>
39#include <pwd.h>
40#ifdef DES
41#include <time.h>
42#include <openssl/des.h>
43#define ED_DES_INCLUDES

--- 41 unchanged lines hidden (view full) ---

85static int des_n = 0; /* index for put_des_char/get_des_char */
86#endif
87
88/* init_des_cipher: initialize DES */
89void
90init_des_cipher(void)
91{
92#ifdef DES
93 int i;
94
95 des_ct = des_n = 0;
96
97 /* initialize the initialization vector */
98 MEMZERO(ivec, 8);
99
100 /* initialize the padding vector */
93 des_ct = des_n = 0;
94
95 /* initialize the initialization vector */
96 MEMZERO(ivec, 8);
97
98 /* initialize the padding vector */
101 for (i = 0; i < 8; i++)
102 pvec[i] = (char)arc4random_uniform(256);
99 arc4random_buf(pvec, sizeof(pvec));
103#endif
104}
105
106
107/* get_des_char: return next char in an encrypted file */
108int
109get_des_char(FILE *fp)
110{

--- 286 unchanged lines hidden ---
100#endif
101}
102
103
104/* get_des_char: return next char in an encrypted file */
105int
106get_des_char(FILE *fp)
107{

--- 286 unchanged lines hidden ---