Ticket #26641: ejabberd-md2.patch
File ejabberd-md2.patch, 1.8 KB (added by james.fournie@…, 14 years ago) |
---|
-
mod_caps.erl
old new 277 277 Host, From, Caps, [SubNode | SubNodes]) -> 278 278 BinaryNode = node_to_binary(Caps#caps.node, SubNode), 279 279 IsValid = case Caps#caps.hash of 280 "md2" ->281 Caps#caps.version == make_disco_hash(Els, md2);282 280 "md5" -> 283 281 Caps#caps.version == make_disco_hash(Els, md5); 284 282 "sha-1" -> … … 354 352 concat_features(DiscoEls), 355 353 concat_info(DiscoEls)], 356 354 base64:encode_to_string( 357 if Algo == md2 -> 358 sha:md2(Concat); 359 Algo == md5 -> 355 if Algo == md5 -> 360 356 crypto:md5(Concat); 361 357 Algo == sha1 -> 362 358 crypto:sha(Concat); -
sha.erl
old new 28 28 -author('alexey@process-one.net'). 29 29 30 30 -export([start/0, sha/1, sha1/1, sha224/1, sha256/1, sha384/1, 31 sha512/1 , md2/1]).31 sha512/1]). 32 32 33 33 -include("ejabberd.hrl"). 34 34 … … 80 80 sha512(Text) -> 81 81 erlang:port_control(?DRIVER, 512, Text). 82 82 83 md2(Text) ->84 erlang:port_control(?DRIVER, 2, Text).85 86 83 driver_path() -> 87 84 Suffix = case os:type() of 88 85 {win32, _} -> ".dll"; -
tls/sha_drv.c
old new 20 20 21 21 #include <erl_driver.h> 22 22 #include <openssl/sha.h> 23 #include <openssl/md2.h>24 23 25 24 static ErlDrvData sha_drv_start(ErlDrvPort port, char *buf) 26 25 { … … 36 35 ErlDrvBinary *b = NULL; 37 36 38 37 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;44 38 case 224: 45 39 rlen = SHA224_DIGEST_LENGTH; 46 40 b = driver_alloc_binary(rlen);