Removed extra calls to HMAC_CTX_init()
authorAlan T. DeKok <aland@freeradius.org>
Wed, 10 Nov 2010 14:13:20 +0000 (15:13 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 10 Nov 2010 16:20:45 +0000 (17:20 +0100)
Noticed by James Ballantine

src/modules/rlm_wimax/rlm_wimax.c

index d88d06d..8265802 100644 (file)
@@ -220,7 +220,6 @@ static int wimax_postauth(void *instance, REQUEST *request)
        /*
         *      MIP-RK-2 = HMAC-SSHA256(EMSK, MIP-RK-1 | usage-data | 0x01)
         */
        /*
         *      MIP-RK-2 = HMAC-SSHA256(EMSK, MIP-RK-1 | usage-data | 0x01)
         */
-       HMAC_CTX_init(&hmac);
        HMAC_Init_ex(&hmac, emsk->vp_octets, emsk->length, EVP_sha256(), NULL);
        
        HMAC_Update(&hmac, (const uint8_t *) &mip_rk_1, rk1_len);
        HMAC_Init_ex(&hmac, emsk->vp_octets, emsk->length, EVP_sha256(), NULL);
        
        HMAC_Update(&hmac, (const uint8_t *) &mip_rk_1, rk1_len);
@@ -237,7 +236,6 @@ static int wimax_postauth(void *instance, REQUEST *request)
        /*
         *      MIP-SPI = HMAC-SSHA256(MIP-RK, "SPI CMIP PMIP");
         */
        /*
         *      MIP-SPI = HMAC-SSHA256(MIP-RK, "SPI CMIP PMIP");
         */
-       HMAC_CTX_init(&hmac);
        HMAC_Init_ex(&hmac, mip_rk, rk_len, EVP_sha256(), NULL);
        
        HMAC_Update(&hmac, (const uint8_t *) "SPI CMIP PMIP", 12);
        HMAC_Init_ex(&hmac, mip_rk, rk_len, EVP_sha256(), NULL);
        
        HMAC_Update(&hmac, (const uint8_t *) "SPI CMIP PMIP", 12);
@@ -302,7 +300,6 @@ static int wimax_postauth(void *instance, REQUEST *request)
                 *      MN-HA-PMIP4 =
                 *         H(MIP-RK, "PMIP4 MN HA" | HA-IPv4 | MN-NAI);
                 */
                 *      MN-HA-PMIP4 =
                 *         H(MIP-RK, "PMIP4 MN HA" | HA-IPv4 | MN-NAI);
                 */
-               HMAC_CTX_init(&hmac);
                HMAC_Init_ex(&hmac, mip_rk, rk_len, EVP_sha1(), NULL);
 
                HMAC_Update(&hmac, (const uint8_t *) "PMIP4 MN HA", 11);
                HMAC_Init_ex(&hmac, mip_rk, rk_len, EVP_sha1(), NULL);
 
                HMAC_Update(&hmac, (const uint8_t *) "PMIP4 MN HA", 11);
@@ -354,7 +351,6 @@ static int wimax_postauth(void *instance, REQUEST *request)
                 *      MN-HA-CMIP4 =
                 *         H(MIP-RK, "CMIP4 MN HA" | HA-IPv4 | MN-NAI);
                 */
                 *      MN-HA-CMIP4 =
                 *         H(MIP-RK, "CMIP4 MN HA" | HA-IPv4 | MN-NAI);
                 */
-               HMAC_CTX_init(&hmac);
                HMAC_Init_ex(&hmac, mip_rk, rk_len, EVP_sha1(), NULL);
 
                HMAC_Update(&hmac, (const uint8_t *) "CMIP4 MN HA", 11);
                HMAC_Init_ex(&hmac, mip_rk, rk_len, EVP_sha1(), NULL);
 
                HMAC_Update(&hmac, (const uint8_t *) "CMIP4 MN HA", 11);
@@ -406,7 +402,6 @@ static int wimax_postauth(void *instance, REQUEST *request)
                 *      MN-HA-CMIP6 =
                 *         H(MIP-RK, "CMIP6 MN HA" | HA-IPv6 | MN-NAI);
                 */
                 *      MN-HA-CMIP6 =
                 *         H(MIP-RK, "CMIP6 MN HA" | HA-IPv6 | MN-NAI);
                 */
-               HMAC_CTX_init(&hmac);
                HMAC_Init_ex(&hmac, mip_rk, rk_len, EVP_sha1(), NULL);
 
                HMAC_Update(&hmac, (const uint8_t *) "CMIP6 MN HA", 11);
                HMAC_Init_ex(&hmac, mip_rk, rk_len, EVP_sha1(), NULL);
 
                HMAC_Update(&hmac, (const uint8_t *) "CMIP6 MN HA", 11);
@@ -455,7 +450,6 @@ static int wimax_postauth(void *instance, REQUEST *request)
         */
        fa_rk = pairfind(request->reply->vps, 14, VENDORPEC_WIMAX);
        if (fa_rk && (fa_rk->length <= 1)) {
         */
        fa_rk = pairfind(request->reply->vps, 14, VENDORPEC_WIMAX);
        if (fa_rk && (fa_rk->length <= 1)) {
-               HMAC_CTX_init(&hmac);
                HMAC_Init_ex(&hmac, mip_rk, rk_len, EVP_sha1(), NULL);
                
                HMAC_Update(&hmac, (const uint8_t *) "FA-RK", 5);
                HMAC_Init_ex(&hmac, mip_rk, rk_len, EVP_sha1(), NULL);
                
                HMAC_Update(&hmac, (const uint8_t *) "FA-RK", 5);
@@ -488,7 +482,6 @@ static int wimax_postauth(void *instance, REQUEST *request)
         */
        ip = pairfind(request->reply->vps, 1901, 0);
        if (fa_rk && ip && mn_nai) {
         */
        ip = pairfind(request->reply->vps, 1901, 0);
        if (fa_rk && ip && mn_nai) {
-               HMAC_CTX_init(&hmac);
                HMAC_Init_ex(&hmac, fa_rk->vp_octets, fa_rk->length,
                             EVP_sha1(), NULL);
                
                HMAC_Init_ex(&hmac, fa_rk->vp_octets, fa_rk->length,
                             EVP_sha1(), NULL);