Handle WANT_READ more correctly (thanks to Bodo).
[openssl.git] / demos / b64.c
index 42abc42d33eb8f761a10e05735266ee8ab844e5d..8e248e7e728547c75e1659e80729fee39f6e6920 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "apps.h"
-#include "buffer.h"
-#include "err.h"
-#include "evp.h"
-#include "objects.h"
-#include "x509.h"
-#include "pem.h"
+#include "../apps/apps.h"
+#include <openssl/buffer.h>
+#include <openssl/err.h>
+#include <openssl/evp.h>
+#include <openssl/objects.h>
+#include <openssl/x509.h>
+#include <openssl/pem.h>
 
 #undef SIZE
 #undef BSIZE
@@ -177,11 +177,11 @@ bad:
                if (verbose) BIO_printf(bio_err,"bufsize=%d\n",bsize);
                }
 
-       strbuf=Malloc(SIZE);
-       buff=(unsigned char *)Malloc(EVP_ENCODE_LENGTH(bsize));
+       strbuf=OPENSSL_malloc(SIZE);
+       buff=(unsigned char *)OPENSSL_malloc(EVP_ENCODE_LENGTH(bsize));
        if ((buff == NULL) || (strbuf == NULL))
                {
-               BIO_printf(bio_err,"Malloc failure\n");
+               BIO_printf(bio_err,"OPENSSL_malloc failure\n");
                goto end;
                }
 
@@ -259,8 +259,8 @@ bad:
                BIO_printf(bio_err,"bytes written:%8ld\n",BIO_number_written(out));
                }
 end:
-       if (strbuf != NULL) Free(strbuf);
-       if (buff != NULL) Free(buff);
+       if (strbuf != NULL) OPENSSL_free(strbuf);
+       if (buff != NULL) OPENSSL_free(buff);
        if (in != NULL) BIO_free(in);
        if (out != NULL) BIO_free(out);
        if (benc != NULL) BIO_free(benc);