mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
Fixed creation of private keys under W32.
Minor code cleanups.
This commit is contained in:
parent
f81f521a72
commit
84efbe69c7
@ -1,5 +1,8 @@
|
||||
2007-08-22 Werner Koch <wk@g10code.com>
|
||||
|
||||
* findkey.c (O_BINARY): Make sure it is defined.
|
||||
(agent_write_private_key): Use O_BINARY
|
||||
|
||||
* protect-tool.c (import_p12_file): Add hack to allow importing of
|
||||
gnupg 2.0.4 generated files.
|
||||
|
||||
|
@ -32,6 +32,10 @@
|
||||
|
||||
#include "agent.h"
|
||||
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
/* Helper to pass data to the check callback of the unprotect function. */
|
||||
struct try_unprotect_arg_s {
|
||||
const unsigned char *protected_key;
|
||||
@ -70,8 +74,8 @@ agent_write_private_key (const unsigned char *grip,
|
||||
POSIX (GNU provides the "x" opentype for fopen, however, this is
|
||||
not portable). Thus, we use the more flexible open function and
|
||||
then use fdopen to obtain a stream. */
|
||||
fd = open (fname, force? (O_CREAT | O_TRUNC | O_WRONLY)
|
||||
: (O_CREAT | O_EXCL | O_WRONLY),
|
||||
fd = open (fname, force? (O_CREAT | O_TRUNC | O_WRONLY | O_BINARY)
|
||||
: (O_CREAT | O_EXCL | O_WRONLY | O_BINARY),
|
||||
S_IRUSR | S_IWUSR
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
| S_IRGRP
|
||||
|
@ -71,6 +71,11 @@ void log_error( const char *fmt, ... ) JNLIB_GCC_A_PRINTF(1,2);
|
||||
void log_info( const char *fmt, ... ) JNLIB_GCC_A_PRINTF(1,2);
|
||||
void log_debug( const char *fmt, ... ) JNLIB_GCC_A_PRINTF(1,2);
|
||||
void log_printf( const char *fmt, ... ) JNLIB_GCC_A_PRINTF(1,2);
|
||||
|
||||
/* Print a hexdump of BUFFER. With TEXT passes as NULL print just the
|
||||
raw dump, with TEXT being an empty string, print a trailing
|
||||
linefeed, otherwise print an entire debug line with TEXT followed
|
||||
by the hexdump and a final LF. */
|
||||
void log_printhex (const char *text, const void *buffer, size_t length);
|
||||
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
2007-08-22 Werner Koch <wk@g10code.com>
|
||||
|
||||
* certreqgen.c (create_request): Replace open coding by bin2hex.
|
||||
|
||||
* certreqgen-ui.c (gpgsm_gencertreq_tty): Use es_fopenmem.
|
||||
|
||||
2007-08-21 Werner Koch <wk@g10code.com>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* certreqgen.c - Generate a key and a certification request
|
||||
* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
@ -786,8 +786,7 @@ create_request (ctrl_t ctrl,
|
||||
goto leave;
|
||||
}
|
||||
gcry_sexp_release (s_pkey);
|
||||
for (n=0; n < 20; n++)
|
||||
sprintf (hexgrip+n*2, "%02X", grip[n]);
|
||||
bin2hex (grip, 20, hexgrip);
|
||||
|
||||
if (carddirect)
|
||||
rc = gpgsm_scd_pksign (ctrl, carddirect, NULL,
|
||||
|
Loading…
x
Reference in New Issue
Block a user