Support for migration from 3.0 19/182719/6
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Wed, 27 Jun 2018 09:08:57 +0000 (11:08 +0200)
committerJaemin Ryu <jm77.ryu@samsung.com>
Thu, 26 Jul 2018 05:12:18 +0000 (05:12 +0000)
commitb823a8e0ee6ed8bba05cf8c1d3245680d94a4e78
tree00b57612d9636148ccb5beb38da54d87d7e45847
parent00ac93ce4d1e3363a52846faedf3879bd9e6199e
Support for migration from 3.0

There are products based on Tizen 3.0 using different encryption scheme and
footer format. To properly migrate their internal memory encryption key the
flag marking the beginning of an upgrade is left by ode-fota.

During the first device unlock(attempt to mount encrypted partition) after the
upgrade the flag presence is checked. The flag is removed but if it was
present, oded will try to use the product specific key storage plugin to load
the master key for internal encryption.

If it succeeds it will encrypt the master key using given password. Otherwise
it will fall back to normal operation, that is, decrypt the master key using
given password.

Any attempt to decrypt the master key using a password will result in removal
of the upgrade flag.

It is assumed that affected products verify the password prior to passing it to
ode_internal_encryption_set_mount_password().

For unaffected products that do not require the migration it's enough to remove
the flag or the master key stored for the purpose of the upgrade before calling
ode_internal_encryption_set_mount_password(). Note that it is advised to remove
the master key stored for the purpose of the upgrade as soon as possible after
the upgrade due to security reasons. Even if the flag and master key are
present, the encryption introduced in this commit won't break anything as long
as the password is correct.

Change-Id: I86c83366c432aa8ce1d4f25c9beeed98d4f672c3
fota/fota.cpp
server/internal-encryption.cpp
server/key-server.cpp
server/key-server.h
server/upgrade-support.cpp
server/upgrade-support.h