Fixes from clang / scan-build
[freeradius.git] / src / modules / rlm_eap / types / rlm_eap_leap / eap_leap.c
index 449848a..edf46c0 100644 (file)
@@ -203,7 +203,7 @@ static int eapleap_ntpwdhash(unsigned char *ntpwdhash, VALUE_PAIR *password)
 {
        if ((password->attribute == PW_USER_PASSWORD) ||
            (password->attribute == PW_CLEARTEXT_PASSWORD)) {
-               int i;
+               size_t i;
                unsigned char unicode[512];
 
                /*
@@ -225,7 +225,7 @@ static int eapleap_ntpwdhash(unsigned char *ntpwdhash, VALUE_PAIR *password)
 
        } else {                /* MUST be NT-Password */
                if (password->length == 32) {
-                       password->length = lrad_hex2bin(password->vp_strvalue,
+                       password->length = fr_hex2bin(password->vp_strvalue,
                                                        password->vp_octets,
                                                        16);
                }
@@ -282,7 +282,7 @@ LEAP_PACKET *eapleap_stage6(LEAP_PACKET *packet, REQUEST *request,
                            VALUE_PAIR *user_name, VALUE_PAIR* password,
                            leap_session_t *session, VALUE_PAIR **reply_vps)
 {
-       int i;
+       size_t i;
        unsigned char ntpwdhash[16], ntpwdhashhash[16];
        unsigned char buffer[256];
        LEAP_PACKET *reply;
@@ -365,12 +365,11 @@ LEAP_PACKET *eapleap_stage6(LEAP_PACKET *packet, REQUEST *request,
        memcpy(p, session->peer_challenge, 8); /* PC */
        p += 8;
        memcpy(p, session->peer_response, 24); /* PR */
-       p += 24;
 
        /*
         *      These 16 bytes are the session key to use.
         */
-       librad_md5_calc(ntpwdhash, buffer, 16 + 8 + 24 + 8 + 24);
+       fr_md5_calc(ntpwdhash, buffer, 16 + 8 + 24 + 8 + 24);
 
        memcpy(vp->vp_strvalue + vp->length, ntpwdhash, 16);
        memset(vp->vp_strvalue + vp->length + 16, 0,
@@ -415,7 +414,7 @@ LEAP_PACKET *eapleap_initiate(UNUSED EAP_DS *eap_ds, VALUE_PAIR *user_name)
         *      Fill the challenge with random bytes.
         */
        for (i = 0; i < reply->count; i++) {
-               reply->challenge[i] = lrad_rand();
+               reply->challenge[i] = fr_rand();
        }
 
        DEBUG2("  rlm_eap_leap: Issuing AP Challenge");