From 88bdb609a8ecddde802368e493e7d2c9da45e92b Mon Sep 17 00:00:00 2001 From: Milan Broz Date: Thu, 30 Jul 2009 14:59:10 +0000 Subject: [PATCH] Move XOR function to af.c, nobody outside of it use it now. git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@81 36d66b0a-2a48-0410-832c-cd162a569da5 --- ChangeLog | 1 + luks/Makefile.am | 1 - luks/XORblock.h | 13 ------------- luks/af.c | 9 ++++++++- luks/keymanage.c | 1 - 5 files changed, 9 insertions(+), 16 deletions(-) delete mode 100644 luks/XORblock.h diff --git a/ChangeLog b/ChangeLog index d3532c2..e0c3716 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ * Return ENOENT for empty keyslots, EINVAL will be used later for other type of error. * Switch PBKDF2 from internal SHA1 to libgcrypt, make hash algorithm not hardcoded to SHA1 here. * Add required parameters for changing hash used in LUKS key setup scheme. + * Do not export simple XOR helper now used only inside AF functions. 2009-07-28 Milan Broz * Pad luks header to 512 sector size. diff --git a/luks/Makefile.am b/luks/Makefile.am index c914769..a79b703 100644 --- a/luks/Makefile.am +++ b/luks/Makefile.am @@ -16,7 +16,6 @@ libluks_la_SOURCES = \ sha/hmac.h \ sha/hmac_sha1.c \ sha/sha1.h \ - XORblock.h \ pbkdf.h \ random.h \ af.h \ diff --git a/luks/XORblock.h b/luks/XORblock.h deleted file mode 100644 index 6171ae1..0000000 --- a/luks/XORblock.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef INCLUDED_CRYPTSETUP_LUKS_XORBLOCK_H -#define INCLUDED_CRYPTSETUP_LUKS_XORBLOCK_H - -#include - -static void inline XORblock(char const *src1, char const *src2, char *dst, size_t n) -{ - size_t j; - for(j = 0; j < n; ++j) - dst[j] = src1[j] ^ src2[j]; -} - -#endif diff --git a/luks/af.c b/luks/af.c index 31a0197..3b5c180 100644 --- a/luks/af.c +++ b/luks/af.c @@ -27,9 +27,16 @@ #include #include #include "sha1.h" -#include "XORblock.h" #include "random.h" +static void XORblock(char const *src1, char const *src2, char *dst, size_t n) +{ + size_t j; + + for(j = 0; j < n; ++j) + dst[j] = src1[j] ^ src2[j]; +} + static int hash_buf(char *src, char *dst, uint32_t iv, int len, int hash_id) { gcry_md_hd_t hd; diff --git a/luks/keymanage.c b/luks/keymanage.c index aba9fe2..b914573 100644 --- a/luks/keymanage.c +++ b/luks/keymanage.c @@ -35,7 +35,6 @@ #include "pbkdf.h" #include "sha1.h" #include "random.h" -#include "XORblock.h" #include #include <../lib/internal.h> -- 2.34.1