Skip to content

Commit b3cdff3

Browse files
committed
Remove a duplicate MAX_ECC_KEY_BYTES. Add comment for why MAX_RSA_KEY_BYTES uses (times 2). Fix LABEL_MAX_BUFFER. Add better defaults for SLB9672/SLB9673.
1 parent 4754bf1 commit b3cdff3

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

wolftpm/tpm2.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ typedef UINT32 TPM_GENERATED;
7272
#define TPM_SPEC_YEAR 2016
7373
#define TPM_SPEC_DAY_OF_YEAR 273
7474

75-
#define TPM_GENERATED_VALUE 0xff544347
76-
75+
#define TPM_GENERATED_VALUE 0xff544347U
76+
#define TPM_MAX_DERIVATION_BITS 8192U
7777

7878
typedef enum {
7979
TPM_ALG_ERROR = 0x0000,

wolftpm/tpm2_types.h

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,18 @@ typedef int64_t INT64;
376376
#define WOLFTPM_PERFORM_SELFTEST
377377
#endif
378378

379+
/* Chip defaults */
380+
#if defined(WOLFTPM_SLB9672) || defined(WOLFTPM_SLB9673)
381+
#ifndef MAX_RSA_KEY_BITS
382+
#define MAX_RSA_KEY_BITS 4096
383+
#endif
384+
#ifndef MAX_ECC_KEY_BITS
385+
#define MAX_ECC_KEY_BITS 384
386+
#endif
387+
#ifndef HASH_COUNT
388+
#define HASH_COUNT 3
389+
#endif
390+
#endif
379391

380392

381393
/* ---------------------------------------------------------------------------*/
@@ -388,10 +400,6 @@ typedef int64_t INT64;
388400
#define TPM_SHA384_DIGEST_SIZE 48
389401
#define TPM_SHA512_DIGEST_SIZE 64
390402

391-
#ifndef MAX_ECC_KEY_BYTES
392-
#define MAX_ECC_KEY_BYTES 66
393-
#endif
394-
395403
#ifndef TPM_MAX_BLOCK_SIZE
396404
#define TPM_MAX_BLOCK_SIZE 128
397405
#endif
@@ -432,12 +440,15 @@ typedef int64_t INT64;
432440
#define MAX_SYM_KEY_BYTES 32
433441
#endif
434442
#ifndef LABEL_MAX_BUFFER
435-
#define LABEL_MAX_BUFFER 48
443+
/* the TCG specification defines a label size not exceed 32 bytes */
444+
#define LABEL_MAX_BUFFER 32
436445
#endif
446+
437447
#ifndef MAX_RSA_KEY_BITS
438448
#define MAX_RSA_KEY_BITS 2048
439449
#endif
440450
#ifndef MAX_RSA_KEY_BYTES
451+
/* the TCG specification defines an RSA key as two max values */
441452
#define MAX_RSA_KEY_BYTES (((MAX_RSA_KEY_BITS+7)/8)*2)
442453
#endif
443454

0 commit comments

Comments
 (0)