crypto/ppccap.c: permit build with no-chacha and no-poly1305.
[openssl.git] / crypto / evp / encode.c
index 36affe56261d281594a522d9ea3fb3e63b1254d7..ed85f8933bc01f01cea67d39650cb960a69d6247 100644 (file)
@@ -1,4 +1,3 @@
-/* crypto/evp/encode.c */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -59,6 +58,7 @@
 #include <stdio.h>
 #include "internal/cryptlib.h"
 #include <openssl/evp.h>
+#include "evp_locl.h"
 
 static unsigned char conv_ascii2bin(unsigned char a);
 #ifndef CHARSET_EBCDIC
@@ -140,6 +140,20 @@ static unsigned char conv_ascii2bin(unsigned char a)
 }
 #endif
 
+EVP_ENCODE_CTX *EVP_ENCODE_CTX_new(void)
+{
+    return OPENSSL_zalloc(sizeof(EVP_ENCODE_CTX));
+}
+
+void EVP_ENCODE_CTX_free(EVP_ENCODE_CTX *ctx)
+{
+    OPENSSL_free(ctx);
+}
+int EVP_ENCODE_CTX_num(EVP_ENCODE_CTX *ctx)
+{
+    return ctx->num;
+}
+
 void EVP_EncodeInit(EVP_ENCODE_CTX *ctx)
 {
     ctx->length = 48;
@@ -344,13 +358,13 @@ int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
 tail:
     if (n > 0) {
         if ((n & 3) == 0) {
-        decoded_len = EVP_DecodeBlock(out, d, n);
-        n = 0;
-        if (decoded_len < 0 || eof > decoded_len) {
-            rv = -1;
-            goto end;
-        }
-        ret += (decoded_len - eof);
+            decoded_len = EVP_DecodeBlock(out, d, n);
+            n = 0;
+            if (decoded_len < 0 || eof > decoded_len) {
+                rv = -1;
+                goto end;
+            }
+            ret += (decoded_len - eof);
         } else if (seof) {
             /* EOF in the middle of a base64 block. */
             rv = -1;