Operating System - HP-UX
1754014 Members
7562 Online
108811 Solutions
New Discussion

problem with MD5 protocol

 
srinivas_10
Occasional Contributor

problem with MD5 protocol

Hi I facing different problem.
the code below is working fine on one HPUX11.00 system fine and giveing segmentation fault on another HPUX11.00 with (aCC: HP ANSI C++ B3910B A.03.13. on bothe the servers.)
code is like this in snmp++ sources:(Iam usinf snmp++3.0 beta version sources)

int apPasswordToKeyMD5(
unsigned char *password, /* IN */
int passwordlen, /* IN */
unsigned char *engineID, /* IN - pointer to snmpEngineID */
int engineIDLength, /* IN - length of snmpEngineID */
unsigned char *key) /* OUT - pointer to caller 16-octet buffer */
{
MD5_CTX MD;
unsigned char *cp, password_buf[65];
unsigned long password_index = 0;
unsigned long count = 0, i;
MD5Init (&MD); /* initialize MD5 */
/* Use while loop until we've done 1 Megabyte */

while (count < 1048576) {
cp = password_buf;
for (i = 0; i < 64; i++) {
*cp++ = password[password_index++ % passwordlen];
}
MD5Update (&MD, password_buf, 64);
count += 64;
}
MD5Final (key, &MD); /* tell MD5 we're done */
memcpy(password_buf,key,16);
memcpy(password_buf + 16,engineID, engineIDLength);
memcpy(password_buf + 16 + engineIDLength, key,16);
MD5Init(&MD);
MD5Update(&MD, password_buf, 32 + engineIDLength);
MD5Final(key, &MD);
return SNMPv3_USM_OK;
}



It calulates key but at time of return it is giving sementation fault on system and success on another system.Is there any patches required to use MD5 auth protocol?




Please suggest the if any body find s solution.
W/love
Sri