sprinkle static in this file
This commit is contained in:
parent
aa92b1b91b
commit
85d0adbcff
38
bin/ed/cbc.c
38
bin/ed/cbc.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cbc.c,v 1.19 2009/07/26 01:58:20 dholland Exp $ */
|
||||
/* $NetBSD: cbc.c,v 1.20 2009/07/26 02:06:37 dholland Exp $ */
|
||||
|
||||
/* cbc.c: This file contains the encryption routines for the ed line editor */
|
||||
/*-
|
||||
|
@ -72,7 +72,7 @@
|
|||
#if 0
|
||||
static char *rcsid = "@(#)cbc.c,v 1.2 1994/02/01 00:34:36 alm Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: cbc.c,v 1.19 2009/07/26 01:58:20 dholland Exp $");
|
||||
__RCSID("$NetBSD: cbc.c,v 1.20 2009/07/26 02:06:37 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -132,19 +132,27 @@ enum { /* encrypt, decrypt, authenticate */
|
|||
MODE_ENCRYPT, MODE_DECRYPT, MODE_AUTHENTICATE
|
||||
} mode = MODE_ENCRYPT;
|
||||
|
||||
Desbuf ivec; /* initialization vector */
|
||||
Desbuf pvec; /* padding vector */
|
||||
char bits[] = { /* used to extract bits from a char */
|
||||
static Desbuf ivec; /* initialization vector */
|
||||
static Desbuf pvec; /* padding vector */
|
||||
static char bits[] = { /* used to extract bits from a char */
|
||||
'\200', '\100', '\040', '\020', '\010', '\004', '\002', '\001'
|
||||
};
|
||||
int pflag; /* 1 to preserve parity bits */
|
||||
static int pflag; /* 1 to preserve parity bits */
|
||||
|
||||
char des_buf[8]; /* shared buffer for get_des_char/put_des_char */
|
||||
int des_ct = 0; /* count for get_des_char/put_des_char */
|
||||
int des_n = 0; /* index for put_des_char/get_des_char */
|
||||
static char des_buf[8]; /* shared buffer for get_des_char/put_des_char */
|
||||
static int des_ct = 0; /* count for get_des_char/put_des_char */
|
||||
static int des_n = 0; /* index for put_des_char/get_des_char */
|
||||
#endif
|
||||
|
||||
|
||||
static void des_error(const char *);
|
||||
static int hex_to_binary(int, int);
|
||||
static void expand_des_key(char *, char *);
|
||||
static void set_des_key(char *);
|
||||
static int cbc_decode(char *, FILE *);
|
||||
static int cbc_encode(char *, int, FILE *);
|
||||
|
||||
|
||||
/* init_des_cipher: initialize DES */
|
||||
void
|
||||
init_des_cipher(void)
|
||||
|
@ -243,7 +251,7 @@ get_keyword(void)
|
|||
/*
|
||||
* print a warning message and, possibly, terminate
|
||||
*/
|
||||
void
|
||||
static void
|
||||
des_error(const char *s /* the message */)
|
||||
{
|
||||
(void)sprintf(errmsg, "%s", s ? s : strerror(errno));
|
||||
|
@ -252,7 +260,7 @@ des_error(const char *s /* the message */)
|
|||
/*
|
||||
* map a hex character to an integer
|
||||
*/
|
||||
int
|
||||
static int
|
||||
hex_to_binary(int c /* char to be converted */,
|
||||
int radix /* base (2 to 16) */)
|
||||
{
|
||||
|
@ -283,7 +291,7 @@ hex_to_binary(int c /* char to be converted */,
|
|||
/*
|
||||
* convert the key to a bit pattern
|
||||
*/
|
||||
void
|
||||
static void
|
||||
expand_des_key(char *obuf /* bit pattern */, char *inbuf /* the key itself */)
|
||||
{
|
||||
int i, j; /* counter in a for loop */
|
||||
|
@ -349,7 +357,7 @@ expand_des_key(char *obuf /* bit pattern */, char *inbuf /* the key itself */)
|
|||
* systems set the parity (high) bit of each character to 0, and the
|
||||
* DES ignores the low order bit of each character.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
set_des_key(Desbuf buf /* key block */)
|
||||
{
|
||||
int i, j; /* counter in a for loop */
|
||||
|
@ -378,7 +386,7 @@ set_des_key(Desbuf buf /* key block */)
|
|||
/*
|
||||
* This encrypts using the Cipher Block Chaining mode of DES
|
||||
*/
|
||||
int
|
||||
static int
|
||||
cbc_encode(char *msgbuf, int n, FILE *fp)
|
||||
{
|
||||
int inverse = 0; /* 0 to encrypt, 1 to decrypt */
|
||||
|
@ -414,7 +422,7 @@ cbc_encode(char *msgbuf, int n, FILE *fp)
|
|||
/*
|
||||
* This decrypts using the Cipher Block Chaining mode of DES
|
||||
*/
|
||||
int
|
||||
static int
|
||||
cbc_decode(char *msgbuf /* I/O buffer */,
|
||||
FILE *fp /* input file descriptor */)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ed.h,v 1.33 2005/06/26 19:10:49 christos Exp $ */
|
||||
/* $NetBSD: ed.h,v 1.34 2009/07/26 02:06:37 dholland Exp $ */
|
||||
|
||||
/* ed.h: type and constant definitions for the ed editor. */
|
||||
/*
|
||||
|
@ -194,20 +194,16 @@ void add_line_node(line_t *);
|
|||
int append_lines(long);
|
||||
int apply_subst_template(char *, regmatch_t *, int, int);
|
||||
int build_active_list(int);
|
||||
int cbc_decode(char *, FILE *);
|
||||
int cbc_encode(char *, int, FILE *);
|
||||
int check_addr_range(long, long);
|
||||
void clear_active_list(void);
|
||||
void clear_undo_stack(void);
|
||||
int close_sbuf(void);
|
||||
int copy_lines(long);
|
||||
int delete_lines(long, long);
|
||||
void des_error(const char *);
|
||||
int display_lines(long, long, int);
|
||||
line_t *dup_line_node(line_t *);
|
||||
int exec_command(void);
|
||||
long exec_global(int, int);
|
||||
void expand_des_key(char *, char *);
|
||||
int extract_addr_range(void);
|
||||
char *extract_pattern(int);
|
||||
int extract_subst_tail(int *, long *);
|
||||
|
@ -231,7 +227,6 @@ void handle_hup(int);
|
|||
void handle_int(int);
|
||||
void handle_winch(int);
|
||||
int has_trailing_escape(char *, char *);
|
||||
int hex_to_binary(int, int);
|
||||
void init_buffers(void);
|
||||
void init_des_cipher(void);
|
||||
int is_legal_filename(char *);
|
||||
|
@ -253,7 +248,6 @@ long read_file(char *, long);
|
|||
long read_stream(FILE *, long);
|
||||
int search_and_replace(pattern_t *, int, int);
|
||||
int set_active_node(line_t *);
|
||||
void set_des_key(char *);
|
||||
void signal_hup(int);
|
||||
void signal_int(int);
|
||||
char *strip_escapes(const char *);
|
||||
|
|
Loading…
Reference in New Issue