Skip to content

Commit

Permalink
compiles with libressl
Browse files Browse the repository at this point in the history
  • Loading branch information
muquit committed Oct 12, 2016
1 parent e4c3025 commit 1d71220
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
11 changes: 5 additions & 6 deletions test/test_gmail.sh
Expand Up @@ -14,15 +14,14 @@ if [ x"$FROM" = x ]; then
exit 1
fi

CC=''
if [ x"$Cc" != x ]; then
CC="-cc $Cc"
fi

BCc=''
if [ x"$BCc" != x ]; then
BCc="-bc ${BCc}"
if [ x"$bcc" != x ]; then
bcc="-bc ${bcc}"
fi
echo "BCc: $bcc"

pass=$SMTP_USER_PASS
if [ x"$pass" = x ]; then
Expand All @@ -47,9 +46,9 @@ VALGRIND="valgrind -v --tool=memcheck --leak-check=yes --error-limit=yes --log-f
else
VALGRIND=""
fi
#set -x
set -x

$VALGRIND $BINARY -to $TO ${CC} ${BCc} -from $FROM \
$VALGRIND $BINARY -to $TO ${CC} ${bcc} -from $FROM \
-v \
-starttls -port 587 -auth \
-smtp $SMTP \
Expand Down
11 changes: 9 additions & 2 deletions test/test_gmail_list.sh
Expand Up @@ -15,6 +15,13 @@ if [ ! -f ${LIST_FILE} ]; then
exit 1
fi

TO=$TO
if [ x"$TO" = x ]; then
echo "TO environment variable is not not"
exit 1
fi


FROM=$FROM
if [ x"$FROM" = x ]; then
echo "FROM environment variable is not not"
Expand Down Expand Up @@ -46,13 +53,13 @@ VALGRIND=""
fi
set -x

$VALGRIND $BINARY -list-address ${LIST_FILE} -from $FROM \
$VALGRIND $BINARY -t "${TO}" -list-address ${LIST_FILE} -from $FROM \
-v \
-starttls -port 587 -auth \
-smtp $SMTP \
-cs "utf-8" \
-H "X-Priority: 1" -H "Importance: high" \
-sub "testing mailsend" +cc +bc \
-sub "testing mailsend" \
-user "$FROM" -pass "$PASS" \
-enc-type "none" \
-mime-type "text/plain" \
Expand Down
13 changes: 13 additions & 0 deletions utils.c
Expand Up @@ -791,13 +791,18 @@ char *encode_cram_md5(char *challenge,char *user,char *secret)
unsigned char
hmac_md5[16];

#ifdef LIBRESSL_VERSION_NUMBER
HMAC_CTX
ctx;
#else
#if OPENSSL_VERSION_NUMBER < 0x10100000L
HMAC_CTX
ctx;
#else
/* OpenSSL 1.1.x*/
HMAC_CTX
*ctx;
#endif
#endif

const EVP_MD
Expand Down Expand Up @@ -838,6 +843,13 @@ char *encode_cram_md5(char *challenge,char *user,char *secret)

/* take HMAC-MD5 of the challenge*/

#ifdef LIBRESSL_VERSION_NUMBER
md5=EVP_get_digestbyname("md5");
HMAC_CTX_init(&ctx);
HMAC_Init(&ctx,secret,strlen(secret),md5);
HMAC_Update(&ctx,data,data_len);
HMAC_Final(&ctx,hmac_md5,&hmac_len);
#else
#if OPENSSL_VERSION_NUMBER < 0x10100000L
md5=EVP_get_digestbyname("md5");
HMAC_CTX_init(&ctx);
Expand All @@ -851,6 +863,7 @@ char *encode_cram_md5(char *challenge,char *user,char *secret)
HMAC_Update(ctx,data,data_len);
HMAC_Final(ctx,hmac_md5,&hmac_len);
#endif
#endif /* LIBRESSL_VERSION_NUMBER */

/* convert the digest to hex */
memset(hex,0,sizeof(hex));
Expand Down

0 comments on commit 1d71220

Please sign in to comment.