[libfko] bug fix to set digest length upon SPA packet decode
authorMichael Rash <mbr@cipherdyne.org>
Thu, 11 Jul 2013 03:07:43 +0000 (23:07 -0400)
committerMichael Rash <mbr@cipherdyne.org>
Thu, 11 Jul 2013 03:07:43 +0000 (23:07 -0400)
This bug was caught with the fko_wrapper.c multi-call tester running under
valgrind.

lib/fko_decode.c

index bb20a03..cfceff7 100644 (file)
@@ -73,22 +73,27 @@ fko_decode_spa_data(fko_ctx_t ctx)
     {
         case MD5_B64_LEN:
             ctx->digest_type = FKO_DIGEST_MD5;
+            ctx->digest_len  = MD5_B64_LEN;
             break;
 
         case SHA1_B64_LEN:
             ctx->digest_type = FKO_DIGEST_SHA1;
+            ctx->digest_len  = SHA1_B64_LEN;
             break;
 
         case SHA256_B64_LEN:
             ctx->digest_type = FKO_DIGEST_SHA256;
+            ctx->digest_len  = SHA256_B64_LEN;
             break;
 
         case SHA384_B64_LEN:
             ctx->digest_type = FKO_DIGEST_SHA384;
+            ctx->digest_len  = SHA384_B64_LEN;
             break;
 
         case SHA512_B64_LEN:
             ctx->digest_type = FKO_DIGEST_SHA512;
+            ctx->digest_len  = SHA512_B64_LEN;
             break;
 
         default: /* Invalid or unsupported digest */