summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--README136
-rw-r--r--configure.in3
-rw-r--r--doc/Makefile.am18
-rw-r--r--src/gcrypt.h76
-rw-r--r--src/mpiapi.c96
6 files changed, 188 insertions, 146 deletions
diff --git a/ChangeLog b/ChangeLog
index 701bb2b8..9645e592 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Jun 16 20:16:21 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
+
+
+ * configure.in: Add test for docbook-to-man
+
Tue Jun 15 12:21:08 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
diff --git a/README b/README
index ac26fd71..34d59c97 100644
--- a/README
+++ b/README
@@ -1,12 +1,12 @@
-----BEGIN PGP SIGNED MESSAGE-----
- GnuPG - The GNU Privacy Guard
- -------------------------------
- Version 0.9.7
+ GnuPG - The GNU Privacy Guard
+ -------------------------------
+ Version 0.9.7
GnuPG is now in Beta test and you should report all bugs to the
mailing list (see below). The 0.9.x versions are released mainly
- to fix all remaining serious bugs. As soon as version 1.0 is out,
+ to fix all remaining serious bugs. As soon as version 1.0 is out,
development will continue with a 1.1 series and bug fixes for the
1.0 version as needed.
@@ -23,7 +23,7 @@
"Key fingerprint = 6BD9 050F D8FC 941B 4341 2DCC 68B7 AB89 5754 8DCD"
You may want to add this DSA key to your GnuPG pubring and use it in
- the future to verify new releases. Because you verified this README
+ the future to verify new releases. Because you verified this README
file and _checked_that_it_is_really_my PGP2 key 0C9857A5, you can be
quite sure that the above fingerprint is correct.
@@ -60,7 +60,7 @@
Here is a quick summary:
- 1) "./configure"
+ 1) "./configure"
2) "make"
@@ -92,7 +92,7 @@
The normal way to create a key is
- gpg --gen-key
+ gpg --gen-key
This asks some questions and then starts key generation. To create
good random numbers for the key parameters, GnuPG needs to gather
@@ -119,7 +119,7 @@
Next, you should create a revocation certificate in case someone
gets knowledge of your secret key or you forgot your passphrase
- gpg --gen-revoke your_user_id
+ gpg --gen-revoke your_user_id
Run this command and store the revocation certificate away. The output
is always ASCII armored, so that you can print it and (hopefully
@@ -127,20 +127,20 @@
Now you can use your key to create digital signatures
- gpg -s file
+ gpg -s file
This creates a file "file.gpg" which is compressed and has a
signature attached.
- gpg -sa file
+ gpg -sa file
Same as above, but creates a file "file.asc" which is ASCII armored
- and and ready for sending by mail. It is better to use your
+ and and ready for sending by mail. It is better to use your
mailers features to create signatures (The mailer uses GnuPG to do
this) because the mailer has the ability to MIME encode such
signatures - but this is not a security issue.
- gpg -s -o out file
+ gpg -s -o out file
Creates a signature of "file", but writes the output to the file
"out".
@@ -149,7 +149,7 @@
your key by putting it on a key server, a web page or in your .plan
file) is now able to check whether you really signed this text
- gpg --verify file
+ gpg --verify file
GnuPG now checks whether the signature is valid and prints an
appropriate message. If the signature is good, you know at least
@@ -160,29 +160,29 @@
create a new file that is identical to the original. gpg can also
run as a filter, so that you can pipe data to verify trough it
- cat signed-file | gpg | wc -l
+ cat signed-file | gpg | wc -l
which will check the signature of signed-file and then display the
number of lines in the original file.
To send a message encrypted to someone you can use
- gpg -e -r heine file
+ gpg -e -r heine file
This encrypts "file" with the public key of the user "heine" and
writes it to "file.gpg"
- echo "hello" | gpg -ea -r heine | mail heine
+ echo "hello" | gpg -ea -r heine | mail heine
Ditto, but encrypts "hello\n" and mails it as ASCII armored message
to the user with the mail address heine.
- gpg -se -r heine file
+ gpg -se -r heine file
This encrypts "file" with the public key of "heine" and writes it
to "file.gpg" after signing it with your user id.
- gpg -se -r heine -u Suttner file
+ gpg -se -r heine -u Suttner file
Ditto, but sign the file with your alternative user id "Suttner"
@@ -190,7 +190,7 @@
GnuPG has some options to help you publish public keys. This is
called "exporting" a key, thus
- gpg --export >all-my-keys
+ gpg --export >all-my-keys
exports all the keys in the keyring and writes them (in a binary
format) to "all-my-keys". You may then mail "all-my-keys" as an
@@ -201,14 +201,14 @@
To mail a public key or put it on a web page you have to create
the key in ASCII armored format
- gpg --export --armor | mail panther@tiger.int
+ gpg --export --armor | mail panther@tiger.int
This will send all your public keys to your friend panther.
If you have received a key from someone else you can put it
into your public keyring. This is called "importing"
- gpg --import [filenames]
+ gpg --import [filenames]
New keys are appended to your keyring and already existing
keys are updated. Note that GnuPG does not import keys that
@@ -222,7 +222,7 @@
every other program used for management of cryptographic keys)
provides other solutions.
- gpg --fingerprint <username>
+ gpg --fingerprint <username>
prints the so called "fingerprint" of the given username which
is a sequence of hex bytes (which you may have noticed in mail
@@ -237,43 +237,43 @@
Suppose however that friend of yours knows someone who knows someone
who has met the owner of the public key at some computer conference.
Suppose that all the people between you and the public key holder
- may now act as introducers to you. Introducers signing keys thereby
+ may now act as introducers to you. Introducers signing keys thereby
certify that they know the owner of the keys they sign. If you then
trust all the introducers to have correctly signed other keys, you
can be be sure that the other key really belongs to the one who
claims to own it..
There are 2 steps to validate a key:
- 1. First check that there is a complete chain
- of signed keys from the public key you want to use
- and your key and verify each signature.
- 2. Make sure that you have full trust in the certificates
- of all the introduces between the public key holder and
- you.
+ 1. First check that there is a complete chain
+ of signed keys from the public key you want to use
+ and your key and verify each signature.
+ 2. Make sure that you have full trust in the certificates
+ of all the introduces between the public key holder and
+ you.
Step 2 is the more complicated part because there is no easy way
for a computer to decide who is trustworthy and who is not. GnuPG
leaves this decision to you and will ask you for a trust value
(here also referenced as the owner-trust of a key) for every key
- needed to check the chain of certificates. You may choose from:
+ needed to check the chain of certificates. You may choose from:
a) "I don't know" - then it is not possible to use any
- of the chains of certificates, in which this key is used
- as an introducer, to validate the target key. Use this if
- you don't know the introducer.
+ of the chains of certificates, in which this key is used
+ as an introducer, to validate the target key. Use this if
+ you don't know the introducer.
b) "I do not trust" - Use this if you know that the introducer
- does not do a good job in certifying other keys. The effect
- is the same as with a) but for a) you may later want to
- change the value because you got new information about this
- introducer.
+ does not do a good job in certifying other keys. The effect
+ is the same as with a) but for a) you may later want to
+ change the value because you got new information about this
+ introducer.
c) "I trust marginally" - Use this if you assume that the
- introducer knows what he is doing. Together with some
- other marginally trusted keys, GnuPG validates the target
- key then as good.
+ introducer knows what he is doing. Together with some
+ other marginally trusted keys, GnuPG validates the target
+ key then as good.
d) "I fully trust" - Use this if you really know that this
- introducer does a good job when certifying other keys.
- If all the introducer are of this trust value, GnuPG
- normally needs only one chain of signatures to validate
- a target key okay. (But this may be adjusted with the help
- of some options).
+ introducer does a good job when certifying other keys.
+ If all the introducer are of this trust value, GnuPG
+ normally needs only one chain of signatures to validate
+ a target key okay. (But this may be adjusted with the help
+ of some options).
This information is confidential because it gives your personal
opinion on the trustworthiness of someone else. Therefore this data
is not stored in the keyring but in the "trustdb"
@@ -286,7 +286,7 @@
Okay, here is how GnuPG helps you with key management. Most stuff
is done with the --edit-key command
- gpg --edit-key <keyid or username>
+ gpg --edit-key <keyid or username>
GnuPG displays some information about the key and then prompts
for a command (enter "help" to see a list of commands and see
@@ -326,37 +326,37 @@
* Only by the short keyid (prepend a zero if it begins with A..F):
- "234567C4"
- "0F34E556E"
- "01347A56A"
- "0xAB123456
+ "234567C4"
+ "0F34E556E"
+ "01347A56A"
+ "0xAB123456
* By a complete keyid:
- "234AABBCC34567C4"
- "0F323456784E56EAB"
- "01AB3FED1347A5612"
- "0x234AABBCC34567C4"
+ "234AABBCC34567C4"
+ "0F323456784E56EAB"
+ "01AB3FED1347A5612"
+ "0x234AABBCC34567C4"
* By a fingerprint:
- "1234343434343434C434343434343434"
- "123434343434343C3434343434343734349A3434"
- "0E12343434343434343434EAB3484343434343434"
+ "1234343434343434C434343434343434"
+ "123434343434343C3434343434343734349A3434"
+ "0E12343434343434343434EAB3484343434343434"
The first one is MD5 the others are ripemd160 or sha1.
* By an exact string:
- "=Heinrich Heine <heinrichh@uni-duesseldorf.de>"
+ "=Heinrich Heine <heinrichh@uni-duesseldorf.de>"
* By an email address:
- "<heinrichh@uni-duesseldorf.de>"
+ "<heinrichh@uni-duesseldorf.de>"
* By word match
- "+Heinrich Heine duesseldorf"
+ "+Heinrich Heine duesseldorf"
All words must match excatly (not case sensitive) and appear in
any order in the user ID. Words are any sequences of letters,
@@ -364,15 +364,15 @@
* By the Local ID (from the trust DB):
- "#34"
+ "#34"
This may be used by a MUA to specify an exact key after selecting
a key from GnuPG (by using a special option or an extra utility)
* Or by the usual substring:
- "Heine"
- "*Heine"
+ "Heine"
+ "*Heine"
The '*' indicates substring search explicitly.
@@ -400,22 +400,22 @@
Esoteric commands
-----------------
- gpg --list-packets datafile
+ gpg --list-packets datafile
Use this to list the contents of a data file. If the file is encrypted
you are asked for the passphrase, so that GnuPG is able to look at the
inner structure of a encrypted packet. This command should list all
kinds of rfc2440 messages.
- gpgm --list-trustdb
+ gpgm --list-trustdb
List the contents of the trust DB in a human readable format
- gpgm --list-trustdb <usernames>
+ gpgm --list-trustdb <usernames>
List the tree of certificates for the given usernames
- gpgm --list-trust-path username
+ gpgm --list-trust-path username
List the possible trust paths for the given username. The length
of such a trust path is limited by the option --max-cert-depth
@@ -437,7 +437,7 @@
the normal www.gnu.org webserver.
Please direct bug reports to <gnupg-bugs@gnu.org> or, better,
- post them to the mailing list <g10@net.lut.ac.uk> (this is a
+ post them to the mailing list <gnupg-devel@gnupg.org> (this is a
closed list - subscribe before posting, see above (~line 33)).
Please direct questions about GnuPG to the mailing list or
one of the pgp newsgroups and give me more time to improve
diff --git a/configure.in b/configure.in
index 63b5539d..76ad05c1 100644
--- a/configure.in
+++ b/configure.in
@@ -130,6 +130,9 @@ AC_PROG_CPP
AC_ISC_POSIX
AC_PROG_INSTALL
AC_PROG_RANLIB
+AC_CHECK_PROG(DOCBOOK_TO_MAN, docbook-to-man, yes, no)
+AM_CONDITIONAL(HAVE_DOCBOOK_TO_MAN, test "$ac_cv_prog_DOCBOOK_TO_MAN" = yes)
+
if test x$compile_libgcrypt = xyes; then
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 460a63db..26f83e32 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,25 +1,23 @@
## Process this file with automake to create Makefile.in
-EXTRA_DIST = DETAILS gpg.1pod gpg.1 FAQ HACKING OpenPGP
+EXTRA_DIST = DETAILS gpg.sgml gpg.1 FAQ HACKING OpenPGP
man_MANS = gpg.1
-
-%: %pod
- pod2man $< --section=`echo $@ | sed 's/^.*(?)$$/$$&/'`\
- --release="`date -r $< '+%d %b %Y'`"\
- --center="GNU Tools" --date=' '\
- >$@,$$$$ && mv -f $@,$$$$ $@\
- || rm -f $@,$$$$
-
+%.1 : %.sgml
+if HAVE_DOCBOOK_TO_MAN
+ docbook-to-man $< >$@
+else
+ : Warning: missing docbook-to-man, cannot make $@
+endif
%.txt : %.sgml
sgml2txt -c latin $*
%.html : %.sgml
- sgml2html -l deutsch -c latin $*
+ sgml2html -c latin $*
%.dvi : %.sgml
-rm $*.sgml.tmp
diff --git a/src/gcrypt.h b/src/gcrypt.h
index e3dacbf7..4b8d5bec 100644
--- a/src/gcrypt.h
+++ b/src/gcrypt.h
@@ -65,6 +65,11 @@ enum gcry_ctl_cmds {
int gcry_control( enum gcry_ctl_cmds, ... );
+enum gcry_random_level {
+ GCRY_WEAK_RANDOM = 0,
+ GCRY_STRONG_RANDOM = 1,
+ GCRY_VERY_STRONG_RANDOM = 2
+};
/*******************************************
* *
@@ -72,20 +77,6 @@ int gcry_control( enum gcry_ctl_cmds, ... );
* *
*******************************************/
-enum gcry_mpi_opcode {
- GCRYMPI_NOOP = 0,
- GCRYMPI_NEW = 1, /* use gcry_mpi_new() */
- GCRYMPI_SNEW = 2, /* use gcry_mpi_new() */
- GCRYMPI_RELEASE = 3,
- GCRYMPI_RESIZE = 4,
- GCRYMPI_COPY = 5, /* use gcry_mpi_new() */
- GCRYMPI_SWAP = 6,
- GCRYMPI_SET = 7,
- GCRYMPI_SET_UI = 8,
- GCRYMPI_CMP = 9,
- GCRYMPI_CMP_UI = 10
-};
-
enum gcry_mpi_format {
GCRYMPI_FMT_STD = 0, /* As used by OpenPGP */
GCRYMPI_FMT_SSH = 1, /* As used by SSH */
@@ -93,35 +84,42 @@ enum gcry_mpi_format {
};
struct gcry_mpi;
+typedef struct gcry_mpi *GCRY_MPI;
+
+GCRY_MPI gcry_mpi_new( unsigned int nbits );
+GCRY_MPI gcry_mpi_snew( unsigned int nbits );
+void gcry_mpi_release( GCRY_MPI a );
+GCRY_MPI gcry_mpi_copy( const GCRY_MPI a );
+GCRY_MPI gcry_mpi_set( GCRY_MPI w, const GCRY_MPI u );
+GCRY_MPI gcry_mpi_set_ui( GCRY_MPI w, unsigned long u );
+int gcry_mpi_cmp( const GCRY_MPI u, const GCRY_MPI v );
+int gcry_mpi_cmp_ui( const GCRY_MPI u, unsigned long v );
+void gcry_mpi_randomize( GCRY_MPI w,
+ unsigned int nbits, enum gcry_random_level level);
+int gcry_mpi_scan( GCRY_MPI *ret_mpi, enum gcry_mpi_format format,
+ const char *buffer, size_t *nbytes );
+int gcry_mpi_print( enum gcry_mpi_format format,
+ char *buffer, size_t *nbytes, const GCRY_MPI a );
+
+void gcry_mpi_powm( GCRY_MPI w,
+ const GCRY_MPI b, const GCRY_MPI e, const GCRY_MPI m );
-int gcry_mpi_api( enum gcry_mpi_opcode opcode, int n_args, ... );
-struct gcry_mpi *gcry_mpi_new( enum gcry_mpi_opcode opcode,
- unsigned int size,
- struct gcry_mpi *val
- );
-int gcry_mpi_scan( struct gcry_mpi **ret_mpi, enum gcry_mpi_format format,
- const char *buffer, size_t *nbytes );
-int gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes,
- struct gcry_mpi *a );
#ifndef GCRYPT_NO_MPI_MACROS
-#define mpi_new( nbits ) gcry_mpi_new( GCRYMPI_NEW, (nbits), NULL )
-#define mpi_secure_new( nbits ) gcry_mpi_new( GCRYMPI_SNEW, (nbits), NULL )
-#define mpi_release( a ) do { gcry_mpi_api( GCRYMPI_RELEASE, 1, (a) ); \
- (a) = NULL; } while(0)
-#define mpi_resize( a, n ) gcry_mpi_api( GCRYMPI_RESIZE, 2, (a), (n) )
-#define mpi_copy( a ) gcry_mpi_new( GCRYMPI_COPY, 0, (a) )
-#define mpi_swap( a, b ) gcyr_mpi_api( GCRYMPI_SWAP, 2, (a), (b) )
-/* void mpi_set( MPI w, MPI u ); */
-#define mpi_set( w, u) gcry_mpi_api( GCRYMPI_SET, 2, (w), (u) )
-/* void mpi_set_ui( MPI w, unsigned long u ); */
-#define mpi_set_ui( w, u) gcry_mpi_api( GCRYMPI_SET_UI, 2, (w), (u) )
-/* int mpi_cmp( MPI u, MPI v ); */
-#define mpi_cmp( u, v ) gcry_mpi_api( GCRYMPI_CMP, 2, (u), (v) )
-/* int mpi_cmp_ui( MPI u, unsigned long v ); */
-#define mpi_cmp_ui( u, v ) gcry_mpi_api( GCRYMPI_CMP_UI, 2, (u), (v) )
+#define mpi_new(n) gcry_mpi_new( (n) )
+#define mpi_secure_new( n ) gcry_mpi_snew( (n) )
+#define mpi_release( a ) do { gcry_mpi_release( (a) ); \
+ (a) = NULL; } while(0)
+#define mpi_copy( a ) gcry_mpi_copy( (a) )
+#define mpi_set( w, u) gcry_mpi_set( (w), (u) )
+#define mpi_set_ui( w, u) gcry_mpi_set_ui( (w), (u) )
+#define mpi_cmp( u, v ) gcry_mpi_cmp( (u), (v) )
+#define mpi_cmp_ui( u, v ) gcry_mpi_cmp_ui( (u), (v) )
+
+#define mpi_powm(w,b,e,m) gcry_mpi_powm( (w), (b), (e), (m) )
#if 0
+#define mpi_swap( a, b ) gcry_mpi_api( (a), (b) )
void g10m_add(MPI w, MPI u, MPI v);
void g10m_add_ui(MPI w, MPI u, unsigned long v );
void g10m_sub( MPI w, MPI u, MPI v);
@@ -134,8 +132,6 @@ void g10m_mulm( MPI w, MPI u, MPI v, MPI m);
void g10m_fdiv_q( MPI quot, MPI dividend, MPI divisor );
-void g10m_powm( MPI res, MPI base, MPI exp, MPI mod);
-
int g10m_gcd( MPI g, MPI a, MPI b );
int g10m_invm( MPI x, MPI u, MPI v );
diff --git a/src/mpiapi.c b/src/mpiapi.c
index dfdaeb99..9685008e 100644
--- a/src/mpiapi.c
+++ b/src/mpiapi.c
@@ -28,42 +28,77 @@
#define GCRYPT_NO_MPI_MACROS 1
#include "g10lib.h"
#include "mpi.h"
+#include "../cipher/random.h"
+GCRY_MPI
+gcry_mpi_new( unsigned int nbits )
+{
+ return mpi_alloc( (nbits+BITS_PER_MPI_LIMB-1) / BITS_PER_MPI_LIMB );
+}
+
+
+GCRY_MPI
+gcry_mpi_snew( unsigned int nbits )
+{
+ return mpi_alloc_secure( (nbits+BITS_PER_MPI_LIMB-1) / BITS_PER_MPI_LIMB );
+}
+
+void
+gcry_mpi_release( GCRY_MPI a )
+{
+ mpi_free( a );
+}
+
+GCRY_MPI
+gcry_mpi_copy( const GCRY_MPI a )
+{
+ return mpi_copy( (GCRY_MPI)a );
+}
+
+GCRY_MPI
+gcry_mpi_set( GCRY_MPI w, const GCRY_MPI u )
+{
+ if( !w )
+ w = mpi_alloc( mpi_get_nlimbs(u) );
+ mpi_set( w, (GCRY_MPI)u );
+ return w;
+}
+
+GCRY_MPI
+gcry_mpi_set_ui( GCRY_MPI w, unsigned long u )
+{
+ if( !w )
+ w = mpi_alloc(1);
+ mpi_set_ui( w, u );
+ return w;
+}
+
int
-gcry_mpi_api( enum gcry_mpi_opcode opcode, int n_args, ... )
+gcry_mpi_cmp( const GCRY_MPI u, const GCRY_MPI v )
{
- switch( opcode ) {
- case GCRYMPI_NOOP:
- return 0;
+ return mpi_cmp( (GCRY_MPI)u, (GCRY_MPI)v );
+}
- default:
- return GCRYERR_INV_OP;
- }
+int
+gcry_mpi_cmp_ui( const GCRY_MPI u, unsigned long v )
+{
+ return mpi_cmp_ui( (GCRY_MPI)u, v );
}
-struct gcry_mpi *
-gcry_mpi_new( enum gcry_mpi_opcode opcode,
- unsigned int nbits, struct gcry_mpi *val)
+void
+gcry_mpi_randomize( GCRY_MPI w,
+ unsigned int nbits, enum gcry_random_level level )
{
- switch( opcode ) {
- case GCRYMPI_NEW:
- return mpi_alloc( (nbits+BITS_PER_MPI_LIMB-1) / BITS_PER_MPI_LIMB );
-
- case GCRYMPI_SNEW:
- return mpi_alloc_secure( (nbits+BITS_PER_MPI_LIMB-1)
- / BITS_PER_MPI_LIMB );
- case GCRYMPI_COPY:
- return mpi_copy( val );
-
- default:
- return NULL;
- }
+ char *p = get_random_bits( nbits, level, mpi_is_secure(w) );
+ mpi_set_buffer( w, p, (nbits+7)/8, 0 );
+ m_free(p);
}
+
int
gcry_mpi_scan( struct gcry_mpi **ret_mpi, enum gcry_mpi_format format,
const char *buffer, size_t *nbytes )
@@ -195,19 +230,16 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes,
return GCRYERR_INTERNAL; /* can't handle it yet */
tmp = mpi_get_buffer( a, &n, NULL );
- if( n && (*tmp & 0x80) ) {
- n++;
+ if( !n || (*tmp & 0x80) )
extra=1;
- }
if( 2*n+2+1 > len ) {
m_free(tmp);
return GCRYERR_TOO_SHORT; /* the provided buffer is too short */
}
- if( extra || !n ) {
+ if( extra ) {
*s++ = '0';
*s++ = '0';
- n += 2;
}
#if BYTES_PER_MPI_LIMB == 2
@@ -234,3 +266,11 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes,
return GCRYERR_INV_ARG;
}
+
+void
+gcry_mpi_powm( MPI w, MPI b, MPI e, MPI m )
+{
+ mpi_powm( w, b, e, m );
+}
+
+