[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS shishi/lib
From: |
shishi-commit |
Subject: |
CVS shishi/lib |
Date: |
Thu, 02 Dec 2004 03:30:46 +0100 |
Update of /home/cvs/shishi/lib
In directory dopio:/tmp/cvs-serv3440
Modified Files:
diskio.c
Log Message:
Use new b64 API.
--- /home/cvs/shishi/lib/diskio.c 2004/09/10 10:00:00 1.42
+++ /home/cvs/shishi/lib/diskio.c 2004/12/02 02:30:46 1.43
@@ -41,32 +41,29 @@
{
char *der;
size_t derlen;
- char b64der[BUFSIZ];
- int res;
+ char *b64der;
size_t i;
+ int res;
- if (asn1 == NULL)
- return !SHISHI_OK;
-
- asn1_print_structure (fh, asn1, "", ASN1_PRINT_NAME_TYPE_VALUE);
+ if (!asn1)
+ return SHISHI_OK;
res = shishi_asn1_to_der (handle, asn1, &der, &derlen);
- if (res != ASN1_SUCCESS)
- {
- shishi_error_printf (handle, "Could not DER encode %s: %s\n",
- asn1type, shishi_strerror (res));
- return !SHISHI_OK;
- }
+ if (res != SHISHI_OK)
+ return res;
- base64_to (b64der, der, derlen, sizeof (b64der));
+ asn1_print_structure (fh, asn1, "", ASN1_PRINT_NAME_TYPE_VALUE);
+
+ i = base64_encode_alloc (der, derlen, &b64der);
+ if (b64der == NULL && i == 0 && derlen != 0)
+ return SHISHI_BASE64_ERROR;
+ if (b64der == NULL)
+ return SHISHI_MALLOC_ERROR;
fprintf (fh, HEADERBEG "\n", asn1type);
if (headers)
- {
- fprintf (fh, "%s", headers);
- fprintf (fh, "\n");
- }
+ fprintf (fh, "%s\n", headers);
for (i = 0; i < strlen (b64der); i++)
{
@@ -77,6 +74,8 @@
if ((i + 1) % 64 != 0)
fprintf (fh, "\n");
+ free (b64der);
+
fprintf (fh, HEADEREND "\n", asn1type);
return SHISHI_OK;
- CVS shishi/lib, shishi-commit, 2004/12/01
- CVS shishi/lib, shishi-commit, 2004/12/01
- CVS shishi/lib,
shishi-commit <=
- CVS shishi/lib, shishi-commit, 2004/12/01
- CVS shishi/lib, shishi-commit, 2004/12/01
- CVS shishi/lib, shishi-commit, 2004/12/01
- CVS shishi/lib, shishi-commit, 2004/12/01
- CVS shishi/lib, shishi-commit, 2004/12/02
- CVS shishi/lib, shishi-commit, 2004/12/02
- CVS shishi/lib, shishi-commit, 2004/12/02
- CVS shishi/lib, shishi-commit, 2004/12/02
- CVS shishi/lib, shishi-commit, 2004/12/18