29-AUG-2000 picked up gnupg-1.0.2 from www.gnupg.org

unpacked it.
built it on Linux with 

% ./configure --disable-asm -disable-dynload --with-included-zlib --enable-static-rnd=unix
% make | tee make_vms.com

copied make_vms.com to VMS system
copied config.h     to VMS system as vms_config.h
edited vms_config.h

There are 3 logicals associated with this program which must be defined
(or not, unclear if/when they are ever used.)  The MAKE_VMS.COM lists them
during the build.

used nedit.h to modify make_vms.com

Build...

A zillion of these:

        for(p=buffer, s=string; *s; s++ ) {
......................^
%CC-W-PTRMISMATCH1, In this statement, the referenced type of the pointer 
value "string" is "const char", which is not compatible with "const
unsigned char" because they differ by signed/unsigned attribute. 
at line number 364 in file PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.UTIL]STRGUTIL.C;1

Is this a header difference or just crappy programming?  In this particular 
error the functino is defined as:

char *
native_to_utf8( const char *string )
{

and s as

    const byte *s;

so where does "byte" come from?  [.include]types.h sets byte as unsigned 
char.  So this is just crappy programming, assigning signed values to an 
unsigned one.  Disable the PTRMISMATCH1 warning.


    if( !(fp = fdopen(fd, mode)) )
..........................^
%CC-W-NOTCONSTQUAL, In this statement, the referenced type of the pointer 
value "mode" is const, but the referenced type of the targ
et of this assignment is not.
at line number 618 in file PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.UTIL]IOBUF.C;1

Ignore the warning, it's due to a bug in the prototype for fdopen in this 
version of Compaq C.  mode is declared as char * when it should be const 
char *.

        if( !link(h->tname, h->lockname) ) {
.............^
%CC-I-IMPLICITFUNC, In this statement, the identifier "link" is implicitly 
declared as a function.
at line number 223 in file PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.UTIL]DOTLOCK.C;1

That's not good, what is this doing?    If HAVE_DOSISH_SYSTEM is defined 
then it bypasses most of this.  Go that route for now.

$ mycc/define=HAVE_CONFIG_H/include=([],[-],[-.include],[-.intl]) dynload.c

            *r_get_info = ctx->sym;
............^
%CC-W-PTRMISMATCH, In this statement, the referenced type of the pointer
value "ctx->sym" is "void", which is not compatible with "function (int,
pointer to unsigned int, pointer to pointer to unsigned char, pointer to
int, pointer to int, pointer to pointer to function (pointer to void)
returning void, pointer to pointer to function (pointer to void, pointer to
unsigned char, u". at line number 382 in file
PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.CIPHER]DYNLOAD.C;1 

Do we need dynload?  I thought I told it not to use that?  It seems to 
revolve around register_cipher_extension() which is only ever called from 
g10.c.  There's also register_internal_cipher_extension() which is too long.

#define reg_int_cipher_extension register_internal_cipher_extension


Created a RNVMS.C module.  It's based on Dave Jones's SSH server.  It may 
not return enough random information, but it's a start.

$ link/exe=bftest     bftest.obj,[-.cipher]libcipher/lib,[-.mpi]libmpi/lib, 
-
[-.util]libutil/lib,[-.zlib]libzlib/lib
%LINK-W-WRNERS, compilation warnings
        in module DYNLOAD file PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.
CIPHER]LIBCIPHER.OLB;1
%LINK-W-WRNERS, compilation warnings
        in module RMD160 file PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.
CIPHER]LIBCIPHER.OLB;1
%LINK-W-WRNERS, compilation warnings
        in module TWOFISH file PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.
CIPHER]LIBCIPHER.OLB;1
%LINK-W-WRNERS, compilation warnings
        in module MD5 file PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.
CIPHER]LIBCIPHER.OLB;1
%LINK-W-WRNERS, compilation warnings
        in module SHA1 file PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.
CIPHER]LIBCIPHER.OLB;1
%LINK-W-NUDFSYMS, 1 undefined symbol:
%LINK-I-UDFSYM,         RNDLINUX_CONSTRUCTOR
%LINK-W-USEUNDEF, undefined symbol RNDLINUX_CONSTRUCTOR referenced
        in psect $LINK$ offset %X00000030
        in module CONSTRUCT file PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.CIPHER]LIBCIPHER.OLB;1

Maybe it doesn't need SHA1 or TIGER?  Comment them out.

Nope, now construct wants SHA1 and RNDLINUX_CONSTRUCTOR.  See what 
construct.c is up to.  Ah, yet another #($&#($&(#*$& configure generated 
file.  Modify it, change the build instructions.

In packet.h at 

        PKT_COMMENT       =61,  /* new comment packet (private) */

trailing comma.  Generates a lot of annoying informationals.  Fixed it.


$ mycc/define=HAVE_CONFIG_H/include=([],[-],[-.include],[-.intl],[-.zlib]) passphrase.c

                assert( count >= 0 );
................^
%CC-I-QUESTCOMPARE, In this statement, the unsigned expression "count" is 
being compared with a relational operator to a constant wh
ose value is not greater than zero.  This might not be what you intended.
at line number 282 in file PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.G10]PASSPHRASE.C;1

This is a BUG, but a fairly complex one since the code seems to require 
count to be unsigned.

$ mycc/define=HAVE_CONFIG_H/include=([],[-],[-.include],[-.intl],[-.zlib]) 
encr-data.c

        if( n == -1 ) n = 0;
............^
%CC-I-QUESTCOMPARE1, In this statement, the unsigned expression "n" is 
being compared with an equality operator to a constant whose
value is negative.  This might not be what you intended.
at line number 240 in file PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.G10]
ENCR-DATA.C;1

Bug.  Fixed it by 

$ diff encr-data.c encr-data.c_dist
************
File PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.G10]ENCR-DATA.C;3
  234   /*    size_t n, size = *ret_len; */
  235       size_t size = *ret_len;
  236       int n;
  237       int rc = 0;
******
File PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.G10]ENCR-DATA.C_DIST;1
  234       size_t n, size = *ret_len;
  235       int rc = 0;

**********************************************************************

static RETSIGTYPE
^
%CC-W-MISSINGRETURN, Non-void function "got_fatal_signal" does not
contain a return statement. at line number 52 in file
PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.G10]SIGNAL.C;1 

static RETSIGTYPE
^
%CC-W-MISSINGRETURN, Non-void function "got_usr_signal" does not
contain a return statement. at line number 82 in file
PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.G10]SIGNAL.C;1 

    nact.sa_handler = got_fatal_signal;
....^
%CC-W-PTRMISMATCH, In this statement, the referenced type of the
pointer value "got_fatal_signal" is "function (int) returning int", 
which is not compatible with "function (int) returning void". at line
number 106 in file PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.G10]SIGNAL.C;1 

    nact.sa_handler = got_usr_signal;
....^
%CC-W-PTRMISMATCH, In this statement, the referenced type of the
pointer value "got_usr_signal" is "function (int) returning int", w
hich is not compatible with "function (int) returning void". at line
number 115 in file PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.G10]SIGNAL.C;1 

RETSIGTYPE is int, make it void.  (Don't see how it could be otherwise
given the way the code is written.) 

*********************************************************************************


            if( (time_t)((ulong)(curtime+interval)) < 0 )
................^
%CC-I-QUESTCOMPARE, In this statement, the unsigned expression
"(time_t)((ulong)(curtime+interval))" is being compared with a relati
onal operator to a constant whose value is not greater than zero. 
This might not be what you intended. at line number 732 in file
PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.G10]KEYGEN.C;1 

time_t on VMS is an unsigned long int.  Replace time_t by "long int"
in the code and it compiles cleanly.


*********************************************************************************

have to search code for "HAVE_DRIVE_LETTERS" because stuff like this 
abounds there:

      #ifdef HAVE_DRIVE_LETTERS
	opt.homedir = "c:/gnupg";
      #else
	opt.homedir = "~/.gnupg";
      #endif

Occurs in:

PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.G10]G10.C;1
  get gnupg directory to /SYS$LOGIN/GNUPG
PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.G10]OPENFILE.C;1
  ok IF HAVE_DRIVE_LETTERS not defined
PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.G10]RINGEDIT.C;1
   they use gnupg-ring:foo to specify that foo is a gnupg-ring.  Blech.
   should be ok though as they change the name to snip off the prefix
   which would otherwise have been seen as a logical.  What the heck is
   wrong with normal suffix file types???
PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.UTIL]FILEUTIL.C;1
   Used in make_basename.  Should be ok so long as we stick with 
   unix path/file name syntax.
PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.UTIL]SIMPLE-GETTEXT.C;1
   Not used.

Ok, rebuild and try again.

Clean.  Examples work.  Create a document VMS_INSTALL.TXT which 
describes how to overlay the VMS port onto GPG 1.0.2.

Done (sort of).

**********************************************************************

smithp01@MCRC16.MED.NYU.EDU reports

  The program doesn't automatically create [.gnupg]options

to do that manually do:

$ set def sys$login
$ create/dir [.gnupg]
$ search/remainder/out=options.. gnupgdata:options.skel "Options for GnuPG"

**********************************************************************

When it tries to create a key it fails to open /dev/tty.   That's hardcoded
into [.UTIL]TTYIO.C.  Changed the code to put in TERMDEVICE where "/dev/tty" 
was and modified vms_config.h to define this.

$ gnupg --gen-key

is working now, but passphrase gets echoed in clear text - minor security 
problem.

Oops, I spoke too soon;

+++>++++++++++.........................................>+++++.<+++++.............+++++
gpg: md_enable: algorithm 2 not available
gpg: md_enable: algorithm 2 not available

gpg: Ohhhh jeeee: you found a bug ... (PRGDISK:[SHARED.PROGRAMS.GNUPG.GNUPG-1_0_2.CIPHER]MD.C;1:377)
secmem usage: 1760/6624 bytes in 6/9 blocks of pool 6656/16384
%SYSTEM-F-OPCCUS, opcode reserved to customer fault at PC=FFFFFFFF80A21E04, PS=0000001B
%TRACE-F-TRACEBACK, symbolic stack dump follows
  image    module    routine             line      rel PC           abs PC
                                            0 FFFFFFFF80A21E04 FFFFFFFF80A21E04
                                            0 FFFFFFFF8098F248 FFFFFFFF8098F248
 GPG  LOGGER  g10_log_bug                4758 0000000000000818 00000000000C85C8
 GPG  MD  md_read                        5385 0000000000000C98 000000000009B9A8
 GPG  KEYID  keyid_from_sk               7148 0000000000000940 0000000000075180
 GPG  SIGN  make_keysig_packet           7620 00000000000026A0 0000000000063A30
 GPG  KEYGEN  write_selfsig              6971 00000000000003C8 0000000000076218
 GPG  KEYGEN  do_generate_keypair        8371 0000000000004064 0000000000079EB4
 GPG  KEYGEN  proc_parameter_file        7988 0000000000002E80 0000000000078CD0
 GPG  KEYGEN  generate_keypair           8274 0000000000003BDC 0000000000079A2C
 GPG  G10  set_debug                     8801 0000000000002D78 0000000000052D78
 GPG  G10  main                          8484 0000000000000000 0000000000000000
 GPG  G10  __main                           0 0000000000000070 0000000000050070
                                            0 FFFFFFFF850E93F4 FFFFFFFF850E93F4

Presumably the real problem is that md_enable, algorithm 2 wasn't available.

Doesn't matter if I select 
   (1) DSA and ElGamal (default)
   (2) DSA (sign only)
   (4) ElGamal (sign and encrypt)

1 or 4 from this.  Although in the latter case it gives the

  gpg: md_enable: algorithm 2 not available

message only once.

Email to gnupg maintainer asking how md_load works (since it
seems not to on OpenVMS)

In the meantime. DUh, found it.  Left out a couple of lines in 
vms_construct.c and needed to compile sha1.c.

Now it gets to:

gpg: /SYS$LOGIN/gnupg/pubring.gpg.tmp: can't create: file specification 
syntax error
gpg: can't write public key: file open error
Key generation failed: file open error

Typical Unix/vms filename bug.  These are hardcoded into RINGEDIT.C.
(Didn't these guys ever hear of header files?)

Can disable this with USE_ONLY_8DOT3 definition.  

Hey key generation worked!
