Ticket #26641: ejabberd-md2.patch

File ejabberd-md2.patch, 1.8 KB (added by james.fournie@…, 14 years ago)

Patch to remove MD2 functionality, see also Gentoo bug 331299

  • mod_caps.erl

    old new  
    277277                 Host, From, Caps, [SubNode | SubNodes]) ->
    278278    BinaryNode = node_to_binary(Caps#caps.node, SubNode),
    279279    IsValid = case Caps#caps.hash of
    280                   "md2" ->
    281                       Caps#caps.version == make_disco_hash(Els, md2);
    282280                  "md5" ->
    283281                      Caps#caps.version == make_disco_hash(Els, md5);
    284282                  "sha-1" ->
     
    354352              concat_features(DiscoEls),
    355353              concat_info(DiscoEls)],
    356354    base64:encode_to_string(
    357       if Algo == md2 ->
    358               sha:md2(Concat);
    359          Algo == md5 ->
     355      if Algo == md5 ->
    360356              crypto:md5(Concat);
    361357         Algo == sha1 ->
    362358              crypto:sha(Concat);
  • sha.erl

    old new  
    2828-author('alexey@process-one.net').
    2929
    3030-export([start/0, sha/1, sha1/1, sha224/1, sha256/1, sha384/1,
    31          sha512/1, md2/1]).
     31         sha512/1]).
    3232
    3333-include("ejabberd.hrl").
    3434
     
    8080sha512(Text) ->
    8181    erlang:port_control(?DRIVER, 512, Text).
    8282
    83 md2(Text) ->
    84     erlang:port_control(?DRIVER, 2, Text).
    85 
    8683driver_path() ->
    8784    Suffix = case os:type() of
    8885                 {win32, _} -> ".dll";
  • tls/sha_drv.c

    old new  
    2020
    2121#include <erl_driver.h>
    2222#include <openssl/sha.h>
    23 #include <openssl/md2.h>
    2423
    2524static ErlDrvData sha_drv_start(ErlDrvPort port, char *buf)
    2625{
     
    3635  ErlDrvBinary *b = NULL;
    3736
    3837  switch (command) {
    39   case 2:
    40     rlen = MD2_DIGEST_LENGTH;
    41     b = driver_alloc_binary(rlen);
    42     if (b) MD2((unsigned char*)buf, len, (unsigned char*)b->orig_bytes);
    43     break;
    4438  case 224:
    4539    rlen = SHA224_DIGEST_LENGTH;
    4640    b = driver_alloc_binary(rlen);