Skip to content

Commit bac047c

Browse files
authored
Release 1.1.92.13 (#11)
1 parent 41cd151 commit bac047c

File tree

857 files changed

+27721
-5373
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

857 files changed

+27721
-5373
lines changed

CommandCore/build.gradle

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/*
2+
* This project is licensed as below.
3+
*
4+
* **************************************************************************
5+
*
6+
* Copyright 2020-2023 Intel Corporation. All Rights Reserved.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted provided that the following conditions are met:
10+
*
11+
* 1. Redistributions of source code must retain the above copyright notice,
12+
* this list of conditions and the following disclaimer.
13+
*
14+
* 2. Redistributions in binary form must reproduce the above copyright
15+
* notice, this list of conditions and the following disclaimer in the
16+
* documentation and/or other materials provided with the distribution.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21+
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
22+
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25+
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26+
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27+
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28+
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*
30+
* **************************************************************************
31+
*
32+
*/
33+
34+
buildscript {
35+
repositories {
36+
mavenLocal()
37+
mavenCentral()
38+
gradlePluginPortal()
39+
}
40+
}
41+
42+
plugins {
43+
alias(libs.plugins.lombok)
44+
alias(libs.plugins.gradle.versions)
45+
alias(libs.plugins.modernizer)
46+
id 'maven-publish'
47+
id 'java-library'
48+
id 'idea'
49+
}
50+
51+
apply from: rootProject.file('gradle/common.gradle')
52+
53+
def buildVersion = ext.getBuildVersion()
54+
55+
jar {
56+
archiveBaseName.set('CommandCore')
57+
archiveVersion.set(buildVersion)
58+
manifest {
59+
attributes(
60+
'Sealed': 'true',
61+
'Implementation-Title': 'Intel Command Core library',
62+
'Implementation-Version': buildVersion
63+
)
64+
}
65+
}
66+
67+
sourceCompatibility = JavaVersion.VERSION_17
68+
targetCompatibility = JavaVersion.VERSION_17
69+
70+
group = 'com.intel.bkp.command'
71+
version = buildVersion
72+
73+
74+
test {
75+
useJUnitPlatform()
76+
}
77+
78+
repositories {
79+
mavenLocal()
80+
mavenCentral()
81+
}
82+
83+
dependencies {
84+
implementation project(":Utils")
85+
implementation project(":CryptoCore")
86+
implementation project(":ServiceCore")
87+
88+
implementation libs.slf4j.api
89+
90+
testImplementation project(':TestLibrary')
91+
testImplementation platform(libs.junit.bom)
92+
testImplementation libs.junit.jupiter
93+
testImplementation libs.bundles.mockito
94+
}
95+
96+
publishing {
97+
publications {
98+
mavenJava(MavenPublication) {
99+
from components.java
100+
}
101+
}
102+
}

Verifier/src/main/java/com/intel/bkp/verifier/command/MailboxCommandLayer.java renamed to CommandCore/src/main/java/com/intel/bkp/command/MailboxCommandLayer.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@
3131
*
3232
*/
3333

34-
package com.intel.bkp.verifier.command;
34+
package com.intel.bkp.command;
3535

36+
import com.intel.bkp.command.header.CommandHeader;
37+
import com.intel.bkp.command.header.CommandHeaderManager;
38+
import com.intel.bkp.command.model.CommandIdentifier;
39+
import com.intel.bkp.command.model.CommandLayer;
40+
import com.intel.bkp.command.model.Message;
3641
import com.intel.bkp.utils.ByteBufferSafe;
37-
import com.intel.bkp.verifier.command.header.CommandHeader;
38-
import com.intel.bkp.verifier.command.header.CommandHeaderManager;
39-
import com.intel.bkp.verifier.interfaces.CommandLayer;
40-
import com.intel.bkp.verifier.interfaces.Message;
41-
import com.intel.bkp.verifier.model.CommandIdentifier;
4242
import lombok.extern.slf4j.Slf4j;
4343

4444
import java.nio.ByteBuffer;
@@ -69,7 +69,7 @@ public byte[] retrieve(byte[] data, CommandIdentifier command) {
6969
}
7070

7171
protected int getArgumentsLen(byte[] dataBytes) {
72-
return (int)Math.ceil((double)dataBytes.length / Integer.BYTES);
72+
return (int) Math.ceil((double) dataBytes.length / Integer.BYTES);
7373
}
7474

7575
protected byte[] buildCommandHeader(int commandCode, int argumentsLength, int id, int client) {

Verifier/src/main/java/com/intel/bkp/verifier/exceptions/CommandHeaderValidationException.java renamed to CommandCore/src/main/java/com/intel/bkp/command/exception/CommandHeaderValidationException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
*/
3333

34-
package com.intel.bkp.verifier.exceptions;
34+
package com.intel.bkp.command.exception;
3535

3636
public class CommandHeaderValidationException extends Exception {
3737
public CommandHeaderValidationException(String internalMessage) {

Verifier/src/main/java/com/intel/bkp/verifier/exceptions/CommandFailedException.java renamed to CommandCore/src/main/java/com/intel/bkp/command/exception/JtagResponseException.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,20 @@
3131
*
3232
*/
3333

34-
package com.intel.bkp.verifier.exceptions;
34+
package com.intel.bkp.command.exception;
3535

36-
import com.intel.bkp.verifier.command.header.CommandHeader;
36+
import com.intel.bkp.command.header.CommandHeader;
3737

38-
public class CommandFailedException extends VerifierRuntimeException {
38+
public class JtagResponseException extends RuntimeException {
39+
public JtagResponseException(String internalMessage) {
40+
super(internalMessage);
41+
}
3942

40-
public CommandFailedException(String responseName, CommandHeader parsedHeader) {
43+
public JtagResponseException(String responseName, CommandHeader parsedHeader) {
4144
this(responseName, parsedHeader.getId(), parsedHeader.getClient(), parsedHeader.getCode());
4245
}
4346

44-
public CommandFailedException(String responseName, int commandId, int commandClient, int errorCode) {
47+
public JtagResponseException(String responseName, int commandId, int commandClient, int errorCode) {
4548
super(String.format("Command [%s] of id '%d' and client '%d' failed with code: '%d' (0x%s).",
4649
responseName, commandId, commandClient, errorCode, Integer.toHexString(errorCode)));
4750
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* This project is licensed as below.
3+
*
4+
* **************************************************************************
5+
*
6+
* Copyright 2020-2023 Intel Corporation. All Rights Reserved.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted provided that the following conditions are met:
10+
*
11+
* 1. Redistributions of source code must retain the above copyright notice,
12+
* this list of conditions and the following disclaimer.
13+
*
14+
* 2. Redistributions in binary form must reproduce the above copyright
15+
* notice, this list of conditions and the following disclaimer in the
16+
* documentation and/or other materials provided with the distribution.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21+
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
22+
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25+
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26+
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27+
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28+
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*
30+
* **************************************************************************
31+
*
32+
*/
33+
34+
package com.intel.bkp.command.exception;
35+
36+
import com.intel.bkp.command.header.CommandHeader;
37+
38+
public class JtagUnknownCommandResponseException extends RuntimeException {
39+
public JtagUnknownCommandResponseException(String internalMessage) {
40+
super(internalMessage);
41+
}
42+
43+
public JtagUnknownCommandResponseException(String responseName, CommandHeader parsedHeader) {
44+
this(responseName, parsedHeader.getId(), parsedHeader.getClient(), parsedHeader.getCode());
45+
}
46+
47+
public JtagUnknownCommandResponseException(String responseName, int commandId, int commandClient, int errorCode) {
48+
super(String.format("Command [%s] of id '%d' and client '%d' failed with code: '%d' (0x%s).",
49+
responseName, commandId, commandClient, errorCode, Integer.toHexString(errorCode)));
50+
}
51+
}

Verifier/src/main/java/com/intel/bkp/verifier/exceptions/UnknownDeviceFamilyFuseMapException.java renamed to CommandCore/src/main/java/com/intel/bkp/command/exception/UnknownDeviceFamilyFuseMapException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@
3131
*
3232
*/
3333

34-
package com.intel.bkp.verifier.exceptions;
34+
package com.intel.bkp.command.exception;
3535

3636
import static com.intel.bkp.utils.HexConverter.toFormattedHex;
3737

38-
public class UnknownDeviceFamilyFuseMapException extends VerifierRuntimeException {
38+
public class UnknownDeviceFamilyFuseMapException extends RuntimeException {
3939

4040
public UnknownDeviceFamilyFuseMapException(byte invalidIdentifier) {
4141
super(String.format(

Verifier/src/main/java/com/intel/bkp/verifier/command/header/CommandHeader.java renamed to CommandCore/src/main/java/com/intel/bkp/command/header/CommandHeader.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
*/
3333

34-
package com.intel.bkp.verifier.command.header;
34+
package com.intel.bkp.command.header;
3535

3636
import lombok.AllArgsConstructor;
3737
import lombok.Getter;
@@ -56,6 +56,10 @@ public int getCode() {
5656
return fields.get(HeaderFields.COMMAND_CODE);
5757
}
5858

59+
public int getArgumentsSize() {
60+
return fields.get(HeaderFields.LENGTH);
61+
}
62+
5963
public int getId() {
6064
return fields.get(HeaderFields.ID);
6165
}

Verifier/src/main/java/com/intel/bkp/verifier/command/header/CommandHeaderManager.java renamed to CommandCore/src/main/java/com/intel/bkp/command/header/CommandHeaderManager.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,13 @@
3131
*
3232
*/
3333

34-
package com.intel.bkp.verifier.command.header;
34+
package com.intel.bkp.command.header;
3535

36+
import com.intel.bkp.command.exception.CommandHeaderValidationException;
37+
import com.intel.bkp.command.exception.JtagResponseException;
38+
import com.intel.bkp.command.exception.JtagUnknownCommandResponseException;
3639
import com.intel.bkp.utils.ByteBufferSafe;
37-
import com.intel.bkp.utils.ByteConverter;
3840
import com.intel.bkp.utils.ByteSwap;
39-
import com.intel.bkp.verifier.exceptions.CommandFailedException;
40-
import com.intel.bkp.verifier.exceptions.CommandHeaderValidationException;
41-
import com.intel.bkp.verifier.exceptions.JtagResponseException;
42-
import com.intel.bkp.verifier.exceptions.UnknownCommandException;
4341
import lombok.AccessLevel;
4442
import lombok.NoArgsConstructor;
4543
import lombok.extern.slf4j.Slf4j;
@@ -48,6 +46,7 @@
4846
import java.util.Map;
4947
import java.util.concurrent.ConcurrentHashMap;
5048

49+
import static com.intel.bkp.utils.ByteConverter.toBytes;
5150
import static com.intel.bkp.utils.ByteSwapOrder.B2L;
5251
import static com.intel.bkp.utils.ByteSwapOrder.L2B;
5352

@@ -69,7 +68,8 @@ public static byte[] build(CommandHeader commandHeader) {
6968
for (HeaderFields headerField : HeaderFields.values()) {
7069
headerFinalValue |= commandHeader.getFields().get(headerField) << headerField.getOffset();
7170
}
72-
return ByteConverter.toBytes(headerFinalValue);
71+
72+
return toBytes(headerFinalValue);
7373
}
7474

7575
public static CommandHeader parseFromFw(byte[] commandHeader) throws CommandHeaderValidationException {
@@ -116,19 +116,19 @@ public static void validateCommandHeaderCode(byte[] command, String commandName)
116116
}
117117

118118
private static void verifyCommandHeaderLength(int length) throws CommandHeaderValidationException {
119-
if (length != COMMAND_HEADER_LEN) {
119+
if (COMMAND_HEADER_LEN != length) {
120120
throw new CommandHeaderValidationException(
121121
String.format(COMMAND_HEADER_INVALID_LENGTH, length, COMMAND_HEADER_LEN));
122122
}
123123
}
124124

125125
private static void throwOnError(String responseName, CommandHeader parsedHeader) {
126126
if (FwErrorCodes.UNKNOWN_COMMAND.getCode() == parsedHeader.getCode()) {
127-
throw new UnknownCommandException(responseName, parsedHeader);
127+
throw new JtagUnknownCommandResponseException(responseName, parsedHeader);
128128
}
129129

130130
if (FwErrorCodes.STATUS_OKAY.getCode() != parsedHeader.getCode()) {
131-
throw new CommandFailedException(responseName, parsedHeader);
131+
throw new JtagResponseException(responseName, parsedHeader);
132132
}
133133
}
134134
}

Verifier/src/main/java/com/intel/bkp/verifier/command/header/FwErrorCodes.java renamed to CommandCore/src/main/java/com/intel/bkp/command/header/FwErrorCodes.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,14 @@
3131
*
3232
*/
3333

34-
package com.intel.bkp.verifier.command.header;
34+
package com.intel.bkp.command.header;
3535

3636
import lombok.AllArgsConstructor;
3737
import lombok.Getter;
3838

3939
@AllArgsConstructor
4040
@Getter
4141
public enum FwErrorCodes {
42-
4342
STATUS_OKAY(0x00),
4443
UNKNOWN_COMMAND(0x03);
4544

Verifier/src/main/java/com/intel/bkp/verifier/command/header/HeaderFields.java renamed to CommandCore/src/main/java/com/intel/bkp/command/header/HeaderFields.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
*/
3333

34-
package com.intel.bkp.verifier.command.header;
34+
package com.intel.bkp.command.header;
3535

3636
import lombok.AllArgsConstructor;
3737
import lombok.Getter;

Verifier/src/main/java/com/intel/bkp/verifier/command/logger/SigmaLogger.java renamed to CommandCore/src/main/java/com/intel/bkp/command/logger/CommandLogger.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,31 @@
3131
*
3232
*/
3333

34-
package com.intel.bkp.verifier.command.logger;
34+
package com.intel.bkp.command.logger;
3535

3636
import lombok.AccessLevel;
3737
import lombok.NoArgsConstructor;
3838
import lombok.extern.slf4j.Slf4j;
3939

40+
import static com.intel.bkp.utils.HexConverter.toHex;
41+
4042
@Slf4j
4143
@NoArgsConstructor(access = AccessLevel.PRIVATE)
42-
public class SigmaLogger {
44+
public class CommandLogger {
4345

44-
public static String log(ILogger message, SigmaLoggerValues dataName, Class callingClass) {
46+
public static String log(ILogger message, CommandLoggerValues dataName, Class<?> callingClass) {
4547
String msg = getMessage(message.hex(), dataName, callingClass);
4648
log.debug(msg);
4749
return msg;
4850
}
4951

50-
private static String getMessage(String value, SigmaLoggerValues dataName, Class callingClass) {
52+
public static String log(byte[] value, CommandLoggerValues dataName, Class<?> callingClass) {
53+
String msg = getMessage(toHex(value), dataName, callingClass);
54+
log.debug(msg);
55+
return msg;
56+
}
57+
58+
private static String getMessage(String value, CommandLoggerValues dataName, Class<?> callingClass) {
5159
return String.format("Caller: %s, Name: %s, Data: %s", callingClass.getSimpleName(), dataName, value);
5260
}
5361
}

0 commit comments

Comments
 (0)