Author: kotkov
Date: Wed Mar 22 15:17:31 2023
New Revision: 1908639
URL: http://svn.apache.org/viewvc?rev=1908639&view=rev
Log:
On the 'pristine-checksum-salt' branch: Lay some groundwork for using a
dynamically salted checksum in a working copy by allowing to create a
checksum context with a specified salt value.
* subversion/include/svn_checksum.h
(): Include svn_string.h
(svn_checksum_ctx_create2): New function, accepting a new `salt` argument.
Revved from …
(svn_checksum_ctx_create): …this function.
(svn_checksum_ctx_reset): Update docstring.
* subversion/libsvn_subr/checksum.c
(struct svn_checksum_ctx_t): Add new `salt` field.
(svn_checksum_ctx_create2): New.
(svn_checksum_ctx_reset): Update implementation.
(wrap_write_stream): Call the new function.
(svn_checksum_ctx_create): Implement with a call to the new function. Move …
* subversion/libsvn_subr/deprecated.c
(svn_checksum_ctx_create): …here.
* subversion/libsvn_subr/stream.c,
subversion/libsvn_delta/text_delta.c,
subversion/libsvn_fs_base/reps-strings.c,
subversion/libsvn_fs_fs/cached_data.c,
subversion/libsvn_fs_fs/index.c,
subversion/libsvn_fs_fs/transaction.c,
subversion/libsvn_fs_fs/verify.c,
subversion/libsvn_fs_x/cached_data.c,
subversion/libsvn_fs_x/index.c,
subversion/libsvn_fs_x/transaction.c,
subversion/libsvn_fs_x/verify.c,
subversion/libsvn_ra_svn/client.c:
Update all calls to the now deprecated svn_checksum_ctx_create(): call
svn_checksum_ctx_create2() with a NULL salt.
Modified:
subversion/branches/pristine-checksum-salt/subversion/include/svn_checksum.h
subversion/branches/pristine-checksum-salt/subversion/libsvn_delta/text_delta.c
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_base/reps-strings.c
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/cached_data.c
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/index.c
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/transaction.c
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/verify.c
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/cached_data.c
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/index.c
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/transaction.c
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/verify.c
subversion/branches/pristine-checksum-salt/subversion/libsvn_ra_svn/client.c
subversion/branches/pristine-checksum-salt/subversion/libsvn_subr/checksum.c
subversion/branches/pristine-checksum-salt/subversion/libsvn_subr/deprecated.c
subversion/branches/pristine-checksum-salt/subversion/libsvn_subr/stream.c
Modified:
subversion/branches/pristine-checksum-salt/subversion/include/svn_checksum.h
URL:
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-salt/subversion/include/svn_checksum.h?rev=1908639&r1=1908638&r2=1908639&view=diff
==============================================================================
---
subversion/branches/pristine-checksum-salt/subversion/include/svn_checksum.h
(original)
+++
subversion/branches/pristine-checksum-salt/subversion/include/svn_checksum.h
Wed Mar 22 15:17:31 2023
@@ -31,6 +31,7 @@
#include <apr_pools.h> /* for apr_pool_t */
#include "svn_types.h" /* for svn_boolean_t, svn_error_t */
+#include "svn_string.h" /* for svn_string_t */
#ifdef __cplusplus
extern "C" {
@@ -214,17 +215,33 @@ svn_checksum_empty_checksum(svn_checksum
/**
* Create a new @c svn_checksum_ctx_t structure, allocated from @a pool for
- * calculating checksums of type @a kind. @see svn_checksum_final()
+ * calculating checksums of type @a kind. If @a salt is non-NULL, its content
+ * will be prepended to the checksummed data. @a salt doesn't need to have a
+ * specific lifetime, because it will be copied by the function internally.
+ *
+ * @see svn_checksum_final()
+ *
+ * @since New in 1.15.
+ */
+svn_checksum_ctx_t *
+svn_checksum_ctx_create2(svn_checksum_kind_t kind,
+ const svn_string_t *salt,
+ apr_pool_t *pool);
+
+/**
+ * Similar to svn_checksum_ctx_create2(), but with @a salt set to @c NULL.
*
* @since New in 1.6.
+ * @deprecated Provided for backward compatibility with the 1.6 API.
*/
+SVN_DEPRECATED
svn_checksum_ctx_t *
svn_checksum_ctx_create(svn_checksum_kind_t kind,
apr_pool_t *pool);
/**
* Reset an existing checksum @a ctx to initial state.
- * @see svn_checksum_ctx_create()
+ * @see svn_checksum_ctx_create2()
*
* @since New in 1.10.
*/
Modified:
subversion/branches/pristine-checksum-salt/subversion/libsvn_delta/text_delta.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-salt/subversion/libsvn_delta/text_delta.c?rev=1908639&r1=1908638&r2=1908639&view=diff
==============================================================================
---
subversion/branches/pristine-checksum-salt/subversion/libsvn_delta/text_delta.c
(original)
+++
subversion/branches/pristine-checksum-salt/subversion/libsvn_delta/text_delta.c
Wed Mar 22 15:17:31 2023
@@ -439,7 +439,7 @@ svn_txdelta_run(svn_stream_t *source,
tb.result_pool = result_pool;
if (checksum != NULL)
- tb.context = svn_checksum_ctx_create(checksum_kind, scratch_pool);
+ tb.context = svn_checksum_ctx_create2(checksum_kind, NULL, scratch_pool);
do
{
@@ -481,7 +481,7 @@ svn_txdelta2(svn_txdelta_stream_t **stre
b->more = TRUE;
b->buf = apr_palloc(pool, 2 * SVN_DELTA_WINDOW_SIZE);
b->context = calculate_checksum
- ? svn_checksum_ctx_create(svn_checksum_md5, pool)
+ ? svn_checksum_ctx_create2(svn_checksum_md5, NULL, pool)
: NULL;
b->result_pool = pool;
@@ -829,7 +829,7 @@ svn_txdelta_apply2(svn_stream_t *source,
ab->result_digest = result_digest;
if (result_digest)
- ab->md5_context = svn_checksum_ctx_create(svn_checksum_md5, subpool);
+ ab->md5_context = svn_checksum_ctx_create2(svn_checksum_md5, NULL,
subpool);
if (error_info)
ab->error_info = apr_pstrdup(subpool, error_info);
@@ -902,7 +902,7 @@ svn_error_t *svn_txdelta_send_stream(svn
svn_checksum_ctx_t *md5_checksum_ctx;
if (digest)
- md5_checksum_ctx = svn_checksum_ctx_create(svn_checksum_md5, pool);
+ md5_checksum_ctx = svn_checksum_ctx_create2(svn_checksum_md5, NULL, pool);
while (1)
{
Modified:
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_base/reps-strings.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_base/reps-strings.c?rev=1908639&r1=1908638&r2=1908639&view=diff
==============================================================================
---
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_base/reps-strings.c
(original)
+++
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_base/reps-strings.c
Wed Mar 22 15:17:31 2023
@@ -692,8 +692,8 @@ rep_read_get_baton(struct rep_read_baton
struct rep_read_baton *b;
b = apr_pcalloc(pool, sizeof(*b));
- b->md5_checksum_ctx = svn_checksum_ctx_create(svn_checksum_md5, pool);
- b->sha1_checksum_ctx = svn_checksum_ctx_create(svn_checksum_sha1, pool);
+ b->md5_checksum_ctx = svn_checksum_ctx_create2(svn_checksum_md5, NULL, pool);
+ b->sha1_checksum_ctx = svn_checksum_ctx_create2(svn_checksum_sha1, NULL,
pool);
if (rep_key)
SVN_ERR(svn_fs_base__rep_contents_size(&(b->size), fs, rep_key,
@@ -1028,8 +1028,8 @@ rep_write_get_baton(svn_fs_t *fs,
struct rep_write_baton *b;
b = apr_pcalloc(pool, sizeof(*b));
- b->md5_checksum_ctx = svn_checksum_ctx_create(svn_checksum_md5, pool);
- b->sha1_checksum_ctx = svn_checksum_ctx_create(svn_checksum_sha1, pool);
+ b->md5_checksum_ctx = svn_checksum_ctx_create2(svn_checksum_md5, NULL, pool);
+ b->sha1_checksum_ctx = svn_checksum_ctx_create2(svn_checksum_sha1, NULL,
pool);
b->fs = fs;
b->trail = trail;
b->pool = pool;
Modified:
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/cached_data.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/cached_data.c?rev=1908639&r1=1908638&r2=1908639&view=diff
==============================================================================
---
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/cached_data.c
(original)
+++
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/cached_data.c
Wed Mar 22 15:17:31 2023
@@ -1523,7 +1523,7 @@ rep_read_get_baton(struct rep_read_baton
b->base_window = NULL;
b->chunk_index = 0;
b->buf = NULL;
- b->md5_checksum_ctx = svn_checksum_ctx_create(svn_checksum_md5, pool);
+ b->md5_checksum_ctx = svn_checksum_ctx_create2(svn_checksum_md5, NULL, pool);
b->checksum_finalized = FALSE;
memcpy(b->md5_digest, rep->md5_digest, sizeof(rep->md5_digest));
b->len = rep->expanded_size;
Modified:
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/index.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/index.c?rev=1908639&r1=1908638&r2=1908639&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/index.c
(original)
+++ subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/index.c
Wed Mar 22 15:17:31 2023
@@ -3101,7 +3101,7 @@ calc_fnv1(svn_fs_fs__p2l_entry_t *entry,
unsigned char buffer[4096];
svn_checksum_t *checksum;
svn_checksum_ctx_t *context
- = svn_checksum_ctx_create(svn_checksum_fnv1a_32x4, scratch_pool);
+ = svn_checksum_ctx_create2(svn_checksum_fnv1a_32x4, NULL, scratch_pool);
apr_off_t size = entry->size;
/* Special rules apply to unused sections / items. The data must be a
Modified:
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/transaction.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/transaction.c?rev=1908639&r1=1908638&r2=1908639&view=diff
==============================================================================
---
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/transaction.c
(original)
+++
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/transaction.c
Wed Mar 22 15:17:31 2023
@@ -1876,7 +1876,7 @@ fnv1a_wrap_stream(svn_checksum_ctx_t **c
fnv1a_stream_baton_t *baton = apr_pcalloc(pool, sizeof(*baton));
baton->inner_stream = inner_stream;
- baton->context = svn_checksum_ctx_create(svn_checksum_fnv1a_32x4, pool);
+ baton->context = svn_checksum_ctx_create2(svn_checksum_fnv1a_32x4, NULL,
pool);
*context = baton->context;
outer_stream = svn_stream_create(baton, pool);
@@ -2208,8 +2208,8 @@ rep_write_get_baton(struct rep_write_bat
b = apr_pcalloc(pool, sizeof(*b));
- b->sha1_checksum_ctx = svn_checksum_ctx_create(svn_checksum_sha1, pool);
- b->md5_checksum_ctx = svn_checksum_ctx_create(svn_checksum_md5, pool);
+ b->sha1_checksum_ctx = svn_checksum_ctx_create2(svn_checksum_sha1, NULL,
pool);
+ b->md5_checksum_ctx = svn_checksum_ctx_create2(svn_checksum_md5, NULL, pool);
b->fs = fs;
b->result_pool = pool;
@@ -2809,9 +2809,9 @@ write_container_rep(representation_t *re
else
fnv1a_checksum_ctx = NULL;
whb->size = 0;
- whb->md5_ctx = svn_checksum_ctx_create(svn_checksum_md5, scratch_pool);
+ whb->md5_ctx = svn_checksum_ctx_create2(svn_checksum_md5, NULL,
scratch_pool);
if (item_type != SVN_FS_FS__ITEM_TYPE_DIR_REP)
- whb->sha1_ctx = svn_checksum_ctx_create(svn_checksum_sha1, scratch_pool);
+ whb->sha1_ctx = svn_checksum_ctx_create2(svn_checksum_sha1, NULL,
scratch_pool);
stream = svn_stream_create(whb, scratch_pool);
svn_stream_set_write(stream, write_container_handler);
@@ -2953,9 +2953,9 @@ write_container_delta_rep(representation
whb->stream = svn_txdelta_target_push(diff_wh, diff_whb, source,
scratch_pool);
whb->size = 0;
- whb->md5_ctx = svn_checksum_ctx_create(svn_checksum_md5, scratch_pool);
+ whb->md5_ctx = svn_checksum_ctx_create2(svn_checksum_md5, NULL,
scratch_pool);
if (item_type != SVN_FS_FS__ITEM_TYPE_DIR_REP)
- whb->sha1_ctx = svn_checksum_ctx_create(svn_checksum_sha1, scratch_pool);
+ whb->sha1_ctx = svn_checksum_ctx_create2(svn_checksum_sha1, NULL,
scratch_pool);
/* serialize the hash */
stream = svn_stream_create(whb, scratch_pool);
Modified:
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/verify.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/verify.c?rev=1908639&r1=1908638&r2=1908639&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/verify.c
(original)
+++ subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_fs/verify.c
Wed Mar 22 15:17:31 2023
@@ -179,7 +179,7 @@ verify_index_checksum(apr_file_t *file,
apr_off_t size = end - start;
svn_checksum_t *actual;
svn_checksum_ctx_t *context
- = svn_checksum_ctx_create(svn_checksum_md5, scratch_pool);
+ = svn_checksum_ctx_create2(svn_checksum_md5, NULL, scratch_pool);
/* Calculate the index checksum. */
SVN_ERR(svn_io_file_seek(file, APR_SET, &start, scratch_pool));
@@ -566,7 +566,7 @@ expected_streamed_checksum(apr_file_t *f
unsigned char buffer[STREAM_THRESHOLD];
svn_checksum_t *checksum;
svn_checksum_ctx_t *context
- = svn_checksum_ctx_create(svn_checksum_fnv1a_32x4, pool);
+ = svn_checksum_ctx_create2(svn_checksum_fnv1a_32x4, NULL, pool);
apr_off_t size = entry->size;
while (size > 0)
Modified:
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/cached_data.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/cached_data.c?rev=1908639&r1=1908638&r2=1908639&view=diff
==============================================================================
---
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/cached_data.c
(original)
+++
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/cached_data.c
Wed Mar 22 15:17:31 2023
@@ -1254,8 +1254,8 @@ rep_read_get_baton(rep_read_baton_t **rb
b->base_window = NULL;
b->chunk_index = 0;
b->buf = NULL;
- b->md5_checksum_ctx = svn_checksum_ctx_create(svn_checksum_md5,
- result_pool);
+ b->md5_checksum_ctx = svn_checksum_ctx_create2(svn_checksum_md5, NULL,
+ result_pool);
b->checksum_finalized = FALSE;
memcpy(b->md5_digest, rep->md5_digest, sizeof(rep->md5_digest));
b->len = rep->expanded_size;
Modified:
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/index.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/index.c?rev=1908639&r1=1908638&r2=1908639&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/index.c
(original)
+++ subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/index.c
Wed Mar 22 15:17:31 2023
@@ -3444,7 +3444,7 @@ calc_fnv1(svn_fs_x__p2l_entry_t *entry,
unsigned char buffer[4096];
svn_checksum_t *checksum;
svn_checksum_ctx_t *context
- = svn_checksum_ctx_create(svn_checksum_fnv1a_32x4, scratch_pool);
+ = svn_checksum_ctx_create2(svn_checksum_fnv1a_32x4, NULL, scratch_pool);
apr_off_t size = entry->size;
/* Special rules apply to unused sections / items. The data must be a
Modified:
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/transaction.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/transaction.c?rev=1908639&r1=1908638&r2=1908639&view=diff
==============================================================================
---
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/transaction.c
(original)
+++
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/transaction.c
Wed Mar 22 15:17:31 2023
@@ -2257,10 +2257,10 @@ rep_write_get_baton(rep_write_baton_t **
b = apr_pcalloc(result_pool, sizeof(*b));
- b->sha1_checksum_ctx = svn_checksum_ctx_create(svn_checksum_sha1,
+ b->sha1_checksum_ctx = svn_checksum_ctx_create2(svn_checksum_sha1, NULL,
+ result_pool);
+ b->md5_checksum_ctx = svn_checksum_ctx_create2(svn_checksum_md5, NULL,
result_pool);
- b->md5_checksum_ctx = svn_checksum_ctx_create(svn_checksum_md5,
- result_pool);
b->fs = fs;
b->result_pool = result_pool;
@@ -2929,9 +2929,9 @@ write_container_delta_rep(svn_fs_x__repr
whb->stream = svn_txdelta_target_push(diff_wh, diff_whb, source,
scratch_pool);
whb->size = 0;
- whb->md5_ctx = svn_checksum_ctx_create(svn_checksum_md5, scratch_pool);
+ whb->md5_ctx = svn_checksum_ctx_create2(svn_checksum_md5, NULL,
scratch_pool);
if (item_type != SVN_FS_X__ITEM_TYPE_DIR_REP)
- whb->sha1_ctx = svn_checksum_ctx_create(svn_checksum_sha1, scratch_pool);
+ whb->sha1_ctx = svn_checksum_ctx_create2(svn_checksum_sha1, NULL,
scratch_pool);
/* serialize the hash */
stream = svn_stream_create(whb, scratch_pool);
Modified:
subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/verify.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/verify.c?rev=1908639&r1=1908638&r2=1908639&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/verify.c
(original)
+++ subversion/branches/pristine-checksum-salt/subversion/libsvn_fs_x/verify.c
Wed Mar 22 15:17:31 2023
@@ -153,7 +153,7 @@ verify_index_checksum(svn_fs_x__revision
apr_off_t size = index_info->end - index_info->start;
svn_checksum_t *actual;
svn_checksum_ctx_t *context
- = svn_checksum_ctx_create(svn_checksum_md5, scratch_pool);
+ = svn_checksum_ctx_create2(svn_checksum_md5, NULL, scratch_pool);
/* Calculate the index checksum. */
SVN_ERR(svn_fs_x__rev_file_seek(file, NULL, index_info->start));
@@ -537,7 +537,7 @@ expected_streamed_checksum(svn_fs_x__rev
unsigned char buffer[STREAM_THRESHOLD];
svn_checksum_t *checksum;
svn_checksum_ctx_t *context
- = svn_checksum_ctx_create(svn_checksum_fnv1a_32x4, scratch_pool);
+ = svn_checksum_ctx_create2(svn_checksum_fnv1a_32x4, NULL, scratch_pool);
apr_off_t size = entry->size;
while (size > 0)
Modified:
subversion/branches/pristine-checksum-salt/subversion/libsvn_ra_svn/client.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-salt/subversion/libsvn_ra_svn/client.c?rev=1908639&r1=1908638&r2=1908639&view=diff
==============================================================================
---
subversion/branches/pristine-checksum-salt/subversion/libsvn_ra_svn/client.c
(original)
+++
subversion/branches/pristine-checksum-salt/subversion/libsvn_ra_svn/client.c
Wed Mar 22 15:17:31 2023
@@ -1471,7 +1471,7 @@ static svn_error_t *get_file(svn_ra_sess
{
SVN_ERR(svn_checksum_parse_hex(&expected_checksum, svn_checksum_md5,
expected_digest, pool));
- checksum_ctx = svn_checksum_ctx_create(svn_checksum_md5, pool);
+ checksum_ctx = svn_checksum_ctx_create2(svn_checksum_md5, NULL, pool);
}
/* Read the file's contents. */
Modified:
subversion/branches/pristine-checksum-salt/subversion/libsvn_subr/checksum.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-salt/subversion/libsvn_subr/checksum.c?rev=1908639&r1=1908638&r2=1908639&view=diff
==============================================================================
---
subversion/branches/pristine-checksum-salt/subversion/libsvn_subr/checksum.c
(original)
+++
subversion/branches/pristine-checksum-salt/subversion/libsvn_subr/checksum.c
Wed Mar 22 15:17:31 2023
@@ -533,33 +533,45 @@ struct svn_checksum_ctx_t
{
void *apr_ctx;
svn_checksum_kind_t kind;
+ const svn_string_t *salt;
};
svn_checksum_ctx_t *
-svn_checksum_ctx_create(svn_checksum_kind_t kind,
- apr_pool_t *pool)
+svn_checksum_ctx_create2(svn_checksum_kind_t kind,
+ const svn_string_t *salt,
+ apr_pool_t *pool)
{
svn_checksum_ctx_t *ctx = apr_palloc(pool, sizeof(*ctx));
ctx->kind = kind;
+
+ if (salt)
+ ctx->salt = svn_string_dup(salt, pool);
+ else
+ ctx->salt = svn_string_create_empty(pool);
+
switch (kind)
{
case svn_checksum_md5:
ctx->apr_ctx = apr_palloc(pool, sizeof(apr_md5_ctx_t));
apr_md5_init(ctx->apr_ctx);
+ apr_md5_update(ctx->apr_ctx, ctx->salt->data, ctx->salt->len);
break;
case svn_checksum_sha1:
ctx->apr_ctx = apr_palloc(pool, sizeof(apr_sha1_ctx_t));
apr_sha1_init(ctx->apr_ctx);
+ apr_sha1_update(ctx->apr_ctx, ctx->salt->data, (unsigned
int)ctx->salt->len);
break;
case svn_checksum_fnv1a_32:
ctx->apr_ctx = svn_fnv1a_32__context_create(pool);
+ svn_fnv1a_32__update(ctx->apr_ctx, ctx->salt->data, ctx->salt->len);
break;
case svn_checksum_fnv1a_32x4:
ctx->apr_ctx = svn_fnv1a_32x4__context_create(pool);
+ svn_fnv1a_32x4__update(ctx->apr_ctx, ctx->salt->data, ctx->salt->len);
break;
default:
@@ -577,19 +589,23 @@ svn_checksum_ctx_reset(svn_checksum_ctx_
case svn_checksum_md5:
memset(ctx->apr_ctx, 0, sizeof(apr_md5_ctx_t));
apr_md5_init(ctx->apr_ctx);
+ apr_md5_update(ctx->apr_ctx, ctx->salt->data, ctx->salt->len);
break;
case svn_checksum_sha1:
memset(ctx->apr_ctx, 0, sizeof(apr_sha1_ctx_t));
apr_sha1_init(ctx->apr_ctx);
+ apr_sha1_update(ctx->apr_ctx, ctx->salt->data, (unsigned
int)ctx->salt->len);
break;
case svn_checksum_fnv1a_32:
svn_fnv1a_32__context_reset(ctx->apr_ctx);
+ svn_fnv1a_32__update(ctx->apr_ctx, ctx->salt->data, ctx->salt->len);
break;
case svn_checksum_fnv1a_32x4:
svn_fnv1a_32x4__context_reset(ctx->apr_ctx);
+ svn_fnv1a_32x4__update(ctx->apr_ctx, ctx->salt->data, ctx->salt->len);
break;
default:
@@ -806,7 +822,7 @@ wrap_write_stream(svn_checksum_t **check
stream_baton_t *baton = apr_pcalloc(pool, sizeof(*baton));
baton->inner_stream = inner_stream;
- baton->context = svn_checksum_ctx_create(kind, pool);
+ baton->context = svn_checksum_ctx_create2(kind, NULL, pool);
baton->checksum = checksum;
baton->digest = digest;
baton->pool = pool;
Modified:
subversion/branches/pristine-checksum-salt/subversion/libsvn_subr/deprecated.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-salt/subversion/libsvn_subr/deprecated.c?rev=1908639&r1=1908638&r2=1908639&view=diff
==============================================================================
---
subversion/branches/pristine-checksum-salt/subversion/libsvn_subr/deprecated.c
(original)
+++
subversion/branches/pristine-checksum-salt/subversion/libsvn_subr/deprecated.c
Wed Mar 22 15:17:31 2023
@@ -2013,3 +2013,11 @@ svn_cstring_join(const apr_array_header_
{
return svn_cstring_join2(strings, separator, TRUE, pool);
}
+
+/*** From checksum.c ***/
+svn_checksum_ctx_t *
+svn_checksum_ctx_create(svn_checksum_kind_t kind,
+ apr_pool_t *pool)
+{
+ return svn_checksum_ctx_create2(kind, NULL, pool);
+}
Modified:
subversion/branches/pristine-checksum-salt/subversion/libsvn_subr/stream.c
URL:
http://svn.apache.org/viewvc/subversion/branches/pristine-checksum-salt/subversion/libsvn_subr/stream.c?rev=1908639&r1=1908638&r2=1908639&view=diff
==============================================================================
--- subversion/branches/pristine-checksum-salt/subversion/libsvn_subr/stream.c
(original)
+++ subversion/branches/pristine-checksum-salt/subversion/libsvn_subr/stream.c
Wed Mar 22 15:17:31 2023
@@ -1496,12 +1496,12 @@ svn_stream_checksummed2(svn_stream_t *st
baton = apr_palloc(pool, sizeof(*baton));
if (read_checksum)
- baton->read_ctx = svn_checksum_ctx_create(checksum_kind, pool);
+ baton->read_ctx = svn_checksum_ctx_create2(checksum_kind, NULL, pool);
else
baton->read_ctx = NULL;
if (write_checksum)
- baton->write_ctx = svn_checksum_ctx_create(checksum_kind, pool);
+ baton->write_ctx = svn_checksum_ctx_create2(checksum_kind, NULL, pool);
else
baton->write_ctx = NULL;
@@ -1530,7 +1530,7 @@ compute_stream_checksum(svn_checksum_t *
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- svn_checksum_ctx_t *ctx = svn_checksum_ctx_create(kind, scratch_pool);
+ svn_checksum_ctx_t *ctx = svn_checksum_ctx_create2(kind, NULL, scratch_pool);
char *buf = apr_palloc(scratch_pool, SVN__STREAM_CHUNK_SIZE);
while (1)