BaseTools/Capsule: Add max value checks to Capsule Generation tools

https://bugzilla.tianocore.org/show_bug.cgi?id=1021
https://bugzilla.tianocore.org/show_bug.cgi?id=1022
https://bugzilla.tianocore.org/show_bug.cgi?id=1026

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
Kinney, Michael D 2018-07-27 12:27:19 -07:00
parent e4005ecb0b
commit 6ed4651cb5
1 changed files with 10 additions and 0 deletions

View File

@ -298,6 +298,12 @@ if __name__ == '__main__':
parser.error ('--capflag PopulateSystemTable also requires --capflag PersistAcrossReset') parser.error ('--capflag PopulateSystemTable also requires --capflag PersistAcrossReset')
if 'InitiateReset' in args.CapsuleFlag: if 'InitiateReset' in args.CapsuleFlag:
parser.error ('--capflag InitiateReset also requires --capflag PersistAcrossReset') parser.error ('--capflag InitiateReset also requires --capflag PersistAcrossReset')
if args.CapsuleOemFlag > 0xFFFF:
parser.error ('--capoemflag must be an integer between 0x0000 and 0xffff')
if args.HardwareInstance > 0xFFFFFFFFFFFFFFFF:
parser.error ('--hardware-instance must be an integer in range 0x0..0xffffffffffffffff')
if args.MonotonicCount > 0xFFFFFFFFFFFFFFFF:
parser.error ('--monotonic-count must be an integer in range 0x0..0xffffffffffffffff')
UseSignTool = args.SignToolPfxFile is not None UseSignTool = args.SignToolPfxFile is not None
UseOpenSsl = (args.OpenSslSignerPrivateCertFile is not None and UseOpenSsl = (args.OpenSslSignerPrivateCertFile is not None and
@ -319,6 +325,10 @@ if __name__ == '__main__':
if args.Encode and (UseSignTool or UseOpenSsl): if args.Encode and (UseSignTool or UseOpenSsl):
if args.FwVersion is None or args.LowestSupportedVersion is None: if args.FwVersion is None or args.LowestSupportedVersion is None:
parser.error ('the following options are required: --fw-version, --lsv') parser.error ('the following options are required: --fw-version, --lsv')
if args.FwVersion > 0xFFFFFFFF:
parser.error ('--fw-version must be an integer in range 0x0..0xffffffff')
if args.LowestSupportedVersion > 0xFFFFFFFF:
parser.error ('--lsv must be an integer in range 0x0..0xffffffff')
if UseSignTool: if UseSignTool:
args.SignToolPfxFile.close() args.SignToolPfxFile.close()