[asterisk-bugs] [Asterisk 0018209]: [regression] ast_md5_hash sometimes create incorrect md5 digest

Asterisk Bug Tracker noreply at bugs.digium.com
Thu Nov 4 13:24:26 CDT 2010


The following issue has been UPDATED. 
====================================================================== 
https://issues.asterisk.org/view.php?id=18209 
====================================================================== 
Reported By:                rainlake
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   18209
Category:                   Functions/func_md5
Reproducibility:            random
Severity:                   minor
Priority:                   normal
Status:                     acknowledged
Asterisk Version:           1.8.0 
JIRA:                       SWP-2477 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2010-10-25 15:40 CDT
Last Modified:              2010-11-04 13:24 CDT
====================================================================== 
Summary:                    [regression] ast_md5_hash sometimes create incorrect
md5 digest
Description: 
ast_md5_hash sometimes create incorrect md5 digest. on arm(DockStar)
device
make & install asterisk 1.8.0 on my DockStar. my ata can not register or
make calls sometimes.
add log in channels/chan_sip.c @ check_auth()
like  below code

function ast_md5_hash can not get correct md5 digest almost all the
time(sometimes it is correct) .
it's different as echo -n "<user>:<realm>:<secret>" | md5sum
while in 1.6.2.10, it's always correct.

if (!ast_strlen_zero(md5secret)) {
                ast_copy_string(a1_hash, md5secret, sizeof(a1_hash));
                ast_log(LOG_NOTICE, "result is correct hash is has
md5secret original:%s",a1_hash);
        } else {
                char a1[256];

                snprintf(a1, sizeof(a1), "%s:%s:%s", username, p->realm,
secret);
                 ast_log(LOG_NOTICE, "result is correct hash is a1
original:%s",a1);
                ast_md5_hash(a1_hash, a1);
                ast_log(LOG_NOTICE, "result is correct hash is a1
hashed:%s",a1_hash);
        }

        /* compute the expected response to compare with what we received
*/
        {
                char a2[256];
                char a2_hash[256];
                char resp[256];

                snprintf(a2, sizeof(a2), "%s:%s",
sip_methods[sipmethod].text,
                                S_OR(keys[K_URI].s, uri));
                ast_log(LOG_NOTICE, "result is correct hash is a2
original:%s",a2);
                ast_md5_hash(a2_hash, a2);
                 ast_log(LOG_NOTICE, "result is correct hash is a2
hash:%s",a2_hash);
                snprintf(resp, sizeof(resp), "%s:%s:%s", a1_hash,
usednonce, a2_hash);
                 ast_log(LOG_NOTICE, "result is correct hash original is
:%s",resp);
                ast_md5_hash(resp_hash, resp);
                ast_log(LOG_NOTICE, "result is correct hash
is:%s",resp_hash);
        }

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-11-04 13:24 lmadsen        Severity                 major => minor      
2010-11-04 13:24 lmadsen        Description Updated                          
======================================================================




More information about the asterisk-bugs mailing list