This repository was archived by the owner on Apr 14, 2023. It is now read-only.
forked from Xilinx/bootgen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbifoptions.cpp
More file actions
executable file
·949 lines (825 loc) · 27.6 KB
/
bifoptions.cpp
File metadata and controls
executable file
·949 lines (825 loc) · 27.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
/******************************************************************************
* Copyright 2015-2019 Xilinx, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
/*
-------------------------------------------------------------------------------
************************************************************ HEADER FILES *****
-------------------------------------------------------------------------------
*/
#include <fstream>
#include <algorithm>
#include <string>
#include "bifoptions.h"
#include "bifscanner.h"
/* Forward Class Declaration */
class BootImage;
/*
-------------------------------------------------------------------------------
*************************************************************** FUNCTIONS *****
-------------------------------------------------------------------------------
*/
/******************************************************************************/
BifOptions::BifOptions(Arch::Type architecture, const char* name)
: groupname("")
, regInitFile("")
, udfBhFile("")
, ppkFile("")
, pskFile("")
, headerSignatureFile("")
, bhKeyFile("")
, pufHelperFile("")
, bhKeyIVFile("")
, familyKeyFile("")
, keySourceEncryption(KeySource::None)
, bootDevice(BootDevice::DEFAULT)
, bhAuthEnable(BhRsa::BhRsaDisable)
, pufHdLoc(PufHdLoc::PUFinEFuse)
, authOnly(AuthOnly::None)
, pufMode(PufMode::PUF12K)
, optKey(OptKey::None)
, shutterVal(SHUTTER_VAL)
, ppkSelect(0)
, spkSelect(1)
, spkId(0x00000000)
, headerAuthParam(false)
, createHeaderAC(false)
, splitMode(SplitMode::None)
, splitFmt(File::Unknown)
, xipMode(false)
, core(Core::A53Singlex64)
, isPPKSelectGlobal(false)
, isSPKSelectGlobal(false)
, isSpkIdGlobal(false)
{
arch = architecture;
SetGroupName(name);
}
/******************************************************************************
PartitionBifOptions
******************************************************************************/
PartitionBifOptions::PartitionBifOptions()
: aesKeyFile("")
, spkFile("")
, sskFile("")
, spkSignatureFile("")
, bootImage(false)
, pmuFwImage(false)
, presignFile("")
, udfDataFile("")
, encryptType(Encryption::None)
, authType(Authentication::None)
, checksumType(Checksum::None)
, ownerType(PartitionOwner::FSBL)
, destCPUType(DestinationCPU::NONE)
, destDeviceType(DestinationDevice::DEST_DEV_PS)
, exceptionLevel(ExceptionLevel::EL3)
, trustzone(TrustZone::NonSecure)
, bootloader(false)
, early_handoff(false)
, hivec(false)
, authblockattr(0)
, pid(0)
, blocks(0)
, defBlockSize(0)
, spkSelect(1)
, spkSelLocal(false)
, spkId(0x00000000)
, spkIdLocal(false)
, fileType(0)
, filename("")
, arch (Arch::ZYNQ)
, partitionId(0)
, boot(false)
, user(false)
, Static(false)
, Protected(false)
, multiboot(false)
, noautostart(false)
, blockSize(0)
, bigEndian(false)
, a32Mode(false)
{ }
/******************************************************************************/
void BifOptions::SetHeaderAC(bool flag)
{
createHeaderAC = flag;
}
/******************************************************************************/
void BifOptions::Add(PartitionBifOptions* currentPartitionBifOptions)
{
//filespec->Dump();
switch (currentPartitionBifOptions->fileType)
{
case BIF::BisonParser::token::INIT:
SetRegInitFileName(currentPartitionBifOptions->filename);
break;
case BIF::BisonParser::token::UDF_BH:
SetUdfBHFileName(currentPartitionBifOptions->filename);
break;
case BIF::BisonParser::token::AES_KEY_FILE:
SetAESKeyFileName(currentPartitionBifOptions->filename);
break;
case BIF::BisonParser::token::FAMILY_KEY:
SetFamilyKeyFileName(currentPartitionBifOptions->filename);
break;
case BIF::BisonParser::token::PPK_FILE:
SetPPKFileName(currentPartitionBifOptions->filename);
break;
case BIF::BisonParser::token::PSK_FILE:
SetPSKFileName(currentPartitionBifOptions->filename);
break;
case BIF::BisonParser::token::SPK_FILE:
SetSPKFileName(currentPartitionBifOptions->filename);
break;
case BIF::BisonParser::token::SSK_FILE:
SetSSKFileName(currentPartitionBifOptions->filename);
break;
case BIF::BisonParser::token::SPK_SIGNATURE_FILE:
SetSPKSignFileName(currentPartitionBifOptions->filename);
break;
case BIF::BisonParser::token::BH_SIGNATURE_FILE:
SetBHSignFileName(currentPartitionBifOptions->filename);
break;
case BIF::BisonParser::token::HEADER_SIGNATURE_FILE:
SetHeaderSignFileName(currentPartitionBifOptions->filename);
break;
case BIF::BisonParser::token::BH_KEY_FILE:
SetBHKeyFileName(currentPartitionBifOptions->filename);
break;
case BIF::BisonParser::token::PUF_HELPER_FILE:
SetPUFHelperFileName(currentPartitionBifOptions->filename);
break;
case BIF::BisonParser::token::BH_KEY_IV:
SetBHKeyIVFileName(currentPartitionBifOptions->filename);
break;
case BIF::BisonParser::token::PMUFW_IMAGE:
SetPmufwImageFileName(currentPartitionBifOptions);
break;
case 0:
partitionBifOptionList.push_back(currentPartitionBifOptions);
}
}
/******************************************************************************/
void BifOptions::SetRegInitFileName(std::string filename)
{
std::ifstream f(filename.c_str());
if (!f)
{
LOG_ERROR("Can't read file - %s", regInitFile.c_str());
}
regInitFile = filename;
LOG_TRACE("Setting Register initialization file as %s", regInitFile.c_str());
}
/******************************************************************************/
std::string BifOptions::GetRegInitFileName()
{
return regInitFile;
}
/******************************************************************************/
std::string BifOptions::GetGroupName()
{
return groupname;
}
/******************************************************************************/
std::string BifOptions::GetAESKeyFileName(void)
{
return aesKeyFile;
}
/******************************************************************************/
void BifOptions::SetUdfBHFileName(std::string filename)
{
std::ifstream f(filename.c_str());
if (!f)
{
LOG_ERROR("Can't read file - %s", regInitFile.c_str());
}
udfBhFile = filename;
LOG_TRACE("Setting UDF of BH as %s", udfBhFile.c_str());
}
/******************************************************************************/
void BifOptions::SetPmufwImageFileName(PartitionBifOptions* currentPartitionBifOptions)
{
if (arch != Arch::ZYNQMP)
{
LOG_ERROR("BIF attribute error !!!\n\t\t'[pmufw_image]' is supported only in ZYNQMP architecture");
}
std::ifstream f(currentPartitionBifOptions->filename.c_str());
if (!f)
{
LOG_ERROR("Can't read file - %s", regInitFile.c_str());
}
if (currentPartitionBifOptions->authType != Authentication::None)
{
LOG_ERROR("BIF attribute error !!!\n\t\tBif option 'authentication' is not supported with [pmufw_image].\n\t\tpmufw will be signed along with bootloader, if authentication is enabled for bootloader.");
}
if (currentPartitionBifOptions->encryptType != Encryption::None)
{
LOG_ERROR("BIF attribute error !!!\n\t\tBif option 'encryption' is not supported with [pmufw_image].\n\t\tpmufw will be encrypted if encryption is enabled for bootloader.");
}
if (currentPartitionBifOptions->checksumType != Checksum::None)
{
LOG_ERROR("BIF attribute error !!!\n\t\tBif option 'checksum' is not supported with [pmufw_image].\n\t\tpmufw will be checksummed if checksum is enabled for bootloader.");
}
if (currentPartitionBifOptions->destCPUType != DestinationCPU::NONE)
{
LOG_ERROR("BIF attribute error !!!\n\t\tBif option 'destination_cpu' is not supported with [pmufw_image].");
}
pmuFwImageFile = currentPartitionBifOptions->filename;
LOG_TRACE("Setting PMU FW Image file as %s", pmuFwImageFile.c_str());
}
/******************************************************************************/
void BifOptions::SetGroupName(std::string name)
{
groupname = name;
}
/******************************************************************************/
void BifOptions::SetPPKFileName(std::string filename)
{
std::ifstream f(filename.c_str());
ppkFile = filename;
}
/******************************************************************************/
void BifOptions::SetPSKFileName(std::string filename)
{
std::ifstream f(filename.c_str());
pskFile = filename;
}
/******************************************************************************/
void BifOptions::SetSPKFileName(std::string filename)
{
std::ifstream f(filename.c_str());
spkFile = filename;
}
/******************************************************************************/
void BifOptions::SetSSKFileName(std::string filename)
{
std::ifstream f(filename.c_str());
sskFile = filename;
}
/******************************************************************************/
void BifOptions::SetSPKSignFileName(std::string filename)
{
std::ifstream f(filename.c_str());
if (!f)
{
LOG_ERROR("Can't read file - %s", filename.c_str());
}
spkSignatureFile = filename;
}
/******************************************************************************/
void BifOptions::SetBHSignFileName(std::string filename)
{
std::ifstream f(filename.c_str());
if (!f)
{
LOG_ERROR("Can't read file - %s", filename.c_str());
}
bhSignatureFile = filename;
}
/******************************************************************************/
void BifOptions::SetHeaderSignFileName(std::string filename)
{
std::ifstream f(filename.c_str());
if (!f)
{
LOG_ERROR("Can't read file - %s", filename.c_str());
}
headerSignatureFile = filename;
}
/******************************************************************************/
void BifOptions::SetBHKeyFileName(std::string filename)
{
if (arch == Arch::ZYNQ)
{
LOG_ERROR("BIF attribute error !!!\n\t\t'[bh_keyfile]' not supported in ZYNQ architecture");
}
std::ifstream f(filename.c_str());
if (!f)
{
LOG_ERROR("Can't read file - %s", filename.c_str());
}
bhKeyFile = filename;
LOG_TRACE("Setting BH Key file as %s", bhKeyFile.c_str());
}
/******************************************************************************/
void BifOptions::SetOptKey(OptKey::Type type)
{
optKey = type;
}
/******************************************************************************/
void BifOptions::SetPufMode(PufMode::Type type)
{
pufMode = type;
}
/******************************************************************************/
void BifOptions::SetShutterValue(uint32_t value)
{
shutterVal = value;
}
/******************************************************************************/
void BifOptions::SetPUFHelperFileName(std::string filename)
{
if (arch == Arch::ZYNQ)
{
LOG_ERROR("BIF attribute error !!!\n\t\t'[puf_file]' not supported in ZYNQ architecture");
}
std::ifstream f(filename.c_str());
if (!f)
{
LOG_ERROR("Can't read file - %s", filename.c_str());
}
pufHelperFile = filename;
LOG_TRACE("Setting PUF Helper Data file as %s", pufHelperFile.c_str());
}
/******************************************************************************/
void BifOptions::SetBHKeyIVFileName(std::string filename)
{
if (arch == Arch::ZYNQ)
{
LOG_ERROR("BIF attribute error !!!\n\t\t'[bh_key_iv]' not supported in ZYNQ architecture");
}
std::ifstream f(filename.c_str());
if (!f)
{
LOG_ERROR("Can't read file - %s", filename.c_str());
}
bhKeyIVFile = filename;
LOG_TRACE("Setting BH IV file as %s", bhKeyIVFile.c_str());
}
/******************************************************************************/
void BifOptions::SetFamilyKeyFileName(std::string filename)
{
if (arch == Arch::ZYNQ)
{
LOG_ERROR("BIF attribute error !!!\n\t\t'[familykey]' not supported in ZYNQ architecture");
}
std::ifstream f(filename.c_str());
if (!f)
{
LOG_ERROR("Can't read file - %s", filename.c_str());
}
familyKeyFile = filename;
LOG_TRACE("Setting Family Key file as %s", familyKeyFile.c_str());
}
/******************************************************************************/
void BifOptions::SetAESKeyFileName(std::string filename)
{
std::ifstream f(filename.c_str());
aesKeyFile = filename;
}
/******************************************************************************/
void BifOptions::SetBootVectorArray(uint32_t vector)
{
static bool warningGiven = false;
if (!warningGiven)
{
LOG_TRACE("Setting bootvector array");
}
warningGiven = true;
bootvectors.push_back(vector);
if (bootvectors.size() > 8)
{
LOG_ERROR("BIF attribute error !!!\n\t\t[bootvectors] cannot take more than 8 vector addresses");
}
}
/******************************************************************************/
void BifOptions::SetXipMode()
{
xipMode = true;
}
/******************************************************************************/
bool BifOptions::GetXipMode(void)
{
return xipMode;
}
/******************************************************************************/
void BifOptions::SetSplitMode(SplitMode::Type type)
{
LOG_TRACE("Setting Split Mode as %d", type );
splitMode = type;
}
/******************************************************************************/
void BifOptions::SetSplitFmt(File::Type type)
{
LOG_TRACE("Setting Split Format as %d", type);
splitFmt = type;
}
/******************************************************************************/
void BifOptions::SetEncryptionKeySource(KeySource::Type type)
{
if (arch == Arch::ZYNQ)
{
if ((type != KeySource::BbramRedKey) && (type != KeySource::EfuseRedKey) && (type != KeySource::None))
{
LOG_DEBUG(DEBUG_STAMP, "Key Source = %d", type);
LOG_ERROR("BIF attribute error !!!\n\t\tUnknown option for 'keysrc_encryption' in BIF file\n\t\tZynq Architecture supports 'efuse' & 'bbram' key sources");
}
}
keySourceEncryption = type;
}
/******************************************************************************/
void BifOptions::SetBootDevice(BootDevice::Type type)
{
LOG_TRACE("Setting Boot Device as %d", type);
bootDevice = type;
}
/******************************************************************************/
OptKey::Type BifOptions::GetAesOptKeyFlag(void)
{
return optKey;
}
/******************************************************************************/
void PartitionBifOptions::SetArchType(Arch::Type type)
{
arch = type;
}
/******************************************************************************/
void PartitionBifOptions::SetEncryptionBlocks(uint32_t size, uint32_t num)
{
if (arch == Arch::ZYNQ)
{
LOG_ERROR("BIF attribute error !!!\n\t\t'blocks' not supported in ZYNQ architecture");
}
if (num == 0)
{
SetDefaultEncryptionBlockSize(size);
}
else if (defBlockSize == 0)
{
for (uint32_t i = 0; i < num; i++)
{
blocks.push_back(size);
}
}
else
{
LOG_ERROR("cannot choose block size after choosing def block size");
}
}
/******************************************************************************/
void PartitionBifOptions::SetDefaultEncryptionBlockSize(uint32_t blk)
{
defBlockSize = blk;
}
/******************************************************************************/
void BifOptions::InsertEncryptionBlock(uint32_t blk)
{
blocks.push_back(blk);
}
/******************************************************************************/
void PartitionBifOptions::SetDestCpu(DestinationCPU::Type type)
{
if (arch == Arch::ZYNQ)
{
LOG_ERROR("BIF attribute error !!!\n\t\t'destination_cpu' not supported in ZYNQ architecture");
}
destCPUType = type;
}
/******************************************************************************/
void PartitionBifOptions::SetDestDevice(DestinationDevice::Type type)
{
if (arch == Arch::ZYNQ)
{
LOG_ERROR("BIF attribute error !!!\n\t\t'destination_device' not supported in ZYNQ architecture");
}
if (type == DestinationDevice::DEST_DEV_PMU)
{
LOG_ERROR("BIF attribute 'destination_device=pmufw' is not supported.\
Please use 'destination_cpu=pmu'");
}
if (type == DestinationDevice::DEST_DEV_XIP)
{
LOG_ERROR("BIF attribute 'destination_device=xip' is not supported.\
Please use the attribute 'xip_mode'. \
For more info, see 'bootgen -bif_help xip_mode'");
}
destDeviceType = type;
}
/******************************************************************************/
void PartitionBifOptions::SetAuthType(Authentication::Type type)
{
authType = type;
}
/******************************************************************************/
void PartitionBifOptions::SetEncryptType(Encryption::Type type)
{
encryptType = type;
}
/******************************************************************************/
void PartitionBifOptions::SetChecksumType(Checksum::Type type)
{
if (type == Checksum::SHA2)
{
LOG_ERROR("BIF cksum BIF attribute error !!!\n\t\t'checksum=sha2' is not supported.");
}
if ((arch == Arch::ZYNQ) && (type == Checksum::SHA3))
{
LOG_ERROR("BIF attribute error !!!\n\t\t'checksum=sha3' not supported in ZYNQ architecture");
}
if ((arch == Arch::ZYNQMP) && (type == Checksum::MD5))
{
LOG_ERROR("BIF attribute error !!!\n\t\t'checksum=md5' not supported in ZYNQMP architecture");
}
checksumType = type;
}
/******************************************************************************/
void PartitionBifOptions::SetOwnerType(PartitionOwner::Type type)
{
ownerType = type;
}
/******************************************************************************/
void PartitionBifOptions::SetExceptionLevel(ExceptionLevel::Type type)
{
if (arch == Arch::ZYNQ)
{
LOG_ERROR("BIF el BIF attribute error !!!\n\t\t'exception_level' not supported in ZYNQ architecture");
}
exceptionLevel = type;
}
/******************************************************************************/
void BifOptions::SetFsblFilename(std::string filename)
{
fsblFilename = filename;
}
/******************************************************************************/
void PartitionBifOptions::SetTrustZone(TrustZone::Type type)
{
if (arch == Arch::ZYNQ)
{
LOG_ERROR("BIF trust BIF attribute error !!!\n\t\t'trustzone' not supported in ZYNQ architecture");
}
trustzone = type;
}
/******************************************************************************/
void PartitionBifOptions::SetEarlyHandoff(bool flag)
{
if (arch == Arch::ZYNQ)
{
LOG_ERROR("BIF eh BIF attribute error !!!\n\t\t'early_handoff' not supported in ZYNQ architecture");
}
if (bootloader == true)
{
LOG_ERROR("BIF attribute error !!!\n\t\t'early_handoff' not supported for bootloader partitions");
}
early_handoff = flag;
}
/******************************************************************************/
void PartitionBifOptions::SetHivec(bool flag)
{
if (arch == Arch::ZYNQ)
{
LOG_ERROR("BIF attribute error !!!\n\t\t'hivec' not supported in ZYNQ architecture");
}
hivec = flag;
}
/******************************************************************************/
std::vector<uint32_t>& PartitionBifOptions::GetEncryptionBlocks(void)
{
return blocks;
}
/******************************************************************************/
std::vector<uint32_t>& BifOptions::GetEncryptionBlocksList(void)
{
return blocks;
}
/******************************************************************************/
void PartitionBifOptions::SetAuthBlockAttr(size_t authBlockAttr)
{
if (authBlockAttr != 4 && authBlockAttr != 8 && authBlockAttr != 16 && authBlockAttr != 32 && authBlockAttr != 64)
{
LOG_ERROR("'-authblock' option supports only 4,8,16,32,64 sizes (taken in MB)");
}
if (arch != Arch::ZYNQMP)
{
LOG_ERROR("'-authblock' option supported only for ZYNQMP architecture '-arch zynqmp'");
}
authblockattr = authBlockAttr;
}
/******************************************************************************/
uint32_t PartitionBifOptions::GetDefaultEncryptionBlockSize(void)
{
return defBlockSize;
}
/******************************************************************************/
void BifOptions::SetPPKSelection(uint32_t ppkSelection)
{
if ((ppkSelection == 0) | (ppkSelection == 1))
{
ppkSelect = ppkSelection;
isPPKSelectGlobal = true;
LOG_TRACE("Setting PPK Selection in Auth Certificate as %d", ppkSelect);
}
else
{
LOG_DEBUG(DEBUG_STAMP, "PPK Select - %d", ppkSelect);
LOG_ERROR("BIF attribute error !!!\n\t\t'ppk_select' can either be 0 or 1");
}
}
/******************************************************************************/
void BifOptions::SetSPKSelection(uint32_t spkSelection)
{
spkSelect = spkSelection;
isSPKSelectGlobal = true;
LOG_TRACE("Setting SPK Selection in Auth Certificate as %d", spkSelect);
}
/******************************************************************************/
void BifOptions::SetSpkId(uint32_t id)
{
spkId = id;
isSpkIdGlobal = true;
LOG_TRACE("Setting SPK ID in Auth Certificate as 0x%x", id);
}
/******************************************************************************/
void BifOptions::SetHeaderAuthentication()
{
headerAuthParam = true;
SetHeaderAC(true);
LOG_TRACE("Setting Header Authentication");
}
/******************************************************************************/
std::string BifOptions::GetFamilyKeyFileName()
{
return familyKeyFile;
}
/******************************************************************************/
BhRsa::Type BifOptions::GetBhRsa(void)
{
return bhAuthEnable;
}
/******************************************************************************/
BootDevice::Type BifOptions::GetBootDevice(void)
{
return bootDevice;
}
/******************************************************************************/
PufMode::Type BifOptions::GetPufMode(void)
{
return pufMode;
}
/******************************************************************************/
PufHdLoc::Type BifOptions::GetPufHdLoc(void)
{
return pufHdLoc;
}
/******************************************************************************/
OptKey::Type BifOptions::GetOptKey(void)
{
return optKey;
}
/******************************************************************************/
AuthOnly::Type BifOptions::GetAuthOnly(void)
{
return authOnly;
}
/******************************************************************************/
uint32_t BifOptions::GetPpkSelection(void)
{
return ppkSelect;
}
/******************************************************************************/
bool BifOptions::GetPpkSelectionGlobal()
{
return isPPKSelectGlobal;
}
/******************************************************************************/
std::string BifOptions::GetPPKFileName(void)
{
return ppkFile;
}
/******************************************************************************/
std::string BifOptions::GetPSKFileName(void)
{
return pskFile;
}
/******************************************************************************/
uint32_t BifOptions::GetSpkSelection(void)
{
return spkSelect;
}
/******************************************************************************/
bool BifOptions::GetSpkSelectionGlobal()
{
return isSPKSelectGlobal;
}
/******************************************************************************/
std::string BifOptions::GetSPKFileName(void)
{
return spkFile;
}
/******************************************************************************/
std::string BifOptions::GetSSKFileName(void)
{
return sskFile;
}
/******************************************************************************/
uint32_t BifOptions::GetSpkId(void)
{
return spkId;
}
/******************************************************************************/
bool BifOptions::GetSpkIdGlobal()
{
return isSpkIdGlobal;
}
/******************************************************************************/
bool BifOptions::GetHeaderAC()
{
return createHeaderAC;
}
/******************************************************************************/
std::string BifOptions::GetBhKeyFile(void)
{
return bhKeyFile;
}
/******************************************************************************/
uint32_t BifOptions::GetShutterValue(void)
{
return shutterVal;
}
/******************************************************************************/
std::string BifOptions::GetHeaderSignatureFile(void)
{
return headerSignatureFile;
}
/******************************************************************************/
std::string BifOptions::GetPufHelperFile(void)
{
return pufHelperFile;
}
/******************************************************************************/
std::string BifOptions::GetPmuFwImageFile(void)
{
return pmuFwImageFile;
}
/******************************************************************************/
std::string BifOptions::GetBHKeyIVFile(void)
{
return bhKeyIVFile;
}
/******************************************************************************/
std::string BifOptions::GetUdfBhFile(void)
{
return udfBhFile;
}
/******************************************************************************/
SplitMode::Type BifOptions::GetSplitMode(void)
{
return splitMode;
}
/******************************************************************************/
File::Type BifOptions::GetSplitFormat(void)
{
return splitFmt;
}
/******************************************************************************/
std::vector<uint32_t>& BifOptions::GetBootVectorArray(void)
{
return bootvectors;
}
/******************************************************************************/
std::string BifOptions::GetSPKSignFileName(void)
{
return spkSignatureFile;
}
/******************************************************************************/
std::string BifOptions::GetBHSignFileName(void)
{
return bhSignatureFile;
}
/******************************************************************************/
void BifOptions::SetAuthOnly(AuthOnly::Type type)
{
authOnly = type;
}
/******************************************************************************/
void BifOptions::SetBhRsa(BhRsa::Type value)
{
bhAuthEnable = value;
}
/******************************************************************************/
void BifOptions::SetPufHdLoc(PufHdLoc::Type value)
{
pufHdLoc= value;
}
/******************************************************************************/
void BifOptions::SetCore(Core::Type type)
{
core = type;
}
/******************************************************************************/
Core::Type BifOptions::GetCore(void)
{
return core;
}