From 7663d126b180e4268ad47d20b7056c677d15a7fe Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Thu, 6 Mar 2025 21:13:02 +0100 Subject: [PATCH] resolve naming problem --- pclsync/pcrypto.c | 2 +- pclsync/pcrypto.h | 2 +- pclsync/pcryptofolder.c | 10 +++++----- pclsync/pp2p.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pclsync/pcrypto.c b/pclsync/pcrypto.c index e0668bf..7ef6798 100644 --- a/pclsync/pcrypto.c +++ b/pclsync/pcrypto.c @@ -197,7 +197,7 @@ void pcrypto_ctr_encdec_free( psync_free(enc); } -void pcrypto_ctr_encdec_encode( +void pcrypto_ctr_encdec_decode( pcrypto_ctr_encdec_t enc, void *data, size_t datalen, uint64_t dataoffset) { unsigned char buff[PAES_BLOCK_SIZE * 3], *aessrc, *aesdst; diff --git a/pclsync/pcrypto.h b/pclsync/pcrypto.h index 08b6aa7..df32de1 100644 --- a/pclsync/pcrypto.h +++ b/pclsync/pcrypto.h @@ -84,7 +84,7 @@ typedef pcrypto_encdec_iv_t *pcrypto_sector_encdec_t; #define PSYNC_CRYPTO_INVALID_REVISIONID ((uint32_t)-1) pcrypto_ctr_encdec_t pcrypto_ctr_encdec_create(pssl_symkey_t *key); -void pcrypto_ctr_encdec_encode(pcrypto_ctr_encdec_t enc, void *data, size_t datalen, uint64_t dataoffset); +void pcrypto_ctr_encdec_decode(pcrypto_ctr_encdec_t enc, void *data, size_t datalen, uint64_t dataoffset); void pcrypto_ctr_encdec_free(pcrypto_ctr_encdec_t enc); int pcrypto_decode_sec(pcrypto_sector_encdec_t enc, const unsigned char *data, size_t datalen, unsigned char *out, const pcrypto_sector_auth_t auth, uint64_t sectorid); unsigned char * pcrypto_decode_text(pcrypto_textdec_t enc, const unsigned char *data, size_t datalen); diff --git a/pclsync/pcryptofolder.c b/pclsync/pcryptofolder.c index 726130a..94ca0ea 100644 --- a/pclsync/pcryptofolder.c +++ b/pclsync/pcryptofolder.c @@ -1191,7 +1191,7 @@ int pcryptofolder_setup(const char *password, const char *hint) { return PSYNC_CRYPTO_SETUP_KEYGEN_FAILED; } debug(D_NOTICE, "encoding private key"); - pcrypto_ctr_encdec_encode(enc, rsaprivatebin->data, + pcrypto_ctr_encdec_decode(enc, rsaprivatebin->data, rsaprivatebin->datalen, 0); pcrypto_ctr_encdec_free(enc); debug(D_NOTICE, "encoded private key, uploading keys"); @@ -1357,7 +1357,7 @@ int pcryptofolder_unlock(const char *password) { psymkey_free(aeskey); rsaprivdec = (unsigned char *)pmemlock_malloc(rsaprivlen); memcpy(rsaprivdec, rsapriv, rsaprivlen); - pcrypto_ctr_encdec_encode(enc, rsaprivdec, rsaprivlen, 0); + pcrypto_ctr_encdec_decode(enc, rsaprivdec, rsaprivlen, 0); pcrypto_ctr_encdec_free(enc); debug(D_NOTICE, "successfully decoded private key"); @@ -1819,7 +1819,7 @@ int psync_pcloud_crypto_reencode_key(const unsigned char *rsapub, size_t rsapubl goto err_nm_1; } memcpy(rsaprivdec, rsapriv_struct->key, rsaprivlen); - pcrypto_ctr_encdec_encode(enc, rsaprivdec, rsaprivlen, + pcrypto_ctr_encdec_decode(enc, rsaprivdec, rsaprivlen, 0); pcrypto_ctr_encdec_free(enc); newpriv = (unsigned char *)psync_malloc(offsetof(priv_key_ver1, key) + @@ -1841,7 +1841,7 @@ int psync_pcloud_crypto_reencode_key(const unsigned char *rsapub, size_t rsapubl if (unlikely(enc == PSYNC_CRYPTO_INVALID_ENCODER)) goto err_nm_1; memcpy(rsapriv_struct->key, rsaprivdec, rsaprivlen); - pcrypto_ctr_encdec_encode(enc, rsapriv_struct->key, + pcrypto_ctr_encdec_decode(enc, rsapriv_struct->key, rsaprivlen, 0); pcrypto_ctr_encdec_free(enc); newprivlen = offsetof(priv_key_ver1, key) + rsaprivlen; @@ -1928,7 +1928,7 @@ int psync_pcloud_crypto_encode_key(const char *newpassphrase, uint32_t flags, ch if (unlikely(enc == PSYNC_CRYPTO_INVALID_ENCODER)) goto err_nm_1; memcpy(rsapriv_struct->key, rsapriv->data, rsaprivlen); - pcrypto_ctr_encdec_encode(enc, rsapriv_struct->key, + pcrypto_ctr_encdec_decode(enc, rsapriv_struct->key, rsaprivlen, 0); pcrypto_ctr_encdec_free(enc); rsaprivlen += offsetof(priv_key_ver1, key); diff --git a/pclsync/pp2p.c b/pclsync/pp2p.c index de6c944..0eb8929 100644 --- a/pclsync/pp2p.c +++ b/pclsync/pp2p.c @@ -405,7 +405,7 @@ static void psync_p2p_tcphandler(void *ptr) { rd = sizeof(buff); if (unlikely_log(pfile_read(fd, buff, rd) != rd)) break; - pcrypto_ctr_encdec_encode(encoder, buff, rd, off); + pcrypto_ctr_encdec_decode(encoder, buff, rd, off); if (unlikely_log(socket_write_all(sock, buff, rd))) break; off += rd; @@ -700,7 +700,7 @@ static int psync_p2p_download(int sock, psync_fileid_t fileid, rd = fsize - off; if (unlikely_log(socket_read_all(sock, buff, rd))) goto err0; - pcrypto_ctr_encdec_encode(decoder, buff, rd, off); + pcrypto_ctr_encdec_decode(decoder, buff, rd, off); if (unlikely_log(pfile_write(fd, buff, rd) != rd)) goto err0; psync_hash_update(&hashctx, buff, rd);