From e0292d52eb7481b0eb524f2bf260913805b0c824 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Wed, 30 Oct 2002 21:54:13 +0100
Subject: [PATCH] (sexp_transport_iterator_first): Updated to new conventions
 for base64_decode_update and base64_decode_final.

Rev: src/nettle/sexp-transport.c:1.2
---
 sexp-transport.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/sexp-transport.c b/sexp-transport.c
index 7737891c..73e8c876 100644
--- a/sexp-transport.c
+++ b/sexp-transport.c
@@ -60,6 +60,7 @@ sexp_transport_iterator_first(struct sexp_iterator *iterator,
 	{
 	  /* Found transport encoding */
 	  struct base64_decode_ctx ctx;
+	  unsigned length;
 	  unsigned end;
 
 	  for (end = ++in; end < length && input[end] != '}'; end++)
@@ -69,13 +70,18 @@ sexp_transport_iterator_first(struct sexp_iterator *iterator,
 	    return 0;
 	    
 	  base64_decode_init(&ctx);
-	    
-	  out += base64_decode_update(&ctx, input + out,
-				      end - in, input + in);
-	  if (!base64_decode_status(&ctx))
+	  length = end - in;
+	  
+	  if (base64_decode_update(&ctx, &length, input + out,
+				   length, input + in)
+	      && base64_decode_final(&ctx))
+	    {	  
+	      out += length;
+	      in = end + 1;
+	    }
+	  else
 	    return 0;
-	  in = end + 1;
-
+	  
 	  break;
 	}
       default:
-- 
GitLab