Skip to content

Commit 26e6a73

Browse files
committed
checksums: support all OpenSSL EVP digests
Add option "-c digest" to use any of supported EVP message digests inplace of insecure MD5. This generates checksum files named by the digest by default, e.g .SHA256.CHECKSUMS Rename md5.c to checksum.c Rename md5_* functions to csum_* functions Rename MD5* variables to Csum* variables For backwards compatibility -m translates to -c md5 The "-M filename" option to rename the checksums file remains untouched
1 parent da1ba1a commit 26e6a73

File tree

6 files changed

+204
-141
lines changed

6 files changed

+204
-141
lines changed

PORTING

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ $DragonFly: src/bin/cpdup/PORTING,v 1.2 2008/04/11 17:33:11 dillon Exp $
2121
#!/bin/csh
2222
#
2323
cd cpdup
24-
rm -f md5.c
24+
rm -f checksum.c
2525
rm -f *.o
26-
cc -D__unused= -D_GNU_SOURCE -D__USE_FILE_OFFSET64 -DNOMD5 *.c -c
27-
cc -D__unused= -D_GNU_SOURCE -D__USE_FILE_OFFSET64 -DNOMD5 *.o -o ~/bin/cpdup
26+
cc -D__unused= -D_GNU_SOURCE -D__USE_FILE_OFFSET64 -DNOCHECKSUM *.c -c
27+
cc -D__unused= -D_GNU_SOURCE -D__USE_FILE_OFFSET64 -DNOCHECKSUM *.o -o ~/bin/cpdup
2828

2929
BACKUP SCRIPT MODIFICATIONS - you will almost certainly have to adjust
3030
the do_cleanup script to extract the proper field(s) from the df output.

cpdup.1

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
.Nm
1313
.Op Fl C
1414
.Op Fl v Ns Op Cm v Ns Op Cm v
15+
.Op Fl c
1516
.Op Fl d
1617
.Op Fl n
1718
.Op Fl u
@@ -73,6 +74,27 @@ modifications made to the destination.
7374
.Fl vvv
7475
will cause all files and directories to be reported whether or not
7576
modifications are made.
77+
.It Fl c Ar digest
78+
Generate and maintain a checksum file using the specified message
79+
.Ar digest
80+
called
81+
.Pa \&.DIGEST.CHECKSUMS
82+
in each directory on the source where
83+
.Pa DIGEST
84+
is replaced by the upperscale name of the message digest used.
85+
An alternate file name may be specified with the
86+
.Fl M Ar file
87+
option. Supported are all localy available OpenSSL
88+
.Xr EVP 7
89+
message digests, e.g. md5, rmd160, sha1, sha256 or sha512.
90+
A checksum check is done on each file of the destination when the destination
91+
appears to be the same as the source. If the check fails,
92+
the source is recopied to the destination. When you specify a destination
93+
directory, the checksum file is only updated as needed and may not be updated
94+
even if modifications are made to a source file. If you do not specify a
95+
destination directory the
96+
.Nm
97+
command forcefully regenerates the checksum for every file in the source.
7698
.It Fl d
7799
Print directories as they are being traversed.
78100
Useful to watch the progress;
@@ -120,21 +142,14 @@ Quiet operation.
120142
.It Fl o
121143
Do not remove any files, just overwrite/add.
122144
.It Fl m
123-
Generate and maintain a MD5 checkfile called
124-
.Pa \&.MD5.CHECKSUMS
125-
in each directory on the source
126-
and do an MD5 check on each file of the destination when the destination
127-
appears to be the same as the source. If the check fails,
128-
the source is recopied to the destination. When you specify a destination
129-
directory, the MD5 checkfile is only updated as needed and may not be updated
130-
even if modifications are made to a source file. If you do not specify a
131-
destination directory the
132-
.Nm
133-
command forcefully regenerates the MD5 checkfile for every file in the source.
134-
.It Fl M Ar file
135145
Works the same as
136-
.Fl m
137-
but allows you to specify the name of the MD5 checkfile.
146+
.Fl c Ar md5
147+
for compatibility purposes
148+
.It Fl M Ar file
149+
allows you to specify the name of the checksum file generated by options
150+
.Fl c
151+
or
152+
.Fl m.
138153
.It Fl H Ar path
139154
.Nm
140155
will create a hardlink from a file found under

0 commit comments

Comments
 (0)