mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Make MD2 autodetected (EJAB-1285)
This commit is contained in:
parent
771da0e1d6
commit
83e17a7c65
@ -54,6 +54,11 @@ ifeq (@transient_supervisors@, false)
|
|||||||
EFLAGS+=-DNO_TRANSIENT_SUPERVISORS
|
EFLAGS+=-DNO_TRANSIENT_SUPERVISORS
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq (@md2@, true)
|
||||||
|
EFLAGS+=-DHAVE_MD2
|
||||||
|
ERLANG_CFLAGS += -DHAVE_MD2
|
||||||
|
endif
|
||||||
|
|
||||||
INSTALL_EPAM=
|
INSTALL_EPAM=
|
||||||
ifeq (@pam@, pam)
|
ifeq (@pam@, pam)
|
||||||
INSTALL_EPAM=install -m 750 $(O_USER) epam $(PBINDIR)
|
INSTALL_EPAM=install -m 750 $(O_USER) epam $(PBINDIR)
|
||||||
|
@ -132,6 +132,9 @@ if test "$ENABLEUSER" != ""; then
|
|||||||
AC_SUBST([INSTALLUSER], [$ENABLEUSER])
|
AC_SUBST([INSTALLUSER], [$ENABLEUSER])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_CHECK_HEADER(openssl/md2.h, md2=true, md2=false)
|
||||||
|
AC_SUBST(md2)
|
||||||
|
|
||||||
AC_CANONICAL_SYSTEM
|
AC_CANONICAL_SYSTEM
|
||||||
#AC_DEFINE_UNQUOTED(CPU_VENDOR_OS, "$target")
|
#AC_DEFINE_UNQUOTED(CPU_VENDOR_OS, "$target")
|
||||||
#AC_SUBST(target_os)
|
#AC_SUBST(target_os)
|
||||||
|
@ -28,7 +28,11 @@
|
|||||||
-author('alexey@process-one.net').
|
-author('alexey@process-one.net').
|
||||||
|
|
||||||
-export([start/0, sha/1, sha1/1, sha224/1, sha256/1, sha384/1,
|
-export([start/0, sha/1, sha1/1, sha224/1, sha256/1, sha384/1,
|
||||||
sha512/1, md2/1]).
|
sha512/1]).
|
||||||
|
|
||||||
|
-ifdef(HAVE_MD2).
|
||||||
|
-export([md2/1]).
|
||||||
|
-endif.
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
|
|
||||||
@ -80,8 +84,10 @@ sha384(Text) ->
|
|||||||
sha512(Text) ->
|
sha512(Text) ->
|
||||||
erlang:port_control(?DRIVER, 512, Text).
|
erlang:port_control(?DRIVER, 512, Text).
|
||||||
|
|
||||||
|
-ifdef(HAVE_MD2).
|
||||||
md2(Text) ->
|
md2(Text) ->
|
||||||
erlang:port_control(?DRIVER, 2, Text).
|
erlang:port_control(?DRIVER, 2, Text).
|
||||||
|
-endif.
|
||||||
|
|
||||||
driver_path() ->
|
driver_path() ->
|
||||||
Suffix = case os:type() of
|
Suffix = case os:type() of
|
||||||
|
@ -27,6 +27,11 @@ ifdef debug
|
|||||||
EFLAGS+=+debug_info +export_all
|
EFLAGS+=+debug_info +export_all
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq (@md2@, true)
|
||||||
|
EFLAGS+=-DHAVE_MD2
|
||||||
|
ERLANG_CFLAGS += -DHAVE_MD2
|
||||||
|
endif
|
||||||
|
|
||||||
ERLSHLIBS = ../tls_drv.so ../sha_drv.so
|
ERLSHLIBS = ../tls_drv.so ../sha_drv.so
|
||||||
OUTDIR = ..
|
OUTDIR = ..
|
||||||
SOURCES = $(wildcard *.erl)
|
SOURCES = $(wildcard *.erl)
|
||||||
|
@ -20,7 +20,9 @@
|
|||||||
|
|
||||||
#include <erl_driver.h>
|
#include <erl_driver.h>
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
|
#ifdef HAVE_MD2
|
||||||
#include <openssl/md2.h>
|
#include <openssl/md2.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static ErlDrvData sha_drv_start(ErlDrvPort port, char *buf)
|
static ErlDrvData sha_drv_start(ErlDrvPort port, char *buf)
|
||||||
{
|
{
|
||||||
@ -36,11 +38,13 @@ static int sha_drv_control(ErlDrvData handle,
|
|||||||
ErlDrvBinary *b = NULL;
|
ErlDrvBinary *b = NULL;
|
||||||
|
|
||||||
switch (command) {
|
switch (command) {
|
||||||
|
#ifdef HAVE_MD2
|
||||||
case 2:
|
case 2:
|
||||||
rlen = MD2_DIGEST_LENGTH;
|
rlen = MD2_DIGEST_LENGTH;
|
||||||
b = driver_alloc_binary(rlen);
|
b = driver_alloc_binary(rlen);
|
||||||
if (b) MD2((unsigned char*)buf, len, (unsigned char*)b->orig_bytes);
|
if (b) MD2((unsigned char*)buf, len, (unsigned char*)b->orig_bytes);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case 224:
|
case 224:
|
||||||
rlen = SHA224_DIGEST_LENGTH;
|
rlen = SHA224_DIGEST_LENGTH;
|
||||||
b = driver_alloc_binary(rlen);
|
b = driver_alloc_binary(rlen);
|
||||||
|
Loading…
Reference in New Issue
Block a user