WARNS=2 (mainly shadow variable declarations)

This commit is contained in:
agc 2009-01-21 03:31:22 +00:00
parent 2626a640dd
commit 5bc2794550
10 changed files with 136 additions and 100 deletions

View File

@ -22,16 +22,30 @@
#ifndef __OPS_CALLBACK_H__
#define __OPS_CALLBACK_H__
#define CB(cbinfo,t,pc) do { (pc)->tag=(t); if(ops_parse_cb((pc),(cbinfo)) == OPS_RELEASE_MEMORY) ops_parser_content_free(pc); } while(0)
#define CB(cbinfo,t,pc) do { \
(pc)->tag=(t); \
if(ops_parse_cb((pc),(cbinfo)) == OPS_RELEASE_MEMORY) \
ops_parser_content_free(pc); \
} while(/* CONSTCOND */0)
/*#define CB(cbinfo,t,pc) do { (pc)->tag=(t); if((cbinfo)->cb(pc,(cbinfo)) == OPS_RELEASE_MEMORY) ops_parser_content_free(pc); } while(0)*/
//#define CB(cbinfo,t,pc) do { (pc)->tag=(t); if((cbinfo)->cb(pc,(cbinfo)) == OPS_RELEASE_MEMORY) ops_parser_content_free(pc); } while(0)
#define CBP(info,t,pc) CB(&(info)->cbinfo,t,pc)
#define ERR(cbinfo,err,code) do { content.content.error.error=err; content.tag=OPS_PARSER_ERROR; ops_parse_cb(&content,(cbinfo)); OPS_ERROR(errors,code,err); return -1; } while(0)
#define ERR(cbinfo,err,code) do { \
content.content.error.error=err; \
content.tag=OPS_PARSER_ERROR; \
ops_parse_cb(&content,(cbinfo)); \
OPS_ERROR(errors,code,err); \
return -1; \
} while(/*CONSTCOND*/0)
/*#define ERR(err) do { content.content.error.error=err; content.tag=OPS_PARSER_ERROR; ops_parse_cb(&content,cbinfo); return -1; } while(0)*/
#define ERRP(info,err) do { C.error.error=err; CBP(info,OPS_PARSER_ERROR,&content); return ops_false; } while(0)
#define ERRP(info,err) do { \
C.error.error=err; \
CBP(info,OPS_PARSER_ERROR,&content); \
return ops_false; \
} while(/*CONSTCOND*/0)
#endif /*__OPS_CALLBACK_H__*/

View File

@ -114,12 +114,27 @@ void ops_print_errors(ops_error_t *errstack);
void ops_free_errors(ops_error_t *errstack);
int ops_has_error(ops_error_t *errstack, ops_errcode_t errcode);
#define OPS_SYSTEM_ERROR_1(err,code,syscall,fmt,arg) do { ops_push_error(err,OPS_E_SYSTEM_ERROR,errno,__FILE__,__LINE__,syscall); ops_push_error(err,code,0,__FILE__,__LINE__,fmt,arg); } while(0)
#define OPS_MEMORY_ERROR(err) {fprintf(stderr, "Memory error\n");} // \todo placeholder for better error handling
#define OPS_ERROR(err,code,fmt) do { ops_push_error(err,code,0,__FILE__,__LINE__,fmt); } while(0)
#define OPS_ERROR_1(err,code,fmt,arg) do { ops_push_error(err,code,0,__FILE__,__LINE__,fmt,arg); } while(0)
#define OPS_ERROR_2(err,code,fmt,arg,arg2) do { ops_push_error(err,code,0,__FILE__,__LINE__,fmt,arg,arg2); } while(0)
#define OPS_ERROR_3(err,code,fmt,arg,arg2,arg3) do { ops_push_error(err,code,0,__FILE__,__LINE__,fmt,arg,arg2,arg3); } while(0)
#define OPS_ERROR_4(err,code,fmt,arg,arg2,arg3,arg4) do { ops_push_error(err,code,0,__FILE__,__LINE__,fmt,arg,arg2,arg3,arg4); } while(0)
#define OPS_SYSTEM_ERROR_1(err,code,syscall,fmt,arg) do { \
ops_push_error(err,OPS_E_SYSTEM_ERROR,errno,__FILE__,__LINE__,syscall);\
ops_push_error(err,code,0,__FILE__,__LINE__,fmt,arg); \
} while(/*CONSTCOND*/0)
#define OPS_MEMORY_ERROR(err) { \
fprintf(stderr, "Memory error\n"); \
} // \todo placeholder for better error handling
#define OPS_ERROR(err,code,fmt) do { \
ops_push_error(err,code,0,__FILE__,__LINE__,fmt); \
} while(/*CONSTCOND*/0)
#define OPS_ERROR_1(err,code,fmt,arg) do { \
ops_push_error(err,code,0,__FILE__,__LINE__,fmt,arg); \
} while(/*CONSTCOND*/0)
#define OPS_ERROR_2(err,code,fmt,arg,arg2) do { \
ops_push_error(err,code,0,__FILE__,__LINE__,fmt,arg,arg2); \
} while(/*CONSTCOND*/0)
#define OPS_ERROR_3(err,code,fmt,arg,arg2,arg3) do { \
ops_push_error(err,code,0,__FILE__,__LINE__,fmt,arg,arg2,arg3); \
} while(/*CONSTCOND*/0)
#define OPS_ERROR_4(err,code,fmt,arg,arg2,arg3,arg4) do { \
ops_push_error(err,code,0,__FILE__,__LINE__,fmt,arg,arg2,arg3,arg4); \
} while(/*CONSTCOND*/0)
#endif /* OPS_ERRORS */

View File

@ -358,17 +358,17 @@ ops_boolean_t ops_write_compressed(const unsigned char *data,
int r=0;
int sz_in=0;
int sz_out=0;
compress_arg_t* compress=ops_mallocz(sizeof *compress);
compress_arg_t* compression=ops_mallocz(sizeof(compress_arg_t));
// compress the data
const int level=Z_DEFAULT_COMPRESSION; // \todo allow varying levels
compress->stream.zalloc=Z_NULL;
compress->stream.zfree=Z_NULL;
compress->stream.opaque=NULL;
compression->stream.zalloc=Z_NULL;
compression->stream.zfree=Z_NULL;
compression->stream.opaque=NULL;
// all other fields set to zero by use of ops_mallocz
if (deflateInit(&compress->stream,level) != Z_OK)
if (deflateInit(&compression->stream,level) != Z_OK)
{
// can't initialise
assert(0);
@ -376,32 +376,32 @@ ops_boolean_t ops_write_compressed(const unsigned char *data,
// do necessary transformation
// copy input to maintain const'ness of src
assert(compress->src==NULL);
assert(compress->dst==NULL);
assert(compression->src==NULL);
assert(compression->dst==NULL);
sz_in=len * sizeof (unsigned char);
sz_out= (sz_in * 1.01) + 12; // from zlib webpage
compress->src=ops_mallocz(sz_in);
compress->dst=ops_mallocz(sz_out);
memcpy(compress->src,data,len);
compression->src=ops_mallocz(sz_in);
compression->dst=ops_mallocz(sz_out);
memcpy(compression->src,data,len);
// setup stream
compress->stream.next_in=compress->src;
compress->stream.avail_in=sz_in;
compress->stream.total_in=0;
compression->stream.next_in=compression->src;
compression->stream.avail_in=sz_in;
compression->stream.total_in=0;
compress->stream.next_out=compress->dst;
compress->stream.avail_out=sz_out;
compress->stream.total_out=0;
compression->stream.next_out=compression->dst;
compression->stream.avail_out=sz_out;
compression->stream.total_out=0;
r=deflate(&compress->stream, Z_FINISH);
r=deflate(&compression->stream, Z_FINISH);
assert(r==Z_STREAM_END); // need to loop if not
// write it out
return (ops_write_ptag(OPS_PTAG_CT_COMPRESSED, cinfo)
&& ops_write_length(1+compress->stream.total_out, cinfo)
&& ops_write_length(1+compression->stream.total_out, cinfo)
&& ops_write_scalar(OPS_C_ZLIB,1,cinfo)
&& ops_write(compress->dst, compress->stream.total_out,cinfo));
&& ops_write(compression->dst, compression->stream.total_out,cinfo));
}
// EOF

View File

@ -153,15 +153,15 @@ static unsigned secret_key_length(const ops_secret_key_t *key)
/**
* \ingroup Core_Create
* \param key
* \param time
* \param t
* \param n
* \param e
*/
void ops_fast_create_rsa_public_key(ops_public_key_t *key,time_t time,
void ops_fast_create_rsa_public_key(ops_public_key_t *key,time_t t,
BIGNUM *n,BIGNUM *e)
{
key->version=4;
key->creation_time=time;
key->creation_time=t;
key->algorithm=OPS_PKA_RSA;
key->key.rsa.n=n;
key->key.rsa.e=e;
@ -219,7 +219,7 @@ static ops_boolean_t write_secret_key_body(const ops_secret_key_t *key,
{
/* RFC4880 Section 5.5.3 Secret-Key Packet Formats */
ops_crypt_t crypt;
ops_crypt_t crypted;
ops_hash_t hash;
unsigned char hashed[OPS_SHA1_HASH_SIZE];
unsigned char session_key[CAST_KEY_LENGTH];
@ -333,25 +333,25 @@ static ops_boolean_t write_secret_key_body(const ops_secret_key_t *key,
/* use this session key to encrypt */
ops_crypt_any(&crypt,key->algorithm);
crypt.set_iv(&crypt, key->iv);
crypt.set_key(&crypt, session_key);
ops_encrypt_init(&crypt);
ops_crypt_any(&crypted,key->algorithm);
crypted.set_iv(&crypted, key->iv);
crypted.set_key(&crypted, session_key);
ops_encrypt_init(&crypted);
if (ops_get_debug_level(__FILE__))
{
unsigned int i=0;
unsigned int i2=0;
fprintf(stderr,"\nWRITING:\niv=");
for (i=0; i<ops_block_size(key->algorithm); i++)
for (i2=0; i2<ops_block_size(key->algorithm); i2++)
{
fprintf(stderr, "%02x ", key->iv[i]);
fprintf(stderr, "%02x ", key->iv[i2]);
}
fprintf(stderr,"\n");
fprintf(stderr,"key=");
for (i=0; i<CAST_KEY_LENGTH; i++)
for (i2=0; i2<CAST_KEY_LENGTH; i2++)
{
fprintf(stderr, "%02x ", session_key[i]);
fprintf(stderr, "%02x ", session_key[i2]);
}
fprintf(stderr,"\n");
@ -360,7 +360,7 @@ static ops_boolean_t write_secret_key_body(const ops_secret_key_t *key,
fprintf(stderr,"turning encryption on...\n");
}
ops_writer_push_encrypt_crypt(info, &crypt);
ops_writer_push_encrypt_crypt(info, &crypted);
switch(key->public_key.algorithm)
{
@ -580,7 +580,7 @@ ops_boolean_t ops_write_struct_public_key(const ops_public_key_t *key,
/**
* \ingroup Core_WritePackets
* \brief Writes one RSA public key packet.
* \param time Creation time
* \param t Creation time
* \param n RSA public modulus
* \param e RSA public encryption exponent
* \param info Writer settings
@ -588,13 +588,13 @@ ops_boolean_t ops_write_struct_public_key(const ops_public_key_t *key,
* \return ops_true if OK, otherwise ops_false
*/
ops_boolean_t ops_write_rsa_public_key(time_t time,const BIGNUM *n,
ops_boolean_t ops_write_rsa_public_key(time_t t,const BIGNUM *n,
const BIGNUM *e,
ops_create_info_t *info)
{
ops_public_key_t key;
ops_fast_create_rsa_public_key(&key,time,DECONST(BIGNUM,n),
ops_fast_create_rsa_public_key(&key,t,DECONST(BIGNUM,n),
DECONST(BIGNUM,e));
return ops_write_struct_public_key(&key,info);
}
@ -635,7 +635,7 @@ void ops_build_public_key(ops_memory_t *out,const ops_public_key_t *key,
* freed.
*
* \param key The key structure to be initialised.
* \param time
* \param t
* \param d The RSA parameter d (=e^-1 mod (p-1)(q-1)) [OPTIONAL]
* \param p The RSA parameter p
* \param q The RSA parameter q (q > p)
@ -643,11 +643,11 @@ void ops_build_public_key(ops_memory_t *out,const ops_public_key_t *key,
* \param n The RSA public parameter n (=p*q) [OPTIONAL]
* \param e The RSA public parameter e */
void ops_fast_create_rsa_secret_key(ops_secret_key_t *key,time_t time,
void ops_fast_create_rsa_secret_key(ops_secret_key_t *key,time_t t,
BIGNUM *d,BIGNUM *p,BIGNUM *q,BIGNUM *u,
BIGNUM *n,BIGNUM *e)
{
ops_fast_create_rsa_public_key(&key->public_key,time,n,e);
ops_fast_create_rsa_public_key(&key->public_key,t,n,e);
// XXX: calculate optionals
key->key.rsa.d=d;
@ -878,10 +878,10 @@ ops_boolean_t encode_m_buf(const unsigned char *M, size_t mLen,
if (ops_get_debug_level(__FILE__))
{
unsigned int i=0;
unsigned int i2=0;
fprintf(stderr,"Encoded Message: \n");
for (i=0; i<mLen; i++)
fprintf(stderr,"%2x ", EM[i]);
for (i2=0; i2<mLen; i2++)
fprintf(stderr,"%2x ", EM[i2]);
fprintf(stderr,"\n");
}
@ -925,6 +925,7 @@ ops_pk_session_key_t *ops_create_pk_session_key(const ops_keydata_t *key)
if (ops_get_debug_level(__FILE__))
{
unsigned int i=0;
fprintf(stderr,"Encrypting for RSA key id : ");
for (i=0; i<sizeof session_key->key_id; i++)
fprintf(stderr,"%2x ", key->key_id[i]);

View File

@ -302,9 +302,9 @@ unsigned ops_get_user_id_count(const ops_keydata_t *key)
\param index Which key to get
\return Pointer to requested user id
*/
const unsigned char* ops_get_user_id(const ops_keydata_t *key, unsigned index)
const unsigned char* ops_get_user_id(const ops_keydata_t *key, unsigned subscript)
{
return key->uids[index].user_id;
return key->uids[subscript].user_id;
}
/**
@ -354,11 +354,11 @@ ops_boolean_t ops_is_key_supported(const ops_keydata_t *keydata)
\endcode
*/
const ops_keydata_t* ops_keyring_get_key_by_index(const ops_keyring_t *keyring, int index)
const ops_keydata_t* ops_keyring_get_key_by_index(const ops_keyring_t *keyring, int subscript)
{
if (index >= keyring->nkeys)
if (subscript >= keyring->nkeys)
return NULL;
return &keyring->keys[index];
return &keyring->keys[subscript];
}
// \todo check where userid pointers are copied

View File

@ -94,13 +94,13 @@ static unsigned int ops_ulong_list_resize(ops_ulong_list_t *list)
*
* \return 1 if success, else 0
*/
unsigned int ops_ulong_list_add(ops_ulong_list_t *list, unsigned long *ulong)
unsigned int ops_ulong_list_add(ops_ulong_list_t *list, unsigned long *ulongp)
{
if (list->size==list->used)
if (!ops_ulong_list_resize(list))
return 0;
list->ulongs[list->used]=*ulong;
list->ulongs[list->used]=*ulongp;
list->used++;
return 1;
}

View File

@ -1395,7 +1395,7 @@ static int parse_one_signature_subpacket(ops_signature_t *sig,
unsigned char c[1]="";
ops_parser_content_t content;
unsigned t8,t7;
ops_boolean_t read=ops_true;
ops_boolean_t doread=ops_true;
unsigned char bool[1]="";
ops_init_subregion(&subregion,region);
@ -1594,7 +1594,7 @@ static int parse_one_signature_subpacket(ops_signature_t *sig,
if(pinfo->ss_parsed[t8]&t7)
OPS_ERROR_1(&pinfo->errors, OPS_E_PROTO_UNKNOWN_SS,
"Unknown signature subpacket type (%d)", c[0]&0x7f);
read=ops_false;
doread=ops_false;
break;
}
@ -1605,15 +1605,15 @@ static int parse_one_signature_subpacket(ops_signature_t *sig,
OPS_ERROR_1(&pinfo->errors,OPS_E_PROTO_CRITICAL_SS_IGNORED,
"Critical signature subpacket ignored (%d)",
c[0]&0x7f);
if(!read && !limited_skip(subregion.length-1,&subregion,pinfo))
if(!doread && !limited_skip(subregion.length-1,&subregion,pinfo))
return 0;
// printf("skipped %d length %d\n",c[0]&0x7f,subregion.length);
if(read)
if(doread)
ops_parser_content_free(&content);
return 1;
}
if(read && subregion.length_read != subregion.length)
if(doread && subregion.length_read != subregion.length)
{
OPS_ERROR_1(&pinfo->errors,OPS_E_R_UNCONSUMED_DATA,
"Unconsumed data (%d)",
@ -1767,7 +1767,9 @@ static int parse_v4_signature(ops_region_t *region,ops_parse_info_t *pinfo)
return 0;
C.signature.info.type=c[0];
if (ops_get_debug_level(__FILE__))
{ fprintf(stderr, "signature type=%d (%s)\n", C.signature.info.type, ops_show_sig_type(C.signature.info.type)); }
{ fprintf(stderr, "signature type=%d (%s)\n",
C.signature.info.type,
ops_show_sig_type(C.signature.info.type)); }
/* XXX: check signature type */
@ -1776,14 +1778,18 @@ static int parse_v4_signature(ops_region_t *region,ops_parse_info_t *pinfo)
C.signature.info.key_algorithm=c[0];
/* XXX: check algorithm */
if (ops_get_debug_level(__FILE__))
{ fprintf(stderr, "key_algorithm=%d (%s)\n", C.signature.info.key_algorithm, ops_show_pka(C.signature.info.key_algorithm)); }
{ fprintf(stderr, "key_algorithm=%d (%s)\n",
C.signature.info.key_algorithm,
ops_show_pka(C.signature.info.key_algorithm)); }
if(!limited_read(c,1,region,pinfo))
return 0;
C.signature.info.hash_algorithm=c[0];
/* XXX: check algorithm */
if (ops_get_debug_level(__FILE__))
{ fprintf(stderr, "hash_algorithm=%d %s\n", C.signature.info.hash_algorithm, ops_show_hash_algorithm(C.signature.info.hash_algorithm)); }
{ fprintf(stderr, "hash_algorithm=%d %s\n",
C.signature.info.hash_algorithm,
ops_show_hash_algorithm(C.signature.info.hash_algorithm)); }
CBP(pinfo,OPS_PTAG_CT_SIGNATURE_HEADER,&content);

View File

@ -54,8 +54,8 @@ static void print_string_and_value(char *name,
unsigned char value);
static void print_tagname(const char *str);
static void print_time( char *name,
time_t time);
static void print_time_short(time_t time);
time_t t);
static void print_time_short(time_t t);
static void print_unsigned_int(char *name,
unsigned int val);
static void showtime(const char *name,time_t t);
@ -290,17 +290,17 @@ static void print_unsigned_int(char *name, unsigned int val)
printf("%d\n", val);
}
static void print_time( char *name, time_t time)
static void print_time( char *name, time_t t)
{
print_indent();
printf("%s: ",name);
showtime("time",time);
showtime("time",t);
printf("\n");
}
static void print_time_short(time_t time)
static void print_time_short(time_t t)
{
showtime_short(time);
showtime_short(t);
}
static void print_string_and_value(char *name,const char *str,
@ -450,15 +450,15 @@ static void print_utf8_string(const char *name,const unsigned char *str)
print_string(name,(const char *)str);
}
static void print_duration(char *name, time_t time)
static void print_duration(char *name, time_t t)
{
int mins, hours, days, years;
print_indent();
printf("%s: ",name);
printf("duration " TIME_T_FMT " seconds",(long long)time);
printf("duration " TIME_T_FMT " seconds",(long long)t);
mins=time/60;
mins=t/60;
hours=mins/60;
days=hours/24;
years=days/365;

View File

@ -60,7 +60,7 @@ static void encrypt_se_ip_destroyer (ops_writer_info_t *winfo);
void ops_writer_push_encrypt_se_ip(ops_create_info_t *cinfo,
const ops_keydata_t *pub_key)
{
ops_crypt_t* encrypt;
ops_crypt_t* encrypted;
unsigned char *iv=NULL;
// Create arg to be used with this writer
@ -73,14 +73,14 @@ void ops_writer_push_encrypt_se_ip(ops_create_info_t *cinfo,
ops_write_pk_session_key(cinfo,encrypted_pk_session_key);
// Setup the arg
encrypt=ops_mallocz(sizeof *encrypt);
ops_crypt_any(encrypt, encrypted_pk_session_key->symmetric_algorithm);
iv=ops_mallocz(encrypt->blocksize);
encrypt->set_iv(encrypt, iv);
encrypt->set_key(encrypt, &encrypted_pk_session_key->key[0]);
ops_encrypt_init(encrypt);
encrypted=ops_mallocz(sizeof *encrypted);
ops_crypt_any(encrypted, encrypted_pk_session_key->symmetric_algorithm);
iv=ops_mallocz(encrypted->blocksize);
encrypted->set_iv(encrypted, iv);
encrypted->set_key(encrypted, &encrypted_pk_session_key->key[0]);
ops_encrypt_init(encrypted);
arg->crypt=encrypt;
arg->crypt=encrypted;
// And push writer on stack
ops_writer_push(cinfo,encrypt_se_ip_writer,NULL,encrypt_se_ip_destroyer,arg);
@ -150,13 +150,13 @@ static void encrypt_se_ip_destroyer (ops_writer_info_t *winfo)
ops_boolean_t ops_write_se_ip_pktset(const unsigned char *data,
const unsigned int len,
ops_crypt_t *crypt,
ops_crypt_t *crypted,
ops_create_info_t *cinfo)
{
unsigned char hashed[SHA_DIGEST_LENGTH];
const size_t sz_mdc=1+1+SHA_DIGEST_LENGTH;
size_t sz_preamble=crypt->blocksize+2;
size_t sz_preamble=crypted->blocksize+2;
unsigned char* preamble=ops_mallocz(sz_preamble);
size_t sz_buf=sz_preamble+len+sz_mdc;
@ -172,9 +172,9 @@ ops_boolean_t ops_write_se_ip_pktset(const unsigned char *data,
return 0;
}
ops_random(preamble, crypt->blocksize);
preamble[crypt->blocksize]=preamble[crypt->blocksize-2];
preamble[crypt->blocksize+1]=preamble[crypt->blocksize-1];
ops_random(preamble, crypted->blocksize);
preamble[crypted->blocksize]=preamble[crypted->blocksize-2];
preamble[crypted->blocksize+1]=preamble[crypted->blocksize-1];
if (ops_get_debug_level(__FILE__))
{
@ -197,7 +197,7 @@ ops_boolean_t ops_write_se_ip_pktset(const unsigned char *data,
{
unsigned int i=0;
size_t sz_plaintext=len;
size_t sz_mdc=1+1+OPS_SHA1_HASH_SIZE;
size_t sz_mdc2=1+1+OPS_SHA1_HASH_SIZE;
unsigned char* mdc=NULL;
fprintf(stderr,"\nplaintext: ");
@ -207,14 +207,14 @@ ops_boolean_t ops_write_se_ip_pktset(const unsigned char *data,
fprintf(stderr,"\nmdc: ");
mdc=ops_memory_get_data(mem_mdc);
for (i=0; i<sz_mdc;i++)
for (i=0; i<sz_mdc2;i++)
fprintf(stderr," 0x%02x", mdc[i]);
fprintf(stderr,"\n");
}
// and write it out
ops_writer_push_encrypt_crypt(cinfo, crypt);
ops_writer_push_encrypt_crypt(cinfo, crypted);
#ifdef DEBUG
if (ops_get_debug_level(__FILE__))

View File

@ -72,7 +72,7 @@ static void stream_encrypt_se_ip_destroyer (ops_writer_info_t *winfo);
void ops_writer_push_stream_encrypt_se_ip(ops_create_info_t *cinfo,
const ops_keydata_t *pub_key)
{
ops_crypt_t* encrypt;
ops_crypt_t* encrypted;
unsigned char *iv=NULL;
const unsigned int bufsz=1024; // initial value; gets expanded as necessary
@ -87,14 +87,14 @@ void ops_writer_push_stream_encrypt_se_ip(ops_create_info_t *cinfo,
ops_write_pk_session_key(cinfo,encrypted_pk_session_key);
// Setup the arg
encrypt=ops_mallocz(sizeof *encrypt);
ops_crypt_any(encrypt, encrypted_pk_session_key->symmetric_algorithm);
iv=ops_mallocz(encrypt->blocksize);
encrypt->set_iv(encrypt, iv);
encrypt->set_key(encrypt, &encrypted_pk_session_key->key[0]);
ops_encrypt_init(encrypt);
encrypted=ops_mallocz(sizeof *encrypted);
ops_crypt_any(encrypted, encrypted_pk_session_key->symmetric_algorithm);
iv=ops_mallocz(encrypted->blocksize);
encrypted->set_iv(encrypted, iv);
encrypted->set_key(encrypted, &encrypted_pk_session_key->key[0]);
ops_encrypt_init(encrypted);
arg->crypt=encrypt;
arg->crypt=encrypted;
arg->mem_data=ops_memory_new();
ops_memory_init(arg->mem_data,bufsz);