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

View File

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