Reanmed public functions

This commit is contained in:
Werner Koch 2000-11-13 13:25:22 +00:00
parent f14941f072
commit e047a8a263
15 changed files with 129 additions and 148 deletions

View File

@ -77,13 +77,15 @@ struct gpgme_data_s {
char *private_buffer; char *private_buffer;
}; };
struct recipient_s { struct user_id_s {
struct recipient_s *next; struct user_id_s *next;
int validity; /* 0 = undefined, 1 = not, 2 = marginal,
3 = full, 4 = ultimate */
char name[1]; char name[1];
}; };
struct gpgme_recipient_set_s { struct gpgme_recipients_s {
struct recipient_s *list; struct user_id_s *list;
int checked; /* wether the recipients are all valid */ int checked; /* wether the recipients are all valid */
}; };

View File

@ -31,7 +31,7 @@
/** /**
* gpgme_new_data: * gpgme_data_new:
* @r_dh: Returns a new data object. * @r_dh: Returns a new data object.
* @buffer: If not NULL, used to initialize the data object. * @buffer: If not NULL, used to initialize the data object.
* @size: Size of the buffer * @size: Size of the buffer
@ -46,7 +46,7 @@
* Return value: * Return value:
**/ **/
GpgmeError GpgmeError
gpgme_new_data ( GpgmeData *r_dh, const char *buffer, size_t size, int copy ) gpgme_data_new ( GpgmeData *r_dh, const char *buffer, size_t size, int copy )
{ {
GpgmeData dh; GpgmeData dh;
@ -78,14 +78,14 @@ gpgme_new_data ( GpgmeData *r_dh, const char *buffer, size_t size, int copy )
} }
/** /**
* gpgme_release_data: * gpgme_data_release:
* @dh: Data object * @dh: Data object
* *
* Release the data object @dh. @dh may be NULL in which case nothing * Release the data object @dh. @dh may be NULL in which case nothing
* happens. * happens.
**/ **/
void void
gpgme_release_data ( GpgmeData dh ) gpgme_data_release ( GpgmeData dh )
{ {
if (dh) { if (dh) {
xfree (dh->private_buffer); xfree (dh->private_buffer);
@ -95,7 +95,7 @@ gpgme_release_data ( GpgmeData dh )
GpgmeDataType GpgmeDataType
gpgme_query_data_type ( GpgmeData dh ) gpgme_data_get_type ( GpgmeData dh )
{ {
if ( !dh || !dh->data ) if ( !dh || !dh->data )
return GPGME_DATA_TYPE_NONE; return GPGME_DATA_TYPE_NONE;
@ -104,7 +104,7 @@ gpgme_query_data_type ( GpgmeData dh )
} }
void void
_gpgme_set_data_mode ( GpgmeData dh, GpgmeDataMode mode ) _gpgme_data_set_mode ( GpgmeData dh, GpgmeDataMode mode )
{ {
assert (dh); assert (dh);
dh->mode = mode; dh->mode = mode;
@ -112,14 +112,14 @@ _gpgme_set_data_mode ( GpgmeData dh, GpgmeDataMode mode )
GpgmeDataMode GpgmeDataMode
_gpgme_query_data_mode ( GpgmeData dh ) _gpgme_data_get_mode ( GpgmeData dh )
{ {
assert (dh); assert (dh);
return dh->mode; return dh->mode;
} }
GpgmeError GpgmeError
gpgme_rewind_data ( GpgmeData dh ) gpgme_data_rewind ( GpgmeData dh )
{ {
if ( !dh ) if ( !dh )
return mk_error (Invalid_Value); return mk_error (Invalid_Value);
@ -130,7 +130,7 @@ gpgme_rewind_data ( GpgmeData dh )
} }
GpgmeError GpgmeError
gpgme_read_data ( GpgmeData dh, char *buffer, size_t length, size_t *nread ) gpgme_data_read ( GpgmeData dh, char *buffer, size_t length, size_t *nread )
{ {
size_t nbytes; size_t nbytes;
@ -151,7 +151,7 @@ gpgme_read_data ( GpgmeData dh, char *buffer, size_t length, size_t *nread )
GpgmeError GpgmeError
_gpgme_append_data ( GpgmeData dh, const char *buffer, size_t length ) _gpgme_data_append ( GpgmeData dh, const char *buffer, size_t length )
{ {
assert (dh); assert (dh);

View File

@ -39,8 +39,8 @@ encrypt_status_handler ( GpgmeCtx ctx, GpgStatusCode code, char *args )
GpgmeError GpgmeError
gpgme_start_encrypt ( GpgmeCtx c, GpgmeRecipientSet recp, gpgme_op_encrypt_start ( GpgmeCtx c, GpgmeRecipients recp,
GpgmeData plain, GpgmeData ciph ) GpgmeData plain, GpgmeData ciph )
{ {
int rc = 0; int rc = 0;
int i; int i;
@ -50,14 +50,14 @@ gpgme_start_encrypt ( GpgmeCtx c, GpgmeRecipientSet recp,
/* do some checks */ /* do some checks */
assert ( !c->gpg ); assert ( !c->gpg );
if ( !gpgme_count_recipients ( recp ) ) { if ( !gpgme_recipients_count ( recp ) ) {
/* Fixme: In this case we should do symmentric encryption */ /* Fixme: In this case we should do symmentric encryption */
rc = mk_error (No_Recipients); rc = mk_error (No_Recipients);
goto leave; goto leave;
} }
/* create a process object */ /* create a process object */
rc = _gpgme_gpg_new_object ( &c->gpg ); rc = _gpgme_gpg_new ( &c->gpg );
if (rc) if (rc)
goto leave; goto leave;
@ -73,16 +73,16 @@ gpgme_start_encrypt ( GpgmeCtx c, GpgmeRecipientSet recp,
_gpgme_append_gpg_args_from_recipients ( recp, c->gpg ); _gpgme_append_gpg_args_from_recipients ( recp, c->gpg );
/* Check the supplied data */ /* Check the supplied data */
if ( gpgme_query_data_type (plain) == GPGME_DATA_TYPE_NONE ) { if ( gpgme_data_get_type (plain) == GPGME_DATA_TYPE_NONE ) {
rc = mk_error (No_Data); rc = mk_error (No_Data);
goto leave; goto leave;
} }
_gpgme_set_data_mode (plain, GPGME_DATA_MODE_OUT ); _gpgme_data_set_mode (plain, GPGME_DATA_MODE_OUT );
if ( !ciph || gpgme_query_data_type (ciph) != GPGME_DATA_TYPE_NONE ) { if ( !ciph || gpgme_data_get_type (ciph) != GPGME_DATA_TYPE_NONE ) {
rc = mk_error (Invalid_Value); rc = mk_error (Invalid_Value);
goto leave; goto leave;
} }
_gpgme_set_data_mode (ciph, GPGME_DATA_MODE_IN ); _gpgme_data_set_mode (ciph, GPGME_DATA_MODE_IN );
/* Tell the gpg object about the data */ /* Tell the gpg object about the data */
_gpgme_gpg_add_arg ( c->gpg, "--output" ); _gpgme_gpg_add_arg ( c->gpg, "--output" );
_gpgme_gpg_add_arg ( c->gpg, "-" ); _gpgme_gpg_add_arg ( c->gpg, "-" );
@ -96,14 +96,14 @@ gpgme_start_encrypt ( GpgmeCtx c, GpgmeRecipientSet recp,
leave: leave:
if (rc) { if (rc) {
c->pending = 0; c->pending = 0;
_gpgme_gpg_release_object ( c->gpg ); c->gpg = NULL; _gpgme_gpg_release ( c->gpg ); c->gpg = NULL;
} }
return rc; return rc;
} }
/** /**
* gpgme_encrypt: * gpgme_op_encrypt:
* @c: The context * @c: The context
* @recp: A set of recipients * @recp: A set of recipients
* @in: plaintext input * @in: plaintext input
@ -116,10 +116,10 @@ gpgme_start_encrypt ( GpgmeCtx c, GpgmeRecipientSet recp,
* Return value: 0 on success or an errorcode. * Return value: 0 on success or an errorcode.
**/ **/
GpgmeError GpgmeError
gpgme_encrypt ( GpgmeCtx c, GpgmeRecipientSet recp, gpgme_op_encrypt ( GpgmeCtx c, GpgmeRecipients recp,
GpgmeData in, GpgmeData out ) GpgmeData in, GpgmeData out )
{ {
int rc = gpgme_start_encrypt ( c, recp, in, out ); int rc = gpgme_op_encrypt_start ( c, recp, in, out );
if ( !rc ) { if ( !rc ) {
gpgme_wait (c, 1); gpgme_wait (c, 1);
c->pending = 0; c->pending = 0;

View File

@ -27,7 +27,7 @@
#include "ops.h" #include "ops.h"
/** /**
* gpgme_new_context: * gpgme_new:
* @r_ctx: Returns the new context * @r_ctx: Returns the new context
* *
* Create a new context to be used with most of the other GPGME * Create a new context to be used with most of the other GPGME
@ -36,7 +36,7 @@
* Return value: An error code * Return value: An error code
**/ **/
GpgmeError GpgmeError
gpgme_new_context (GpgmeCtx *r_ctx) gpgme_new (GpgmeCtx *r_ctx)
{ {
GpgmeCtx c; GpgmeCtx c;
@ -50,16 +50,16 @@ gpgme_new_context (GpgmeCtx *r_ctx)
} }
/** /**
* gpgme_release_contect: * gpgme_release:
* @c: Context to be released. * @c: Context to be released.
* *
* Release all resources associated with the given context. * Release all resources associated with the given context.
**/ **/
void void
gpgme_release_context ( GpgmeCtx c ) gpgme_release ( GpgmeCtx c )
{ {
_gpgme_gpg_release_object ( c->gpg ); _gpgme_gpg_release ( c->gpg );
_gpgme_release_result ( c ); _gpgme_release_result ( c );
_gpgme_key_release ( c->tmp_key ); _gpgme_key_release ( c->tmp_key );
/* fixme: release the key_queue */ /* fixme: release the key_queue */
@ -92,15 +92,6 @@ _gpgme_release_result ( GpgmeCtx c )

View File

@ -33,8 +33,8 @@ typedef struct gpgme_context_s *GpgmeCtx;
struct gpgme_data_s; struct gpgme_data_s;
typedef struct gpgme_data_s *GpgmeData; typedef struct gpgme_data_s *GpgmeData;
struct gpgme_recipient_set_s; struct gpgme_recipients_s;
typedef struct gpgme_recipient_set_s *GpgmeRecipientSet; typedef struct gpgme_recipients_s *GpgmeRecipients;
struct gpgme_key_s; struct gpgme_key_s;
typedef struct gpgme_key_s *GpgmeKey; typedef struct gpgme_key_s *GpgmeKey;
@ -70,47 +70,45 @@ typedef enum {
/* Context management */ /* Context management */
GpgmeError gpgme_new_context (GpgmeCtx *r_ctx); GpgmeError gpgme_new (GpgmeCtx *r_ctx);
void gpgme_release_context ( GpgmeCtx c ); void gpgme_release ( GpgmeCtx c );
GpgmeCtx gpgme_wait ( GpgmeCtx c, int hang ); GpgmeCtx gpgme_wait ( GpgmeCtx c, int hang );
/* Functions to handle recipients */ /* Functions to handle recipients */
GpgmeError gpgme_new_recipient_set (GpgmeRecipientSet *r_rset); GpgmeError gpgme_recipients_new (GpgmeRecipients *r_rset);
void gpgme_release_recipient_set ( GpgmeRecipientSet rset); void gpgme_recipients_release ( GpgmeRecipients rset);
GpgmeError gpgme_add_recipient (GpgmeRecipientSet rset, const char *name); GpgmeError gpgme_recipients_add_name (GpgmeRecipients rset,
unsigned int gpgme_count_recipients ( const GpgmeRecipientSet rset ); const char *name);
unsigned int gpgme_recipients_count ( const GpgmeRecipients rset );
/* Functions to handle data sources */ /* Functions to handle data sources */
GpgmeError gpgme_new_data ( GpgmeData *r_dh, GpgmeError gpgme_data_new ( GpgmeData *r_dh,
const char *buffer, size_t size, int copy ); const char *buffer, size_t size, int copy );
void gpgme_release_data ( GpgmeData dh ); void gpgme_data_release ( GpgmeData dh );
GpgmeDataType gpgme_query_data_type ( GpgmeData dh ); GpgmeDataType gpgme_data_get_type ( GpgmeData dh );
GpgmeError gpgme_rewind_data ( GpgmeData dh ); GpgmeError gpgme_data_rewind ( GpgmeData dh );
GpgmeError gpgme_read_data ( GpgmeData dh, GpgmeError gpgme_data_read ( GpgmeData dh,
char *buffer, size_t length, size_t *nread ); char *buffer, size_t length, size_t *nread );
/* Basic GnuPG functions */ /* Basic GnuPG functions */
GpgmeError gpgme_start_encrypt ( GpgmeCtx c, GpgmeRecipientSet recp, GpgmeError gpgme_op_encrypt_start ( GpgmeCtx c, GpgmeRecipients recp,
GpgmeData in, GpgmeData out ); GpgmeData in, GpgmeData out );
GpgmeError gpgme_start_verify ( GpgmeCtx c, GpgmeData sig, GpgmeData text ); GpgmeError gpgme_op_verify_start ( GpgmeCtx c,
GpgmeData sig, GpgmeData text );
/* Key management functions */ /* Key management functions */
GpgmeError gpgme_keylist_start ( GpgmeCtx c, GpgmeError gpgme_op_keylist_start ( GpgmeCtx c,
const char *pattern, int secret_only ); const char *pattern, int secret_only );
GpgmeError gpgme_keylist_next ( GpgmeCtx c, GpgmeKey *r_key ); GpgmeError gpgme_op_keylist_next ( GpgmeCtx c, GpgmeKey *r_key );
/* Convenience functions for syncronous usage */ /* Convenience functions for syncronous usage */
GpgmeError gpgme_encrypt ( GpgmeCtx c, GpgmeRecipientSet recp, GpgmeError gpgme_op_encrypt ( GpgmeCtx c, GpgmeRecipients recp,
GpgmeData in, GpgmeData out ); GpgmeData in, GpgmeData out );
GpgmeError gpgme_verify ( GpgmeCtx c, GpgmeData sig, GpgmeData text ); GpgmeError gpgme_op_verify ( GpgmeCtx c, GpgmeData sig, GpgmeData text );
/* miscellaneous functions */ /* miscellaneous functions */

View File

@ -23,13 +23,8 @@
#include <time.h> #include <time.h>
#include "types.h" #include "types.h"
#include "context.h"
struct user_id_s {
struct user_id_s *next;
int validity; /* 0 = undefined, 1 = not, 2 = marginal,
3 = full, 4 = ultimate */
char name[1];
};
struct gpgme_key_s { struct gpgme_key_s {
struct { struct {

View File

@ -287,7 +287,7 @@ finish_key ( GpgmeCtx ctx )
GpgmeError GpgmeError
gpgme_keylist_start ( GpgmeCtx c, const char *pattern, int secret_only ) gpgme_op_keylist_start ( GpgmeCtx c, const char *pattern, int secret_only )
{ {
GpgmeError rc = 0; GpgmeError rc = 0;
int i; int i;
@ -299,14 +299,14 @@ gpgme_keylist_start ( GpgmeCtx c, const char *pattern, int secret_only )
c->out_of_core = 0; c->out_of_core = 0;
if ( c->gpg ) { if ( c->gpg ) {
_gpgme_gpg_release_object ( c->gpg ); _gpgme_gpg_release ( c->gpg );
c->gpg = NULL; c->gpg = NULL;
} }
_gpgme_key_release (c->tmp_key); _gpgme_key_release (c->tmp_key);
c->tmp_key = NULL; c->tmp_key = NULL;
/* Fixme: release key_queue */ /* Fixme: release key_queue */
rc = _gpgme_gpg_new_object ( &c->gpg ); rc = _gpgme_gpg_new ( &c->gpg );
if (rc) if (rc)
goto leave; goto leave;
@ -336,14 +336,14 @@ gpgme_keylist_start ( GpgmeCtx c, const char *pattern, int secret_only )
leave: leave:
if (rc) { if (rc) {
c->pending = 0; c->pending = 0;
_gpgme_gpg_release_object ( c->gpg ); c->gpg = NULL; _gpgme_gpg_release ( c->gpg ); c->gpg = NULL;
} }
return rc; return rc;
} }
GpgmeError GpgmeError
gpgme_keylist_next ( GpgmeCtx c, GpgmeKey *r_key ) gpgme_op_keylist_next ( GpgmeCtx c, GpgmeKey *r_key )
{ {
struct key_queue_item_s *q; struct key_queue_item_s *q;

View File

@ -33,14 +33,14 @@ GpgmeCtx _gpgme_wait_on_condition ( GpgmeCtx c,
/*-- recipient.c --*/ /*-- recipient.c --*/
void _gpgme_append_gpg_args_from_recipients ( void _gpgme_append_gpg_args_from_recipients (
const GpgmeRecipientSet rset, const GpgmeRecipients rset,
GpgObject gpg ); GpgObject gpg );
/*-- data.c --*/ /*-- data.c --*/
GpgmeDataMode _gpgme_query_data_mode ( GpgmeData dh ); GpgmeDataMode _gpgme_data_get_mode ( GpgmeData dh );
void _gpgme_set_data_mode ( GpgmeData dh, GpgmeDataMode mode ); void _gpgme_data_set_mode ( GpgmeData dh, GpgmeDataMode mode );
GpgmeError _gpgme_append_data ( GpgmeData dh, GpgmeError _gpgme_data_append ( GpgmeData dh,
const char *buffer, size_t length ); const char *buffer, size_t length );
/*-- key.c --*/ /*-- key.c --*/

View File

@ -28,9 +28,9 @@
#include "rungpg.h" #include "rungpg.h"
GpgmeError GpgmeError
gpgme_new_recipient_set (GpgmeRecipientSet *r_rset) gpgme_recipients_new (GpgmeRecipients *r_rset)
{ {
GpgmeRecipientSet rset; GpgmeRecipients rset;
rset = xtrycalloc ( 1, sizeof *rset ); rset = xtrycalloc ( 1, sizeof *rset );
if (!rset) if (!rset)
@ -40,7 +40,7 @@ gpgme_new_recipient_set (GpgmeRecipientSet *r_rset)
} }
void void
gpgme_release_recipient_set ( GpgmeRecipientSet rset ) gpgme_recipients_release ( GpgmeRecipients rset )
{ {
/* fixme: release the linked list */ /* fixme: release the linked list */
xfree ( rset ); xfree ( rset );
@ -48,9 +48,9 @@ gpgme_release_recipient_set ( GpgmeRecipientSet rset )
GpgmeError GpgmeError
gpgme_add_recipient (GpgmeRecipientSet rset, const char *name ) gpgme_recipients_add_name (GpgmeRecipients rset, const char *name )
{ {
struct recipient_s *r; struct user_id_s *r;
if (!name || !rset ) if (!name || !rset )
return mk_error (Invalid_Value); return mk_error (Invalid_Value);
@ -64,9 +64,9 @@ gpgme_add_recipient (GpgmeRecipientSet rset, const char *name )
} }
unsigned int unsigned int
gpgme_count_recipients ( const GpgmeRecipientSet rset ) gpgme_recipients_count ( const GpgmeRecipients rset )
{ {
struct recipient_s *r; struct user_id_s *r;
unsigned int count = 0; unsigned int count = 0;
if ( rset ) { if ( rset ) {
@ -79,10 +79,10 @@ gpgme_count_recipients ( const GpgmeRecipientSet rset )
void void
_gpgme_append_gpg_args_from_recipients ( _gpgme_append_gpg_args_from_recipients (
const GpgmeRecipientSet rset, const GpgmeRecipients rset,
GpgObject gpg ) GpgObject gpg )
{ {
struct recipient_s *r; struct user_id_s *r;
assert (rset); assert (rset);
for (r=rset->list ; r; r = r->next ) { for (r=rset->list ; r; r = r->next ) {
@ -92,8 +92,3 @@ _gpgme_append_gpg_args_from_recipients (
} }

View File

@ -110,7 +110,7 @@ static GpgmeError read_colon_line ( GpgObject gpg );
GpgmeError GpgmeError
_gpgme_gpg_new_object ( GpgObject *r_gpg ) _gpgme_gpg_new ( GpgObject *r_gpg )
{ {
GpgObject gpg; GpgObject gpg;
int rc = 0; int rc = 0;
@ -153,7 +153,7 @@ _gpgme_gpg_new_object ( GpgObject *r_gpg )
leave: leave:
if (rc) { if (rc) {
_gpgme_gpg_release_object (gpg); _gpgme_gpg_release (gpg);
*r_gpg = NULL; *r_gpg = NULL;
} }
else else
@ -162,7 +162,7 @@ _gpgme_gpg_new_object ( GpgObject *r_gpg )
} }
void void
_gpgme_gpg_release_object ( GpgObject gpg ) _gpgme_gpg_release ( GpgObject gpg )
{ {
if ( !gpg ) if ( !gpg )
return; return;
@ -366,7 +366,7 @@ build_argv ( GpgObject gpg )
} }
for ( a=gpg->arglist; a; a = a->next ) { for ( a=gpg->arglist; a; a = a->next ) {
if ( a->data ) { if ( a->data ) {
switch ( _gpgme_query_data_mode (a->data) ) { switch ( _gpgme_data_get_mode (a->data) ) {
case GPGME_DATA_MODE_NONE: case GPGME_DATA_MODE_NONE:
case GPGME_DATA_MODE_INOUT: case GPGME_DATA_MODE_INOUT:
xfree (fd_data_map); xfree (fd_data_map);
@ -382,7 +382,7 @@ build_argv ( GpgObject gpg )
break; break;
} }
switch ( gpgme_query_data_type (a->data) ) { switch ( gpgme_data_get_type (a->data) ) {
case GPGME_DATA_TYPE_NONE: case GPGME_DATA_TYPE_NONE:
if ( fd_data_map[datac].inbound ) if ( fd_data_map[datac].inbound )
break; /* allowed */ break; /* allowed */
@ -596,7 +596,7 @@ gpg_inbound_handler ( void *opaque, pid_t pid, int fd )
int nread; int nread;
char buf[200]; char buf[200];
assert ( _gpgme_query_data_mode (dh) == GPGME_DATA_MODE_IN ); assert ( _gpgme_data_get_mode (dh) == GPGME_DATA_MODE_IN );
do { do {
nread = read (fd, buf, 200 ); nread = read (fd, buf, 200 );
@ -614,7 +614,7 @@ gpg_inbound_handler ( void *opaque, pid_t pid, int fd )
* the read function or provides a memory area for writing to it. * the read function or provides a memory area for writing to it.
*/ */
err = _gpgme_append_data ( dh, buf, nread ); err = _gpgme_data_append ( dh, buf, nread );
if ( err ) { if ( err ) {
fprintf (stderr, "_gpgme_append_data failed: %s\n", fprintf (stderr, "_gpgme_append_data failed: %s\n",
gpgme_strerror(err)); gpgme_strerror(err));
@ -659,8 +659,8 @@ gpg_outbound_handler ( void *opaque, pid_t pid, int fd )
{ {
GpgmeData dh = opaque; GpgmeData dh = opaque;
assert ( _gpgme_query_data_mode (dh) == GPGME_DATA_MODE_OUT ); assert ( _gpgme_data_get_mode (dh) == GPGME_DATA_MODE_OUT );
switch ( gpgme_query_data_type (dh) ) { switch ( gpgme_data_get_type (dh) ) {
case GPGME_DATA_TYPE_MEM: case GPGME_DATA_TYPE_MEM:
if ( write_mem_data ( dh, fd ) ) if ( write_mem_data ( dh, fd ) )
return 1; /* ready */ return 1; /* ready */

View File

@ -84,8 +84,8 @@ typedef enum {
typedef void (*GpgStatusHandler)( GpgmeCtx, GpgStatusCode code, char *args ); typedef void (*GpgStatusHandler)( GpgmeCtx, GpgStatusCode code, char *args );
typedef void (*GpgColonLineHandler)( GpgmeCtx, char *line ); typedef void (*GpgColonLineHandler)( GpgmeCtx, char *line );
GpgmeError _gpgme_gpg_new_object ( GpgObject *r_gpg ); GpgmeError _gpgme_gpg_new ( GpgObject *r_gpg );
void _gpgme_gpg_release_object ( GpgObject gpg ); void _gpgme_gpg_release ( GpgObject gpg );
GpgmeError _gpgme_gpg_add_arg ( GpgObject gpg, const char *arg ); GpgmeError _gpgme_gpg_add_arg ( GpgObject gpg, const char *arg );
GpgmeError _gpgme_gpg_add_data ( GpgObject gpg, GpgmeData data, int dup_to ); GpgmeError _gpgme_gpg_add_data ( GpgObject gpg, GpgmeData data, int dup_to );
void _gpgme_gpg_set_status_handler ( GpgObject gpg, void _gpgme_gpg_set_status_handler ( GpgObject gpg,

View File

@ -90,7 +90,7 @@ verify_status_handler ( GpgmeCtx ctx, GpgStatusCode code, char *args )
GpgmeError GpgmeError
gpgme_start_verify ( GpgmeCtx c, GpgmeData sig, GpgmeData text ) gpgme_op_verify_start ( GpgmeCtx c, GpgmeData sig, GpgmeData text )
{ {
int rc = 0; int rc = 0;
int i; int i;
@ -106,10 +106,10 @@ gpgme_start_verify ( GpgmeCtx c, GpgmeData sig, GpgmeData text )
* run gpg in the new --pipemode (I started with this but it is * run gpg in the new --pipemode (I started with this but it is
* not yet finished) */ * not yet finished) */
if ( c->gpg ) { if ( c->gpg ) {
_gpgme_gpg_release_object ( c->gpg ); _gpgme_gpg_release ( c->gpg );
c->gpg = NULL; c->gpg = NULL;
} }
rc = _gpgme_gpg_new_object ( &c->gpg ); rc = _gpgme_gpg_new ( &c->gpg );
if (rc) if (rc)
goto leave; goto leave;
@ -122,17 +122,17 @@ gpgme_start_verify ( GpgmeCtx c, GpgmeData sig, GpgmeData text )
/* Check the supplied data */ /* Check the supplied data */
if ( gpgme_query_data_type (sig) == GPGME_DATA_TYPE_NONE ) { if ( gpgme_data_get_type (sig) == GPGME_DATA_TYPE_NONE ) {
rc = mk_error (No_Data); rc = mk_error (No_Data);
goto leave; goto leave;
} }
if ( text && gpgme_query_data_type (text) == GPGME_DATA_TYPE_NONE ) { if ( text && gpgme_data_get_type (text) == GPGME_DATA_TYPE_NONE ) {
rc = mk_error (No_Data); rc = mk_error (No_Data);
goto leave; goto leave;
} }
_gpgme_set_data_mode (sig, GPGME_DATA_MODE_OUT ); _gpgme_data_set_mode (sig, GPGME_DATA_MODE_OUT );
if (text) /* detached signature */ if (text) /* detached signature */
_gpgme_set_data_mode (text, GPGME_DATA_MODE_OUT ); _gpgme_data_set_mode (text, GPGME_DATA_MODE_OUT );
/* Tell the gpg object about the data */ /* Tell the gpg object about the data */
_gpgme_gpg_add_arg ( c->gpg, "--" ); _gpgme_gpg_add_arg ( c->gpg, "--" );
_gpgme_gpg_add_data ( c->gpg, sig, -1 ); _gpgme_gpg_add_data ( c->gpg, sig, -1 );
@ -145,7 +145,7 @@ gpgme_start_verify ( GpgmeCtx c, GpgmeData sig, GpgmeData text )
leave: leave:
if (rc) { if (rc) {
c->pending = 0; c->pending = 0;
_gpgme_gpg_release_object ( c->gpg ); c->gpg = NULL; _gpgme_gpg_release ( c->gpg ); c->gpg = NULL;
} }
return rc; return rc;
} }
@ -153,9 +153,9 @@ gpgme_start_verify ( GpgmeCtx c, GpgmeData sig, GpgmeData text )
GpgmeError GpgmeError
gpgme_verify ( GpgmeCtx c, GpgmeData sig, GpgmeData text ) gpgme_op_verify ( GpgmeCtx c, GpgmeData sig, GpgmeData text )
{ {
int rc = gpgme_start_verify ( c, sig, text ); int rc = gpgme_op_verify_start ( c, sig, text );
if ( !rc ) { if ( !rc ) {
gpgme_wait (c, 1); gpgme_wait (c, 1);
if ( c->result_type != RESULT_TYPE_VERIFY ) if ( c->result_type != RESULT_TYPE_VERIFY )

View File

@ -38,9 +38,9 @@ print_data ( GpgmeData dh )
size_t nread; size_t nread;
GpgmeError err; GpgmeError err;
err = gpgme_rewind_data ( dh ); err = gpgme_data_rewind ( dh );
fail_if_err (err); fail_if_err (err);
while ( !(err = gpgme_read_data ( dh, buf, 100, &nread )) ) { while ( !(err = gpgme_data_read ( dh, buf, 100, &nread )) ) {
fwrite ( buf, nread, 1, stdout ); fwrite ( buf, nread, 1, stdout );
} }
if (err != GPGME_EOF) if (err != GPGME_EOF)
@ -55,27 +55,27 @@ main (int argc, char **argv )
GpgmeCtx ctx; GpgmeCtx ctx;
GpgmeError err; GpgmeError err;
GpgmeData in, out; GpgmeData in, out;
GpgmeRecipientSet rset; GpgmeRecipients rset;
do { do {
err = gpgme_new_context (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);
err = gpgme_new_data ( &in, "Hallo Leute\n", 12, 0 ); err = gpgme_data_new ( &in, "Hallo Leute\n", 12, 0 );
fail_if_err (err); fail_if_err (err);
err = gpgme_new_data ( &out, NULL, 0,0 ); err = gpgme_data_new ( &out, NULL, 0,0 );
fail_if_err (err); fail_if_err (err);
err = gpgme_new_recipient_set (&rset); err = gpgme_recipients_new (&rset);
fail_if_err (err); fail_if_err (err);
err = gpgme_add_recipient (rset, "Bob"); err = gpgme_recipients_add_name (rset, "Bob");
fail_if_err (err); fail_if_err (err);
err = gpgme_add_recipient (rset, "Alpha"); err = gpgme_recipients_add_name (rset, "Alpha");
fail_if_err (err); fail_if_err (err);
err = gpgme_encrypt (ctx, rset, in, out ); err = gpgme_op_encrypt (ctx, rset, in, out );
fail_if_err (err); fail_if_err (err);
fflush (NULL); fflush (NULL);
@ -83,10 +83,10 @@ main (int argc, char **argv )
print_data (out); print_data (out);
fputs ("End Result.\n", stdout ); fputs ("End Result.\n", stdout );
gpgme_release_recipient_set (rset); gpgme_recipients_release (rset);
gpgme_release_data (in); gpgme_data_release (in);
gpgme_release_data (out); gpgme_data_release (out);
gpgme_release_context (ctx); gpgme_release (ctx);
} while ( argc > 1 && !strcmp( argv[1], "--loop" ) ); } while ( argc > 1 && !strcmp( argv[1], "--loop" ) );
return 0; return 0;

View File

@ -37,10 +37,10 @@ doit ( GpgmeCtx ctx, const char *pattern )
GpgmeError err; GpgmeError err;
GpgmeKey key; GpgmeKey key;
err = gpgme_keylist_start (ctx, pattern, 0 ); err = gpgme_op_keylist_start (ctx, pattern, 0 );
fail_if_err (err); fail_if_err (err);
while ( !(err = gpgme_keylist_next ( ctx, &key )) ) { while ( !(err = gpgme_op_keylist_next ( ctx, &key )) ) {
printf ("Got key object (%p)\n", key ); printf ("Got key object (%p)\n", key );
} }
if ( err != GPGME_EOF ) if ( err != GPGME_EOF )
@ -66,12 +66,12 @@ main (int argc, char **argv )
} }
pattern = argc? *argv : NULL; pattern = argc? *argv : NULL;
err = gpgme_new_context (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);
do { do {
doit ( ctx, pattern ); doit ( ctx, pattern );
} while ( loop ); } while ( loop );
gpgme_release_context (ctx); gpgme_release (ctx);
return 0; return 0;
} }

View File

@ -51,32 +51,32 @@ main (int argc, char **argv )
GpgmeError err; GpgmeError err;
GpgmeData sig, text; GpgmeData sig, text;
err = gpgme_new_context (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);
do { do {
err = gpgme_new_data ( &text, test_text1, strlen (test_text1), 0 ); err = gpgme_data_new ( &text, test_text1, strlen (test_text1), 0 );
fail_if_err (err); fail_if_err (err);
err = gpgme_new_data ( &sig, test_sig1, strlen (test_sig1), 0 ); err = gpgme_data_new ( &sig, test_sig1, strlen (test_sig1), 0 );
fail_if_err (err); fail_if_err (err);
puts ("checking a valid message:\n"); puts ("checking a valid message:\n");
err = gpgme_verify (ctx, sig, text ); err = gpgme_op_verify (ctx, sig, text );
fail_if_err (err); fail_if_err (err);
puts ("checking a manipulated message:\n"); puts ("checking a manipulated message:\n");
gpgme_release_data (text); gpgme_data_release (text);
err = gpgme_new_data ( &text, test_text1f, strlen (test_text1f), 0 ); err = gpgme_data_new ( &text, test_text1f, strlen (test_text1f), 0 );
fail_if_err (err); fail_if_err (err);
gpgme_rewind_data ( sig ); gpgme_data_rewind ( sig );
err = gpgme_verify (ctx, sig, text ); err = gpgme_op_verify (ctx, sig, text );
fail_if_err (err); fail_if_err (err);
gpgme_release_data (sig); gpgme_data_release (sig);
gpgme_release_data (text); gpgme_data_release (text);
} while ( argc > 1 && !strcmp( argv[1], "--loop" ) ); } while ( argc > 1 && !strcmp( argv[1], "--loop" ) );
gpgme_release_context (ctx); gpgme_release (ctx);
return 0; return 0;
} }