+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
/*
* Modified by Kurt D. Zeilenga for inclusion into OpenLDAP
*/
#include "portable.h"
-#include <stdlib.h>
-#include <stddef.h>
-#include <ctype.h>
-
+#include <ac/assert.h>
+#include <ac/stdlib.h>
+#include <ac/ctype.h>
#include <ac/string.h>
/* include socket.h to get sys/types.h and/or winsock2.h */
#include "lutil.h"
-#define Assert(Cond) if (!(Cond)) abort()
-
static const char Base64[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static const char Pad64 = '=';
*/
int
-b64_ntop(
+lutil_b64_ntop(
u_char const *src,
size_t srclength,
char *target,
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
output[3] = input[2] & 0x3f;
- Assert(output[0] < 64);
- Assert(output[1] < 64);
- Assert(output[2] < 64);
- Assert(output[3] < 64);
+ assert(output[0] < 64);
+ assert(output[1] < 64);
+ assert(output[2] < 64);
+ assert(output[3] < 64);
if (datalength + 4 > targsize)
return (-1);
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
- Assert(output[0] < 64);
- Assert(output[1] < 64);
- Assert(output[2] < 64);
+ assert(output[0] < 64);
+ assert(output[1] < 64);
+ assert(output[2] < 64);
if (datalength + 4 > targsize)
return (-1);
*/
int
-b64_pton(
+lutil_b64_pton(
char const *src,
u_char *target,
size_t targsize)