updated to trunk of openpgp-sdk

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-OpenPGP@5078 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-04-04 19:27:07 +00:00
parent eb448cbaaf
commit c27f695a37
39 changed files with 1956 additions and 747 deletions

View file

@ -30,3 +30,5 @@ int ops_decompress(ops_region_t *region,ops_parse_info_t *parse_info,
ops_boolean_t ops_write_compressed(const unsigned char* data,
const unsigned int len,
ops_create_info_t *cinfo);
void ops_writer_push_compressed(ops_create_info_t *cinfo);

View file

@ -43,6 +43,8 @@ struct ops_create_info
ops_error_t *errors; /*!< an error stack */
};
void ops_prepare_parent_info(ops_create_info_t *parent_info,
ops_writer_info_t *winfo);
ops_create_info_t *ops_create_info_new(void);
void ops_create_info_delete(ops_create_info_t *info);

View file

@ -30,6 +30,12 @@
#include "packet.h"
#include "packet-parse.h"
#include <openssl/dsa.h>
#include <openssl/opensslv.h>
#include <openssl/opensslconf.h>
#if OPENSSL_VERSION_NUMBER < 0x00908030L
# define OPENSSL_NO_CAMELLIA
#endif
#define OPS_MIN_HASH_SIZE 16
@ -166,6 +172,7 @@ void ops_writer_push_encrypt(ops_create_info_t *info,
ops_boolean_t ops_encrypt_file(const char* input_filename, const char* output_filename, const ops_keydata_t *pub_key, const ops_boolean_t use_armour, const ops_boolean_t allow_overwrite);
ops_boolean_t ops_decrypt_file(const char* input_filename, const char* output_filename, ops_keyring_t *keyring, const ops_boolean_t use_armour, const ops_boolean_t allow_overwrite,ops_parse_cb_t* cb_get_passphrase);
extern void ops_encrypt_stream(ops_create_info_t* cinfo, const ops_keydata_t* public_key, const ops_secret_key_t* secret_key, const ops_boolean_t compress, const ops_boolean_t use_armour);
// Keys
ops_boolean_t ops_rsa_generate_keypair(const int numbits, const unsigned long e, ops_keydata_t* keydata);

View file

@ -113,6 +113,7 @@ void ops_print_error(ops_error_t *err);
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);
void ops_move_errors(ops_create_info_t *source, ops_error_t **errstack);
#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

View file

@ -0,0 +1,35 @@
/*
* Copyright (c) 2005-2009 Nominet UK (www.nic.uk)
* All rights reserved.
* Contributors: Ben Laurie, Rachel Willmer. The Contributors have asserted
* their moral rights under the UK Copyright Design and Patents Act 1988 to
* be recorded as the authors of this copyright work.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License.
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __OPS_LITERAL_H__
#define __OPS_LITERAL_H__
ops_boolean_t write_literal_header(ops_create_info_t *info,
void *header_data);
void ops_writer_push_literal(ops_create_info_t *info);
void ops_writer_push_literal_with_opts(ops_create_info_t *info,
unsigned int buf_size);
#endif /* __OPS_LITERAL_H__ */
// EOF

View file

@ -132,7 +132,6 @@ int ops_parse_errs(ops_parse_info_t *parse_info,ops_ulong_list_t *errs);
void ops_parse_and_validate(ops_parse_info_t *parse_info);
void ops_parse_options(ops_parse_info_t *pinfo,ops_content_tag_t tag,
ops_parse_type_t type);
@ -140,7 +139,7 @@ ops_boolean_t ops_limited_read(unsigned char *dest,size_t length,
ops_region_t *region,ops_error_t **errors,
ops_reader_info_t *rinfo,
ops_parse_cb_info_t *cbinfo);
ops_boolean_t ops_stacked_limited_read(unsigned char *dest,unsigned length,
ops_boolean_t ops_stacked_limited_read(void *dest,unsigned length,
ops_region_t *region,
ops_error_t **errors,
ops_reader_info_t *rinfo,

View file

@ -127,7 +127,6 @@ typedef enum
#define OPS_PTAG_NF_CONTENT_TAG_SHIFT 0
/** Structure to hold one parse error string. */
typedef struct
{
@ -310,6 +309,9 @@ typedef enum
OPS_SA_AES_192 =8, /*!< AES with 192-bit key */
OPS_SA_AES_256 =9, /*!< AES with 256-bit key */
OPS_SA_TWOFISH =10, /*!< Twofish with 256-bit key (TWOFISH) */
OPS_SA_CAMELLIA_128 =11, /*!< Camellia with 128-bit key */
OPS_SA_CAMELLIA_192 =12, /*!< Camellia with 192-bit key */
OPS_SA_CAMELLIA_256 =13, /*!< Camellia with 256-bit key */
} ops_symmetric_algorithm_t;
/** Hashing Algorithm Numbers.
@ -358,7 +360,8 @@ typedef struct
ops_public_key_t public_key;
ops_s2k_usage_t s2k_usage;
ops_s2k_specifier_t s2k_specifier;
ops_symmetric_algorithm_t algorithm;
ops_symmetric_algorithm_t algorithm; // the algorithm used to encrypt
// the key
ops_hash_algorithm_t hash_algorithm;
unsigned char salt[OPS_SALT_SIZE];
unsigned octet_count;
@ -658,8 +661,8 @@ typedef struct
/** Signature Subpacket : Revocation Key */
typedef struct
{
unsigned char cclass;
unsigned char algid;
unsigned char clss; /* class - name changed for C++ */
unsigned char algid;
unsigned char fingerprint[20];
} ops_ss_revocation_key_t;

View file

@ -0,0 +1,54 @@
/*
* Copyright (c) 2005-2009 Nominet UK (www.nic.uk)
* All rights reserved.
* Contributors: Ben Laurie, Rachel Willmer, Alasdair Mackintosh.
* The Contributors have asserted their moral rights under the
* UK Copyright Design and Patents Act 1988 to
* be recorded as the authors of this copyright work.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License.
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __OPS_PARTIAL_H__
#define __OPS_PARTIAL_H__
#include "types.h"
#include "writer.h"
/**
* Function that writes out a packet header. See
* ops_writer_push_partial
*/
typedef ops_boolean_t ops_write_partial_header_t(ops_create_info_t *info,
void *data);
typedef ops_boolean_t ops_write_partial_trailer_t(ops_create_info_t *info,
void *data);
void ops_writer_push_partial(size_t packet_size,
ops_create_info_t *info,
ops_content_tag_t tag,
ops_write_partial_header_t *header_writer,
void *header_data);
void ops_writer_push_partial_with_trailer(
size_t packet_size,
ops_create_info_t *cinfo,
ops_content_tag_t tag,
ops_write_partial_header_t *header_writer,
void *header_data,
ops_write_partial_trailer_t *trailer_writer,
void *trailer_data);
#endif /* __OPS_PARTIAL_H__ */

View file

@ -91,5 +91,6 @@ ops_boolean_t ops_sign_file_as_cleartext(const char* input_filename, const char*
ops_boolean_t ops_sign_buf_as_cleartext(const char* input, const size_t len, ops_memory_t** output, const ops_secret_key_t *skey);
ops_boolean_t ops_sign_file(const char* input_filename, const char* output_filename, const ops_secret_key_t *skey, const ops_boolean_t use_armour, const ops_boolean_t overwrite);
ops_memory_t * ops_sign_buf(const void* input, const size_t input_len, const ops_sig_type_t sig_type, const ops_secret_key_t *skey, const ops_boolean_t use_armour);
ops_boolean_t ops_writer_push_signed(ops_create_info_t *cinfo, const ops_sig_type_t sig_type, const ops_secret_key_t *skey);
#endif

View file

@ -25,6 +25,6 @@
#include <openpgpsdk/readerwriter.h>
void ops_writer_push_stream_encrypt_se_ip(ops_create_info_t *cinfo,
const ops_key_data_t *pub_key);
const ops_keydata_t *pub_key);
#endif /*__OPS_STREAMWRITER_H__*/

View file

@ -189,6 +189,10 @@ typedef enum ops_content_tag_t ops_ss_type_t;
typedef unsigned char ops_ss_rr_code_t;
/** ops_parse_type_t */
/** Used to specify whether subpackets should be returned raw, parsed or ignored.
*/
typedef enum ops_parse_type_t ops_parse_type_t;
/** ops_parser_content_t */
@ -208,8 +212,6 @@ typedef enum
{
OPS_WF_DUMMY,
} ops_writer_flags_t;
/** ops_writer_ret_t */
/* typedef enum ops_writer_ret_t ops_writer_ret_t; */
/**
* \ingroup Create

View file

@ -71,7 +71,7 @@ typedef struct
} validate_key_cb_arg_t;
/** Struct use with the validate_data_cb callback */
typedef struct
typedef struct validate_data_cb_arg
{
enum
{