Also add STATIC_ARRAY macro to hide it in c++ compilation.
* Compute client -> server authentication response.
*/
static void rpa_user_response(struct rpa_auth_request *request,
- unsigned char digest[MD5_RESULTLEN])
+ unsigned char digest[STATIC_ARRAY MD5_RESULTLEN])
{
struct md5_context ctx;
unsigned char z[48];
* Compute server -> client authentication response.
*/
static void rpa_server_response(struct rpa_auth_request *request,
- unsigned char digest[MD5_RESULTLEN])
+ unsigned char digest[STATIC_ARRAY MD5_RESULTLEN])
{
struct md5_context ctx;
unsigned char tmp[MD5_RESULTLEN];
passdb->iface = passdb_iface_deinit;
}
-void passdbs_generate_md5(unsigned char md5[MD5_RESULTLEN])
+void passdbs_generate_md5(unsigned char md5[STATIC_ARRAY MD5_RESULTLEN])
{
struct md5_context ctx;
struct passdb_module *const *passdbs;
void passdb_register_module(struct passdb_module_interface *iface);
void passdb_unregister_module(struct passdb_module_interface *iface);
-void passdbs_generate_md5(unsigned char md5[MD5_RESULTLEN]);
+void passdbs_generate_md5(unsigned char md5[STATIC_ARRAY MD5_RESULTLEN]);
void passdbs_init(void);
void passdbs_deinit(void);
userdb->iface = &userdb_iface_deinit;
}
-void userdbs_generate_md5(unsigned char md5[MD5_RESULTLEN])
+void userdbs_generate_md5(unsigned char md5[STATIC_ARRAY MD5_RESULTLEN])
{
struct md5_context ctx;
struct userdb_module *const *userdbs;
void userdb_register_module(struct userdb_module_interface *iface);
void userdb_unregister_module(struct userdb_module_interface *iface);
-void userdbs_generate_md5(unsigned char md5[MD5_RESULTLEN]);
+void userdbs_generate_md5(unsigned char md5[STATIC_ARRAY MD5_RESULTLEN]);
void userdbs_init(void);
void userdbs_deinit(void);
}
static void mbox_md5_all_finish(struct mbox_md5_context *ctx,
- unsigned char result[16])
+ unsigned char result[STATIC_ARRAY 16])
{
md5_final(&ctx->hdr_md5_ctx, result);
i_free(ctx);
}
static void mbox_md5_apop3d_finish(struct mbox_md5_context *ctx,
- unsigned char result[16])
+ unsigned char result[STATIC_ARRAY 16])
{
md5_final(&ctx->hdr_md5_ctx, result);
i_free(ctx);
void (*more)(struct mbox_md5_context *ctx,
struct message_header_line *hdr);
void (*finish)(struct mbox_md5_context *ctx,
- unsigned char result[16]);
+ unsigned char result[STATIC_ARRAY 16]);
};
extern struct mbox_md5_vfuncs mbox_md5_apop3d;
}
void guid_128_host_hash_get(const char *host,
- unsigned char hash_r[GUID_128_HOST_HASH_SIZE])
+ unsigned char hash_r[STATIC_ARRAY GUID_128_HOST_HASH_SIZE])
{
unsigned char full_hash[SHA1_RESULTLEN];
/* Return the hash of host used by guid_128_generate(). */
void guid_128_host_hash_get(const char *host,
- unsigned char hash_r[GUID_128_HOST_HASH_SIZE]);
+ unsigned char hash_r[STATIC_ARRAY GUID_128_HOST_HASH_SIZE]);
#endif
# define DOVECOT_PREREQ(maj, min) 0
#endif
+#ifdef __cplusplus
+# define STATIC_ARRAY
+#else
+# define STATIC_ARRAY static
+#endif
+
#endif
memcpy(ctx->buffer, data, size);
}
-void md4_final(struct md4_context *ctx, unsigned char result[MD4_RESULTLEN])
+void md4_final(struct md4_context *ctx, unsigned char result[STATIC_ARRAY MD4_RESULTLEN])
{
/* @UNSAFE */
unsigned long used, free;
}
void md4_get_digest(const void *data, size_t size,
- unsigned char result[MD4_RESULTLEN])
+ unsigned char result[STATIC_ARRAY MD4_RESULTLEN])
{
struct md4_context ctx;
void md4_init(struct md4_context *ctx);
void md4_update(struct md4_context *ctx, const void *data, size_t size);
-void md4_final(struct md4_context *ctx, unsigned char result[MD4_RESULTLEN]);
+void md4_final(struct md4_context *ctx,
+ unsigned char result[STATIC_ARRAY MD4_RESULTLEN]);
void md4_get_digest(const void *data, size_t size,
- unsigned char result[MD4_RESULTLEN]);
+ unsigned char result[STATIC_ARRAY MD4_RESULTLEN]);
extern const struct hash_method hash_method_md4;
memcpy(ctx->buffer, data, size);
}
-void md5_final(struct md5_context *ctx, unsigned char result[MD5_RESULTLEN])
+void md5_final(struct md5_context *ctx, unsigned char result[STATIC_ARRAY MD5_RESULTLEN])
{
/* @UNSAFE */
unsigned long used, free;
}
void md5_get_digest(const void *data, size_t size,
- unsigned char result[MD5_RESULTLEN])
+ unsigned char result[STATIC_ARRAY MD5_RESULTLEN])
{
struct md5_context ctx;
void md5_init(struct md5_context *ctx);
void md5_update(struct md5_context *ctx, const void *data, size_t size);
-void md5_final(struct md5_context *ctx, unsigned char result[MD5_RESULTLEN]);
+void md5_final(struct md5_context *ctx,
+ unsigned char result[STATIC_ARRAY MD5_RESULTLEN]);
void md5_get_digest(const void *data, size_t size,
- unsigned char result[MD5_RESULTLEN]);
+ unsigned char result[STATIC_ARRAY MD5_RESULTLEN]);
extern const struct hash_method hash_method_md5;
}
void sha1_get_digest(const void *data, size_t size,
- unsigned char result[SHA1_RESULTLEN])
+ unsigned char result[STATIC_ARRAY SHA1_RESULTLEN])
{
struct sha1_ctxt ctx;
#define SHA1_RESULTLEN (160/8)
extern void sha1_get_digest(const void *, size_t,
- unsigned char [SHA1_RESULTLEN]);
+ unsigned char [STATIC_ARRAY SHA1_RESULTLEN]);
extern const struct hash_method hash_method_sha1;
}
void sha256_result(struct sha256_ctx *ctx,
- unsigned char digest[SHA256_RESULTLEN])
+ unsigned char digest[STATIC_ARRAY SHA256_RESULTLEN])
{
size_t block_nb;
size_t pm_len;
}
void sha256_get_digest(const void *data, size_t size,
- unsigned char digest[SHA256_RESULTLEN])
+ unsigned char digest[STATIC_ARRAY SHA256_RESULTLEN])
{
struct sha256_ctx ctx;
}
void sha512_result(struct sha512_ctx *ctx,
- unsigned char digest[SHA512_RESULTLEN])
+ unsigned char digest[STATIC_ARRAY SHA512_RESULTLEN])
{
unsigned int block_nb;
unsigned int pm_len;
}
void sha512_get_digest(const void *data, size_t size,
- unsigned char digest[SHA512_RESULTLEN])
+ unsigned char digest[STATIC_ARRAY SHA512_RESULTLEN])
{
struct sha512_ctx ctx;
void sha256_init(struct sha256_ctx *ctx);
void sha256_loop(struct sha256_ctx *ctx, const void *data, size_t len);
void sha256_result(struct sha256_ctx *ctx,
- unsigned char digest[SHA256_RESULTLEN]);
+ unsigned char digest[STATIC_ARRAY SHA256_RESULTLEN]);
void sha256_get_digest(const void *data, size_t size,
- unsigned char digest[SHA256_RESULTLEN]);
+ unsigned char digest[STATIC_ARRAY SHA256_RESULTLEN]);
void sha512_init(struct sha512_ctx *ctx);
void sha512_loop(struct sha512_ctx *ctx, const void *data, size_t len);
void sha512_result(struct sha512_ctx *ctx,
- unsigned char digest[SHA512_RESULTLEN]);
+ unsigned char digest[STATIC_ARRAY SHA512_RESULTLEN]);
void sha512_get_digest(const void *data, size_t size,
- unsigned char digest[SHA512_RESULTLEN]);
+ unsigned char digest[STATIC_ARRAY SHA512_RESULTLEN]);
extern const struct hash_method hash_method_sha256;
extern const struct hash_method hash_method_sha512;
int pop3_migration_get_hdr_sha1(uint32_t mail_seq, struct istream *input,
uoff_t hdr_size,
- unsigned char sha1_r[SHA1_RESULTLEN],
+ unsigned char sha1_r[STATIC_ARRAY SHA1_RESULTLEN],
bool *have_eoh_r)
{
struct istream *input2;
}
static int
-get_hdr_sha1(struct mail *mail, unsigned char sha1_r[SHA1_RESULTLEN])
+get_hdr_sha1(struct mail *mail, unsigned char sha1_r[STATIC_ARRAY SHA1_RESULTLEN])
{
struct istream *input;
struct message_size hdr_size;
static bool
get_cached_hdr_sha1(struct mail *mail, buffer_t *cache_buf,
- unsigned char sha1_r[SHA1_RESULTLEN])
+ unsigned char sha1_r[STATIC_ARRAY SHA1_RESULTLEN])
{
struct index_mail *imail = (struct index_mail *)mail;
int pop3_migration_get_hdr_sha1(uint32_t mail_seq, struct istream *input,
uoff_t hdr_size,
- unsigned char sha1_r[SHA1_RESULTLEN],
+ unsigned char sha1_r[STATIC_ARRAY SHA1_RESULTLEN],
bool *have_eoh_r);
#endif