|
@@ -144,16 +144,34 @@ python do_swuimage () {
|
|
|
privkey = d.getVar('SWUPDATE_PRIVATE_KEY', True)
|
|
privkey = d.getVar('SWUPDATE_PRIVATE_KEY', True)
|
|
|
if not privkey:
|
|
if not privkey:
|
|
|
bb.fatal("SWUPDATE_PRIVATE_KEY isn't set")
|
|
bb.fatal("SWUPDATE_PRIVATE_KEY isn't set")
|
|
|
- if not os.path.exists(privkey):
|
|
|
|
|
|
|
+
|
|
|
|
|
+ engine = d.getVar('SWUPDATE_SIGNING_ENGINE', True)
|
|
|
|
|
+ if engine:
|
|
|
|
|
+ engine = "-engine '%s' -keyform engine " % (engine)
|
|
|
|
|
+ elif not os.path.exists(privkey):
|
|
|
bb.fatal("SWUPDATE_PRIVATE_KEY %s doesn't exist" % (privkey))
|
|
bb.fatal("SWUPDATE_PRIVATE_KEY %s doesn't exist" % (privkey))
|
|
|
|
|
+ else:
|
|
|
|
|
+ engine = ""
|
|
|
|
|
+
|
|
|
|
|
+ engine_path = d.getVar('SWUPDATE_SIGNING_ENGINE_PATH', True)
|
|
|
|
|
+ if engine and engine_path:
|
|
|
|
|
+ engine_path = 'OPENSSL_ENGINES="%s" ' % (engine_path)
|
|
|
|
|
+ else:
|
|
|
|
|
+ engine_path = ""
|
|
|
|
|
+
|
|
|
passout = d.getVar('SWUPDATE_PASSWORD_FILE', True)
|
|
passout = d.getVar('SWUPDATE_PASSWORD_FILE', True)
|
|
|
if passout:
|
|
if passout:
|
|
|
passout = "-passin file:'%s' " % (passout)
|
|
passout = "-passin file:'%s' " % (passout)
|
|
|
else:
|
|
else:
|
|
|
passout = ""
|
|
passout = ""
|
|
|
- signcmd = "openssl dgst -sha256 -sign '%s' %s -out '%s' '%s'" % (
|
|
|
|
|
|
|
+
|
|
|
|
|
+ # Sign with openssl.real, provided by openssl-native so OPENSSL_ENGINES
|
|
|
|
|
+ # can be overridden
|
|
|
|
|
+ signcmd = "%sopenssl.real dgst -sha256 -sign '%s' %s%s -out '%s' '%s'" % (
|
|
|
|
|
+ engine_path,
|
|
|
privkey,
|
|
privkey,
|
|
|
passout,
|
|
passout,
|
|
|
|
|
+ engine,
|
|
|
os.path.join(s, 'sw-description.sig'),
|
|
os.path.join(s, 'sw-description.sig'),
|
|
|
os.path.join(s, 'sw-description'))
|
|
os.path.join(s, 'sw-description'))
|
|
|
if os.system(signcmd) != 0:
|
|
if os.system(signcmd) != 0:
|