Permalink
Browse files

Merge pull request #9 from jmesmon/all-but-tty

2 Changes: use variable in make and remove undefined behavior wrt memcpy
  • Loading branch information...
2 parents a8295a1 + 4322ebf commit 9113e4c9fc5b67503b76cc9d0a46589127a3ec36 @bwalex committed Jun 21, 2012
Showing with 8 additions and 3 deletions.
  1. +4 −2 Makefile
  2. +4 −1 crypto-gcrypt.c
View
@@ -7,6 +7,8 @@ PBKDF_BACKEND?=openssl
# system compiler, normally gcc
CC?=gcc
+RM?=rm -f
+
# whether to enable debugging or not
DEBUG?=no
@@ -60,7 +62,7 @@ lib:
$(CC) -shared -Wl,-version-script=tcplay.map -o libtcplay.so tcplay_api.o $(OBJS)
test:
- gcc -O0 -g -L. -I. tcplay_api_test.c -ltcplay -lcrypto -ldm -lprop
+ $(CC) -O0 -g -L. -I. tcplay_api_test.c -ltcplay -lcrypto -ldm -lprop
clean:
- rm -f tcplay libtcplay.so tcplay.core *.o ktrace.out
+ $(RM) tcplay libtcplay.so tcplay.core *.o ktrace.out
View
@@ -171,7 +171,10 @@ syscrypt(struct tc_crypto_algo *cipher, unsigned char *key, size_t klen, unsigne
return EINVAL;
}
- memcpy(out, in, len);
+ /* When chaining ciphers, we reuse the input buffer as the output buffer */
+ if (out != in)
+ memcpy(out, in, len);
+
if (do_encrypt)
err = xts_encrypt(ctx, out, len, iv);
else

0 comments on commit 9113e4c

Please sign in to comment.