diff options
Diffstat (limited to 'librsync.h')
-rw-r--r-- | librsync.h | 49 |
1 files changed, 37 insertions, 12 deletions
@@ -2,7 +2,7 @@ * * librsync -- library for network deltas * - * Copyright (C) 2000, 2001 by Martin Pool <mbp@sourcefrog.net> + * Copyright 2000, 2001, 2014 by Martin Pool <mbp@sourcefrog.net> * Copyright (C) 2003 by Donovan Baarda <abo@minkirri.apana.org.au> * * This program is free software; you can redistribute it and/or modify @@ -32,9 +32,7 @@ * * \brief Main public interface to librsync. * \author Martin Pool <mbp@sourcefrog.net> - * \version librsync-0.9.6 - * - * $Id$ + * \version librsync-1.0.0 * * See \ref intro for an introduction to use of this library. */ @@ -52,6 +50,8 @@ extern "C" { extern char const rs_librsync_version[]; extern char const rs_licence_string[]; +typedef unsigned char rs_byte_t; + /** * \brief Log severity levels. @@ -73,6 +73,25 @@ typedef enum { + /* + | "The IETF already has more than enough + | RFCs that codify the obvious, make + | stupidity illegal, support truth, + | justice, and the IETF way, and generally + | demonstrate the author is a brilliant and + | valuable Contributor to The Standards + | Process." + | -- Vernon Schryver + */ + + +typedef enum { + RS_DELTA_MAGIC = 0x72730236, /* r s \2 6 */ + RS_MD4_SIG_MAGIC = 0x72730136, /* r s \1 6 */ + RS_BLAKE2_SIG_MAGIC = 0x72730137 /* r s \1 7 */ +} rs_magic_number; + + /** * \typedef rs_trace_fn_t * \brief Callback to write out log messages. @@ -190,10 +209,17 @@ typedef struct rs_stats { */ typedef struct rs_mdfour rs_mdfour_t; -#define RS_MD4_LENGTH 16 +/* Commenting this out deliberately - in case library users + * depend on this size - this could potentially overflow + * buffers now + * #define RS_MD4_LENGTH 16 + */ +extern const int RS_MD4_SUM_LENGTH, RS_BLAKE2_SUM_LENGTH; + +#define RS_MAX_STRONG_SUM_LENGTH 32 typedef unsigned int rs_weak_sum_t; -typedef unsigned char rs_strong_sum_t[RS_MD4_LENGTH]; +typedef unsigned char rs_strong_sum_t[RS_MAX_STRONG_SUM_LENGTH]; void rs_mdfour(unsigned char *out, void const *in, size_t); void rs_mdfour_begin(/* @out@ */ rs_mdfour_t * md); @@ -278,10 +304,6 @@ struct rs_buffers_s { */ typedef struct rs_buffers_s rs_buffers_t; -/** Default length of strong signatures, in bytes. The MD4 checksum - * is truncated to this size. */ -#define RS_DEFAULT_STRONG_LEN 8 - /** Default block length, if not determined by any other factors. */ #define RS_DEFAULT_BLOCK_LEN 2048 @@ -319,7 +341,8 @@ rs_result rs_job_free(rs_job_t *); int rs_accum_value(rs_job_t *, char *sum, size_t sum_len); -rs_job_t *rs_sig_begin(size_t new_block_len, size_t strong_sum_len); +rs_job_t *rs_sig_begin(size_t new_block_len, size_t strong_sum_len, + rs_long_t sig_magic); rs_job_t *rs_delta_begin(rs_signature_t *); @@ -367,7 +390,9 @@ extern int rs_inbuflen, rs_outbuflen; void rs_mdfour_file(FILE *in_file, char *result); rs_result rs_sig_file(FILE *old_file, FILE *sig_file, - size_t block_len, size_t strong_len, rs_stats_t *); + size_t block_len, size_t strong_len, + rs_long_t sign_magic, + rs_stats_t *); rs_result rs_loadsig_file(FILE *, rs_signature_t **, rs_stats_t *); |