cbc.c (115717) | cbc.c (115777) |
---|---|
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 * --- 22 unchanged lines hidden (view full) --- 31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 * SUCH DAMAGE. 36 */ 37 38#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 * --- 22 unchanged lines hidden (view full) --- 31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 * SUCH DAMAGE. 36 */ 37 38#include <sys/cdefs.h> |
39__FBSDID("$FreeBSD: head/bin/ed/cbc.c 115717 2003-06-02 19:06:28Z markm $"); | 39__FBSDID("$FreeBSD: head/bin/ed/cbc.c 115777 2003-06-03 17:03:48Z jhay $"); |
40 41#include <sys/types.h> 42#include <errno.h> 43#include <pwd.h> 44#ifdef DES 45#include <time.h> 46#include <openssl/des.h> 47#define ED_DES_INCLUDES --- 23 unchanged lines hidden (view full) --- 71/* 72 * global variables and related macros 73 */ 74 75enum { /* encrypt, decrypt, authenticate */ 76 MODE_ENCRYPT, MODE_DECRYPT, MODE_AUTHENTICATE 77} mode = MODE_ENCRYPT; 78 | 40 41#include <sys/types.h> 42#include <errno.h> 43#include <pwd.h> 44#ifdef DES 45#include <time.h> 46#include <openssl/des.h> 47#define ED_DES_INCLUDES --- 23 unchanged lines hidden (view full) --- 71/* 72 * global variables and related macros 73 */ 74 75enum { /* encrypt, decrypt, authenticate */ 76 MODE_ENCRYPT, MODE_DECRYPT, MODE_AUTHENTICATE 77} mode = MODE_ENCRYPT; 78 |
79#ifdef DES |
|
79DES_cblock ivec; /* initialization vector */ 80DES_cblock pvec; /* padding vector */ | 80DES_cblock ivec; /* initialization vector */ 81DES_cblock pvec; /* padding vector */ |
82#endif |
|
81 82char bits[] = { /* used to extract bits from a char */ 83 '\200', '\100', '\040', '\020', '\010', '\004', '\002', '\001' 84}; 85 86int pflag; /* 1 to preserve parity bits */ 87 | 83 84char bits[] = { /* used to extract bits from a char */ 85 '\200', '\100', '\040', '\020', '\010', '\004', '\002', '\001' 86}; 87 88int pflag; /* 1 to preserve parity bits */ 89 |
90#ifdef DES |
|
88DES_key_schedule schedule; /* expanded DES key */ | 91DES_key_schedule schedule; /* expanded DES key */ |
92#endif |
|
89 90unsigned char des_buf[8]; /* shared buffer for get_des_char/put_des_char */ 91int des_ct = 0; /* count for get_des_char/put_des_char */ 92int des_n = 0; /* index for put_des_char/get_des_char */ 93 94/* init_des_cipher: initialize DES */ 95void 96init_des_cipher(void) --- 306 unchanged lines hidden --- | 93 94unsigned char des_buf[8]; /* shared buffer for get_des_char/put_des_char */ 95int des_ct = 0; /* count for get_des_char/put_des_char */ 96int des_n = 0; /* index for put_des_char/get_des_char */ 97 98/* init_des_cipher: initialize DES */ 99void 100init_des_cipher(void) --- 306 unchanged lines hidden --- |