Beautify source code.
This commit is contained in:
parent
0a882398e1
commit
d953c7815c
@ -45,7 +45,8 @@ typedef ssize_t (*gpgme_data_write_cb) (gpgme_data_t dh, const void *buffer,
|
||||
/* Set the current position from where the next read or write starts
|
||||
in the data object with the handle DH to OFFSET, relativ to
|
||||
WHENCE. */
|
||||
typedef off_t (*gpgme_data_seek_cb) (gpgme_data_t dh, off_t offset, int whence);
|
||||
typedef off_t (*gpgme_data_seek_cb) (gpgme_data_t dh, off_t offset,
|
||||
int whence);
|
||||
|
||||
/* Release the data object with the handle DH. */
|
||||
typedef void (*gpgme_data_release_cb) (gpgme_data_t dh);
|
||||
@ -111,7 +112,8 @@ struct gpgme_data
|
||||
};
|
||||
|
||||
|
||||
gpgme_error_t _gpgme_data_new (gpgme_data_t *r_dh, struct _gpgme_data_cbs *cbs);
|
||||
gpgme_error_t _gpgme_data_new (gpgme_data_t *r_dh,
|
||||
struct _gpgme_data_cbs *cbs);
|
||||
|
||||
void _gpgme_data_release (gpgme_data_t dh);
|
||||
|
||||
|
@ -27,7 +27,8 @@
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
decrypt_verify_status_handler (void *priv, gpgme_status_code_t code, char *args)
|
||||
decrypt_verify_status_handler (void *priv, gpgme_status_code_t code,
|
||||
char *args)
|
||||
{
|
||||
return _gpgme_decrypt_status_handler (priv, code, args)
|
||||
|| _gpgme_verify_status_handler (priv, code, args);
|
||||
@ -59,9 +60,8 @@ _gpgme_op_decrypt_verify_start (gpgme_ctx_t ctx, int synchronous,
|
||||
|
||||
if (ctx->passphrase_cb)
|
||||
{
|
||||
err = _gpgme_engine_set_command_handler (ctx->engine,
|
||||
_gpgme_passphrase_command_handler,
|
||||
ctx, NULL);
|
||||
err = _gpgme_engine_set_command_handler
|
||||
(ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
@ -76,7 +76,8 @@ _gpgme_op_decrypt_verify_start (gpgme_ctx_t ctx, int synchronous,
|
||||
/* Decrypt ciphertext CIPHER and make a signature verification within
|
||||
CTX and store the resulting plaintext in PLAIN. */
|
||||
gpgme_error_t
|
||||
gpgme_op_decrypt_verify_start (gpgme_ctx_t ctx, gpgme_data_t cipher, gpgme_data_t plain)
|
||||
gpgme_op_decrypt_verify_start (gpgme_ctx_t ctx, gpgme_data_t cipher,
|
||||
gpgme_data_t plain)
|
||||
{
|
||||
return _gpgme_op_decrypt_verify_start (ctx, 0, cipher, plain);
|
||||
}
|
||||
@ -85,7 +86,8 @@ gpgme_op_decrypt_verify_start (gpgme_ctx_t ctx, gpgme_data_t cipher, gpgme_data_
|
||||
/* Decrypt ciphertext CIPHER and make a signature verification within
|
||||
CTX and store the resulting plaintext in PLAIN. */
|
||||
gpgme_error_t
|
||||
gpgme_op_decrypt_verify (gpgme_ctx_t ctx, gpgme_data_t cipher, gpgme_data_t plain)
|
||||
gpgme_op_decrypt_verify (gpgme_ctx_t ctx, gpgme_data_t cipher,
|
||||
gpgme_data_t plain)
|
||||
{
|
||||
gpgme_error_t err = _gpgme_op_decrypt_verify_start (ctx, 1, cipher, plain);
|
||||
if (!err)
|
||||
|
@ -64,7 +64,8 @@ gpgme_op_decrypt_result (gpgme_ctx_t ctx)
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_decrypt_status_handler (void *priv, gpgme_status_code_t code, char *args)
|
||||
_gpgme_decrypt_status_handler (void *priv, gpgme_status_code_t code,
|
||||
char *args)
|
||||
{
|
||||
gpgme_ctx_t ctx = (gpgme_ctx_t) priv;
|
||||
gpgme_error_t err;
|
||||
@ -170,9 +171,8 @@ decrypt_start (gpgme_ctx_t ctx, int synchronous,
|
||||
|
||||
if (ctx->passphrase_cb)
|
||||
{
|
||||
err = _gpgme_engine_set_command_handler (ctx->engine,
|
||||
_gpgme_passphrase_command_handler,
|
||||
ctx, NULL);
|
||||
err = _gpgme_engine_set_command_handler
|
||||
(ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
@ -185,7 +185,8 @@ decrypt_start (gpgme_ctx_t ctx, int synchronous,
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
gpgme_op_decrypt_start (gpgme_ctx_t ctx, gpgme_data_t cipher, gpgme_data_t plain)
|
||||
gpgme_op_decrypt_start (gpgme_ctx_t ctx, gpgme_data_t cipher,
|
||||
gpgme_data_t plain)
|
||||
{
|
||||
return decrypt_start (ctx, 0, cipher, plain);
|
||||
}
|
||||
|
@ -89,7 +89,8 @@ delete_start (gpgme_ctx_t ctx, int synchronous, const gpgme_key_t key,
|
||||
/* Delete KEY from the keyring. If ALLOW_SECRET is non-zero, secret
|
||||
keys are also deleted. */
|
||||
gpgme_error_t
|
||||
gpgme_op_delete_start (gpgme_ctx_t ctx, const gpgme_key_t key, int allow_secret)
|
||||
gpgme_op_delete_start (gpgme_ctx_t ctx, const gpgme_key_t key,
|
||||
int allow_secret)
|
||||
{
|
||||
return delete_start (ctx, 0, key, allow_secret);
|
||||
}
|
||||
|
@ -71,7 +71,8 @@ gpgme_op_encrypt_result (gpgme_ctx_t ctx)
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_encrypt_status_handler (void *priv, gpgme_status_code_t code, char *args)
|
||||
_gpgme_encrypt_status_handler (void *priv, gpgme_status_code_t code,
|
||||
char *args)
|
||||
{
|
||||
gpgme_ctx_t ctx = (gpgme_ctx_t) priv;
|
||||
gpgme_error_t err;
|
||||
@ -159,9 +160,8 @@ encrypt_start (gpgme_ctx_t ctx, int synchronous, gpgme_recipients_t recp,
|
||||
if (symmetric && ctx->passphrase_cb)
|
||||
{
|
||||
/* Symmetric encryption requires a passphrase. */
|
||||
err = _gpgme_engine_set_command_handler (ctx->engine,
|
||||
_gpgme_passphrase_command_handler,
|
||||
ctx, NULL);
|
||||
err = _gpgme_engine_set_command_handler
|
||||
(ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
@ -178,8 +178,8 @@ encrypt_start (gpgme_ctx_t ctx, int synchronous, gpgme_recipients_t recp,
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
gpgme_op_encrypt_start (gpgme_ctx_t ctx, gpgme_recipients_t recp, gpgme_data_t plain,
|
||||
gpgme_data_t cipher)
|
||||
gpgme_op_encrypt_start (gpgme_ctx_t ctx, gpgme_recipients_t recp,
|
||||
gpgme_data_t plain, gpgme_data_t cipher)
|
||||
{
|
||||
return encrypt_start (ctx, 0, recp, plain, cipher);
|
||||
}
|
||||
|
@ -40,19 +40,21 @@ struct engine_ops
|
||||
void (*set_status_handler) (void *engine, EngineStatusHandler fnc,
|
||||
void *fnc_value);
|
||||
gpgme_error_t (*set_command_handler) (void *engine, EngineCommandHandler fnc,
|
||||
void *fnc_value, gpgme_data_t data);
|
||||
void *fnc_value, gpgme_data_t data);
|
||||
gpgme_error_t (*set_colon_line_handler) (void *engine,
|
||||
EngineColonLineHandler fnc,
|
||||
void *fnc_value);
|
||||
gpgme_error_t (*decrypt) (void *engine, gpgme_data_t ciph, gpgme_data_t plain);
|
||||
EngineColonLineHandler fnc,
|
||||
void *fnc_value);
|
||||
gpgme_error_t (*decrypt) (void *engine, gpgme_data_t ciph,
|
||||
gpgme_data_t plain);
|
||||
gpgme_error_t (*delete) (void *engine, gpgme_key_t key, int allow_secret);
|
||||
gpgme_error_t (*edit) (void *engine, gpgme_key_t key, gpgme_data_t out,
|
||||
gpgme_ctx_t ctx /* FIXME */);
|
||||
gpgme_error_t (*encrypt) (void *engine, gpgme_recipients_t recp,
|
||||
gpgme_data_t plain, gpgme_data_t ciph, int use_armor);
|
||||
gpgme_data_t plain, gpgme_data_t ciph,
|
||||
int use_armor);
|
||||
gpgme_error_t (*encrypt_sign) (void *engine, gpgme_recipients_t recp,
|
||||
gpgme_data_t plain, gpgme_data_t ciph,
|
||||
int use_armor, gpgme_ctx_t ctx /* FIXME */);
|
||||
gpgme_data_t plain, gpgme_data_t ciph,
|
||||
int use_armor, gpgme_ctx_t ctx /* FIXME */);
|
||||
gpgme_error_t (*export) (void *engine, gpgme_recipients_t recp,
|
||||
gpgme_data_t keydata, int use_armor);
|
||||
gpgme_error_t (*genkey) (void *engine, gpgme_data_t help_data, int use_armor,
|
||||
@ -61,13 +63,15 @@ struct engine_ops
|
||||
gpgme_error_t (*keylist) (void *engine, const char *pattern,
|
||||
int secret_only, int keylist_mode);
|
||||
gpgme_error_t (*keylist_ext) (void *engine, const char *pattern[],
|
||||
int secret_only, int reserved,
|
||||
int secret_only, int reserved,
|
||||
int keylist_mode);
|
||||
gpgme_error_t (*sign) (void *engine, gpgme_data_t in, gpgme_data_t out,
|
||||
gpgme_sig_mode_t mode, int use_armor, int use_textmode,
|
||||
gpgme_sig_mode_t mode, int use_armor,
|
||||
int use_textmode,
|
||||
int include_certs, gpgme_ctx_t ctx /* FIXME */);
|
||||
gpgme_error_t (*trustlist) (void *engine, const char *pattern);
|
||||
gpgme_error_t (*verify) (void *engine, gpgme_data_t sig, gpgme_data_t signed_text,
|
||||
gpgme_error_t (*verify) (void *engine, gpgme_data_t sig,
|
||||
gpgme_data_t signed_text,
|
||||
gpgme_data_t plaintext);
|
||||
|
||||
void (*set_io_cbs) (void *engine, gpgme_io_cbs_t io_cbs);
|
||||
@ -81,4 +85,3 @@ extern struct engine_ops _gpgme_engine_ops_gpgsm; /* CMS. */
|
||||
#endif
|
||||
|
||||
#endif /* ENGINE_BACKEND_H */
|
||||
|
||||
|
@ -411,8 +411,8 @@ gpgsm_new (void **engine)
|
||||
err = GPGME_Out_Of_Core;
|
||||
goto leave;
|
||||
}
|
||||
err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL);
|
||||
err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
free (optstr);
|
||||
if (err)
|
||||
{
|
||||
@ -428,8 +428,8 @@ gpgsm_new (void **engine)
|
||||
err = GPGME_Out_Of_Core;
|
||||
goto leave;
|
||||
}
|
||||
err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL);
|
||||
err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
free (optstr);
|
||||
if (err)
|
||||
{
|
||||
@ -488,8 +488,8 @@ gpgsm_new (void **engine)
|
||||
err = GPGME_Out_Of_Core;
|
||||
else
|
||||
{
|
||||
err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL);
|
||||
err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL);
|
||||
free (optstr);
|
||||
if (err)
|
||||
err = map_assuan_error (err);
|
||||
@ -541,7 +541,8 @@ gpgsm_new (void **engine)
|
||||
static gpgme_status_code_t parse_status (const char *name);
|
||||
|
||||
static gpgme_error_t
|
||||
gpgsm_assuan_simple_command (ASSUAN_CONTEXT ctx, char *cmd, EngineStatusHandler status_fnc,
|
||||
gpgsm_assuan_simple_command (ASSUAN_CONTEXT ctx, char *cmd,
|
||||
EngineStatusHandler status_fnc,
|
||||
void *status_fnc_value)
|
||||
{
|
||||
AssuanError err;
|
||||
@ -1271,9 +1272,9 @@ gpgsm_keylist_ext (void *engine, const char *pattern[], int secret_only,
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
gpgsm_sign (void *engine, gpgme_data_t in, gpgme_data_t out, gpgme_sig_mode_t mode,
|
||||
int use_armor, int use_textmode, int include_certs,
|
||||
gpgme_ctx_t ctx /* FIXME */)
|
||||
gpgsm_sign (void *engine, gpgme_data_t in, gpgme_data_t out,
|
||||
gpgme_sig_mode_t mode, int use_armor, int use_textmode,
|
||||
int include_certs, gpgme_ctx_t ctx /* FIXME */)
|
||||
{
|
||||
GpgsmObject gpgsm = engine;
|
||||
gpgme_error_t err;
|
||||
|
@ -248,7 +248,8 @@ gpgme_error_t _gpgme_engine_set_colon_line_handler (EngineObject engine,
|
||||
}
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_op_decrypt (EngineObject engine, gpgme_data_t ciph, gpgme_data_t plain)
|
||||
_gpgme_engine_op_decrypt (EngineObject engine, gpgme_data_t ciph,
|
||||
gpgme_data_t plain)
|
||||
{
|
||||
if (!engine)
|
||||
return GPGME_Invalid_Value;
|
||||
@ -260,7 +261,8 @@ _gpgme_engine_op_decrypt (EngineObject engine, gpgme_data_t ciph, gpgme_data_t p
|
||||
}
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_op_delete (EngineObject engine, gpgme_key_t key, int allow_secret)
|
||||
_gpgme_engine_op_delete (EngineObject engine, gpgme_key_t key,
|
||||
int allow_secret)
|
||||
{
|
||||
if (!engine)
|
||||
return GPGME_Invalid_Value;
|
||||
@ -303,8 +305,8 @@ _gpgme_engine_op_encrypt (EngineObject engine, gpgme_recipients_t recp,
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_op_encrypt_sign (EngineObject engine, gpgme_recipients_t recp,
|
||||
gpgme_data_t plain, gpgme_data_t ciph, int use_armor,
|
||||
gpgme_ctx_t ctx /* FIXME */)
|
||||
gpgme_data_t plain, gpgme_data_t ciph,
|
||||
int use_armor, gpgme_ctx_t ctx /* FIXME */)
|
||||
{
|
||||
if (!engine)
|
||||
return GPGME_Invalid_Value;
|
||||
@ -334,7 +336,8 @@ _gpgme_engine_op_export (EngineObject engine, gpgme_recipients_t recp,
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_op_genkey (EngineObject engine, gpgme_data_t help_data,
|
||||
int use_armor, gpgme_data_t pubkey, gpgme_data_t seckey)
|
||||
int use_armor, gpgme_data_t pubkey,
|
||||
gpgme_data_t seckey)
|
||||
{
|
||||
if (!engine)
|
||||
return GPGME_Invalid_Value;
|
||||
|
@ -26,14 +26,17 @@
|
||||
struct engine_object_s;
|
||||
typedef struct engine_object_s *EngineObject;
|
||||
|
||||
typedef gpgme_error_t (*EngineStatusHandler) (void *priv, gpgme_status_code_t code,
|
||||
char *args);
|
||||
typedef gpgme_error_t (*EngineStatusHandler) (void *priv,
|
||||
gpgme_status_code_t code,
|
||||
char *args);
|
||||
typedef gpgme_error_t (*EngineColonLineHandler) (void *priv, char *line);
|
||||
typedef gpgme_error_t (*EngineCommandHandler) (void *priv, gpgme_status_code_t code,
|
||||
const char *keyword,
|
||||
const char **result);
|
||||
typedef gpgme_error_t (*EngineCommandHandler) (void *priv,
|
||||
gpgme_status_code_t code,
|
||||
const char *keyword,
|
||||
const char **result);
|
||||
|
||||
gpgme_error_t _gpgme_engine_new (gpgme_protocol_t proto, EngineObject *r_engine);
|
||||
gpgme_error_t _gpgme_engine_new (gpgme_protocol_t proto,
|
||||
EngineObject *r_engine);
|
||||
void _gpgme_engine_release (EngineObject engine);
|
||||
void _gpgme_engine_set_status_handler (EngineObject engine,
|
||||
EngineStatusHandler fnc,
|
||||
@ -45,44 +48,52 @@ gpgme_error_t _gpgme_engine_set_command_handler (EngineObject engine,
|
||||
gpgme_error_t _gpgme_engine_set_colon_line_handler (EngineObject engine,
|
||||
EngineColonLineHandler fnc,
|
||||
void *fnc_value);
|
||||
gpgme_error_t _gpgme_engine_op_decrypt (EngineObject engine, gpgme_data_t ciph,
|
||||
gpgme_data_t plain);
|
||||
gpgme_error_t _gpgme_engine_op_decrypt (EngineObject engine,
|
||||
gpgme_data_t ciph,
|
||||
gpgme_data_t plain);
|
||||
gpgme_error_t _gpgme_engine_op_delete (EngineObject engine, gpgme_key_t key,
|
||||
int allow_secret);
|
||||
int allow_secret);
|
||||
gpgme_error_t _gpgme_engine_op_edit (EngineObject engine, gpgme_key_t key,
|
||||
gpgme_data_t out, gpgme_ctx_t ctx /* FIXME */);
|
||||
gpgme_error_t _gpgme_engine_op_encrypt (EngineObject engine, gpgme_recipients_t recp,
|
||||
gpgme_data_t plain, gpgme_data_t ciph,
|
||||
int use_armor);
|
||||
gpgme_data_t out,
|
||||
gpgme_ctx_t ctx /* FIXME */);
|
||||
gpgme_error_t _gpgme_engine_op_encrypt (EngineObject engine,
|
||||
gpgme_recipients_t recp,
|
||||
gpgme_data_t plain, gpgme_data_t ciph,
|
||||
int use_armor);
|
||||
gpgme_error_t _gpgme_engine_op_encrypt_sign (EngineObject engine,
|
||||
gpgme_recipients_t recp,
|
||||
gpgme_data_t plain, gpgme_data_t ciph,
|
||||
int use_armor,
|
||||
gpgme_ctx_t ctx /* FIXME */);
|
||||
gpgme_error_t _gpgme_engine_op_export (EngineObject engine, gpgme_recipients_t recp,
|
||||
gpgme_data_t keydata, int use_armor);
|
||||
gpgme_error_t _gpgme_engine_op_genkey (EngineObject engine, gpgme_data_t help_data,
|
||||
int use_armor, gpgme_data_t pubkey,
|
||||
gpgme_data_t seckey);
|
||||
gpgme_error_t _gpgme_engine_op_import (EngineObject engine, gpgme_data_t keydata);
|
||||
gpgme_error_t _gpgme_engine_op_keylist (EngineObject engine, const char *pattern,
|
||||
int secret_only,
|
||||
int keylist_mode);
|
||||
gpgme_recipients_t recp,
|
||||
gpgme_data_t plain,
|
||||
gpgme_data_t ciph,
|
||||
int use_armor,
|
||||
gpgme_ctx_t ctx /* FIXME */);
|
||||
gpgme_error_t _gpgme_engine_op_export (EngineObject engine,
|
||||
gpgme_recipients_t recp,
|
||||
gpgme_data_t keydata, int use_armor);
|
||||
gpgme_error_t _gpgme_engine_op_genkey (EngineObject engine,
|
||||
gpgme_data_t help_data,
|
||||
int use_armor, gpgme_data_t pubkey,
|
||||
gpgme_data_t seckey);
|
||||
gpgme_error_t _gpgme_engine_op_import (EngineObject engine,
|
||||
gpgme_data_t keydata);
|
||||
gpgme_error_t _gpgme_engine_op_keylist (EngineObject engine,
|
||||
const char *pattern,
|
||||
int secret_only,
|
||||
int keylist_mode);
|
||||
gpgme_error_t _gpgme_engine_op_keylist_ext (EngineObject engine,
|
||||
const char *pattern[],
|
||||
int secret_only,
|
||||
int reserved,
|
||||
int keylist_mode);
|
||||
const char *pattern[],
|
||||
int secret_only,
|
||||
int reserved,
|
||||
int keylist_mode);
|
||||
gpgme_error_t _gpgme_engine_op_sign (EngineObject engine, gpgme_data_t in,
|
||||
gpgme_data_t out, gpgme_sig_mode_t mode,
|
||||
int use_armor, int use_textmode,
|
||||
int include_certs,
|
||||
gpgme_ctx_t ctx /* FIXME */);
|
||||
gpgme_data_t out, gpgme_sig_mode_t mode,
|
||||
int use_armor, int use_textmode,
|
||||
int include_certs,
|
||||
gpgme_ctx_t ctx /* FIXME */);
|
||||
gpgme_error_t _gpgme_engine_op_trustlist (EngineObject engine,
|
||||
const char *pattern);
|
||||
const char *pattern);
|
||||
gpgme_error_t _gpgme_engine_op_verify (EngineObject engine, gpgme_data_t sig,
|
||||
gpgme_data_t signed_text,
|
||||
gpgme_data_t plaintext);
|
||||
gpgme_data_t signed_text,
|
||||
gpgme_data_t plaintext);
|
||||
|
||||
void _gpgme_engine_set_io_cbs (EngineObject engine,
|
||||
gpgme_io_cbs_t io_cbs);
|
||||
|
@ -55,7 +55,8 @@ export_start (gpgme_ctx_t ctx, int synchronous,
|
||||
|
||||
/* Export the keys listed in RECP into KEYDATA. */
|
||||
gpgme_error_t
|
||||
gpgme_op_export_start (gpgme_ctx_t ctx, gpgme_recipients_t recp, gpgme_data_t keydata)
|
||||
gpgme_op_export_start (gpgme_ctx_t ctx, gpgme_recipients_t recp,
|
||||
gpgme_data_t keydata)
|
||||
{
|
||||
return export_start (ctx, 0, recp, keydata);
|
||||
}
|
||||
|
@ -300,7 +300,8 @@ gpgme_get_keylist_mode (gpgme_ctx_t ctx)
|
||||
*
|
||||
**/
|
||||
void
|
||||
gpgme_set_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t cb, void *cb_value)
|
||||
gpgme_set_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t cb,
|
||||
void *cb_value)
|
||||
{
|
||||
if (ctx)
|
||||
{
|
||||
@ -320,7 +321,8 @@ gpgme_set_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t cb, void *cb_val
|
||||
* to the crypto engine.
|
||||
**/
|
||||
void
|
||||
gpgme_get_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t *r_cb, void **r_cb_value)
|
||||
gpgme_get_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t *r_cb,
|
||||
void **r_cb_value)
|
||||
{
|
||||
if (ctx)
|
||||
{
|
||||
@ -377,7 +379,8 @@ gpgme_set_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t cb, void *cb_value)
|
||||
* progress indicator.
|
||||
**/
|
||||
void
|
||||
gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *r_cb, void **r_cb_value)
|
||||
gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *r_cb,
|
||||
void **r_cb_value)
|
||||
{
|
||||
if (ctx)
|
||||
{
|
||||
|
@ -630,7 +630,8 @@ get_keysig (gpgme_key_t key, int uid_idx, int idx)
|
||||
|
||||
|
||||
const char *
|
||||
gpgme_key_sig_get_string_attr (gpgme_key_t key, int uid_idx, _gpgme_attr_t what,
|
||||
gpgme_key_sig_get_string_attr (gpgme_key_t key, int uid_idx,
|
||||
_gpgme_attr_t what,
|
||||
const void *reserved, int idx)
|
||||
{
|
||||
gpgme_key_sig_t certsig = get_keysig (key, uid_idx, idx);
|
||||
|
@ -51,7 +51,8 @@ release_op_data (void *hook)
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_passphrase_status_handler (void *priv, gpgme_status_code_t code, char *args)
|
||||
_gpgme_passphrase_status_handler (void *priv, gpgme_status_code_t code,
|
||||
char *args)
|
||||
{
|
||||
gpgme_ctx_t ctx = (gpgme_ctx_t) priv;
|
||||
gpgme_error_t err;
|
||||
|
@ -233,7 +233,8 @@ _gpgme_io_spawn (const char *path, char **argv,
|
||||
if (!duped_stderr)
|
||||
if (dup2 (fd, 2) == -1)
|
||||
{
|
||||
DEBUG1 ("dup2(dev/null, 2) failed: %s\n", strerror (errno));
|
||||
DEBUG1 ("dup2(dev/null, 2) failed: %s\n",
|
||||
strerror (errno));
|
||||
_exit (8);
|
||||
}
|
||||
close (fd);
|
||||
@ -349,7 +350,8 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
|
||||
|
||||
do
|
||||
{
|
||||
count = _gpgme_ath_select (max_fd + 1, &readfds, &writefds, NULL, &timeout);
|
||||
count = _gpgme_ath_select (max_fd + 1, &readfds, &writefds, NULL,
|
||||
&timeout);
|
||||
}
|
||||
while (count < 0 && errno == EINTR);
|
||||
if (count < 0)
|
||||
|
@ -29,7 +29,8 @@
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_progress_status_handler (void *priv, gpgme_status_code_t code, char *args)
|
||||
_gpgme_progress_status_handler (void *priv, gpgme_status_code_t code,
|
||||
char *args)
|
||||
{
|
||||
gpgme_ctx_t ctx = (gpgme_ctx_t) priv;
|
||||
char *p;
|
||||
|
@ -1241,7 +1241,8 @@ append_args_from_signers (GpgObject gpg, gpgme_ctx_t ctx /* FIXME */)
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
gpg_edit (void *engine, gpgme_key_t key, gpgme_data_t out, gpgme_ctx_t ctx /* FIXME */)
|
||||
gpg_edit (void *engine, gpgme_key_t key, gpgme_data_t out,
|
||||
gpgme_ctx_t ctx /* FIXME */)
|
||||
{
|
||||
GpgObject gpg = engine;
|
||||
gpgme_error_t err;
|
||||
@ -1334,7 +1335,8 @@ gpg_encrypt (void *engine, gpgme_recipients_t recp, gpgme_data_t plain,
|
||||
|
||||
static gpgme_error_t
|
||||
gpg_encrypt_sign (void *engine, gpgme_recipients_t recp, gpgme_data_t plain,
|
||||
gpgme_data_t ciph, int use_armor, gpgme_ctx_t ctx /* FIXME */)
|
||||
gpgme_data_t ciph, int use_armor,
|
||||
gpgme_ctx_t ctx /* FIXME */)
|
||||
{
|
||||
GpgObject gpg = engine;
|
||||
gpgme_error_t err;
|
||||
@ -1527,9 +1529,9 @@ gpg_keylist_ext (void *engine, const char *pattern[], int secret_only,
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
gpg_sign (void *engine, gpgme_data_t in, gpgme_data_t out, gpgme_sig_mode_t mode,
|
||||
int use_armor, int use_textmode, int include_certs,
|
||||
gpgme_ctx_t ctx /* FIXME */)
|
||||
gpg_sign (void *engine, gpgme_data_t in, gpgme_data_t out,
|
||||
gpgme_sig_mode_t mode, int use_armor, int use_textmode,
|
||||
int include_certs, gpgme_ctx_t ctx /* FIXME */)
|
||||
{
|
||||
GpgObject gpg = engine;
|
||||
gpgme_error_t err;
|
||||
|
95
gpgme/sema.h
95
gpgme/sema.h
@ -1,63 +1,66 @@
|
||||
/* sema.h - definitions for semaphores
|
||||
* Copyright (C) 2001 Werner Koch (dd9jn)
|
||||
* Copyright (C) 2001 g10 Code GmbH
|
||||
*
|
||||
* This file is part of GPGME.
|
||||
*
|
||||
* GPGME 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.
|
||||
*
|
||||
* GPGME 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
|
||||
*/
|
||||
/* sema.h - Definitions for semaphores.
|
||||
Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
Copyright (C) 2001, 2003 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME 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.
|
||||
|
||||
GPGME 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 GPGME; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef SEMA_H
|
||||
#define SEMA_H
|
||||
|
||||
struct critsect_s {
|
||||
const char *name;
|
||||
void *private;
|
||||
struct critsect_s
|
||||
{
|
||||
const char *name;
|
||||
void *private;
|
||||
};
|
||||
|
||||
#define DEFINE_GLOBAL_LOCK(name) \
|
||||
struct critsect_s name = { #name, NULL }
|
||||
struct critsect_s name = { #name, NULL }
|
||||
#define DEFINE_STATIC_LOCK(name) \
|
||||
static struct critsect_s name = { #name, NULL }
|
||||
static struct critsect_s name = { #name, NULL }
|
||||
|
||||
#define DECLARE_LOCK(name) struct critsect_s name
|
||||
#define INIT_LOCK(a) do { \
|
||||
(a).name = #a; \
|
||||
(a).private = NULL; \
|
||||
} while (0)
|
||||
#define DECLARE_LOCK(name) \
|
||||
struct critsect_s name
|
||||
#define INIT_LOCK(a) \
|
||||
do \
|
||||
{ \
|
||||
(a).name = #a; \
|
||||
(a).private = NULL; \
|
||||
} \
|
||||
while (0)
|
||||
#define DESTROY_LOCK(name) _gpgme_sema_cs_destroy (&(name))
|
||||
|
||||
|
||||
#define LOCK(name) do { \
|
||||
_gpgme_sema_cs_enter ( &(name) );\
|
||||
} while (0)
|
||||
|
||||
#define UNLOCK(name) do { \
|
||||
_gpgme_sema_cs_leave ( &(name) );\
|
||||
} while (0)
|
||||
#define LOCK(name) \
|
||||
do \
|
||||
{ \
|
||||
_gpgme_sema_cs_enter (&(name)); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define UNLOCK(name) \
|
||||
do \
|
||||
{ \
|
||||
_gpgme_sema_cs_leave (&(name)); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
void _gpgme_sema_subsystem_init (void);
|
||||
void _gpgme_sema_cs_enter ( struct critsect_s *s );
|
||||
void _gpgme_sema_cs_leave ( struct critsect_s *s );
|
||||
void _gpgme_sema_cs_destroy ( struct critsect_s *s );
|
||||
|
||||
void _gpgme_sema_cs_enter (struct critsect_s *s);
|
||||
void _gpgme_sema_cs_leave (struct critsect_s *s);
|
||||
void _gpgme_sema_cs_destroy (struct critsect_s *s);
|
||||
|
||||
#endif /* SEMA_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
12
gpgme/sign.c
12
gpgme/sign.c
@ -244,8 +244,8 @@ _gpgme_op_sign_init_result (gpgme_ctx_t ctx)
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
sign_start (gpgme_ctx_t ctx, int synchronous, gpgme_data_t plain, gpgme_data_t sig,
|
||||
gpgme_sig_mode_t mode)
|
||||
sign_start (gpgme_ctx_t ctx, int synchronous, gpgme_data_t plain,
|
||||
gpgme_data_t sig, gpgme_sig_mode_t mode)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
|
||||
@ -268,9 +268,8 @@ sign_start (gpgme_ctx_t ctx, int synchronous, gpgme_data_t plain, gpgme_data_t s
|
||||
|
||||
if (ctx->passphrase_cb)
|
||||
{
|
||||
err = _gpgme_engine_set_command_handler (ctx->engine,
|
||||
_gpgme_passphrase_command_handler,
|
||||
ctx, NULL);
|
||||
err = _gpgme_engine_set_command_handler
|
||||
(ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
@ -295,7 +294,8 @@ gpgme_op_sign_start (gpgme_ctx_t ctx, gpgme_data_t plain, gpgme_data_t sig,
|
||||
|
||||
/* Sign the plaintext PLAIN and store the signature in SIG. */
|
||||
gpgme_error_t
|
||||
gpgme_op_sign (gpgme_ctx_t ctx, gpgme_data_t plain, gpgme_data_t sig, gpgme_sig_mode_t mode)
|
||||
gpgme_op_sign (gpgme_ctx_t ctx, gpgme_data_t plain, gpgme_data_t sig,
|
||||
gpgme_sig_mode_t mode)
|
||||
{
|
||||
gpgme_error_t err = sign_start (ctx, 1, plain, sig, mode);
|
||||
if (!err)
|
||||
|
@ -121,7 +121,8 @@ trustlist_colon_handler (void *priv, char *line)
|
||||
|
||||
|
||||
void
|
||||
_gpgme_op_trustlist_event_cb (void *data, gpgme_event_io_t type, void *type_data)
|
||||
_gpgme_op_trustlist_event_cb (void *data, gpgme_event_io_t type,
|
||||
void *type_data)
|
||||
{
|
||||
gpgme_ctx_t ctx = (gpgme_ctx_t) data;
|
||||
gpgme_error_t err;
|
||||
|
@ -544,8 +544,8 @@ _gpgme_op_verify_start (gpgme_ctx_t ctx, int synchronous, gpgme_data_t sig,
|
||||
/* Decrypt ciphertext CIPHER and make a signature verification within
|
||||
CTX and store the resulting plaintext in PLAIN. */
|
||||
gpgme_error_t
|
||||
gpgme_op_verify_start (gpgme_ctx_t ctx, gpgme_data_t sig, gpgme_data_t signed_text,
|
||||
gpgme_data_t plaintext)
|
||||
gpgme_op_verify_start (gpgme_ctx_t ctx, gpgme_data_t sig,
|
||||
gpgme_data_t signed_text, gpgme_data_t plaintext)
|
||||
{
|
||||
return _gpgme_op_verify_start (ctx, 0, sig, signed_text, plaintext);
|
||||
}
|
||||
|
@ -38,12 +38,10 @@
|
||||
#include "io.h"
|
||||
|
||||
|
||||
/*
|
||||
* We assume that a HANDLE can be represented by an int which should be true
|
||||
* for all i386 systems (HANDLE is defined as void *) and these are the only
|
||||
* systems for which Windows is available.
|
||||
* Further we assume that -1 denotes an invalid handle.
|
||||
*/
|
||||
/* We assume that a HANDLE can be represented by an int which should
|
||||
be true for all i386 systems (HANDLE is defined as void *) and
|
||||
these are the only systems for which Windows is available. Further
|
||||
we assume that -1 denotes an invalid handle. */
|
||||
|
||||
#define fd_to_handle(a) ((HANDLE)(a))
|
||||
#define handle_to_fd(a) ((int)(a))
|
||||
|
@ -52,9 +52,9 @@ critsect_init (struct critsect_s *s)
|
||||
static int initialized;
|
||||
|
||||
if (!initialized) {
|
||||
/* the very first time we call this function, we assume that only
|
||||
* one thread is running, so that we can bootstrap the semaphore code
|
||||
*/
|
||||
/* The very first time we call this function, we assume that
|
||||
only one thread is running, so that we can bootstrap the
|
||||
semaphore code. */
|
||||
InitializeCriticalSection (&init_lock);
|
||||
initialized = 1;
|
||||
}
|
||||
@ -99,7 +99,7 @@ _gpgme_sema_cs_leave (struct critsect_s *s)
|
||||
{
|
||||
if (!s->private)
|
||||
critsect_init (s);
|
||||
LeaveCriticalSection ( (CRITICAL_SECTION*)s->private );
|
||||
LeaveCriticalSection ((CRITICAL_SECTION*)s->private);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -184,7 +184,8 @@ ctx_wait (gpgme_ctx_t ctx, gpgme_error_t *status)
|
||||
event loops. */
|
||||
|
||||
void
|
||||
_gpgme_wait_global_event_cb (void *data, gpgme_event_io_t type, void *type_data)
|
||||
_gpgme_wait_global_event_cb (void *data, gpgme_event_io_t type,
|
||||
void *type_data)
|
||||
{
|
||||
gpgme_ctx_t ctx = (gpgme_ctx_t) data;
|
||||
|
||||
@ -315,7 +316,8 @@ gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang)
|
||||
for (idx = 0; idx < ictx->fdt.size; idx++)
|
||||
if (ictx->fdt.fds[idx].fd != -1)
|
||||
_gpgme_io_close (ictx->fdt.fds[idx].fd);
|
||||
_gpgme_engine_io_event (ictx->engine, GPGME_EVENT_DONE, &err);
|
||||
_gpgme_engine_io_event (ictx->engine, GPGME_EVENT_DONE,
|
||||
&err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,8 @@
|
||||
event loops. */
|
||||
|
||||
void
|
||||
_gpgme_wait_private_event_cb (void *data, gpgme_event_io_t type, void *type_data)
|
||||
_gpgme_wait_private_event_cb (void *data, gpgme_event_io_t type,
|
||||
void *type_data)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
@ -62,14 +62,17 @@ void _gpgme_fd_table_deinit (fd_table_t fdt);
|
||||
gpgme_error_t _gpgme_add_io_cb (void *data, int fd, int dir,
|
||||
gpgme_io_cb_t fnc, void *fnc_data, void **r_tag);
|
||||
void _gpgme_remove_io_cb (void *tag);
|
||||
void _gpgme_wait_private_event_cb (void *data, gpgme_event_io_t type, void *type_data);
|
||||
void _gpgme_wait_global_event_cb (void *data, gpgme_event_io_t type, void *type_data);
|
||||
void _gpgme_wait_private_event_cb (void *data, gpgme_event_io_t type,
|
||||
void *type_data);
|
||||
void _gpgme_wait_global_event_cb (void *data, gpgme_event_io_t type,
|
||||
void *type_data);
|
||||
|
||||
gpgme_error_t _gpgme_wait_user_add_io_cb (void *data, int fd, int dir,
|
||||
gpgme_io_cb_t fnc, void *fnc_data,
|
||||
void **r_tag);
|
||||
void _gpgme_wait_user_remove_io_cb (void *tag);
|
||||
void _gpgme_wait_user_event_cb (void *data, gpgme_event_io_t type, void *type_data);
|
||||
void _gpgme_wait_user_event_cb (void *data, gpgme_event_io_t type,
|
||||
void *type_data);
|
||||
|
||||
gpgme_error_t _gpgme_wait_one (gpgme_ctx_t ctx);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user