mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-12 22:11:29 +02:00
update from tobold
This commit is contained in:
parent
c279427f8d
commit
d9b3dc0000
@ -1,3 +1,7 @@
|
|||||||
|
Wed Jun 10 07:48:59 1998 Werner Koch,mobil,,, (wk@tobold)
|
||||||
|
|
||||||
|
* configure.in (GNUPG_LIBDIR): New.
|
||||||
|
|
||||||
Mon May 25 19:10:59 1998 Werner Koch (wk@isil.d.shuttle.de)
|
Mon May 25 19:10:59 1998 Werner Koch (wk@isil.d.shuttle.de)
|
||||||
|
|
||||||
* rand-unix.c (fast_random_poll): fixed syntax bug.
|
* rand-unix.c (fast_random_poll): fixed syntax bug.
|
||||||
|
@ -64,8 +64,6 @@ target_triplet = @target@
|
|||||||
CATALOGS = @CATALOGS@
|
CATALOGS = @CATALOGS@
|
||||||
CATOBJEXT = @CATOBJEXT@
|
CATOBJEXT = @CATOBJEXT@
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CIPHER_EXTRA_DIST = @CIPHER_EXTRA_DIST@
|
|
||||||
CIPHER_EXTRA_OBJS = @CIPHER_EXTRA_OBJS@
|
|
||||||
CPP = @CPP@
|
CPP = @CPP@
|
||||||
DATADIRNAME = @DATADIRNAME@
|
DATADIRNAME = @DATADIRNAME@
|
||||||
G10_LOCALEDIR = @G10_LOCALEDIR@
|
G10_LOCALEDIR = @G10_LOCALEDIR@
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#undef PACKAGE
|
#undef PACKAGE
|
||||||
#undef G10_LOCALEDIR
|
#undef G10_LOCALEDIR
|
||||||
#undef PRINTABLE_OS_NAME
|
#undef PRINTABLE_OS_NAME
|
||||||
|
#undef GNUPG_LIBDIR
|
||||||
|
|
||||||
/* Define if your locale.h file contains LC_MESSAGES. */
|
/* Define if your locale.h file contains LC_MESSAGES. */
|
||||||
#undef HAVE_LC_MESSAGES
|
#undef HAVE_LC_MESSAGES
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
Wed Jun 10 07:52:08 1998 Werner Koch,mobil,,, (wk@tobold)
|
||||||
|
|
||||||
|
* dynload.c: New
|
||||||
|
* cipher.c: Major changes to allow extensions.
|
||||||
|
|
||||||
Mon Jun 8 22:43:00 1998 Werner Koch (wk@isil.d.shuttle.de)
|
Mon Jun 8 22:43:00 1998 Werner Koch (wk@isil.d.shuttle.de)
|
||||||
|
|
||||||
* cipher.c: Major internal chnages to support extensions.
|
* cipher.c: Major internal chnages to support extensions.
|
||||||
|
104
cipher/cipher.c
104
cipher/cipher.c
@ -32,21 +32,23 @@
|
|||||||
#include "blowfish.h"
|
#include "blowfish.h"
|
||||||
#include "cast5.h"
|
#include "cast5.h"
|
||||||
#include "des.h"
|
#include "des.h"
|
||||||
|
#include "dynload.h"
|
||||||
|
|
||||||
#include <dlfcn.h>
|
|
||||||
|
|
||||||
#define STD_BLOCKSIZE 8
|
#define STD_BLOCKSIZE 8
|
||||||
#define TABLE_SIZE 20
|
#define TABLE_SIZE 20
|
||||||
|
|
||||||
static struct {
|
struct cipher_table_s {
|
||||||
const char *name;
|
const char *name;
|
||||||
int algo;
|
int algo;
|
||||||
int keylen;
|
size_t keylen;
|
||||||
int contextsize; /* allocate this amount of context */
|
size_t contextsize; /* allocate this amount of context */
|
||||||
void (*setkey)( void *c, byte *key, unsigned keylen );
|
void (*setkey)( void *c, byte *key, unsigned keylen );
|
||||||
void (*encrypt)( void *c, byte *outbuf, byte *inbuf );
|
void (*encrypt)( void *c, byte *outbuf, byte *inbuf );
|
||||||
void (*decrypt)( void *c, byte *outbuf, byte *inbuf );
|
void (*decrypt)( void *c, byte *outbuf, byte *inbuf );
|
||||||
} cipher_table[TABLE_SIZE];
|
};
|
||||||
|
|
||||||
|
static struct cipher_table_s cipher_table[TABLE_SIZE];
|
||||||
|
|
||||||
|
|
||||||
struct cipher_handle_s {
|
struct cipher_handle_s {
|
||||||
@ -142,56 +144,54 @@ static int
|
|||||||
load_cipher_modules()
|
load_cipher_modules()
|
||||||
{
|
{
|
||||||
static int done = 0;
|
static int done = 0;
|
||||||
|
void *context = NULL;
|
||||||
|
struct cipher_table_s *ct;
|
||||||
|
int ct_idx;
|
||||||
|
size_t blocksize;
|
||||||
|
int i;
|
||||||
|
const char *name;
|
||||||
|
int any = 0;
|
||||||
|
|
||||||
if( !done ) {
|
if( done )
|
||||||
void *handle;
|
return 0;
|
||||||
char **name;
|
done = 1;
|
||||||
void *sym;
|
|
||||||
void * (*enumfunc)(int, int*, int*, int*);
|
|
||||||
const char *err;
|
|
||||||
|
|
||||||
log_debug("load_cipher_modules\n");
|
for(ct_idx=0, ct = cipher_table; ct_idx < TABLE_SIZE; ct_idx++,ct++ ) {
|
||||||
handle = dlopen("/sahara/proj/psst+g10/non-free-src/rsa+idea.so", RTLD_LAZY);
|
if( !ct->name )
|
||||||
if( !handle )
|
break;
|
||||||
log_bug("dlopen(rsa+idea) failed: %s\n", dlerror() );
|
|
||||||
name = (char**)dlsym(handle, "gnupgext_version");
|
|
||||||
if( (err=dlerror()) )
|
|
||||||
log_error("dlsym: gnupgext_version not found: %s\n", err );
|
|
||||||
else {
|
|
||||||
log_debug("dlsym: gnupgext_version='%s'\n", *name );
|
|
||||||
sym = dlsym(handle, "gnupgext_enum_func");
|
|
||||||
if( (err=dlerror()) )
|
|
||||||
log_error("dlsym: gnupgext_enum_func not found: %s\n", err );
|
|
||||||
else {
|
|
||||||
int seq = 0;
|
|
||||||
int class, vers;
|
|
||||||
|
|
||||||
enumfunc = (void *(*)(int,int*,int*,int*))sym;
|
|
||||||
while( (sym = enumfunc(0, &seq, &class, &vers)) ) {
|
|
||||||
if( vers != 1 ) {
|
|
||||||
log_debug("ignoring extfunc with version %d\n", vers);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
switch( class ) {
|
|
||||||
case 11:
|
|
||||||
case 21:
|
|
||||||
case 31:
|
|
||||||
log_info("provides %s algorithm %d\n",
|
|
||||||
class == 11? "md" :
|
|
||||||
class == 21? "cipher" : "pubkey",
|
|
||||||
*(int*)sym);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
log_debug("skipping class %d\n", class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dlclose(handle);
|
|
||||||
done = 1;
|
|
||||||
}
|
}
|
||||||
|
if( ct_idx >= TABLE_SIZE-1 )
|
||||||
return 0;
|
BUG(); /* table already full */
|
||||||
|
/* now load all extensions */
|
||||||
|
while( (name = enum_gnupgext_ciphers( &context, &ct->algo,
|
||||||
|
&ct->keylen, &blocksize, &ct->contextsize,
|
||||||
|
&ct->setkey, &ct->encrypt, &ct->decrypt)) ) {
|
||||||
|
if( blocksize != STD_BLOCKSIZE ) {
|
||||||
|
log_info("skipping cipher %d: unsupported blocksize\n", ct->algo);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for(i=0; cipher_table[i].name; i++ )
|
||||||
|
if( cipher_table[i].algo == ct->algo )
|
||||||
|
break;
|
||||||
|
if( cipher_table[i].name ) {
|
||||||
|
log_info("skipping cipher %d: already loaded\n", ct->algo );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* put it into the table */
|
||||||
|
log_info("loaded cipher %d (%s)\n", ct->algo, name);
|
||||||
|
ct->name = name;
|
||||||
|
ct_idx++;
|
||||||
|
ct++;
|
||||||
|
any = 1;
|
||||||
|
/* check whether there are more available table slots */
|
||||||
|
if( ct_idx >= TABLE_SIZE-1 ) {
|
||||||
|
log_info("cipher table full; ignoring other extensions\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
enum_gnupgext_ciphers( &context, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL );
|
||||||
|
return any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
187
cipher/dynload.c
187
cipher/dynload.c
@ -18,13 +18,194 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include "util.h"
|
||||||
|
#include "cipher.h"
|
||||||
#include "dynload.h"
|
#include "dynload.h"
|
||||||
|
|
||||||
|
typedef struct ext_list {
|
||||||
|
struct ext_list *next;
|
||||||
|
void *handle; /* handle from dlopen() */
|
||||||
|
int failed; /* already tried but failed */
|
||||||
|
void * (*enumfunc)(int, int*, int*, int*);
|
||||||
|
char name[1];
|
||||||
|
} *EXTLIST;
|
||||||
|
|
||||||
|
static EXTLIST extensions;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
EXTLIST r;
|
||||||
|
int seq1;
|
||||||
|
int seq2;
|
||||||
|
void *sym;
|
||||||
|
} ENUMCONTEXT;
|
||||||
|
|
||||||
|
/****************
|
||||||
|
* Register an extension module. The last registered module will
|
||||||
|
* be loaded first.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
register_cipher_extension( const char *fname )
|
||||||
|
{
|
||||||
|
EXTLIST r, el;
|
||||||
|
|
||||||
|
if( *fname != '/' ) { /* do tilde expansion etc */
|
||||||
|
char *p ;
|
||||||
|
|
||||||
|
if( strchr(fname, '/') )
|
||||||
|
p = make_filename(fname, NULL);
|
||||||
|
else
|
||||||
|
p = make_filename(GNUPG_LIBDIR, fname, NULL);
|
||||||
|
el = m_alloc_clear( sizeof *el + strlen(p) );
|
||||||
|
strcpy(el->name, p );
|
||||||
|
m_free(p);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
el = m_alloc_clear( sizeof *el + strlen(fname) );
|
||||||
|
strcpy(el->name, fname );
|
||||||
|
}
|
||||||
|
/* check that it is not already registered */
|
||||||
|
for(r = extensions; r; r = r->next )
|
||||||
|
if( !compare_filenames(r->name, el->name) ) {
|
||||||
|
log_debug("extension '%s' already registered\n", el->name );
|
||||||
|
m_free(el);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
log_debug("extension '%s' registered\n", el->name );
|
||||||
|
/* and register */
|
||||||
|
el->next = extensions;
|
||||||
|
extensions = el;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
load_extension( EXTLIST el )
|
||||||
|
{
|
||||||
|
char **name;
|
||||||
|
void *sym;
|
||||||
|
const char *err;
|
||||||
|
int seq = 0;
|
||||||
|
int class, vers;
|
||||||
|
|
||||||
|
el->handle = dlopen(el->name, RTLD_LAZY);
|
||||||
|
if( !el->handle ) {
|
||||||
|
log_error("%s: error loading extension: %s\n", el->name, dlerror() );
|
||||||
|
goto failure;
|
||||||
|
}
|
||||||
|
name = (char**)dlsym(el->handle, "gnupgext_version");
|
||||||
|
if( (err=dlerror()) ) {
|
||||||
|
log_error("%s: not a gnupg extension: %s\n", el->name, err );
|
||||||
|
goto failure;
|
||||||
|
}
|
||||||
|
|
||||||
|
log_info("%s: version '%s'\n", el->name, *name );
|
||||||
|
|
||||||
|
sym = dlsym(el->handle, "gnupgext_enum_func");
|
||||||
|
if( (err=dlerror()) ) {
|
||||||
|
log_error("%s: invalid gnupg extension: %s\n", el->name, err );
|
||||||
|
goto failure;
|
||||||
|
}
|
||||||
|
el->enumfunc = (void *(*)(int,int*,int*,int*))sym;
|
||||||
|
|
||||||
|
/* list the contents of the module */
|
||||||
|
while( (sym = (*el->enumfunc)(0, &seq, &class, &vers)) ) {
|
||||||
|
if( vers != 1 ) {
|
||||||
|
log_error("%s: ignoring func with version %d\n", el->name, vers);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
switch( class ) {
|
||||||
|
case 11:
|
||||||
|
case 21:
|
||||||
|
case 31:
|
||||||
|
log_info("%s: provides %s algorithm %d\n", el->name,
|
||||||
|
class == 11? "md" :
|
||||||
|
class == 21? "cipher" : "pubkey",
|
||||||
|
*(int*)sym);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
log_debug("%s: skipping class %d\n", el->name, class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
failure:
|
||||||
|
if( el->handle ) {
|
||||||
|
dlclose(el->handle);
|
||||||
|
el->handle = NULL;
|
||||||
|
}
|
||||||
|
el->failed = 1;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const char *
|
||||||
|
enum_gnupgext_ciphers( void **enum_context, int *algo,
|
||||||
|
size_t *keylen, size_t *blocksize, size_t *contextsize,
|
||||||
|
void (**setkey)( void *c, byte *key, unsigned keylen ),
|
||||||
|
void (**encrypt)( void *c, byte *outbuf, byte *inbuf ),
|
||||||
|
void (**decrypt)( void *c, byte *outbuf, byte *inbuf )
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EXTLIST r;
|
||||||
|
ENUMCONTEXT *ctx;
|
||||||
|
const char * (*finfo)(int, size_t*, size_t*, size_t*,
|
||||||
|
void (**)( void *, byte *, unsigned),
|
||||||
|
void (**)( void *, byte *, byte *),
|
||||||
|
void (**)( void *, byte *, byte *));
|
||||||
|
|
||||||
|
if( !*enum_context ) { /* init context */
|
||||||
|
ctx = m_alloc_clear( sizeof( *ctx ) );
|
||||||
|
ctx->r = extensions;
|
||||||
|
*enum_context = ctx;
|
||||||
|
}
|
||||||
|
else if( !algo ) { /* release the context */
|
||||||
|
m_free(*enum_context);
|
||||||
|
*enum_context = NULL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ctx = *enum_context;
|
||||||
|
|
||||||
|
for( r = ctx->r; r; r = r->next ) {
|
||||||
|
int class, vers;
|
||||||
|
|
||||||
|
if( r->failed )
|
||||||
|
continue;
|
||||||
|
if( !r->handle && load_extension(r) )
|
||||||
|
continue;
|
||||||
|
/* get a cipher info function */
|
||||||
|
if( ctx->sym )
|
||||||
|
goto inner_loop;
|
||||||
|
while( (ctx->sym = (*r->enumfunc)(20, &ctx->seq1, &class, &vers)) ) {
|
||||||
|
void *sym;
|
||||||
|
/* must check class because enumfunc may be wrong coded */
|
||||||
|
if( vers != 1 || class != 20 )
|
||||||
|
continue;
|
||||||
|
inner_loop:
|
||||||
|
finfo = ctx->sym;
|
||||||
|
while( (sym = (*r->enumfunc)(21, &ctx->seq2, &class, &vers)) ) {
|
||||||
|
const char *algname;
|
||||||
|
if( vers != 1 || class != 21 )
|
||||||
|
continue;
|
||||||
|
*algo = *(int*)sym;
|
||||||
|
algname = (*finfo)( *algo, keylen, blocksize, contextsize,
|
||||||
|
setkey, encrypt, decrypt );
|
||||||
|
log_debug("found algo %d (%s)\n", *algo, algname );
|
||||||
|
if( algname ) {
|
||||||
|
ctx->r = r;
|
||||||
|
return algname;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ctx->seq2 = 0;
|
||||||
|
}
|
||||||
|
ctx->seq1 = 0;
|
||||||
|
}
|
||||||
|
ctx->r = r;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -20,5 +20,12 @@
|
|||||||
#ifndef G10_CIPHER_DYNLOAD_H
|
#ifndef G10_CIPHER_DYNLOAD_H
|
||||||
#define G10_CIPHER_DYNLOAD_H
|
#define G10_CIPHER_DYNLOAD_H
|
||||||
|
|
||||||
|
const char *
|
||||||
|
enum_gnupgext_ciphers( void **enum_context, int *algo,
|
||||||
|
size_t *keylen, size_t *blocksize, size_t *contextsize,
|
||||||
|
void (**setkey)( void *c, byte *key, unsigned keylen ),
|
||||||
|
void (**encrypt)( void *c, byte *outbuf, byte *inbuf ),
|
||||||
|
void (**decrypt)( void *c, byte *outbuf, byte *inbuf )
|
||||||
|
);
|
||||||
|
|
||||||
#endif /*G10_CIPHER_DYNLOAD_H*/
|
#endif /*G10_CIPHER_DYNLOAD_H*/
|
||||||
|
84
cipher/pubkey.c
Normal file
84
cipher/pubkey.c
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
/* pubkey.c - pubkey dispatcher
|
||||||
|
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* This file is part of GNUPG.
|
||||||
|
*
|
||||||
|
* GNUPG is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNUPG is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include "util.h"
|
||||||
|
#include "errors.h"
|
||||||
|
#include "mpi.h"
|
||||||
|
#include "cipher.h"
|
||||||
|
#include "dynload.h"
|
||||||
|
|
||||||
|
|
||||||
|
/****************
|
||||||
|
* This is the interface for the public key decryption.
|
||||||
|
* ALGO gives the algorithm to use and this implicitly determines
|
||||||
|
* the size of the arrays.
|
||||||
|
* result is a pointer to a mpi variable which will receive a
|
||||||
|
* newly allocated mpi or NULL in case of an error.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
pubkey_decrypt( int algo, MPI *result, int ndata, MPI *data,
|
||||||
|
int nskey, MPI *skey )
|
||||||
|
{
|
||||||
|
MPI plain = NULL;
|
||||||
|
|
||||||
|
*result = NULL; /* so the caller can do always do an mpi_free */
|
||||||
|
if( DBG_CIPHER ) {
|
||||||
|
int i;
|
||||||
|
log_debug("pubkey_decrypt: algo=%d\n", algo );
|
||||||
|
for(i=0; i < nskey; i++ )
|
||||||
|
log_mpidump(" skey:", skey[i] );
|
||||||
|
for(i=0; i < ndata; i++ )
|
||||||
|
log_mpidump(" data:", data[i] );
|
||||||
|
}
|
||||||
|
if( is_ELGAMAL(algo) ) {
|
||||||
|
ELG_secret_key sk;
|
||||||
|
assert( ndata == 2 && nskey == 4 );
|
||||||
|
sk.p = skey[0];
|
||||||
|
sk.g = skey[1];
|
||||||
|
sk.y = skey[2];
|
||||||
|
sk.x = skey[3];
|
||||||
|
plain = mpi_alloc_secure( mpi_get_nlimbs( sk.p ) );
|
||||||
|
elg_decrypt( plain, data[0], data[1], &sk );
|
||||||
|
}
|
||||||
|
else if( is_RSA(k->pubkey_algo) ) {
|
||||||
|
RSA_secret_key sk;
|
||||||
|
assert( ndata == 1 && nskey == 6 );
|
||||||
|
sk.e = skey[0];
|
||||||
|
sk.n = skey[1];
|
||||||
|
sk.p = skey[2];
|
||||||
|
sk.q = skey[3];
|
||||||
|
sk.d = skey[4];
|
||||||
|
sk.u = skey[5];
|
||||||
|
plain = mpi_alloc_secure( mpi_get_nlimbs(sk.n) );
|
||||||
|
rsa_secret( plain, data[0], &sk );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return G10ERR_PUBKEY_ALGO;
|
||||||
|
*result = plain;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -69,7 +69,7 @@ fast_random_poll()
|
|||||||
{
|
{
|
||||||
#if HAVE_GETHRTIME
|
#if HAVE_GETHRTIME
|
||||||
{ hrtime_t tv;
|
{ hrtime_t tv;
|
||||||
tv = gethrtime(void);
|
tv = gethrtime();
|
||||||
add_randomness( &tv, sizeof(tv), 1 );
|
add_randomness( &tv, sizeof(tv), 1 );
|
||||||
}
|
}
|
||||||
#elif HAVE_GETTIMEOFTIME
|
#elif HAVE_GETTIMEOFTIME
|
||||||
|
@ -88,6 +88,7 @@
|
|||||||
#undef PACKAGE
|
#undef PACKAGE
|
||||||
#undef G10_LOCALEDIR
|
#undef G10_LOCALEDIR
|
||||||
#undef PRINTABLE_OS_NAME
|
#undef PRINTABLE_OS_NAME
|
||||||
|
#undef GNUPG_LIBDIR
|
||||||
|
|
||||||
/* Define if your locale.h file contains LC_MESSAGES. */
|
/* Define if your locale.h file contains LC_MESSAGES. */
|
||||||
#undef HAVE_LC_MESSAGES
|
#undef HAVE_LC_MESSAGES
|
||||||
|
@ -86,6 +86,7 @@ case "${target}" in
|
|||||||
RANLIB="i386--mingw32-ranlib"
|
RANLIB="i386--mingw32-ranlib"
|
||||||
ac_cv_have_dev_random=no
|
ac_cv_have_dev_random=no
|
||||||
AC_DEFINE(USE_RAND_W32)
|
AC_DEFINE(USE_RAND_W32)
|
||||||
|
GNUPG_LIBDIR="c:/lib/gnupg"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
@ -93,8 +94,10 @@ AC_PROG_INSTALL
|
|||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_CPP
|
AC_PROG_CPP
|
||||||
AC_DEFINE(USE_RAND_UNIX)
|
AC_DEFINE(USE_RAND_UNIX)
|
||||||
|
GNUPG_LIBDIR="$g10_prefix/lib/gnupg"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
AC_DEFINE_UNQUOTED(GNUPG_LIBDIR, "$GNUPG_LIBDIR")
|
||||||
|
|
||||||
case "${target}" in
|
case "${target}" in
|
||||||
i386--mingw32)
|
i386--mingw32)
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
Wed Jun 10 07:22:02 1998 Werner Koch,mobil,,, (wk@tobold)
|
||||||
|
|
||||||
|
* g10.c ("load-extension"): New option.
|
||||||
|
|
||||||
Mon Jun 8 22:23:37 1998 Werner Koch (wk@isil.d.shuttle.de)
|
Mon Jun 8 22:23:37 1998 Werner Koch (wk@isil.d.shuttle.de)
|
||||||
|
|
||||||
* seckey-cert.c (do_check): Removed cipher constants
|
* seckey-cert.c (do_check): Removed cipher constants
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl -I../intl
|
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl -I../intl
|
||||||
EXTRA_DIST = OPTIONS pubring.asc
|
EXTRA_DIST = OPTIONS pubring.asc
|
||||||
OMIT_DEPENDENCIES = zlib.h zconf.h
|
OMIT_DEPENDENCIES = zlib.h zconf.h
|
||||||
|
LDFLAGS = -rdynamic
|
||||||
needed_libs = ../cipher/libcipher.a ../mpi/libmpi.a ../util/libutil.a
|
needed_libs = ../cipher/libcipher.a ../mpi/libmpi.a ../util/libutil.a
|
||||||
|
|
||||||
noinst_PROGRAMS = gpgd
|
noinst_PROGRAMS = gpgd
|
||||||
|
@ -93,6 +93,7 @@ l = @l@
|
|||||||
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl -I../intl
|
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl -I../intl
|
||||||
EXTRA_DIST = OPTIONS pubring.asc
|
EXTRA_DIST = OPTIONS pubring.asc
|
||||||
OMIT_DEPENDENCIES = zlib.h zconf.h
|
OMIT_DEPENDENCIES = zlib.h zconf.h
|
||||||
|
LDFLAGS = -rdynamic
|
||||||
needed_libs = ../cipher/libcipher.a ../mpi/libmpi.a ../util/libutil.a
|
needed_libs = ../cipher/libcipher.a ../mpi/libmpi.a ../util/libutil.a
|
||||||
|
|
||||||
noinst_PROGRAMS = gpgd
|
noinst_PROGRAMS = gpgd
|
||||||
@ -170,7 +171,6 @@ PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
|
|||||||
|
|
||||||
DEFS = @DEFS@ -I. -I$(srcdir) -I..
|
DEFS = @DEFS@ -I. -I$(srcdir) -I..
|
||||||
CPPFLAGS = @CPPFLAGS@
|
CPPFLAGS = @CPPFLAGS@
|
||||||
LDFLAGS = @LDFLAGS@
|
|
||||||
LIBS = @LIBS@
|
LIBS = @LIBS@
|
||||||
gpg_OBJECTS = g10.o build-packet.o compress.o free-packet.o getkey.o \
|
gpg_OBJECTS = g10.o build-packet.o compress.o free-packet.o getkey.o \
|
||||||
pkclist.o skclist.o ringedit.o kbnode.o mainproc.o armor.o mdfilter.o \
|
pkclist.o skclist.o ringedit.o kbnode.o mainproc.o armor.o mdfilter.o \
|
||||||
|
@ -89,7 +89,7 @@ encode_simple( const char *filename, int mode )
|
|||||||
cfx.dek = NULL;
|
cfx.dek = NULL;
|
||||||
if( mode ) {
|
if( mode ) {
|
||||||
s2k = m_alloc_clear( sizeof *s2k );
|
s2k = m_alloc_clear( sizeof *s2k );
|
||||||
s2k->mode = 1;
|
s2k->mode = opt.rfc1991? 0:1;
|
||||||
s2k->hash_algo = opt.def_digest_algo ? opt.def_digest_algo
|
s2k->hash_algo = opt.def_digest_algo ? opt.def_digest_algo
|
||||||
: DEFAULT_DIGEST_ALGO;
|
: DEFAULT_DIGEST_ALGO;
|
||||||
cfx.dek = passphrase_to_dek( NULL, opt.def_cipher_algo, s2k, 2 );
|
cfx.dek = passphrase_to_dek( NULL, opt.def_cipher_algo, s2k, 2 );
|
||||||
@ -116,7 +116,7 @@ encode_simple( const char *filename, int mode )
|
|||||||
write_comment( out, "#created by GNUPG v" VERSION " ("
|
write_comment( out, "#created by GNUPG v" VERSION " ("
|
||||||
PRINTABLE_OS_NAME ")");
|
PRINTABLE_OS_NAME ")");
|
||||||
|
|
||||||
if( s2k ) {
|
if( s2k && !opt.rfc1991 ) {
|
||||||
PKT_symkey_enc *enc = m_alloc_clear( sizeof *enc );
|
PKT_symkey_enc *enc = m_alloc_clear( sizeof *enc );
|
||||||
enc->version = 4;
|
enc->version = 4;
|
||||||
enc->cipher_algo = cfx.dek->algo;
|
enc->cipher_algo = cfx.dek->algo;
|
||||||
|
@ -111,6 +111,8 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
{ 534, "no-comment", 0, N_("do not write comment packets")},
|
{ 534, "no-comment", 0, N_("do not write comment packets")},
|
||||||
{ 535, "completes-needed", 1, N_("(default is 1)")},
|
{ 535, "completes-needed", 1, N_("(default is 1)")},
|
||||||
{ 536, "marginals-needed", 1, N_("(default is 3)")},
|
{ 536, "marginals-needed", 1, N_("(default is 3)")},
|
||||||
|
{ 560, "load-extension" ,2, N_("|file|load extension module")},
|
||||||
|
{ 561, "rfc1991", 0, N_("emulate the mode described in RFC1991")},
|
||||||
#ifdef IS_G10
|
#ifdef IS_G10
|
||||||
{ 527, "cipher-algo", 2 , N_("|NAME|use cipher algorithm NAME")},
|
{ 527, "cipher-algo", 2 , N_("|NAME|use cipher algorithm NAME")},
|
||||||
{ 528, "pubkey-algo", 2 , N_("|NAME|use public key algorithm NAME")},
|
{ 528, "pubkey-algo", 2 , N_("|NAME|use public key algorithm NAME")},
|
||||||
@ -427,7 +429,7 @@ main( int argc, char **argv )
|
|||||||
orig_argv = argv;
|
orig_argv = argv;
|
||||||
pargs.argc = &argc;
|
pargs.argc = &argc;
|
||||||
pargs.argv = &argv;
|
pargs.argv = &argv;
|
||||||
pargs.flags= 1; /* do not remove the args */
|
pargs.flags= 1|(1<<6); /* do not remove the args, ignore version */
|
||||||
while( arg_parse( &pargs, opts) ) {
|
while( arg_parse( &pargs, opts) ) {
|
||||||
if( pargs.r_opt == 510 || pargs.r_opt == 511 )
|
if( pargs.r_opt == 510 || pargs.r_opt == 511 )
|
||||||
parse_debug++;
|
parse_debug++;
|
||||||
@ -586,6 +588,8 @@ main( int argc, char **argv )
|
|||||||
case 557: opt.compress_keys = 1; break;
|
case 557: opt.compress_keys = 1; break;
|
||||||
case 558: set_cmd( &cmd, aListSecretKeys); break;
|
case 558: set_cmd( &cmd, aListSecretKeys); break;
|
||||||
case 559: opt.always_trust = 1; break;
|
case 559: opt.always_trust = 1; break;
|
||||||
|
case 560: register_cipher_extension(pargs.r.ret_str); break;
|
||||||
|
case 561: opt.rfc1991 = 1; break;
|
||||||
default : errors++; pargs.err = configfp? 1:2; break;
|
default : errors++; pargs.err = configfp? 1:2; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ struct {
|
|||||||
int skip_verify;
|
int skip_verify;
|
||||||
int compress_keys;
|
int compress_keys;
|
||||||
int always_trust;
|
int always_trust;
|
||||||
|
int rfc1991;
|
||||||
} opt;
|
} opt;
|
||||||
|
|
||||||
|
|
||||||
|
16
g10/packet.h
16
g10/packet.h
@ -27,12 +27,6 @@
|
|||||||
#include "cipher.h"
|
#include "cipher.h"
|
||||||
#include "filter.h"
|
#include "filter.h"
|
||||||
|
|
||||||
#ifndef HAVE_RSA_CIPHER
|
|
||||||
/* although we don't have RSA we need these structures to handle keyrings */
|
|
||||||
typedef struct { MPI e, n; } RSA_public_key;
|
|
||||||
typedef struct { MPI e, n, p, q, d, u; } RSA_secret_key;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PKT_NONE =0,
|
PKT_NONE =0,
|
||||||
PKT_PUBKEY_ENC =1, /* public key encrypted packet */
|
PKT_PUBKEY_ENC =1, /* public key encrypted packet */
|
||||||
@ -74,14 +68,8 @@ typedef struct {
|
|||||||
u32 keyid[2]; /* 64 bit keyid */
|
u32 keyid[2]; /* 64 bit keyid */
|
||||||
byte version;
|
byte version;
|
||||||
byte pubkey_algo; /* algorithm used for public key scheme */
|
byte pubkey_algo; /* algorithm used for public key scheme */
|
||||||
union {
|
int mpi_count; /* 1 for rsa, 2 for ELG */
|
||||||
struct {
|
MPI material[2]; /* (ELG needs 2)
|
||||||
MPI a, b; /* integers with the encrypteded DEK */
|
|
||||||
} elg;
|
|
||||||
struct {
|
|
||||||
MPI rsa_integer; /* integer containing the DEK */
|
|
||||||
} rsa;
|
|
||||||
} d;
|
|
||||||
} PKT_pubkey_enc;
|
} PKT_pubkey_enc;
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,10 +46,11 @@ get_session_key( PKT_pubkey_enc *k, DEK *dek )
|
|||||||
u16 csum, csum2;
|
u16 csum, csum2;
|
||||||
PKT_secret_cert *skc = m_alloc_clear( sizeof *skc );
|
PKT_secret_cert *skc = m_alloc_clear( sizeof *skc );
|
||||||
|
|
||||||
#ifndef HAVE_RSA_CIPHER
|
if( is_RSA(k->pubkey_algo) ) /* warn about that */
|
||||||
if( is_RSA(k->pubkey_algo) )
|
|
||||||
write_status(STATUS_RSA_OR_IDEA);
|
write_status(STATUS_RSA_OR_IDEA);
|
||||||
#endif
|
rc=check_pubkey_algo( k->pubkey_algo );
|
||||||
|
if( rc )
|
||||||
|
goto leave;
|
||||||
|
|
||||||
skc->pubkey_algo = k->pubkey_algo; /* we want a pubkey with this algo*/
|
skc->pubkey_algo = k->pubkey_algo; /* we want a pubkey with this algo*/
|
||||||
if( (rc = get_seckey( skc, k->keyid )) )
|
if( (rc = get_seckey( skc, k->keyid )) )
|
||||||
@ -63,7 +64,6 @@ get_session_key( PKT_pubkey_enc *k, DEK *dek )
|
|||||||
plain_dek = mpi_alloc_secure( mpi_get_nlimbs(skc->d.elg.p) );
|
plain_dek = mpi_alloc_secure( mpi_get_nlimbs(skc->d.elg.p) );
|
||||||
elg_decrypt( plain_dek, k->d.elg.a, k->d.elg.b, &skc->d.elg );
|
elg_decrypt( plain_dek, k->d.elg.a, k->d.elg.b, &skc->d.elg );
|
||||||
}
|
}
|
||||||
#ifdef HAVE_RSA_CIPHER
|
|
||||||
else if( is_RSA(k->pubkey_algo) ) {
|
else if( is_RSA(k->pubkey_algo) ) {
|
||||||
if( DBG_CIPHER )
|
if( DBG_CIPHER )
|
||||||
log_mpidump("Encr DEK frame:", k->d.rsa.rsa_integer );
|
log_mpidump("Encr DEK frame:", k->d.rsa.rsa_integer );
|
||||||
@ -71,8 +71,8 @@ get_session_key( PKT_pubkey_enc *k, DEK *dek )
|
|||||||
plain_dek = mpi_alloc_secure( mpi_get_nlimbs(skc->d.rsa.n) );
|
plain_dek = mpi_alloc_secure( mpi_get_nlimbs(skc->d.rsa.n) );
|
||||||
rsa_secret( plain_dek, k->d.rsa.rsa_integer, &skc->d.rsa );
|
rsa_secret( plain_dek, k->d.rsa.rsa_integer, &skc->d.rsa );
|
||||||
}
|
}
|
||||||
#endif/*HAVE_RSA_CIPHER*/
|
|
||||||
else {
|
else {
|
||||||
|
log_info("need some glue code for pubkey algo %d\n", k->pubkey_algo);
|
||||||
rc = G10ERR_PUBKEY_ALGO; /* unsupported algorithm */
|
rc = G10ERR_PUBKEY_ALGO; /* unsupported algorithm */
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||||||
iobuf_push_filter( out, compress_filter, &zfx );
|
iobuf_push_filter( out, compress_filter, &zfx );
|
||||||
|
|
||||||
|
|
||||||
if( !detached ) {
|
if( !detached && !opt.rfc1991 ) {
|
||||||
/* loop over the secret certificates and build headers */
|
/* loop over the secret certificates and build headers */
|
||||||
for( skc_rover = skc_list; skc_rover; skc_rover = skc_rover->next ) {
|
for( skc_rover = skc_list; skc_rover; skc_rover = skc_rover->next ) {
|
||||||
PKT_secret_cert *skc;
|
PKT_secret_cert *skc;
|
||||||
@ -254,6 +254,8 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||||||
* data, it is not possible to know the used length
|
* data, it is not possible to know the used length
|
||||||
* without a double read of the file - to avoid that
|
* without a double read of the file - to avoid that
|
||||||
* we simple use partial length packets.
|
* we simple use partial length packets.
|
||||||
|
* FIXME: We have to do the double read when opt.rfc1991
|
||||||
|
* is active.
|
||||||
*/
|
*/
|
||||||
if( opt.textmode && !outfile )
|
if( opt.textmode && !outfile )
|
||||||
filesize = 0;
|
filesize = 0;
|
||||||
@ -449,9 +451,10 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile )
|
|||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: This stuff is not correct if mutliplehash algos are used*/
|
/* FIXME: This stuff is not correct if mutliple hash algos are used*/
|
||||||
iobuf_writestr(out, "-----BEGIN PGP SIGNED MESSAGE-----\n" );
|
iobuf_writestr(out, "-----BEGIN PGP SIGNED MESSAGE-----\n" );
|
||||||
if( (opt.def_digest_algo?opt.def_digest_algo:DEFAULT_DIGEST_ALGO)
|
if( opt.rfc1991
|
||||||
|
|| (opt.def_digest_algo?opt.def_digest_algo:DEFAULT_DIGEST_ALGO)
|
||||||
== DIGEST_ALGO_MD5 )
|
== DIGEST_ALGO_MD5 )
|
||||||
iobuf_writestr(out, "\n" );
|
iobuf_writestr(out, "\n" );
|
||||||
else {
|
else {
|
||||||
|
@ -86,6 +86,9 @@ struct cipher_handle_s { char does_not_matter[1]; };
|
|||||||
|
|
||||||
int cipher_debug_mode;
|
int cipher_debug_mode;
|
||||||
|
|
||||||
|
/*-- dynload.c --*/
|
||||||
|
void register_cipher_extension( const char *fname );
|
||||||
|
|
||||||
/*-- cipher.c --*/
|
/*-- cipher.c --*/
|
||||||
int string_to_cipher_algo( const char *string );
|
int string_to_cipher_algo( const char *string );
|
||||||
const char * cipher_algo_to_string( int algo );
|
const char * cipher_algo_to_string( int algo );
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
/* mpi.h - Multi Precision Integers
|
/* mpi.h - Multi Precision Integers
|
||||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
* Copyright (C) 1994, 1996, 1998 Free Software Foundation, Inc.
|
||||||
* Copyright (C) 1994, 1996 Free Software Foundation, Inc.
|
|
||||||
*
|
*
|
||||||
* This file is part of G10.
|
* This file is part of GNUPG.
|
||||||
*
|
*
|
||||||
* G10 is free software; you can redistribute it and/or modify
|
* GNUPG is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* G10 is distributed in the hope that it will be useful,
|
* GNUPG is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
@ -101,6 +101,7 @@ const char *strusage( int level );
|
|||||||
|
|
||||||
/*-- fileutil.c --*/
|
/*-- fileutil.c --*/
|
||||||
char *make_filename( const char *first_part, ... );
|
char *make_filename( const char *first_part, ... );
|
||||||
|
int compare_filenames( const char *a, const char *b );
|
||||||
const char *print_fname_stdin( const char *s );
|
const char *print_fname_stdin( const char *s );
|
||||||
const char *print_fname_stdout( const char *s );
|
const char *print_fname_stdout( const char *s );
|
||||||
|
|
||||||
|
@ -64,8 +64,6 @@ target_triplet = @target@
|
|||||||
CATALOGS = @CATALOGS@
|
CATALOGS = @CATALOGS@
|
||||||
CATOBJEXT = @CATOBJEXT@
|
CATOBJEXT = @CATOBJEXT@
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CIPHER_EXTRA_DIST = @CIPHER_EXTRA_DIST@
|
|
||||||
CIPHER_EXTRA_OBJS = @CIPHER_EXTRA_OBJS@
|
|
||||||
CPP = @CPP@
|
CPP = @CPP@
|
||||||
DATADIRNAME = @DATADIRNAME@
|
DATADIRNAME = @DATADIRNAME@
|
||||||
G10_LOCALEDIR = @G10_LOCALEDIR@
|
G10_LOCALEDIR = @G10_LOCALEDIR@
|
||||||
|
@ -64,8 +64,6 @@ target_triplet = @target@
|
|||||||
CATALOGS = @CATALOGS@
|
CATALOGS = @CATALOGS@
|
||||||
CATOBJEXT = @CATOBJEXT@
|
CATOBJEXT = @CATOBJEXT@
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CIPHER_EXTRA_DIST = @CIPHER_EXTRA_DIST@
|
|
||||||
CIPHER_EXTRA_OBJS = @CIPHER_EXTRA_OBJS@
|
|
||||||
CPP = @CPP@
|
CPP = @CPP@
|
||||||
DATADIRNAME = @DATADIRNAME@
|
DATADIRNAME = @DATADIRNAME@
|
||||||
G10_LOCALEDIR = @G10_LOCALEDIR@
|
G10_LOCALEDIR = @G10_LOCALEDIR@
|
||||||
|
BIN
tools/mk-tdata
BIN
tools/mk-tdata
Binary file not shown.
@ -1,3 +1,9 @@
|
|||||||
|
Wed Jun 10 07:39:41 1998 Werner Koch,mobil,,, (wk@tobold)
|
||||||
|
|
||||||
|
* fileutil.c (compare_filenames): New.
|
||||||
|
|
||||||
|
* argparse.c (arg_parse): New flag bit 6 to ignore --version
|
||||||
|
|
||||||
Thu May 14 16:45:13 1998 Werner Koch (wk@isil.d.shuttle.de)
|
Thu May 14 16:45:13 1998 Werner Koch (wk@isil.d.shuttle.de)
|
||||||
|
|
||||||
* argparse.c (show_help): Add some formatting stuff
|
* argparse.c (show_help): Add some formatting stuff
|
||||||
|
@ -64,8 +64,6 @@ target_triplet = @target@
|
|||||||
CATALOGS = @CATALOGS@
|
CATALOGS = @CATALOGS@
|
||||||
CATOBJEXT = @CATOBJEXT@
|
CATOBJEXT = @CATOBJEXT@
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CIPHER_EXTRA_DIST = @CIPHER_EXTRA_DIST@
|
|
||||||
CIPHER_EXTRA_OBJS = @CIPHER_EXTRA_OBJS@
|
|
||||||
CPP = @CPP@
|
CPP = @CPP@
|
||||||
DATADIRNAME = @DATADIRNAME@
|
DATADIRNAME = @DATADIRNAME@
|
||||||
G10_LOCALEDIR = @G10_LOCALEDIR@
|
G10_LOCALEDIR = @G10_LOCALEDIR@
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
* Bit 3 : Do not use -- to stop option processing.
|
* Bit 3 : Do not use -- to stop option processing.
|
||||||
* Bit 4 : Do not skip the first arg.
|
* Bit 4 : Do not skip the first arg.
|
||||||
* Bit 5 : allow usage of long option with only one dash
|
* Bit 5 : allow usage of long option with only one dash
|
||||||
|
* Bit 6 : ignore --version
|
||||||
* all other bits must be set to zero, this value is modified by the function
|
* all other bits must be set to zero, this value is modified by the function
|
||||||
* so assume this is write only.
|
* so assume this is write only.
|
||||||
* Local flags (for each option):
|
* Local flags (for each option):
|
||||||
@ -377,8 +378,10 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
|
|||||||
if( !opts[i].short_opt && !strcmp( "help", s+2) )
|
if( !opts[i].short_opt && !strcmp( "help", s+2) )
|
||||||
show_help(opts, arg->flags);
|
show_help(opts, arg->flags);
|
||||||
else if( !opts[i].short_opt && !strcmp( "version", s+2) ) {
|
else if( !opts[i].short_opt && !strcmp( "version", s+2) ) {
|
||||||
show_version();
|
if( !(arg->flags & (1<<6)) ) {
|
||||||
exit(0);
|
show_version();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if( !opts[i].short_opt && !strcmp( "warranty", s+2) ) {
|
else if( !opts[i].short_opt && !strcmp( "warranty", s+2) ) {
|
||||||
puts( strusage(16) );
|
puts( strusage(16) );
|
||||||
|
@ -65,6 +65,20 @@ make_filename( const char *first_part, ... )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
compare_filenames( const char *a, const char *b )
|
||||||
|
{
|
||||||
|
/* ? check whether this is an absolute filename and
|
||||||
|
* resolve symlinks?
|
||||||
|
*/
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
return stricmp(a,b);
|
||||||
|
#else
|
||||||
|
return strcmp(a,b);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************
|
/****************
|
||||||
* A simple function to decide whether the filename is stdout
|
* A simple function to decide whether the filename is stdout
|
||||||
* or a real filename.
|
* or a real filename.
|
||||||
|
@ -69,8 +69,6 @@ target_triplet = i586-pc-linux-gnu
|
|||||||
CATALOGS = de.gmo it.gmo
|
CATALOGS = de.gmo it.gmo
|
||||||
CATOBJEXT = .gmo
|
CATOBJEXT = .gmo
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CIPHER_EXTRA_DIST = @CIPHER_EXTRA_DIST@
|
|
||||||
CIPHER_EXTRA_OBJS = @CIPHER_EXTRA_OBJS@
|
|
||||||
CPP = gcc -E
|
CPP = gcc -E
|
||||||
DATADIRNAME = share
|
DATADIRNAME = share
|
||||||
G10_LOCALEDIR = /usr/local/share/locale
|
G10_LOCALEDIR = /usr/local/share/locale
|
||||||
|
@ -69,8 +69,6 @@ target_triplet = @target@
|
|||||||
CATALOGS = @CATALOGS@
|
CATALOGS = @CATALOGS@
|
||||||
CATOBJEXT = @CATOBJEXT@
|
CATOBJEXT = @CATOBJEXT@
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CIPHER_EXTRA_DIST = @CIPHER_EXTRA_DIST@
|
|
||||||
CIPHER_EXTRA_OBJS = @CIPHER_EXTRA_OBJS@
|
|
||||||
CPP = @CPP@
|
CPP = @CPP@
|
||||||
DATADIRNAME = @DATADIRNAME@
|
DATADIRNAME = @DATADIRNAME@
|
||||||
G10_LOCALEDIR = @G10_LOCALEDIR@
|
G10_LOCALEDIR = @G10_LOCALEDIR@
|
||||||
|
Loading…
x
Reference in New Issue
Block a user