summaryrefslogtreecommitdiffstats
path: root/apps/enc.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2001-02-14 02:11:52 +0000
committerDr. Stephen Henson <steve@openssl.org>2001-02-14 02:11:52 +0000
commitf2e5ca84d4d218a29e2c960d9b23a40d8236cd06 (patch)
tree7ae131e9e596c0e97efcae029b4c7b0c63f0d0d3 /apps/enc.c
parent36fafffae21ddbc520dbe316accd2bca4ffac7ba (diff)
Option to disable standard block padding with EVP API.
Add -nopad option to enc command. Update docs.
Diffstat (limited to 'apps/enc.c')
-rw-r--r--apps/enc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/enc.c b/apps/enc.c
index e53cf3b415..e3dbbb0e94 100644
--- a/apps/enc.c
+++ b/apps/enc.c
@@ -111,6 +111,7 @@ int MAIN(int argc, char **argv)
unsigned char *buff=NULL,*bufsize=NULL;
int bsize=BSIZE,verbose=0;
int ret=1,inl;
+ int nopad = 0;
unsigned char key[EVP_MAX_KEY_LENGTH],iv[EVP_MAX_IV_LENGTH];
unsigned char salt[PKCS5_SALT_LEN];
char *str=NULL, *passarg = NULL, *pass = NULL;
@@ -174,6 +175,8 @@ int MAIN(int argc, char **argv)
printkey=1;
else if (strcmp(*argv,"-v") == 0)
verbose=1;
+ else if (strcmp(*argv,"-nopad") == 0)
+ nopad=1;
else if (strcmp(*argv,"-salt") == 0)
nosalt=0;
else if (strcmp(*argv,"-nosalt") == 0)
@@ -513,6 +516,12 @@ bad:
if ((benc=BIO_new(BIO_f_cipher())) == NULL)
goto end;
BIO_set_cipher(benc,cipher,key,iv,enc);
+ if (nopad)
+ {
+ EVP_CIPHER_CTX *ctx;
+ BIO_get_cipher_ctx(benc, &ctx);
+ EVP_CIPHER_CTX_set_padding(ctx, 0);
+ }
if (debug)
{
BIO_set_callback(benc,BIO_debug_callback);