feat(validation): validate user input

The validation is implemented as a set of free-standing functions
in a separated module; each driver which uses storage functions
should call call the corresponding validation functions first.

Fixes: bug #1177971
Fixes: bug #1177976
Fixes: bug #1177979
Fixes: bug #1206175
Fixes: bug #1208873

Change-Id: I0b9c9766a9c3de42f2a2eb470cba0ab7265e669a