[asterisk-bugs] [JIRA] (ASTERISK-16871) [regression] ast_md5_hash sometimes create incorrect md5 digest

Matt Jordan (JIRA) noreply at issues.asterisk.org
Fri Mar 27 16:34:34 CDT 2015


    [ https://issues.asterisk.org/jira/browse/ASTERISK-16871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=225672#comment-225672 ] 

Matt Jordan commented on ASTERISK-16871:
----------------------------------------

I can't reproduce this on an x86 system (32-bit or 64-bit).

{{ast_md5_hash}} calls {{MD5Update}}. It's possible that this is related to your platform and the version of the library that you have installed on there. A quick Google search for issues with the MD5 library and odd length strings didn't turn up much. However, if this was systemic across the platforms Asterisk is typically installed on, I'd suspect we'd be getting lit up.

As it is, I'm closing this out as "Can't Reproduce" - although I suspect that even if we could, we'd find out that it was a problem in the library, and not Asterisk itself.

> [regression] ast_md5_hash sometimes create incorrect md5 digest
> ---------------------------------------------------------------
>
>                 Key: ASTERISK-16871
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-16871
>             Project: Asterisk
>          Issue Type: Bug
>          Components: Functions/func_md5
>            Reporter: zhiqiang wang
>            Severity: Minor
>
> 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.
> {code}
> 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);
>         }
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list