Missing semicolon.
[openssl.git] / fips / aes / fips_gcmtest.c
index 438014f..9f50857 100644 (file)
@@ -243,7 +243,7 @@ static void gcmtest(FILE *in, FILE *out, int encrypt)
                                }
                        rv = FIPS_cipher(&ctx, NULL, NULL, 0);
                        if (rv < 0)
-                               fprintf(out, "FAIL\n");
+                               fprintf(out, "FAIL" RESP_EOL);
                        else
                                OutputValue("PT", pt, ptlen, out, 0);
                        if (iv)
@@ -261,16 +261,16 @@ static void gcmtest(FILE *in, FILE *out, int encrypt)
                        iv = aad = ct = pt = key = tag = NULL;
                        }
                }
+       FIPS_cipher_ctx_cleanup(&ctx);  
        }
 
 static void xtstest(FILE *in, FILE *out)
        {
-       char buf[2048];
-       char lbuf[2048];
+       char buf[204800];
+       char lbuf[204800];
        char *keyword, *value;
-       int inlen;
+       int inlen = 0;
        int encrypt = 0;
-       int rv;
        long l;
        unsigned char *key = NULL, *iv = NULL;
        unsigned char *inbuf = NULL, *outbuf = NULL;
@@ -326,7 +326,7 @@ static void xtstest(FILE *in, FILE *out)
                        {
                        FIPS_cipherinit(&ctx, xts, key, iv, encrypt);
                        outbuf = OPENSSL_malloc(inlen);
-                       rv = FIPS_cipher(&ctx, outbuf, inbuf, inlen);
+                       FIPS_cipher(&ctx, outbuf, inbuf, inlen);
                        OutputValue(encrypt ? "CT":"PT", outbuf, inlen, out, 0);
                        OPENSSL_free(inbuf);
                        OPENSSL_free(outbuf);
@@ -335,6 +335,7 @@ static void xtstest(FILE *in, FILE *out)
                        iv = key = inbuf = outbuf = NULL;
                        }       
                }
+       FIPS_cipher_ctx_cleanup(&ctx);  
        }
 
 static void ccmtest(FILE *in, FILE *out)
@@ -428,6 +429,8 @@ static void ccmtest(FILE *in, FILE *out)
                        }
                else if (!strcmp(keyword,"Adata"))
                        {
+                       if (Adata)
+                               OPENSSL_free(Adata);
                        Adata = hex2bin_m(value, &l);
                        if (Alen && l != Alen)
                                {
@@ -479,11 +482,11 @@ static void ccmtest(FILE *in, FILE *out)
                                {
                                if (rv == 0)
                                        Payload[0] = 0;
-                               fputs("Result = Pass\n", out);
+                               fputs("Result = Pass" RESP_EOL, out);
                                OutputValue("Payload", Payload, len, out, 0);
                                }
                        else
-                               fputs("Result = Fail\n", out);
+                               fputs("Result = Fail" RESP_EOL, out);
                        OPENSSL_free(CT);
                        OPENSSL_free(Payload);
                        CT = Payload = NULL;
@@ -493,10 +496,16 @@ static void ccmtest(FILE *in, FILE *out)
                OPENSSL_free(Key);
        if (Nonce)
                OPENSSL_free(Nonce);
+       if (Adata)
+               OPENSSL_free(Adata);
        FIPS_cipher_ctx_cleanup(&ctx);
        }
 
-int main(int argc,char **argv)
+#ifdef FIPS_ALGVS
+int fips_gcmtest_main(int argc, char **argv)
+#else
+int main(int argc, char **argv)
+#endif
        {
        int encrypt;
        int xts = 0, ccm = 0;