Skip to content

Commit

Permalink
2023.1 Initial Updates
Browse files Browse the repository at this point in the history
1. Copyright Updates
2. Release Updates
3. Bug Fixes
  • Loading branch information
Ramya Darapuneni committed Feb 14, 2023
1 parent 3142732 commit bfba91b
Show file tree
Hide file tree
Showing 151 changed files with 5,505 additions and 4,208 deletions.
8 changes: 3 additions & 5 deletions FlexLexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
//
// If you want to create multiple lexer classes, you use the -P flag
// to rename each yyFlexLexer to some other xxFlexLexer. You then
// include <FlexLexer.h> in your other sources once per lexer class:
// include "FlexLexer.h" in your other sources once per lexer class:
//
// #undef yyFlexLexer
// #define yyFlexLexer xxFlexLexer
// #include <FlexLexer.h>
// #include "FlexLexer.h"
//
// #undef yyFlexLexer
// #define yyFlexLexer zzFlexLexer
// #include <FlexLexer.h>
// #include "FlexLexer.h"
// ...

#ifndef __FLEX_LEXER_H
Expand Down Expand Up @@ -204,5 +204,3 @@ class yyFlexLexer : public FlexLexer {

#endif // yyFlexLexer || ! yyFlexLexerOnce


// 67d7842dbbe25473c3c32b93c0da8047785f30d78e8a024de1b57352245f9689
3 changes: 2 additions & 1 deletion attributes.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright 2015-2020 Xilinx, Inc.
* Copyright 2015-2022 Xilinx, Inc.
* Copyright 2022-2023 Advanced Micro Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
3 changes: 2 additions & 1 deletion authentication-versal.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright 2015-2022 Xilinx, Inc.
* Copyright 2022-2023 Advanced Micro Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -1486,7 +1487,7 @@ void VersalAuthenticationContext::CreateAuthJtagImage(uint8_t* buffer, AuthJtagI

authAlgorithm->CreateSignature(shaHashPadded, (uint8_t*)primaryKey, authJtagImage->authJtagSignature);
authAlgorithm->RearrangeEndianess(authJtagImage->authJtagSignature, signatureLength);

memset(authJtagImage->padto2KB, 0, sizeof(authJtagImage->padto2KB));
delete[] shaHash;
delete[] shaHashPadded;
}
Expand Down
6 changes: 4 additions & 2 deletions authentication-versal.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright 2015-2021 Xilinx, Inc.
* Copyright 2015-2022 Xilinx, Inc.
* Copyright 2022-2023 Advanced Micro Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -153,7 +154,8 @@ typedef struct
uint8_t acPpk[VERSAL_ACKEY_STRUCT_SIZE]; //0x68
uint8_t ppkSHA3Padding[12]; //0x46C
uint8_t authJtagSignature[SIGN_LENGTH_VERSAL]; //0x478
} AuthenticatedJtagImageStructure; //0x678
uint8_t padto2KB[392]; //0x678 /*CR-1143787 : Workaround for ROM*/
} AuthenticatedJtagImageStructure; //0x800

typedef struct
{
Expand Down
3 changes: 2 additions & 1 deletion authentication-zynq.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright 2015-2020 Xilinx, Inc.
* Copyright 2015-2022 Xilinx, Inc.
* Copyright 2022-2023 Advanced Micro Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
3 changes: 2 additions & 1 deletion authentication-zynq.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright 2015-2020 Xilinx, Inc.
* Copyright 2015-2022 Xilinx, Inc.
* Copyright 2022-2023 Advanced Micro Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
3 changes: 2 additions & 1 deletion authentication-zynqmp.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright 2015-2020 Xilinx, Inc.
* Copyright 2015-2022 Xilinx, Inc.
* Copyright 2022-2023 Advanced Micro Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
3 changes: 2 additions & 1 deletion authentication-zynqmp.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright 2015-2020 Xilinx, Inc.
* Copyright 2015-2022 Xilinx, Inc.
* Copyright 2022-2023 Advanced Micro Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
14 changes: 5 additions & 9 deletions authentication.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright 2015-2021 Xilinx, Inc.
* Copyright 2015-2022 Xilinx, Inc.
* Copyright 2022-2023 Advanced Micro Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -216,21 +217,16 @@ void AuthenticationContext::GetPresign(const std::string& presignFilename, uint8
std::string filename(presignFilename);
std::string baseFile = StringUtils::BaseName(filename);

if (index > 9)
{
LOG_DEBUG(DEBUG_STAMP, "Partition index count %d too high",index);
LOG_ERROR("Presign file should have proper index (0-9)");
}

if (index != 0)
{
size_t x = filename.find(".0.");
if (x == std::string::npos)
{
LOG_ERROR("Presign file %s does not have partition index (*.0.*)", baseFile.c_str());
}
// nudge the '0' to '1' ... '9'.
filename[x+1] = (char)(filename[x+1] + index);
// nudge the '0' to index number
std::string sindex = std::to_string(index);
filename.replace(x+1,1,sindex);
}

LOG_TRACE("Reading presign file - %s", filename.c_str());
Expand Down
3 changes: 2 additions & 1 deletion authentication.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright 2015-2020 Xilinx, Inc.
* Copyright 2015-2022 Xilinx, Inc.
* Copyright 2022-2023 Advanced Micro Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
21 changes: 11 additions & 10 deletions authkeys-versal.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright 2015-2021 Xilinx, Inc.
* Copyright 2015-2022 Xilinx, Inc.
* Copyright 2022-2023 Advanced Micro Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -471,12 +472,12 @@ void VersalKey::Parse(const std::string& filename, bool isSecret0)

fseek(f, 0, 0); // rewind

/* If the file starts with 'N', then it is Xilinx Format
/* If the file starts with 'N', then it is AMD Format
If it starts with '-', then it is OpenSSL format */
if (name == 'N')
{
LOG_INFO("Parsing RSA key (Xilinx Format)");
errCode = ParseXilinxRsaKey(f);
LOG_INFO("Parsing RSA key (AMD Format)");
errCode = ParseAMDRsaKey(f);
}
else if (name == '-')
{
Expand All @@ -485,7 +486,7 @@ void VersalKey::Parse(const std::string& filename, bool isSecret0)
}
else
{
LOG_ERROR("Unsupported key file - %s\n Supported key formats: Xilinx Format & OpenSSL format", basefile.c_str());
LOG_ERROR("Unsupported key file - %s\n Supported key formats: AMD Format & OpenSSL format", basefile.c_str());
}
fclose(f);

Expand Down Expand Up @@ -576,15 +577,15 @@ void VersalKey::Parse(const std::string& filename, bool isSecret0)
do
{
name = getc(f);
} while (name >= 0 && isspace(name));
} while (name >= 0 && isspace(name) && name != EOF);

fseek(f, 0, 0); // rewind

/* If the file starts with 'N', then it is Xilinx Format. If it starts with '-', then it is OpenSSL format */
/* If the file starts with 'N', then it is AMD Format. If it starts with '-', then it is OpenSSL format */
if (name == 'N')
{
LOG_INFO("Parsing RSA key (Xilinx Format)");
errCode = ParseXilinxRsaKey(f);
LOG_INFO("Parsing RSA key (AMD Format)");
errCode = ParseAMDRsaKey(f);
}
else if (name == '-')
{
Expand All @@ -593,7 +594,7 @@ void VersalKey::Parse(const std::string& filename, bool isSecret0)
}
else
{
LOG_ERROR("Unsupported key file - %s\n Supported key formats: Xilinx Format & OpenSSL format", basefile.c_str());
LOG_ERROR("Unsupported key file - %s\n Supported key formats: AMD Format & OpenSSL format", basefile.c_str());
}
fclose(f);

Expand Down
3 changes: 2 additions & 1 deletion authkeys-versal.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright 2015-2021 Xilinx, Inc.
* Copyright 2015-2022 Xilinx, Inc.
* Copyright 2022-2023 Advanced Micro Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
13 changes: 7 additions & 6 deletions authkeys.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright 2015-2022 Xilinx, Inc.
* Copyright 2022-2023 Advanced Micro Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -131,23 +132,23 @@ void Key::Parse(const std::string& filename, bool isSecret0)
do
{
name = getc(f);
} while (name >= 0 && isspace(name));
} while (name >= 0 && isspace(name) && name != EOF);

fseek(f,0,0);

/* If the file starts with 'N', then it is Xilinx Format
/* If the file starts with 'N', then it is AMD Format
If it starts with '-', then it is OpenSSL format */
if (name == 'N')
{
errCode = ParseXilinxRsaKey(f);
errCode = ParseAMDRsaKey(f);
}
else if (name == '-')
{
errCode = ParseOpenSSLKey(f);
}
else
{
LOG_ERROR("Unsupported key file - %s\n Supported key formats: Xilinx Format & OpenSSL format", basefile.c_str());
LOG_ERROR("Unsupported key file - %s\n Supported key formats: AMD Format & OpenSSL format", basefile.c_str());
}
fclose(f);

Expand Down Expand Up @@ -238,7 +239,7 @@ uint8_t Key::ParseOpenSSLKey(FILE* f)
}

/******************************************************************************/
uint8_t Key::ParseXilinxRsaKey(FILE* f)
uint8_t Key::ParseAMDRsaKey(FILE* f)
{
int name;

Expand Down Expand Up @@ -311,7 +312,7 @@ uint8_t Key::ParseXilinxRsaKey(FILE* f)
do
{
name = getc(f);
} while (name >= 0 && isspace(name));
} while (name >= 0 && isspace(name) && name != EOF);
if (name != '=')
{
LOG_DEBUG(DEBUG_STAMP, "Bad Key file, expected =, got %c",name);
Expand Down
5 changes: 3 additions & 2 deletions authkeys.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright 2015-2021 Xilinx, Inc.
* Copyright 2015-2022 Xilinx, Inc.
* Copyright 2022-2023 Advanced Micro Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -129,7 +130,7 @@ class Key
void Multiply_p_q(uint8_t p[], uint8_t q[], uint8_t n[]);
void Hex2Byte(FILE* f, uint8_t* data, int count);
virtual void Parse(const std::string& filename, bool isSecret0);
uint8_t ParseXilinxRsaKey(FILE* f);
uint8_t ParseAMDRsaKey(FILE* f);
uint8_t ParseOpenSSLKey(FILE* f);
static void WriteRsaFile(std::string file, const RSA* rsa, bool secret, uint16_t keyLength);
static void WritePemFile(std::string file, RSA* rsa, EC_KEY* eckey, bool secret);
Expand Down
3 changes: 2 additions & 1 deletion baseclass.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright 2015-2019 Xilinx, Inc.
* Copyright 2015-2022 Xilinx, Inc.
* Copyright 2022-2023 Advanced Micro Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 4 additions & 0 deletions bif.l
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright 2015-2022 Xilinx, Inc.
* Copyright 2022-2023 Advanced Micro Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -104,6 +105,9 @@ bh_key_iv yylval->number = tok::BH_KEY_IV; return tok::
uid yylval->number = tok::UNIQUE_ID; return tok::UNIQUE_ID;
parent_uid yylval->number = tok::PARENT_UNIQUE_ID; return tok::PARENT_UNIQUE_ID;
function_id yylval->number = tok::FUNCTION_ID; return tok::FUNCTION_ID;
pcr yylval->number = tok::PCR_NUMBER; return tok::PCR_NUMBER;
pcr_mindex yylval->number = tok::PCR_MEASUREMENT_INDEX; return tok::PCR_MEASUREMENT_INDEX;
imagestore yylval->number = tok::IMAGE_STORE; return tok::IMAGE_STORE;

bbram_kek_iv yylval->number = tok::BBRAM_KEK_IV; return tok::BBRAM_KEK_IV;
bh_kek_iv yylval->number = tok::BH_KEK_IV; return tok::BH_KEK_IV;
Expand Down
Loading

0 comments on commit bfba91b

Please sign in to comment.