]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP2: Use ppKey to decrypt E'-id on Configurator
authorJouni Malinen <jouni@codeaurora.org>
Tue, 13 Oct 2020 17:57:26 +0000 (20:57 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 13 Oct 2020 20:38:47 +0000 (23:38 +0300)
Use the new privacy protection key to decrypt E'-id from Reconfig
Announcement frames.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/common/dpp_crypto.c
src/common/dpp_i.h
src/common/dpp_reconfig.c

index 865215afe67afae4969178bb2d047d6eb85310f4..7c48015319d84308af5c6bbbf96f5cead3d62a2f 100644 (file)
@@ -3163,32 +3163,35 @@ void dpp_free_reconfig_id(struct dpp_reconfig_id *id)
 }
 
 
-EC_POINT * dpp_decrypt_e_id(EVP_PKEY *csign, EVP_PKEY *a_nonce,
+EC_POINT * dpp_decrypt_e_id(EVP_PKEY *ppkey, EVP_PKEY *a_nonce,
                            EVP_PKEY *e_prime_id)
 {
-       const EC_KEY *csign_ec, *a_nonce_ec, *e_prime_id_ec;
-       const BIGNUM *csign_bn;
+       const EC_KEY *pp_ec, *a_nonce_ec, *e_prime_id_ec;
+       const BIGNUM *pp_bn;
        const EC_GROUP *group;
        EC_POINT *e_id = NULL;
        const EC_POINT *a_nonce_point, *e_prime_id_point;
        BN_CTX *ctx = NULL;
 
+       if (!ppkey)
+               return NULL;
+
        /* E-id = E'-id - s_C * A-NONCE */
-       csign_ec = EVP_PKEY_get0_EC_KEY(csign);
+       pp_ec = EVP_PKEY_get0_EC_KEY(ppkey);
        a_nonce_ec = EVP_PKEY_get0_EC_KEY(a_nonce);
        e_prime_id_ec = EVP_PKEY_get0_EC_KEY(e_prime_id);
-       if (!csign_ec || !a_nonce_ec || !e_prime_id_ec)
+       if (!pp_ec || !a_nonce_ec || !e_prime_id_ec)
                return NULL;
-       csign_bn = EC_KEY_get0_private_key(csign_ec);
-       group = EC_KEY_get0_group(csign_ec);
+       pp_bn = EC_KEY_get0_private_key(pp_ec);
+       group = EC_KEY_get0_group(pp_ec);
        a_nonce_point = EC_KEY_get0_public_key(a_nonce_ec);
        e_prime_id_point = EC_KEY_get0_public_key(e_prime_id_ec);
        ctx = BN_CTX_new();
-       if (!csign_bn || !group || !a_nonce_point || !e_prime_id_point || !ctx)
+       if (!pp_bn || !group || !a_nonce_point || !e_prime_id_point || !ctx)
                goto fail;
        e_id = EC_POINT_new(group);
        if (!e_id ||
-           !EC_POINT_mul(group, e_id, NULL, a_nonce_point, csign_bn, ctx) ||
+           !EC_POINT_mul(group, e_id, NULL, a_nonce_point, pp_bn, ctx) ||
            !EC_POINT_invert(group, e_id, ctx) ||
            !EC_POINT_add(group, e_id, e_prime_id_point, e_id, ctx)) {
                EC_POINT_clear_free(e_id);
index b875f2033a26e47eb7f05482b3165b0329e6d13d..af12467a5d92c34a0c2cc20cac8099afa7dbe930 100644 (file)
@@ -133,7 +133,7 @@ int dpp_reconfig_derive_ke_responder(struct dpp_authentication *auth,
 int dpp_reconfig_derive_ke_initiator(struct dpp_authentication *auth,
                                     const u8 *r_proto, u16 r_proto_len,
                                     struct json_token *net_access_key);
-EC_POINT * dpp_decrypt_e_id(EVP_PKEY *csign, EVP_PKEY *a_nonce,
+EC_POINT * dpp_decrypt_e_id(EVP_PKEY *ppkey, EVP_PKEY *a_nonce,
                            EVP_PKEY *e_prime_id);
 char * dpp_sign_connector(struct dpp_configurator *conf,
                          const struct wpabuf *dppcon);
index f9d01d8419a0710184b435934293cbb9909aa932..c4a027363fcea8eaeb1bc77e16de8271d61c2495 100644 (file)
@@ -264,7 +264,7 @@ dpp_reconfig_init(struct dpp_global *dpp, void *msg_ctx,
                return NULL;
        }
        dpp_debug_print_key("E'-id", e_prime_id);
-       e_id = dpp_decrypt_e_id(conf->csign, a_nonce, e_prime_id);
+       e_id = dpp_decrypt_e_id(conf->pp_key, a_nonce, e_prime_id);
        EVP_PKEY_free(a_nonce);
        EVP_PKEY_free(e_prime_id);
        if (!e_id) {