Skip to content

Commit

Permalink
Drop ed(1) "crypto"
Browse files Browse the repository at this point in the history
You should not be using DES.  You should not have been using DES for the
past 30 years.

The ed DES-CBC scheme lacked several desirable properties of a sealed
document system, even ignoring DES itself.  In particular, it did not
provide the "integrity" cryptographic property (detection of tampering), and
it treated ASCII passwords as 64-bit keys (instead of using a KDF like
scrypt or PBKDF2).

Some general approaches ed(1) users might consider to replace the removed
DES mode:

1. Full disk encryption with something like AES-XTS.  This is easy to
conceptualize, design, and implement, and it provides confidentiality for
data at rest.  Like CBC, it lacks tampering protection.  Examples include
GELI, LUKS, FileVault2.

2. Encrypted overlay ("stackable") filesystems (EncFS, PEFS?, CryptoFS,
others).

3. Native encryption at the filesystem layer.  Ext4/F2FS, ZFS, APFS, and
NTFS all have some flavor of this.

4. Storing your files unencrypted.  It's not like DES was doing you much
good.

If you have DES-CBC scrambled files produced by ed(1) prior to this change,
you may decrypt them with:

  openssl des-cbc -d -iv 0 -K <key in hex> -in <inputfile> -out <plaintext>

Reviewed by:	allanjude, bapt, emaste
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D17829
  • Loading branch information
cemeyer committed Nov 4, 2018
1 parent 83e1dcf commit 9278c98
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 477 deletions.
7 changes: 1 addition & 6 deletions bin/ed/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@

PACKAGE=runtime
PROG= ed
SRCS= buf.c cbc.c glbl.c io.c main.c re.c sub.c undo.c
SRCS= buf.c glbl.c io.c main.c re.c sub.c undo.c
LINKS= ${BINDIR}/ed ${BINDIR}/red
MLINKS= ed.1 red.1

.if ${MK_OPENSSL} != "no" && ${MK_ED_CRYPTO} != "no"
CFLAGS+=-DDES
LIBADD= crypto
.endif

.include <bsd.prog.mk>
15 changes: 3 additions & 12 deletions bin/ed/POSIX
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,20 @@ EXTENSIONS
iv) `z' for scrolling through the buffer, and
v) BSD line addressing syntax (i.e., `^' and `%') is recognized.

2) If crypt(3) is available, files can be read and written using DES
encryption. The `x' command prompts the user to enter a key used for
encrypting/ decrypting subsequent reads and writes. If only a newline
is entered as the key, then encryption is disabled. Otherwise, a key
is read in the same manner as a password entry. The key remains in
effect until encryption is disabled. For more information on the
encryption algorithm, see the bdes(1) man page. Encryption/decryption
should be fully compatible with SunOS des(1).

3) The POSIX interactive global commands `G' and `V' are extended to
2) The POSIX interactive global commands `G' and `V' are extended to
support multiple commands, including `a', `i' and `c'. The command
format is the same as for the global commands `g' and `v', i.e., one
command per line with each line, except for the last, ending in a
backslash (\).

4) An extension to the POSIX file commands `E', `e', `r', `W' and `w' is
3) An extension to the POSIX file commands `E', `e', `r', `W' and `w' is
that <file> arguments are processed for backslash escapes, i.e., any
character preceded by a backslash is interpreted literally. If the
first unescaped character of a <file> argument is a bang (!), then the
rest of the line is interpreted as a shell command, and no escape
processing is performed by ed.

5) For SunOS ed(1) compatibility, ed runs in restricted mode if invoked
4) For SunOS ed(1) compatibility, ed runs in restricted mode if invoked
as red. This limits editing of files in the local directory only and
prohibits shell commands.

Expand Down
1 change: 0 additions & 1 deletion bin/ed/README
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ compile with little trouble. Otherwise, the macros SPL1() and SPL0()
should be redefined to disable interrupts.

The following compiler directives are recognized:
DES - to add encryption support (requires crypt(3))
NO_REALLOC_NULL - if realloc(3) does not accept a NULL pointer
BACKWARDS - for backwards compatibility
NEED_INSQUE - if insque(3) is missing
Expand Down
Loading

0 comments on commit 9278c98

Please sign in to comment.