#include <stdio.h>
#include "cryptlib.h"
-#include <openssl/bio.h>
+#include "bio_lcl.h"
#define TRUNCATE
#define DUMP_WIDTH 16
return(ret);
}
-#ifndef OPENSSL_NO_FP_API
+#ifndef OPENSSL_NO_STDIO
static int write_fp(const void *data, size_t len, void *fp)
{
- return fwrite(data, len, 1, (FILE *)fp);
+ return UP_fwrite(data, len, 1, fp);
}
int BIO_dump_fp(FILE *fp, const char *s, int len)
{
return BIO_dump_indent_cb(write_bio, bp, s, len, indent);
}
+int BIO_hex_string(BIO *out, int indent, int width, unsigned char *data,
+ int datalen)
+ {
+ int i, j = 0;
+
+ if (datalen < 1)
+ return 1;
+
+ for (i = 0; i < datalen - 1; i++)
+ {
+ if (i && !j) BIO_printf(out, "%*s", indent, "");
+
+ BIO_printf(out, "%02X:", data[i]);
+
+ j = (j + 1) % width;
+ if (!j) BIO_printf(out, "\n");
+ }
+
+ if (i && !j) BIO_printf(out, "%*s", indent, "");
+ BIO_printf(out, "%02X", data[datalen - 1]);
+ return 1;
+ }