-/* -*- mode: C; c-file-style: "gnu" -*- */
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-md5.c md5 implementation (based on L Peter Deutsch implementation)
*
* Copyright (C) 2003 Red Hat Inc.
* <ghost@aladdin.com>.
*/
+#include <config.h>
#include "dbus-internals.h"
#include "dbus-md5.h"
#include <string.h>
* The implementation of MD5 (see http://www.ietf.org/rfc/rfc1321.txt).
* This MD5 implementation was written by L. Peter Deutsch and
* is not derived from the RSA reference implementation in the
- * RFC. The version included in D-BUS comes from the Ghostscript
+ * RFC. The version included in D-Bus comes from the Ghostscript
* 7.05 distribution.
*
* @{
#define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca)
#define T63 0x2ad7d2bb
#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e)
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+#endif /* !DOXYGEN_SHOULD_SKIP_THIS */
static void
md5_process(DBusMD5Context *context, const unsigned char *data /*[64]*/)
/* some kind of security paranoia, though it seems pointless
* to me given the nonzeroed stuff flying around
*/
- memset ((void*)context, '\0', sizeof (DBusMD5Context));
+ _DBUS_ZERO(*context);
return TRUE;
}
_dbus_md5_update (&context, data);
- if (!_dbus_string_init (&digest, _DBUS_INT_MAX))
+ if (!_dbus_string_init (&digest))
return FALSE;
if (!_dbus_md5_final (&context, &digest))
_dbus_string_get_length (ascii_output)))
goto error;
+ _dbus_string_free (&digest);
+
return TRUE;
error:
_dbus_string_init_const_len (&input_str, input, input_len);
_dbus_string_init_const (&expected_str, expected);
- if (!_dbus_string_init (&results, _DBUS_INT_MAX))
+ if (!_dbus_string_init (&results))
_dbus_assert_not_reached ("no memory for md5 results");
if (!_dbus_md5_compute (&input_str, &results))