also build openssl-enc

This commit is contained in:
Steffen Jaeckel 2017-06-08 21:32:10 +02:00
parent 4929860641
commit 08a461b39c
3 changed files with 8 additions and 6 deletions

2
.gitignore vendored
View File

@ -30,6 +30,8 @@ hashsum
hashsum.exe
multi
multi.exe
openssl-enc
openssl-enc.exe
sizes
sizes.exe
small

View File

@ -157,8 +157,8 @@ void dump_bytes(unsigned char *in, unsigned long len)
* Set is_padding to 1 to pad, 0 to unpad.
*
* Input: paddable buffer, size read, block length of cipher, mode
* Output: none
* Side Effects: bytes printed as a hex blob, no lf at the end
* Output: number of bytes after padding resp. after unpadding
* Side Effects: none
*/
size_t pkcs7_pad(union paddable *buf, size_t nb, int block_length,
int is_padding)
@ -190,14 +190,14 @@ size_t pkcs7_pad(union paddable *buf, size_t nb, int block_length,
/* padval must be nonzero and <= block length */
if(padval <= 0 || padval > block_length)
return -1;
return 0;
/* First byte's accounted for; do the rest */
idx--;
while(idx >= (off_t)(nb-padval))
if(buf->pad[idx] != padval)
return -1;
return 0;
else
idx--;
@ -264,7 +264,7 @@ int do_crypt(FILE *infd, FILE *outfd, unsigned char *key, unsigned char *iv,
if( feof(infd) )
nb = pkcs7_pad(&outbuf, nb,
aes_desc.block_length, 0);
if(nb == -1)
if(nb == 0)
/* The file didn't decrypt correctly */
return CRYPT_ERROR;

View File

@ -108,7 +108,7 @@ THEADERS = $(wildcard testprof/*.h)
TIMING=timing
TEST=test
USEFUL_DEMOS=hashsum
USEFUL_DEMOS=hashsum openssl-enc
DEMOS=$(USEFUL_DEMOS) ltcrypt small tv_gen sizes constants
TIMINGS=demos/timing.o