Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. [security] Migrating from library version 2.1 to 2.2

[security] Migrating from library version 2.1 to 2.2

Scheduled Pinned Locked Moved Development
48 Posts 7 Posters 9.2k Views 9 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • AnticimexA Anticimex

    @alowhum you are welcome. Just remember that simple in this context also mean weak. Storing the secrets in the sketch is a huge security implication on targets that does not support readout protection. Atmga328p among others.

    alowhumA Offline
    alowhumA Offline
    alowhum
    Plugin Developer
    wrote on last edited by alowhum
    #19

    @anticimex I understand. But if my neighbour has access to the nodes inside my house, then I have a bigger security problem :-)

    AnticimexA 1 Reply Last reply
    0
    • alowhumA alowhum

      @anticimex I understand. But if my neighbour has access to the nodes inside my house, then I have a bigger security problem :-)

      AnticimexA Offline
      AnticimexA Offline
      Anticimex
      Contest Winner
      wrote on last edited by
      #20

      @alowhum right, but if you update your sketches OTA, he can potentially sniff your key OTA as well and then he does not need to enter your house ;)

      Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

      alowhumA alexsh1A 2 Replies Last reply
      0
      • AnticimexA Anticimex

        @alowhum right, but if you update your sketches OTA, he can potentially sniff your key OTA as well and then he does not need to enter your house ;)

        alowhumA Offline
        alowhumA Offline
        alowhum
        Plugin Developer
        wrote on last edited by
        #21

        @anticimex Heh, then I will invite him/her over for tea congratulate them. And then apply some verbal security :-P

        Can Arduino nano's be updated OTA?

        AnticimexA 1 Reply Last reply
        1
        • alowhumA alowhum

          @anticimex Heh, then I will invite him/her over for tea congratulate them. And then apply some verbal security :-P

          Can Arduino nano's be updated OTA?

          AnticimexA Offline
          AnticimexA Offline
          Anticimex
          Contest Winner
          wrote on last edited by
          #22

          @alowhum afaik all MySensors capable nodes can be updated OTA with the appropriate bootloader programmed.

          Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

          alowhumA 1 Reply Last reply
          0
          • AnticimexA Anticimex

            @alowhum afaik all MySensors capable nodes can be updated OTA with the appropriate bootloader programmed.

            alowhumA Offline
            alowhumA Offline
            alowhum
            Plugin Developer
            wrote on last edited by
            #23

            @anticimex Wow, I didn't know that! I've gotta look into that! cool!

            AnticimexA 1 Reply Last reply
            0
            • alowhumA alowhum

              @anticimex Wow, I didn't know that! I've gotta look into that! cool!

              AnticimexA Offline
              AnticimexA Offline
              Anticimex
              Contest Winner
              wrote on last edited by
              #24

              @alowhum in general where are two options, DualOptiboot which require an external spi flash but is radio agnostic, or the mysbooloader which have no requirements on external components but might need to be recompiled to match your radio settings.

              Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

              gohanG 1 Reply Last reply
              0
              • AnticimexA Anticimex

                @alowhum in general where are two options, DualOptiboot which require an external spi flash but is radio agnostic, or the mysbooloader which have no requirements on external components but might need to be recompiled to match your radio settings.

                gohanG Offline
                gohanG Offline
                gohan
                Mod
                wrote on last edited by
                #25

                @anticimex I haven't found dual optiboot for all mysensors boards, but maybe there is a way to make it work and I'm not expert on this

                AnticimexA 1 Reply Last reply
                0
                • gohanG gohan

                  @anticimex I haven't found dual optiboot for all mysensors boards, but maybe there is a way to make it work and I'm not expert on this

                  AnticimexA Offline
                  AnticimexA Offline
                  Anticimex
                  Contest Winner
                  wrote on last edited by
                  #26

                  @gohan hence my comment "in general", and in this sence I believe the board in question is "Can Arduino nano's be updated OTA?" and a nano is atmega328p based, and I believe it supports both bootloader variants. Of course there are some devices that might not support both, or perhaps even any of them, but as most of this discussion relates to resource limited nodes, I think only atmega328p based devices are considered.

                  Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                  1 Reply Last reply
                  0
                  • alowhumA alowhum

                    @anticimex Awesome!

                    So I had a look at the new code, and is this a fair summary?:

                    • Simple encryption and simple signing are now two separate functions you can call at the top of your script by adding a line with a password: MY_ENCRYPTION_SIMPLE_PASSWD and MY_SIGNING_SIMPLE_PASSWD.
                    • You can also just put "MY_SECURITY_SIMPLE_PASSWD" at the top of your script, and that will do both in one go. This used to be called the MY_SIGNING_SIMPLE_PASSWD option, which also did both.
                    MY_SIGNING_SIMPLE_PASSWD is now
                    called MY_SECURITY_SIMPLE_PASSWD.
                    MY_SIGNING_SIMPLE_PASSWD only affects signing,
                    and a new flag, MY_ENCRYPTION_SIMPLE_PASSWD
                    only affects encryption.
                    MY_SECURITY_SIMPLE_PASSWD enable both these flags.
                    

                    This is simply wonderful.

                    • More choice and flexibility for the end user.
                    • Get some simple security on your existing Arduino hardware.

                    Thank you so much for this.

                    D Offline
                    D Offline
                    DavidZH
                    wrote on last edited by
                    #27

                    @alowhum said in [security] Migrating from library version 2.1 to 2.2:

                    @anticimex Awesome!

                    So I had a look at the new code, and is this a fair summary?:

                    • Simple encryption and simple signing are now two separate functions you can call at the top of your script by adding a line with a password: MY_ENCRYPTION_SIMPLE_PASSWD and MY_SIGNING_SIMPLE_PASSWD.
                    • You can also just put "MY_SECURITY_SIMPLE_PASSWD" at the top of your script, and that will do both in one go. This used to be called the MY_SIGNING_SIMPLE_PASSWD option, which also did both.
                    MY_SIGNING_SIMPLE_PASSWD is now
                    called MY_SECURITY_SIMPLE_PASSWD.
                    MY_SIGNING_SIMPLE_PASSWD only affects signing,
                    and a new flag, MY_ENCRYPTION_SIMPLE_PASSWD
                    only affects encryption.
                    MY_SECURITY_SIMPLE_PASSWD enable both these flags.
                    

                    I want to follow upon this: I use RFM69 for transport, they have an encryption engine in hardware. Will there be any difference in time to process the message between using:

                    • MY_SECURITY_SIMPLE_PASSWORD with soft encryption done on the ATmega or
                    • MY_SIGNING_SIMPLE_PASSWORD and encryption on the RFM or
                    • just MY_SIGNING_SIMPLE_PASSWORD.

                    If I'm not mistaken a signed message is the full 32 byes anyway, so the actual "airtime" will not change, but maybe the processing time before that will.

                    And yes, I am aware of the implications in total system security. But none of my nodes are accessible from the outside of my house. I am not worried about someone reading the contents of my sketch.

                    AnticimexA 1 Reply Last reply
                    0
                    • D DavidZH

                      @alowhum said in [security] Migrating from library version 2.1 to 2.2:

                      @anticimex Awesome!

                      So I had a look at the new code, and is this a fair summary?:

                      • Simple encryption and simple signing are now two separate functions you can call at the top of your script by adding a line with a password: MY_ENCRYPTION_SIMPLE_PASSWD and MY_SIGNING_SIMPLE_PASSWD.
                      • You can also just put "MY_SECURITY_SIMPLE_PASSWD" at the top of your script, and that will do both in one go. This used to be called the MY_SIGNING_SIMPLE_PASSWD option, which also did both.
                      MY_SIGNING_SIMPLE_PASSWD is now
                      called MY_SECURITY_SIMPLE_PASSWD.
                      MY_SIGNING_SIMPLE_PASSWD only affects signing,
                      and a new flag, MY_ENCRYPTION_SIMPLE_PASSWD
                      only affects encryption.
                      MY_SECURITY_SIMPLE_PASSWD enable both these flags.
                      

                      I want to follow upon this: I use RFM69 for transport, they have an encryption engine in hardware. Will there be any difference in time to process the message between using:

                      • MY_SECURITY_SIMPLE_PASSWORD with soft encryption done on the ATmega or
                      • MY_SIGNING_SIMPLE_PASSWORD and encryption on the RFM or
                      • just MY_SIGNING_SIMPLE_PASSWORD.

                      If I'm not mistaken a signed message is the full 32 byes anyway, so the actual "airtime" will not change, but maybe the processing time before that will.

                      And yes, I am aware of the implications in total system security. But none of my nodes are accessible from the outside of my house. I am not worried about someone reading the contents of my sketch.

                      AnticimexA Offline
                      AnticimexA Offline
                      Anticimex
                      Contest Winner
                      wrote on last edited by
                      #28

                      @davidzh If you enable any form of encryption feature, RFM69 will always use the hardware to implement it. So there is no "soft encryption" on RFM69.

                      Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                      D 1 Reply Last reply
                      0
                      • AnticimexA Anticimex

                        @davidzh If you enable any form of encryption feature, RFM69 will always use the hardware to implement it. So there is no "soft encryption" on RFM69.

                        D Offline
                        D Offline
                        DavidZH
                        wrote on last edited by
                        #29

                        @anticimex

                        Ok clear. Thank you.

                        1 Reply Last reply
                        0
                        • B Offline
                          B Offline
                          bilbolodz
                          wrote on last edited by
                          #30

                          I've a lot devices with very hard physical access to them. I'm using OTA to change firmware so please describe how to implement "new 2.2 checksum feature" into existing sketch using OTA.

                          AnticimexA 1 Reply Last reply
                          0
                          • B bilbolodz

                            I've a lot devices with very hard physical access to them. I'm using OTA to change firmware so please describe how to implement "new 2.2 checksum feature" into existing sketch using OTA.

                            AnticimexA Offline
                            AnticimexA Offline
                            Anticimex
                            Contest Winner
                            wrote on last edited by
                            #31

                            @bilbolodz Not sure what you mean. Then you have to send personalization sketch OTA and that is really not recommended unless you can do that in a secure way. And the personalizer is not designed to use any radios so you cannot expect to be able to FOTA over a new sketch after personalization. You will have to "bring in" your devices if you want to redo personalization.

                            Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                            1 Reply Last reply
                            0
                            • B Offline
                              B Offline
                              bilbolodz
                              wrote on last edited by
                              #32

                              So it means that (If I want use signing) I'm stuck with mysensors version 2.1?
                              I'm not able compile new code (using 2.2) and upload it over OTA because I will loose signing right (without changeing EEPROM content)?
                              I think there should be a way to migrate sketch (which is using soft signing) from 2.1 to 2.2 with OTA. Secure sending of keys actually is NOT a problem because (as I understood) new in 2.2 is "only checksum" of EEPROM.
                              So if I have "2.1 mysensors library" personalized devices, it's possible to write a program which gets existing data from EEPROM calculate checksum and write it to EEPROM (maybe also migrating other structures if there were other changes). Such sketch can be in safe way transferred via OTA because it doesn't contain any secret information. Then I can upload new (using 2.2 library) version of my sketch and I will have working "2.2" devices without touching it (only OTA). What do you think about it?

                              Actually now I've realised (luckily) that in these "hard to get devices" I'm using hardware signing so it should be not a problem (?) :-)

                              AnticimexA gohanG 2 Replies Last reply
                              0
                              • B bilbolodz

                                So it means that (If I want use signing) I'm stuck with mysensors version 2.1?
                                I'm not able compile new code (using 2.2) and upload it over OTA because I will loose signing right (without changeing EEPROM content)?
                                I think there should be a way to migrate sketch (which is using soft signing) from 2.1 to 2.2 with OTA. Secure sending of keys actually is NOT a problem because (as I understood) new in 2.2 is "only checksum" of EEPROM.
                                So if I have "2.1 mysensors library" personalized devices, it's possible to write a program which gets existing data from EEPROM calculate checksum and write it to EEPROM (maybe also migrating other structures if there were other changes). Such sketch can be in safe way transferred via OTA because it doesn't contain any secret information. Then I can upload new (using 2.2 library) version of my sketch and I will have working "2.2" devices without touching it (only OTA). What do you think about it?

                                Actually now I've realised (luckily) that in these "hard to get devices" I'm using hardware signing so it should be not a problem (?) :-)

                                AnticimexA Offline
                                AnticimexA Offline
                                Anticimex
                                Contest Winner
                                wrote on last edited by
                                #33

                                @bilbolodz Correct, checksum is on EEPROM data, so you can make a sketch to read it and calculate the checksum yourself. It is all open source so you can just see in the personalizer how it is calculated and replicate that :)

                                Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                                B 1 Reply Last reply
                                0
                                • AnticimexA Anticimex

                                  @bilbolodz Correct, checksum is on EEPROM data, so you can make a sketch to read it and calculate the checksum yourself. It is all open source so you can just see in the personalizer how it is calculated and replicate that :)

                                  B Offline
                                  B Offline
                                  bilbolodz
                                  wrote on last edited by
                                  #34

                                  @anticimex OK maybe I will try but I think it could be a good idea to extend you "migration guide".

                                  AnticimexA 1 Reply Last reply
                                  0
                                  • B bilbolodz

                                    @anticimex OK maybe I will try but I think it could be a good idea to extend you "migration guide".

                                    AnticimexA Offline
                                    AnticimexA Offline
                                    Anticimex
                                    Contest Winner
                                    wrote on last edited by
                                    #35

                                    @bilbolodz I disapprove manipulating security related data without the personalizer, so no. You can do it, but I do not endorse it.

                                    Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                                    1 Reply Last reply
                                    0
                                    • B Offline
                                      B Offline
                                      bilbolodz
                                      wrote on last edited by
                                      #36

                                      "Your code your rules" but I'm little surprised with your standpoint.

                                      AnticimexA 1 Reply Last reply
                                      0
                                      • B bilbolodz

                                        "Your code your rules" but I'm little surprised with your standpoint.

                                        AnticimexA Offline
                                        AnticimexA Offline
                                        Anticimex
                                        Contest Winner
                                        wrote on last edited by
                                        #37

                                        @bilbolodz That is fine. But as I have currently no means of verifying, I will not make a update to the guide. If you find a way to do it, you are free to post a guide if other need to make a similar thing.

                                        Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                                        1 Reply Last reply
                                        0
                                        • B bilbolodz

                                          So it means that (If I want use signing) I'm stuck with mysensors version 2.1?
                                          I'm not able compile new code (using 2.2) and upload it over OTA because I will loose signing right (without changeing EEPROM content)?
                                          I think there should be a way to migrate sketch (which is using soft signing) from 2.1 to 2.2 with OTA. Secure sending of keys actually is NOT a problem because (as I understood) new in 2.2 is "only checksum" of EEPROM.
                                          So if I have "2.1 mysensors library" personalized devices, it's possible to write a program which gets existing data from EEPROM calculate checksum and write it to EEPROM (maybe also migrating other structures if there were other changes). Such sketch can be in safe way transferred via OTA because it doesn't contain any secret information. Then I can upload new (using 2.2 library) version of my sketch and I will have working "2.2" devices without touching it (only OTA). What do you think about it?

                                          Actually now I've realised (luckily) that in these "hard to get devices" I'm using hardware signing so it should be not a problem (?) :-)

                                          gohanG Offline
                                          gohanG Offline
                                          gohan
                                          Mod
                                          wrote on last edited by
                                          #38

                                          @bilbolodz you can still enable signing on gateway and make it optional, so you will have time to update nodes later on.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          10

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular