Rename function to mdbi_rc4 to prevent it from being exported

This commit is contained in:
Benedikt Reinartz 2021-05-19 07:45:43 +02:00
parent ee5789ebc7
commit 9401d3cd84
5 changed files with 16 additions and 11 deletions

View File

@ -16,8 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _mdbprivate_h_
#define _mdbprivate_h_
#ifndef MDBPRIVATE_H
#define MDBPRIVATE_H
#include "mdbtools.h"
@ -30,6 +30,14 @@
#define g_memdup2 g_memdup
#endif
void mdb_rc4(unsigned char *key, guint32 key_len, unsigned char *buf, guint32 buf_len);
#ifdef __cplusplus
extern "C" {
#endif
void mdbi_rc4(unsigned char *key, guint32 key_len, unsigned char *buf, guint32 buf_len);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -648,9 +648,6 @@ void mdb_iconv_init(MdbHandle *mdb);
void mdb_iconv_close(MdbHandle *mdb);
const char* mdb_target_charset(MdbHandle *mdb);
/* rc4.c */
void mdb_rc4(unsigned char *key, guint32 key_len, unsigned char *buf, guint32 buf_len);
/** @}*/
#ifdef __cplusplus

View File

@ -172,7 +172,7 @@ static MdbHandle *mdb_handle_from_stream(FILE *stream, MdbFileFlags flags) {
}
guint32 tmp_key = 0x6b39dac7;
mdb_rc4(
mdbi_rc4(
(unsigned char *)&tmp_key,
4,
mdb->pg_buf + 0x18,
@ -377,7 +377,7 @@ static ssize_t _mdb_read_pg(MdbHandle *mdb, void *pg_buf, unsigned long pg)
if (pg != 0 && mdb->f->db_key != 0)
{
unsigned int tmp_key = mdb->f->db_key ^ pg;
mdb_rc4((unsigned char*)&tmp_key, 4, pg_buf, mdb->fmt->pg_size);
mdbi_rc4((unsigned char*)&tmp_key, 4, pg_buf, mdb->fmt->pg_size);
}
return mdb->fmt->pg_size;

View File

@ -18,7 +18,7 @@
#include "mdbprivate.h"
typedef struct _RC4_KEY
typedef struct
{
unsigned char state[256];
unsigned char x;
@ -78,7 +78,7 @@ static void RC4(RC4_KEY *key, int buffer_len, unsigned char * buff)
key->y = y;
}
void mdb_rc4(unsigned char *key, guint32 key_len, unsigned char *buf, guint32 buf_len) {
void mdbi_rc4(unsigned char *key, guint32 key_len, unsigned char *buf, guint32 buf_len) {
RC4_KEY rc4_key;
RC4_set_key(&rc4_key, key_len, key);
RC4(&rc4_key, buf_len, buf);

View File

@ -84,7 +84,7 @@ mdb_write_pg(MdbHandle *mdb, unsigned long pg)
{
buf = g_memdup2(mdb->pg_buf, mdb->fmt->pg_size);
unsigned int tmp_key = mdb->f->db_key ^ pg;
mdb_rc4((unsigned char*)&tmp_key, 4, buf, mdb->fmt->pg_size);
mdbi_rc4((unsigned char*)&tmp_key, 4, buf, mdb->fmt->pg_size);
}
len = fwrite(buf, 1, mdb->fmt->pg_size, mdb->f->stream);