Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: [agc-netpgp-standalone] src/crypto/external/bsd/netpgp/dist/src



On Thu, Oct 25, 2012 at 04:09:12PM +0000, Christos Zoulas wrote:
> >But I'm not sure it should - the memory pointer or filename argument
> >is overloaded when it is passed in; the size parameter being negative
> >is used to signify that it's a filename, so ssize_t is the correct
> >type.
> 
> Perhaps there should be two entry points for the function then:
> 
>     pgp_read_file_pubring
>     pgp_read_memory_pubring
> 
> and pgp_read_file_pubring should read/mmap the file and call
> pgp_read_memory_pubring.

Yes, this is what happens in pgpv_read_pubring():

/* set up the pubkey keyring */
int
pgpv_read_pubring(pgpv_t *pgp, const void *keyring, ssize_t size)
{
        if (keyring) { 
                return (size > 0) ?
                        read_binary_memory(pgp, "pubring", keyring, 
(size_t)size) :
                        read_binary_file(pgp, "pubring", "%s", keyring);
        }  
        return read_binary_file(pgp, "pubring", "%s/%s", getenv("HOME"), 
".gnupg/pubring.gpg");
}

just without using two functions to do the same thing.

Regards,
Alistair


Home | Main Index | Thread Index | Old Index