Commit Graph

296 Commits

Author SHA1 Message Date
wiz 4ad6ecab0a Use Fl Fl for long flags. 2009-04-28 09:19:15 +00:00
wiz fefeeb6f5e Fix In argument (no <> needed). Use .Pa for paths. Drop trailing space.
Punctuation nits.
2009-04-28 07:59:35 +00:00
wiz 7d7afa233d Fix xrefs, comment out the one to libbz2 (no man page exists for that). 2009-04-28 07:56:19 +00:00
agc 167587fd07 Clean up minor pieces of lint 2009-04-28 00:41:40 +00:00
agc 702f5adb30 Use .Ar properly 2009-04-28 00:40:45 +00:00
agc f5bbd5a825 Let's allocate enough space for the keyring structure, and not a pointer to it. 2009-04-26 16:55:44 +00:00
agc ee219f892b Enable netpgp in the build, and amend set lists accordingly. 2009-04-25 05:54:50 +00:00
agc efdd9dba1e WARNS=4 changes 2009-04-25 01:29:14 +00:00
agc ea21613ec1 Remove artefacts which should not have been imported - sorry for the noise 2009-04-24 01:05:59 +00:00
agc 93bf6008f8 Import netpgp source into crypto/external - this is a heavily-modified
version of openpgpsdk, and will replace it. Differences between netpgp
and the NetBSD repository version of openpgpsdk are:

+ Wrap source code in GNU autoconf/configure
+ New high-level interface for libnetpgp(3) and netpgp(1)
+ Hide prolifery of local headers in the internal lib directory -
  there is now one exported header called netpgp.h
+ Hide all ops_* functions and structs behind __ops_* names
+ Fix long-standing bug - make decryption work with files > 8192 bytes
  (fix for signature verification of signed files > 8192 bytes was already
  brought forward from the NetBSD repository of openpgpsdk)
+ Use mmap(2) to read files, falls back to read(2) if can't do mmap
+ Compile portable package using libtool
+ Rationalise the number of source files - merge a number of smaller ones
+ Case-insensitive matching of key ids
+ Use PRIsize throughout
+ Use calloc(3) throughout to zero memory
+ Get rid of global symbols which abused a macro
+ Use more descriptive names - remove "_arg_" components, name things for their
  purpose, rather than what they are (their type)
+ No more --passphrase= argument to netpgp(1) - this is now always
  done through callbacks
+ Report source code date and build date in version number, as well as the
  version number itself

This will form the basis of the portable netpgp package.
2009-04-23 06:31:55 +00:00
he 64be3821eb This program also uses the following libs: -lcrypto -lz -lbz2.
Add them explicitly so that this program links for sun2 as well.
2009-02-23 08:25:07 +00:00
agc 88ba3068b1 Use one struct for both zlib and bzip2 decompression. 2009-02-22 16:29:33 +00:00
agc 7bc38e3159 Use pointers to traverse some arrays, and make the code a bit more
readable.
2009-02-20 02:47:54 +00:00
agc 5d3eeabad1 Be a bit less zealous when copying memory, so that we don't copy beyond
th end of the buffer, and provoke a core dump.
2009-02-20 02:45:43 +00:00
lukem d237abe695 fix -Wsign-compare issues 2009-02-12 10:43:41 +00:00
agc 00be53a929 Remove argument names from function prototypes in header files. 2009-02-07 07:00:01 +00:00
agc fd38df44a9 Be a bit more consistent with the naming scheme (and a bit less verbose). 2009-02-07 05:57:39 +00:00
agc 47eb47e6b3 The catch-all header file also includes version.h now, in case we want
to display the version number of the openpgpsdk library.
2009-02-07 05:37:57 +00:00
agc 6aef23c4e0 Re-order header file inclusion order to be alphabetic.
Print out the version number of the openpgpsdk library when showing the
version string.

Parse the existing ~/.gnupg/gpg.conf to get the default user id, if any.

Use the actual size of the arrays in snprintf(), rather than a size which
may or may not be accurate.

Get rid of an unused 8K array on the stack - it's not needed.
2009-02-07 05:36:51 +00:00
agc 02ebfd8cdc Minor cosmetic change - no functional difference. 2009-02-07 05:32:27 +00:00
agc 852e7a06c8 Be a bit less rigid when re-allocating memory - don't just keep doubling
the size we've allocated; instead, if the current size is more than 8 MiB,
then add 1 MiB on; current behaviour remains unchanged for re-allocations
less than 8 MiB.
2009-02-07 05:31:28 +00:00
agc c62065c7b1 Check the characters we're given when trying to decide whether it's a
key id, or a user id/name.
2009-02-07 05:28:55 +00:00
agc eab6d9dfa6 Only use O_BINARY if it's defined (rather than the vague WIN32 definition
test).

Minor cosmetic changes
2009-02-07 05:26:19 +00:00
agc 203a89fce5 Fix a bug which prevented files signed with an RSA public key from being
decrypted.
2009-02-06 06:36:03 +00:00
agc 80a7466337 No need to define our own ops_boolean_t, ops_true and ops_false when
there are perfectly good values like bool, true and false waiting to
be used in <stdbool.h>
2009-02-05 06:03:49 +00:00
agc dda6c6990e When signing or encrypting files, allow the userid to be specified using
the (8 or 16) character keyid.

One more thing off the TODO list.
2009-02-05 01:42:39 +00:00
agc 57ef716bf6 Document the --version switch to print out the version information from
the libopenpgpsdk(3) library
2009-02-02 20:24:36 +00:00
agc c350af2e45 Document the function to get the version information for the openpgpsdk
library.
2009-02-02 20:21:26 +00:00
agc 40cade5517 Add a --version command to the openpgp utility, and document it. The
version is grabbed from the openpgpsdk library.

Make openpgp just include the one catch-all openpgpsdk header file.
2009-02-02 20:13:59 +00:00
agc fed46fd602 Remove a block of text, which wiz had commented out - it was not meant to
be.
2009-01-31 16:00:18 +00:00
wiz 127b1b6933 mdoclint cleanup:
remove trailing whitespace and a few nits.
2009-01-31 14:16:34 +00:00
wiz 8edb63eafb Add all options to SYNOPSIS.
Sort option descriptions.
Describe --passphrase, while it still is supported.
Use more markup.
Comment out block of text that didn't make sense to me in the context.
Punctuation improvements.
2009-01-31 14:14:10 +00:00
agc fce523c3f5 Get rid of 3 static functions which performed the same operation on 3
different arrays, and replace them with a function which takes the array
and size as arguments. No functional change.
2009-01-31 02:33:22 +00:00
agc aa5adc9663 Cosmetic change to surround the argument to sizeof in (brackets). No
functional change.
2009-01-31 01:44:31 +00:00
agc d2d3b6f70a Get rid of all occurrences of ops_mallocz(), since all it did was allocate
zeroed storage, and calloc(3) seems to do that just fine.
2009-01-31 01:20:32 +00:00
agc f058249f4f Add a manual page for the openpgpsdk library - very bare bones right now,
all contributions gratefully received.

Also add a convenience header file, which includes the other necessary
openpgpsdk header files - this means that

#include <openpgpsdk/openpgpsdk.h>

will get all the necessary definitions and declarations.
2009-01-31 00:48:18 +00:00
wiz 22e63019c0 mdoclint cleanup:
Sort sections.
Make HTML-ready.
Add RCS Id.
Fix section and man page names.
2009-01-30 22:59:37 +00:00
agc c804754594 Make source match the documentation (I thought I'd committed these yesterday,
but it seems not).

Bump default number of bits from 1024 to 2048.

Add --armor as a synonym for --armour, and prepare for the great spelling war
of 2009.
2009-01-30 21:39:42 +00:00
agc 990ca9e392 Mac OS X has a CommonDigest wrapper around openssl - use this if necessary. 2009-01-30 04:16:15 +00:00
agc 467d65ac1a Add a manual page for openpgp.1 (all contributions welcome, it's incomplete
right now).

Explain the reason for the WARNS=0 directive in openpgp(1)'s Makefile.
2009-01-30 04:14:19 +00:00
agc 00bc87c557 Run all the sources through indent.
Always print fingerprint information for keys when listing them.

Always display the publick key algorithm used (because of a bug, the
algorithm name was being ignored, rather than printed out).
2009-01-29 05:14:44 +00:00
martin b9c66cb587 avoid comment inside comment 2009-01-28 19:03:10 +00:00
agc fff13c1447 Fix problem in build reported by Paul Goyette 2009-01-28 17:27:35 +00:00
agc 06a360215d Move to /* ... */ style of comments in this code - facilitates running
indent on the code.
2009-01-28 16:54:20 +00:00
agc 8da84dc021 Abstract away all the %zu uses, and use a symbolic constant for them.
With thanks to uwe for the information to make this portable.

Expose the ops_memory_t structure, since we're now using it outside
its own source file.

Various cosmetic changes, mainly for debugging purposes.
2009-01-28 01:29:15 +00:00
agc ff02cd3e84 Use some symbolic constants where possible - take some of the magic out
of this.

Make the --list-keys command work again.
2009-01-28 01:24:49 +00:00
tnn c7c8fe9828 Fix previous. That should of course be %zu. 2009-01-27 17:15:26 +00:00
tnn b7888d42fa use %zd for size_t 2009-01-27 15:34:39 +00:00
agc ed31bb989a The existing code has problems verifying a signed file which is more
than 8192 bytes long, as the callback data simply assigns any data it
receives to a buffer, and then calls the hash function on that buffer
when EOF is reached.

Use an inefficient temporary workaround for this by holding the memory
in a temporary buffer in the callback argument structure.
2009-01-27 02:25:13 +00:00
veego 1ac066df3f Print size_t values using %zu printf format, not %ld
Thanks to Havard (and Matt Thomas) for pointing that out.
2009-01-25 13:38:17 +00:00
he 80506ca579 As Matt Thomas points out, %zu, not %zd, is the correct format
for size_t, since it's unsigned.
2009-01-25 13:31:58 +00:00
lukem 525b9d1b49 sign-compare fixes 2009-01-25 10:13:18 +00:00
agc ccc9f1a9af Make this compile after the last lint corrections 2009-01-25 01:49:20 +00:00
christos 1449463f65 try to fix the mess of headers:
- including each other
- calling non types _t
- doing forward enum declarations
- trailing , in enum
- some lint annotations
2009-01-24 19:55:33 +00:00
christos eb0c1ab347 small cleanups:
1. lint annotations
2. some size_t
3. remove silly breaks
2009-01-24 19:42:20 +00:00
he 6568aa2748 No, our openssl _encrypt routines do not take a *size_t as the 6th
argument, they take an *int, and those are not necessarily compatible.
Papering that over with a cast just gets us a warning that
de-referencing a type-punned pointer will break strict-aliasing
rules, which is turned into an error by our WARNS setting.

Instead, change the "num" field in _opt_crypt_t from size_t to int, and
get rid of the now-redundant casts.
2009-01-24 12:51:11 +00:00
he 99bb07565a Print size_t values using %zd printf format, not %d. 2009-01-24 12:07:44 +00:00
agc df41ea2ee2 Add the build glue and sets information for the libopenpgpsdk library, and
the openpgp binary.
2009-01-24 01:15:24 +00:00
agc ea48522368 Forgot a file in big commit from yesterday:
when matching userid, cheecck if the given userid has a '@' in it.
If so, treat it as an email address, and search for a case-insensitivee
match for the text in between '<' and '>' delimiters.

Otherwise, look for a case insensitive match on the full name.
2009-01-23 17:30:52 +00:00
agc 0306a7c61f Massive overhaul of openpgp.c, the driver program for the openpgpsdk
library.

A good signature verification now shows the filename, time of signing,
and the public keys of the signatories.

Made the interface much more standard by using any argv components after
the options have been parsed to indicate files, rather than a single
--file=filename long option.

Get rid of all assert() calls in the program - dumping core when an
argument is missing is a trifle uncompromising.

When matching userids, if the given userid contains a '@' character,
consider all characters from the rightmost '<' to the terminating
'>' of the file-based userid to be an email address. If there's no
'@' character, consider the given name as a real name, and match
from the start of the file-based userid. All comparisons are done
using case-insensitive searching. I'll consider implementing regexp
matching when enough chocolate bribes are received.

Rework the internals to call a major internal function, rather than doing
everything in main().

Run the results of all this through indent, since the current sources
bear little resemblance to what went before.
2009-01-23 06:07:18 +00:00
agc d0750f9b83 Convert another commented out printf() to a debugging statement 2009-01-22 01:46:51 +00:00
agc 29726fdfea When reading a keyring, often the failure of the initial limited_read_mpi()
when parsing a DSA signature means that we've reached the end of the keyring,
so only print out the annoying error message if we're debugging.
2009-01-22 01:45:59 +00:00
agc c785cc907d If the user hasn't passed the pass phrase in as a command line argument
(not such a great idea), use getpass() to get the passphrase.

Various debugging additions.

When verifying files, print out the file name which was verified, and exit
with either EXIT_FAILURE or EXIT_SUCCESS, depending upon the verification
result. This still needs to be reworked to print out the signatory to the
file, and the date of signing.
2009-01-22 01:43:35 +00:00
agc d26c2431dd Don't rely on a convenience macro when expanding a macro definition. 2009-01-22 01:01:47 +00:00
agc dba5f8d52a When listing keys, if a key ring has been specified, list the keys in
that key ring.  If no key ring has been specified, list the keys in
the default public key ring, rather than dying with a usage message.
Matches gpg behaviour, and stops openpgp violating the POLA.
2009-01-22 00:59:12 +00:00
agc da7f9470ea Convert commented out printf() statements into proper debugging statements 2009-01-22 00:56:13 +00:00
agc 67c903aedc Add more debugging information 2009-01-22 00:55:15 +00:00
lukem 0e88dfdc76 do the PRINTOBJDIR dance to find the (potentially uninstalled) library
in ../lib  (just like we do many other apps)
2009-01-22 00:22:20 +00:00
lukem 9b100d5b4e don't need LDADD here; LIBDPLIBS does the right thing 2009-01-22 00:20:58 +00:00
lukem 87e4630751 descend into lib first 2009-01-22 00:13:19 +00:00
lukem b8a38f2310 update paths 2009-01-22 00:01:52 +00:00
agc b3b80bc7d6 Fix a typo when printing the type of trust 2009-01-21 22:29:04 +00:00
agc bbfe341047 gmtime(3) returns a pointer to a struct tm with a month value in the
range [0,11], so add 1 to this to get a useful value for human
interpretation.
2009-01-21 20:17:14 +00:00
agc 1dbcf9a927 Avoid leaking storage in one function.
Set USE_FORT to yes, and fix the fallout.
2009-01-21 15:35:00 +00:00
agc c80363d779 WARNS=4 (w00t, no changes necessary) 2009-01-21 07:08:10 +00:00
agc 644e4c1f7f Build the openpgpsdk library with WARNS=3 2009-01-21 05:48:56 +00:00
agc 1cf88afccb Fix WARNS=2 warnings (shadow vars again), but don't switch WARNS=2 on for
the application, since WARNS=2 includes fatal warnings when linking, and we
get a warning about IDEA being a patented algorithm.
2009-01-21 03:37:12 +00:00
agc 6dfd9b1804 WARNS=2 for the library build 2009-01-21 03:32:08 +00:00
agc 5bc2794550 WARNS=2 (mainly shadow variable declarations) 2009-01-21 03:31:22 +00:00
agc 2626a640dd Previously debugging information seems to have been output by editing a
static variable and recompiling. Make this a bit more dynamic, adding a
--debug "filename" argument to the application, and by using a filename-
based debug framework to replicate previous behavior. Multiple filenames
can be provided.

In addition, add more debugging information by printing out the human
values of signature type and key algorithm when parsing packets.
2009-01-21 01:32:54 +00:00
agc 84ce5f6759 Restore the exit semantics of the original. If success, the exit code is
EXIT_SUCCESS. If failure, exit code is EXIT_FAILURE. (Duh). If an error
has occurred, use an exit code of 2.
2009-01-21 01:27:55 +00:00
agc 4442e07493 Add the dependent libs to the openpgpsdk library itself, rather than making
any program that uses the library specifically add them.

Install header files in the appropriate place
2009-01-20 19:48:23 +00:00
agc f6ab492fbf Use EXIT_* error codes rather than numeric constants 2009-01-20 19:46:08 +00:00
agc 35a399083a Get rid of a file that's not used 2009-01-20 19:44:42 +00:00
agc c86c75ce57 Add a subdir Makefile to descend into openpgpsdk 2009-01-20 19:42:56 +00:00
agc 68d230573c The openpgp application breaks its own abstraction rules by including a
header file that is meant to be local, so that it can access the content
type of a packet. This change uses an accessor function to find the packet
content type.
2009-01-20 16:58:09 +00:00
agc 0055cf2b60 Add a reachover framework for the openpgp application as well. 2009-01-20 07:50:54 +00:00
agc d4beb7925c Remove duplicated functions 2009-01-20 07:35:26 +00:00
agc e4f17bf621 Also make shared lib 2009-01-20 07:34:42 +00:00
agc cba3672b08 Add a README file, derived form external/src/README, to describe the contents
of the tree rotted at this directory.
2009-01-20 07:15:30 +00:00
agc 5e633613d2 Make this compile (WARNS=1) on NetBSD.
Add reachover library Makefile for the external framework.
2009-01-20 07:12:16 +00:00
agc 9b993b5409 Missed this when removing old sources. 2009-01-20 06:49:14 +00:00
agc 5c077856b5 Second initial import of openpgpsdk v0.9 into the external section of
the crypto sources, per conversation with core.

License is 3-clause BSD.

        An OpenPGP library implementation (RSA and partial DSA), conformant
        with RFC4880 "OpenPGP Message Format".

        RSA Key Generation
            * S2K Usage: ENCRYPTED_AND_HASHED
            * S2K Specifier: SALTED
            * Symmetric algorithm: CAST5

        RSA Encryption
            * Generates "Symmetrically Encrypted Integrity Protected
              Data" packets (required by RFC)
            * Hash: SHA1 (required by RFC)
            * Symmetric Algorithm: CAST5 (hard-coded)
            * Uses compression
            * Optional ASCII armouring

        RSA Decryption
            * Symmetric Algorithm: CAST5, AES, AES256, 3DES
            * Optional Compression: ZIP, ZLIB, BZIP2
            * Optional ASCII armouring

        RSA Signature
            * Armoured, unarmoured or clearsigned
            * Hash algorithm: SHA1

        RSA Verification
            * Armoured, unarmoured or clearsigned
            * V3 or V4 signatures
            * Hash algorithms: SHA1, SHA256, SHA384, SHA512, SHA224

        DSA Signature
            * Armoured, unarmoured or clearsigned
            * Hash algorithms: SHA1

        DSA Verification
            * Armoured, unarmoured or clearsigned
            * V3 or V4 signatures
            * Hash algorithms: SHA1, SHA256, SHA384, SHA512, SHA224
2009-01-20 06:43:54 +00:00
agc 32a7726202 Remove the botched import of the openpgpsdk sources. "They'll be back" 2009-01-20 06:36:37 +00:00
agc ca2dba9441 Make the library compile with WARNS=1 2009-01-12 23:00:00 +00:00
agc 4ca3d4e421 Initial import of openpgpsdk v0.9 into the external section of the crypto
sources, per conversation with core.

License is 3-clause BSD.

	An OpenPGP library implementation (RSA and partial DSA), conformant
	with RFC4880 "OpenPGP Message Format".

	RSA Key Generation
	    * S2K Usage: ENCRYPTED_AND_HASHED
	    * S2K Specifier: SALTED
	    * Symmetric algorithm: CAST5

	RSA Encryption
	    * Generates "Symmetrically Encrypted Integrity Protected
	      Data" packets (required by RFC)
	    * Hash: SHA1 (required by RFC)
	    * Symmetric Algorithm: CAST5 (hard-coded)
	    * Uses compression
	    * Optional ASCII armouring

	RSA Decryption
	    * Symmetric Algorithm: CAST5, AES, AES256, 3DES
	    * Optional Compression: ZIP, ZLIB, BZIP2
	    * Optional ASCII armouring

	RSA Signature
	    * Armoured, unarmoured or clearsigned
	    * Hash algorithm: SHA1

	RSA Verification
	    * Armoured, unarmoured or clearsigned
	    * V3 or V4 signatures
	    * Hash algorithms: SHA1, SHA256, SHA384, SHA512, SHA224

	DSA Signature
	    * Armoured, unarmoured or clearsigned
	    * Hash algorithms: SHA1

	DSA Verification
	    * Armoured, unarmoured or clearsigned
	    * V3 or V4 signatures
	    * Hash algorithms: SHA1, SHA256, SHA384, SHA512, SHA224
2009-01-12 22:55:41 +00:00