Skip to content

Commit

Permalink
also build openssl-enc
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaeckel committed Jun 8, 2017
1 parent 4929860 commit 08a461b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ hashsum
hashsum.exe
multi
multi.exe
openssl-enc
openssl-enc.exe
sizes
sizes.exe
small
Expand Down
10 changes: 5 additions & 5 deletions demos/openssl-enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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--;

Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion makefile_include.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 08a461b

Please sign in to comment.