>From a4a54e84cb1789404509df07af7bcbf0241510d5 Mon Sep 17 00:00:00 2001
From: HAMANO Tsukasa <hamano@osstech.co.jp>
Date: Tue, 3 Dec 2013 19:26:06 +0900
Subject: [PATCH] added iteration count option


Signed-off-by: HAMANO Tsukasa <hamano@osstech.co.jp>
---
 apps/enc.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/apps/enc.c b/apps/enc.c
index aef8978..8e4fdac 100644
--- a/apps/enc.c
+++ b/apps/enc.c
@@ -130,6 +130,7 @@ int MAIN(int argc, char **argv)
 #endif
 	const EVP_MD *dgst=NULL;
 	int non_fips_allow = 0;
+	int iteration = 1;
 
 	apps_startup();
 
@@ -282,6 +283,12 @@ int MAIN(int argc, char **argv)
 			if (--argc < 1) goto bad;
 			md= *(++argv);
 			}
+		else if (strcmp(*argv,"-iteration") == 0)
+			{
+			if (--argc < 1) goto bad;
+			iteration= atoi(*(++argv));
+			if (iteration < 1) goto bad;
+			}
 		else if (strcmp(*argv,"-non-fips-allow") == 0)
 			non_fips_allow = 1;
 		else if	((argv[0][0] == '-') &&
@@ -311,6 +318,7 @@ bad:
 			BIO_printf(bio_err,"%-14s print the iv/key (then exit if -P)\n","-[pP]");
 			BIO_printf(bio_err,"%-14s buffer size\n","-bufsize <n>");
 			BIO_printf(bio_err,"%-14s disable standard block padding\n","-nopad");
+			BIO_printf(bio_err,"%-14s iteration count\n","-iteration");
 #ifndef OPENSSL_NO_ENGINE
 			BIO_printf(bio_err,"%-14s use engine e, possibly a hardware device.\n","-engine e");
 #endif
@@ -554,7 +562,7 @@ bad:
 
 			if (!EVP_BytesToKey(cipher,dgst,sptr,
 					    (unsigned char *)str,
-					    strlen(str),1,key,iv))
+					    strlen(str),iteration,key,iv))
 				{
 				BIO_printf(bio_err, "EVP_BytesToKey failed\n");
 				goto end;
@@ -649,6 +657,7 @@ bad:
 					printf("%02X",iv[i]);
 				printf("\n");
 				}
+			printf("iteration=%d\n", iteration);
 			if (printkey == 2)
 				{
 				ret=0;
-- 
1.5.6.5


-- 
Open Source Solution Technology Corporation
HAMANO Tsukasa <hamano@osstech.co.jp>
fingerprint = 2285 2111 6D34 3816 3C2E  A5B9 16BE D101 6069 BE55
