Hi Dirk,

could you please resend the patch.

i get:
patching file Makefile
patch: **** malformed patch at line 84: 2.

As it seems you mail clients wraps the lines. If you can't disable wrapping 
just attach the patch as file.

/Peter

On Thu, 14 Nov 2013 23:53:42 +0100
Dirk Neukirchen <dirkneukirc...@web.de> wrote:

> This patch updates erlang to a more current 16B02 and
> hopefully removes RIPEMD160 support.
> 
> It's only compile tested - don't know about erlang
> I used the commit that added ripemd to erlang as a guideline
> 
> https://github.com/erlang/otp/commit/3881407ea8444c280d9659f40e6c169a1e10310d.patch
>  add ripemd160 support to crypto
> 
> add ripemd160 message digest support to the crypto app,
> includes some test cases.
> 
> and reverted it accordingly i hope.
> 
> notice:
> - docs are left untouched
> - tests are left untouched
> 
> Signed-off-by: Dirk Neukirchen <dirkneukirc...@web.de>
> ---
> diff --git a/lang/erlang/Makefile b/lang/erlang/Makefile
> index ddba81c..96d336e 100644
> --- a/lang/erlang/Makefile
> +++ b/lang/erlang/Makefile
> @@ -1,5 +1,5 @@
>  #
> -# Copyright (C) 2009-2012 OpenWrt.org
> +# Copyright (C) 2009-2013 OpenWrt.org
>  #
>  # This is free software, licensed under the GNU General Public License v2.
>  # See /LICENSE for more information.
> @@ -8,13 +8,13 @@
>  include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=erlang
> -PKG_VERSION:=R15B01
> -PKG_RELEASE:=4
> +PKG_VERSION:=R16B02
> +PKG_RELEASE:=1
>  
>  PKG_SOURCE:=otp_src_$(PKG_VERSION).tar.gz
>  PKG_SOURCE_URL:= http://www.erlang.org/download/ \
>       http://erlang.mirror.su.se/     
> -PKG_MD5SUM:=f12d00f6e62b36ad027d6c0c08905fad
> +PKG_MD5SUM:=ca63bcde0e5ae0f2df9457f97b3115a4
>  
>  PKG_BUILD_DEPENDS:=erlang/host openssl
>  
> diff --git a/lang/erlang/patches/101-emulator_includes.patch 
> b/lang/erlang/patches/101-emulator_includes.patch
> index 933c73e..8136e47 100644
> --- a/lang/erlang/patches/101-emulator_includes.patch
> +++ b/lang/erlang/patches/101-emulator_includes.patch
> @@ -1,11 +1,14 @@
>  --- a/erts/emulator/Makefile.in
>  +++ b/erts/emulator/Makefile.in
> -@@ -591,7 +591,7 @@ endif
> - 
> - 
> - $(OBJDIR)/%.o: beam/%.c
> --    $(CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) $(INCLUDES) -c $< -o $@
> -+    $(CC) $(INCLUDES) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) -c $< -o $@
> - 
> +@@ -642,9 +642,9 @@ endif
> + 
> + ifneq ($(filter tile-%,$(TARGET)),)
> + $(OBJDIR)/beam_emu.o: beam/beam_emu.c
> +-    $(V_CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) \
> ++    $(V_CC) $(INCLUDES) \
> +          -OPT:Olimit=0 -WOPT:lpre=off:spre=off:epre=off \
> +-         $(INCLUDES) -c $< -o $@
> ++         $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) -c $< -o $@
>   else
> - 
> + # Usually the same as the default rule, but certain platforms (e.g. win32) 
> mix
> + # different compilers
> diff --git a/lang/erlang/patches/104-disable_ripemd.patch 
> b/lang/erlang/patches/104-disable_ripemd.patch
> new file mode 100644
> index 0000000..0995c01
> --- /dev/null
> +++ b/lang/erlang/patches/104-disable_ripemd.patch
> @@ -0,0 +1,191 @@
> +--- a/lib/crypto/c_src/crypto.c
> ++++ b/lib/crypto/c_src/crypto.c
> +@@ -44,7 +44,6 @@
> + #include <openssl/md5.h>
> + #include <openssl/md4.h>
> + #include <openssl/sha.h>
> +-#include <openssl/ripemd.h>
> + #include <openssl/bn.h>
> + #include <openssl/objects.h>
> + #include <openssl/rc4.h>
> +@@ -167,10 +166,6 @@ static ERL_NIF_TERM md5(ErlNifEnv* env,
> + static ERL_NIF_TERM md5_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM 
> argv[]);
> + static ERL_NIF_TERM md5_update(ErlNifEnv* env, int argc, const ERL_NIF_TERM 
> argv[]);
> + static ERL_NIF_TERM md5_final(ErlNifEnv* env, int argc, const ERL_NIF_TERM 
> argv[]);
> +-static ERL_NIF_TERM ripemd160(ErlNifEnv* env, int argc, const ERL_NIF_TERM 
> argv[]);
> +-static ERL_NIF_TERM ripemd160_init(ErlNifEnv* env, int argc, const 
> ERL_NIF_TERM argv[]);
> +-static ERL_NIF_TERM ripemd160_update(ErlNifEnv* env, int argc, const 
> ERL_NIF_TERM argv[]);
> +-static ERL_NIF_TERM ripemd160_final(ErlNifEnv* env, int argc, const 
> ERL_NIF_TERM argv[]);
> + static ERL_NIF_TERM sha(ErlNifEnv* env, int argc, const ERL_NIF_TERM 
> argv[]);
> + static ERL_NIF_TERM sha_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM 
> argv[]);
> + static ERL_NIF_TERM sha_update(ErlNifEnv* env, int argc, const ERL_NIF_TERM 
> argv[]);
> +@@ -292,10 +287,6 @@ static ErlNifFunc nif_funcs[] = {
> +     {"md5_init", 0, md5_init},
> +     {"md5_update", 2, md5_update},
> +     {"md5_final", 1, md5_final},
> +-    {"ripemd160", 1, ripemd160},
> +-    {"ripemd160_init", 0, ripemd160_init},
> +-    {"ripemd160_update", 2, ripemd160_update},
> +-    {"ripemd160_final", 1, ripemd160_final},
> +     {"sha", 1, sha},
> +     {"sha_init", 0, sha_init},
> +     {"sha_update", 2, sha_update},
> +@@ -478,8 +469,6 @@ ERL_NIF_INIT(crypto,nif_funcs,load,NULL,
> + #define MD5_LEN_96      12
> + #define MD4_CTX_LEN     (sizeof(MD4_CTX))
> + #define MD4_LEN         16
> +-#define RIPEMD160_CTX_LEN (sizeof(RIPEMD160_CTX))
> +-#define RIPEMD160_LEN   20
> + #define SHA_CTX_LEN     (sizeof(SHA_CTX))
> + #define SHA_LEN         20
> + #define SHA_LEN_96      12
> +@@ -503,7 +492,6 @@ static ERL_NIF_TERM atom_sha384;
> + static ERL_NIF_TERM atom_sha512;
> + static ERL_NIF_TERM atom_md5;
> + static ERL_NIF_TERM atom_md4;
> +-static ERL_NIF_TERM atom_ripemd160;
> + static ERL_NIF_TERM atom_error;
> + static ERL_NIF_TERM atom_rsa_pkcs1_padding;
> + static ERL_NIF_TERM atom_rsa_pkcs1_oaep_padding;
> +@@ -595,7 +583,6 @@ static int init(ErlNifEnv* env, ERL_NIF_
> +     atom_sha512 = enif_make_atom(env,"sha512");
> +     atom_md4 = enif_make_atom(env,"md4");
> +     atom_md5 = enif_make_atom(env,"md5");
> +-    atom_ripemd160 = enif_make_atom(env,"ripemd160");
> +     atom_error = enif_make_atom(env,"error");
> +     atom_rsa_pkcs1_padding = enif_make_atom(env,"rsa_pkcs1_padding");
> +     atom_rsa_pkcs1_oaep_padding = 
> enif_make_atom(env,"rsa_pkcs1_oaep_padding");
> +@@ -718,7 +705,6 @@ static void init_algorithms_types(void)
> +     algos[algos_cnt++] = atom_md4;
> +     algos[algos_cnt++] = atom_md5;
> +     algos[algos_cnt++] = atom_sha;
> +-    algos[algos_cnt++] = atom_ripemd160;
> + #ifdef HAVE_SHA224
> +     algos[algos_cnt++] = atom_sha224;
> + #endif
> +@@ -816,55 +802,6 @@ static ERL_NIF_TERM md5_final(ErlNifEnv*
> +     return ret;
> + }
> + 
> +-static ERL_NIF_TERM ripemd160(ErlNifEnv* env, int argc, const ERL_NIF_TERM 
> argv[])
> +-{/* (Data) */
> +-    ErlNifBinary ibin;
> +-    ERL_NIF_TERM ret;
> +-
> +-    if (!enif_inspect_iolist_as_binary(env, argv[0], &ibin)) {
> +-    return enif_make_badarg(env);
> +-    }
> +-    RIPEMD160((unsigned char *) ibin.data, ibin.size,
> +-          enif_make_new_binary(env,RIPEMD160_LEN, &ret));
> +-    CONSUME_REDS(env,ibin);
> +-    return ret;
> +-}
> +-static ERL_NIF_TERM ripemd160_init(ErlNifEnv* env, int argc, const 
> ERL_NIF_TERM argv[])
> +-{/* () */
> +-    ERL_NIF_TERM ret;
> +-    RIPEMD160_Init((RIPEMD160_CTX *) enif_make_new_binary(env, 
> RIPEMD160_CTX_LEN, &ret));
> +-    return ret;
> +-}
> +-static ERL_NIF_TERM ripemd160_update(ErlNifEnv* env, int argc, const 
> ERL_NIF_TERM argv[])
> +-{/* (Context, Data) */
> +-    RIPEMD160_CTX* new_ctx;
> +-    ErlNifBinary ctx_bin, data_bin;
> +-    ERL_NIF_TERM ret;
> +-    if (!enif_inspect_binary(env, argv[0], &ctx_bin)
> +-    || ctx_bin.size != RIPEMD160_CTX_LEN
> +-    || !enif_inspect_iolist_as_binary(env, argv[1], &data_bin)) {
> +-    return enif_make_badarg(env);
> +-    }
> +-    new_ctx = (RIPEMD160_CTX*) enif_make_new_binary(env,RIPEMD160_CTX_LEN, 
> &ret);
> +-    memcpy(new_ctx, ctx_bin.data, RIPEMD160_CTX_LEN);
> +-    RIPEMD160_Update(new_ctx, data_bin.data, data_bin.size);
> +-    CONSUME_REDS(env, data_bin);
> +-    return ret;
> +-}
> +-static ERL_NIF_TERM ripemd160_final(ErlNifEnv* env, int argc, const 
> ERL_NIF_TERM argv[])
> +-{/* (Context) */
> +-    ErlNifBinary ctx_bin;
> +-    RIPEMD160_CTX ctx_clone;
> +-    ERL_NIF_TERM ret;
> +-    if (!enif_inspect_binary(env, argv[0], &ctx_bin) || ctx_bin.size != 
> RIPEMD160_CTX_LEN) {
> +-    return enif_make_badarg(env);
> +-    }
> +-    memcpy(&ctx_clone, ctx_bin.data, RIPEMD160_CTX_LEN); /* writable */
> +-    RIPEMD160_Final(enif_make_new_binary(env, RIPEMD160_LEN, &ret), 
> &ctx_clone);
> +-    return ret;
> +-}
> +-
> +-
> + static ERL_NIF_TERM sha(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
> + {/* (Data) */    
> +     ErlNifBinary ibin;
> +@@ -1363,7 +1300,6 @@ static ERL_NIF_TERM hmac_init(ErlNifEnv*
> +     else if (argv[0] == atom_sha512) md = EVP_sha512();
> + #endif
> +     else if (argv[0] == atom_md5) md = EVP_md5();
> +-    else if (argv[0] == atom_ripemd160) md = EVP_ripemd160();
> +     else goto badarg;
> +     
> +     if (!enif_inspect_iolist_as_binary(env, argv[1], &key)) {
> +--- a/lib/crypto/src/crypto.erl
> ++++ b/lib/crypto/src/crypto.erl
> +@@ -229,13 +229,12 @@ hash(Hash, Data0) ->
> +     MaxByts = max_bytes(),
> +     hash(Hash, Data, erlang:byte_size(Data), MaxByts, initial).
> + 
> +--spec hash_init('md5'|'md4'|'ripemd160'|
> ++-spec hash_init('md5'|'md4'|
> +                 'sha'|'sha224'|'sha256'|'sha384'|'sha512') -> any().
> + 
> + hash_init(md5)       -> {md5, md5_init()};
> + hash_init(md4)       -> {md4, md4_init()};
> + hash_init(sha)       -> {sha, sha_init()};
> +-hash_init(ripemd160) -> {ripemd160, ripemd160_init()};
> + hash_init(sha224)    -> {sha224, sha224_init()};
> + hash_init(sha256)    -> {sha256, sha256_init()};
> + hash_init(sha384)    -> {sha384, sha384_init()};
> +@@ -253,7 +252,6 @@ hash_update(State, Data0) ->
> + hash_final({md5,Context})       -> md5_final(Context);
> + hash_final({md4,Context})       -> md4_final(Context);
> + hash_final({sha,Context})       -> sha_final(Context);
> +-hash_final({ripemd160,Context}) -> ripemd160_final(Context);
> + hash_final({sha224,Context})    -> sha224_final(Context);
> + hash_final({sha256,Context})    -> sha256_final(Context);
> + hash_final({sha384,Context})    -> sha384_final(Context);
> +@@ -688,7 +686,6 @@ hash(State0, Data, _Size, MaxByts, conti
> + do_hash(md5, Data)          -> md5(Data);
> + do_hash(md4, Data)          -> md4(Data);
> + do_hash(sha, Data)          -> sha(Data);
> +-do_hash(ripemd160, Data)    -> ripemd160(Data);
> + do_hash(sha224, Data)       -> sha224(Data);
> + do_hash(sha256, Data)       -> sha256(Data);
> + do_hash(sha384, Data)       -> sha384(Data);
> +@@ -704,7 +701,6 @@ hash_update(State0, Data, _, MaxBytes) -
> + do_hash_update({md5,Context}, Data)       -> {md5, 
> md5_update(Context,Data)};
> + do_hash_update({md4,Context}, Data)       -> {md4, 
> md4_update(Context,Data)};
> + do_hash_update({sha,Context}, Data)       -> {sha, 
> sha_update(Context,Data)};
> +-do_hash_update({ripemd160,Context}, Data) -> {ripemd160, 
> ripemd160_update(Context,Data)};
> + do_hash_update({sha224,Context}, Data)    -> {sha224, 
> sha224_update(Context,Data)};
> + do_hash_update({sha256,Context}, Data)    -> {sha256, 
> sha256_update(Context,Data)};
> + do_hash_update({sha384,Context}, Data)    -> {sha384, 
> sha384_update(Context,Data)};
> +@@ -739,20 +735,6 @@ md4_update(_Context, _Data) -> ?nif_stub
> + md4_final(_Context) -> ?nif_stub.
> + 
> + %%
> +-%%  RIPEMD160
> +-%%
> +-
> +--spec ripemd160(iodata()) -> binary().
> +--spec ripemd160_init() -> binary().
> +--spec ripemd160_update(binary(), iodata()) -> binary().
> +--spec ripemd160_final(binary()) -> binary().
> +-
> +-ripemd160(_Data) -> ?nif_stub.
> +-ripemd160_init() -> ?nif_stub.
> +-ripemd160_update(_Context, _Data) -> ?nif_stub.
> +-ripemd160_final(_Context) -> ?nif_stub.
> +-
> +-%%
> + %% SHA
> + %%
> + -spec sha(iodata()) -> binary().
> ---
> 
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to