Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set network key (-k) option is not implemented #21

Open
aabaker opened this issue Apr 15, 2021 · 4 comments
Open

Set network key (-k) option is not implemented #21

aabaker opened this issue Apr 15, 2021 · 4 comments

Comments

@aabaker
Copy link

aabaker commented Apr 15, 2021

Whilst trying to check the expected format for the network key I observed that opt_key just gets set to 1, not optarg when the -k option is selected and the value of opt_key is never read.

@ffainelli
Copy link
Owner

Are you referring to hpav_cfg.c here?

@aabaker
Copy link
Author

aabaker commented May 10, 2021

No, I'm talking about main.c, line 136. Which key this is intended to set isn't entirely clear as the man page just says network key and doesn't specify whether that is NMK, NEK or possibly even the DAK. The logical options would seem to be either it is intended to set the NMK on a directly connected device or it is to set the DAK that would be used to send a CM_SET_KEY to a remote device.

@ffainelli
Copy link
Owner

This dates back from a while ago but we had intended to use this to specify either the DAK or NMK AFAIR.

@aabaker
Copy link
Author

aabaker commented Jun 17, 2021

From my reading of the spec the only message a unit is required / expected to support that can be encrypted with the DEK is the CM_SET_KEY message in which case specifying the NMK that you want to set is also required so saying this value could be either isn't helpful. The most useful option is probably that the option specifies the network password from which the NMK is derived. That allows setting the network key on directly connected devices and then it would be a further activity to also be able to specify a DPW from which a DEK is generated to allow setting the NMK remotely. The desired set of tasks would then be

  1. Update documentation to specify that this option is the network password (not yet implemented)
  2. Add code to implement PBKDF1 as per section 7.10.7.1 of the homeplug spec
  3. Add code to send a CM_SET_KEY message if the -k option is provided using the key generated by applying PBKDF1 to the argument given to -k (and make -k and -m together invalid and remove the not implemented comment from the man page)
  4. Verify that the key generated by step 3 matches that generated for the same password with other management tools
  5. Add a new option to specify the DPW and if this option is specified any messages sent, whether CM_SET_KEY or using the -m option are sent encrypted with the DEK (or more accurately with a TEK that was verified using the DEK) this then allows setting the network key on a device that isn't directly connected

Each of these steps except 2 would provide some user visible benefit but 3 & 5 require more effort than I've got time for. If you agree that is where this should head then I'll create a pull request for step 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants