diff --git a/iscsi-scst/usr/Makefile b/iscsi-scst/usr/Makefile index 163d1e140..07cb4130f 100644 --- a/iscsi-scst/usr/Makefile +++ b/iscsi-scst/usr/Makefile @@ -15,7 +15,7 @@ # GNU General Public License for more details. SRCS_D = iscsid.c iscsi_scstd.c conn.c session.c target.c message.c ctldev.c \ - log.c chap.c event.c param.c config.c isns.c + log.c chap.c event.c param.c config.c isns.c md5.o sha1.o OBJS_D = $(SRCS_D:.c=.o) SRCS_ADM = iscsi_adm.c param.c @@ -30,7 +30,7 @@ CFLAGS += -O2 -fno-inline -Wall -Wextra -Wstrict-prototypes -Wno-sign-compare \ CFLAGS += -D_GNU_SOURCE # required for glibc >= 2.8 PROGRAMS = iscsi-scstd iscsi-scst-adm -LIBS = -lcrypto +LIBS = all: $(PROGRAMS) diff --git a/iscsi-scst/usr/chap.c b/iscsi-scst/usr/chap.c index 721e38032..f4ddc0e2c 100644 --- a/iscsi-scst/usr/chap.c +++ b/iscsi-scst/usr/chap.c @@ -27,8 +27,8 @@ #include #include #include -#include -#include +#include "sha1.h" +#include "md5.h" #include "iscsid.h" @@ -310,25 +310,25 @@ static inline void chap_encode_string(u8 *intnum, int buf_len, char *encode_buf, static inline void chap_calc_digest_md5(char chap_id, const char *secret, int secret_len, const u8 *challenge, int challenge_len, u8 *digest) { - MD5_CTX ctx; + struct md5_ctx ctx; - MD5_Init(&ctx); - MD5_Update(&ctx, &chap_id, 1); - MD5_Update(&ctx, secret, secret_len); - MD5_Update(&ctx, challenge, challenge_len); - MD5_Final(digest, &ctx); + md5_init(&ctx); + md5_update(&ctx, &chap_id, 1); + md5_update(&ctx, secret, secret_len); + md5_update(&ctx, challenge, challenge_len); + md5_final(&ctx, digest); } static inline void chap_calc_digest_sha1(char chap_id, const char *secret, int secret_len, const u8 *challenge, int challenge_len, u8 *digest) { - SHA_CTX ctx; + struct sha1_ctx ctx; - SHA1_Init(&ctx); - SHA1_Update(&ctx, &chap_id, 1); - SHA1_Update(&ctx, secret, secret_len); - SHA1_Update(&ctx, challenge, challenge_len); - SHA1_Final(digest, &ctx); + sha1_init(&ctx); + sha1_update(&ctx, &chap_id, 1); + sha1_update(&ctx, secret, secret_len); + sha1_update(&ctx, challenge, challenge_len); + sha1_final(&ctx, digest); } static int chap_initiator_auth_create_challenge(struct connection *conn) diff --git a/iscsi-scst/usr/types.h b/iscsi-scst/usr/types.h index b9b012e9b..6abbf1804 100644 --- a/iscsi-scst/usr/types.h +++ b/iscsi-scst/usr/types.h @@ -24,11 +24,19 @@ #include #if __BYTE_ORDER == __BIG_ENDIAN +#define cpu_to_le16(x) bswap_16(x) +#define le16_to_cpu(x) bswap_16(x) +#define cpu_to_le32(x) bswap_32(x) +#define le32_to_cpu(x) bswap_32(x) #define cpu_to_be16(x) (x) #define be16_to_cpu(x) (x) #define cpu_to_be32(x) (x) #define be32_to_cpu(x) (x) #elif __BYTE_ORDER == __LITTLE_ENDIAN +#define cpu_to_le16(x) (x) +#define le16_to_cpu(x) (x) +#define cpu_to_le32(x) (x) +#define le32_to_cpu(x) (x) #define cpu_to_be16(x) bswap_16(x) #define be16_to_cpu(x) bswap_16(x) #define cpu_to_be32(x) bswap_32(x)