VirtualBox

Changeset 98878 in vbox for trunk/src/libs/libtpms-0.9.6


Ignore:
Timestamp:
Mar 8, 2023 12:37:11 PM (21 months ago)
Author:
vboxsync
Message:

libs/libtpms-0.9.6: Applied and adjusted our libtpms changes to 0.9.6, bugref:10378

Location:
trunk/src/libs/libtpms-0.9.6
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/libtpms-0.9.6

    • Property svn:mergeinfo
      •  

        old new  
        2121/branches/dsen/gui4/src/libs/libtpms-0.9.0:155183-155185,155187,155198,155200-155201,155205,155228,155235,155243,155248,155282,155285,155287-155288,155311,155316,155336,155342,155344,155437-155438,155441,155443,155488,155509-155513,155526-155527,155559,155572,155576-155577,155592-155593
        2222/trunk/src/src/libs/libtpms-0.9.0:92342,154921
         23/vendor/libtpms/0.9.6:156204-156205
         24/vendor/libtpms/current:147277-156203
  • trunk/src/libs/libtpms-0.9.6/CHANGES

    r91612 r98878  
    11CHANGES - changes for libtpms
     2
     3version 0.9.6:
     4  - tpm2: Check size of buffer before accessing it (CVE-2023-1017 & -1018)
     5
     6version 0.9.5:
     7  - tpm2: Do not set RSA_FLAG_NO_BLINDING on RSA keys anymore
     8  - tpm2: Fix a potential overflow expression (coverity)
     9  - tpm2: Fix size check in CryptSecretDecrypt
     10
     11version 0.9.4:
     12  - tpm: #undef printf in case it is #define'd (OSS-Fuzz)
     13  - tpm2: Check return code of BN_div()
     14  - tpm2: Initialize variables due to gcc complaint (s390x, false positive)
     15  - tpm12: Initialize variables due to gcc complaint (s390x, false positive)
     16  - build-sys: Fix configure script to support _FORTIFY_SOURCE=3
     17
     18version 0.9.3:
     19  - build-sys: Add probing for -fstack-protector
     20  - tpm2: Do not call EVP_PKEY_CTX_set0_rsa_oaep_label() for label of size
     21    (OSSL 3)
     22
     23version 0.9.2:
     24  - tpm2: When writing state initialize s_ContextSlotMask if not set
     25
     26version 0.9.1:
     27  - tpm2: Do not write permanent state if only clock changed
     28  - tpm2: Fix "maybe-uninitialized" warning
    229
    330version 0.9.0:
  • trunk/src/libs/libtpms-0.9.6/configure.ac

    r91612 r98878  
    44# See the LICENSE file for the license associated with this file.
    55
    6 AC_INIT([libtpms],[0.9.0])
     6AC_INIT([libtpms],[0.9.6])
    77AC_PREREQ([2.69])
    88AC_CONFIG_SRCDIR(Makefile.am)
     
    285285
    286286if test "x$enable_hardening" != "xno"; then
    287         # Some versions of gcc fail with -Wstack-protector enabled
    288         TMP="$($CC -fstack-protector-strong $srcdir/include/libtpms/tpm_error.h 2>&1)"
    289         if echo $TMP | $GREP 'unrecognized command line option' >/dev/null; then
    290                 HARDENING_CFLAGS="-fstack-protector "
     287        # Some versions of gcc fail with -Wstack-protector,
     288        # some with -Wstack-protector-strong enabled
     289        if ! $CC -fstack-protector-strong $srcdir/include/libtpms/tpm_error.h 2>/dev/null; then
     290                if $CC -fstack-protector $srcdir/include/libtpms/tpm_error.h 2>/dev/null; then
     291                        HARDENING_CFLAGS="-fstack-protector "
     292                fi
    291293        else
    292294                HARDENING_CFLAGS="-fstack-protector-strong "
    293295        fi
    294296
    295         dnl Must not have -O0 but must have a -O for -D_FORTIFY_SOURCE=2
    296         TMP1="$(echo $CFLAGS | sed -n 's/.*\(-O0\).*/\1/p')"
    297         TMP2="$(echo $CFLAGS | sed -n 's/.*\(-O\).*/\1/p')"
    298         if test -z "$TMP1" && test -n "$TPM2"; then
    299                 HARDENING_CFLAGS="$HARDENING_CFLAGS -D_FORTIFY_SOURCE=2 "
     297        dnl Only support -D_FORTIFY_SOURCE=2 and have higher levels passed in by user
     298        dnl since they may create more overhead
     299        if $CC $CFLAGS -Werror -D_FORTIFY_SOURCE=2 $srcdir/include/libtpms/tpm_library.h 2>/dev/null; then
     300                HARDENING_CFLAGS="$HARDENING_CFLAGS -D_FORTIFY_SOURCE=2"
    300301        fi
    301302        dnl Check linker for 'relro' and 'now'
  • trunk/src/libs/libtpms-0.9.6/debian/changelog

    r91612 r98878  
     1libtpms (0.9.6) RELEASED; urgency=high
     2
     3  - tpm2: Check size of buffer before accessing it (CVE-2023-1017 & -1018)
     4
     5 -- Stefan Berger <[email protected]>  Tue, 28 Feb 2023 09:00:00 -0500
     6
     7libtpms (0.9.5) RELEASED; urgency=medium
     8
     9  - tpm2: Do not set RSA_FLAG_NO_BLINDING on RSA keys anymore
     10  - tpm2: Fix a potential overflow expression (coverity)
     11  - tpm2: Fix size check in CryptSecretDecrypt
     12
     13 -- Stefan Berger <[email protected]>  Fri, 01 Jul 2022 09:00:00 -0500
     14
     15libtpms (0.9.4) RELEASED; urgency=medium
     16
     17  - tpm: #undef printf in case it is #define'd (OSS-Fuzz)
     18  - tpm2: Check return code of BN_div()
     19  - tpm2: Initialize variables due to gcc complaint (s390x, false positive)
     20  - tpm12: Initialize variables due to gcc complaint (s390x, false positive)
     21  - build-sys: Fix configure script to support _FORTIFY_SOURCE=3
     22
     23 -- Stefan Berger <[email protected]>  Mon, 25 Apr 2022 09:00:00 -0500
     24
     25libtpms (0.9.3) RELEASED; urgency=medium
     26
     27  - build-sys: Add probing for -fstack-protector
     28  - tpm2: Do not call EVP_PKEY_CTX_set0_rsa_oaep_label() for label of size (OSSL 3)
     29
     30 -- Stefan Berger <[email protected]>  Mon, 07 Mar 2022 09:00:00 -0500
     31
     32libtpms (0.9.2) RELEASED; urgency=medium
     33
     34  * tpm2: When writing state initialize s_ContextSlotMask if not set
     35
     36 -- Stefan Berger <[email protected]>  Thu, 06 Jan 2022 09:00:00 -0500
     37
     38libtpms (0.9.1) RELEASED; urgency=medium
     39
     40  * tpm2: Do not write permanent state if only clock changed
     41
     42 -- Stefan Berger <[email protected]>  Wed, 24 Nov 2021 09:00:00 -0500
     43
    144libtpms (0.9.0) RELEASED; urgency=medium
    245
  • trunk/src/libs/libtpms-0.9.6/dist/libtpms.spec

    r91612 r98878  
    22
    33%define name      libtpms
    4 %define version   0.9.0
    5 %define release   0~dev1
     4%define version   0.9.6
     5%define release   1
    66
    77# Valid crypto subsystems are 'freebl' and 'openssl'
     
    113113
    114114%changelog
     115* Tue Feb 28 2023 Stefan Berger - 0.9.6-1
     116- tpm2: Check size of buffer before accessing it (CVE-2023-1017 & -1018)
     117
     118* Fri Jul 01 2022 Stefan Berger - 0.9.5-1
     119- Release of version 0.9.5
     120
     121* Mon Apr 25 2022 Stefan Berger - 0.9.4-1
     122- Release of version 0.9.4
     123
     124* Mon Mar 07 2022 Stefan Berger - 0.9.3-1
     125- Release of version 0.9.3
     126
     127* Thu Jan 06 2022 Stefan Berger - 0.9.2-1
     128- Release of version 0.9.2
     129
     130* Wed Nov 24 2021 Stefan Berger - 0.9.1-1
     131- Release of version 0.9.1
     132
    115133* Wed Sep 29 2021 Stefan Berger - 0.9.0-1
    116134- Release of version 0.9.0 (rev. 164)
  • trunk/src/libs/libtpms-0.9.6/dist/libtpms.spec.in

    r91612 r98878  
    33%define name      @PACKAGE@
    44%define version   @VERSION@
    5 %define release   0~dev1
     5%define release   1
    66
    77# Valid crypto subsystems are 'freebl' and 'openssl'
     
    113113
    114114%changelog
     115* Tue Feb 28 2023 Stefan Berger - 0.9.6-1
     116- tpm2: Check size of buffer before accessing it (CVE-2023-1017 & -1018)
     117
     118* Fri Jul 01 2022 Stefan Berger - 0.9.5-1
     119- Release of version 0.9.5
     120
     121* Mon Apr 25 2022 Stefan Berger - 0.9.4-1
     122- Release of version 0.9.4
     123
     124* Mon Mar 07 2022 Stefan Berger - 0.9.3-1
     125- Release of version 0.9.3
     126
     127* Thu Jan 06 2022 Stefan Berger - 0.9.2-1
     128- Release of version 0.9.2
     129
     130* Wed Nov 24 2021 Stefan Berger - 0.9.1-1
     131- Release of version 0.9.1
     132
    115133* Wed Sep 29 2021 Stefan Berger - 0.9.0-1
    116134- Release of version 0.9.0 (rev. 164)
  • trunk/src/libs/libtpms-0.9.6/include/libtpms/tpm_library.h

    r91612 r98878  
    5151#define TPM_LIBRARY_VER_MAJOR 0
    5252#define TPM_LIBRARY_VER_MINOR 9
    53 #define TPM_LIBRARY_VER_MICRO 0
     53#define TPM_LIBRARY_VER_MICRO 6
    5454
    5555#define TPM_LIBRARY_VERSION_GEN(MAJ, MIN, MICRO) \
  • trunk/src/libs/libtpms-0.9.6/src/tpm12/tpm_nvram.c

    r91612 r98878  
    12911291    TPM_BOOL                    isGPIO = FALSE;
    12921292    BYTE                        *gpioData = NULL;
    1293     TPM_NV_DATA_SENSITIVE       *d1NvdataSensitive;
     1293    TPM_NV_DATA_SENSITIVE       *d1NvdataSensitive = NULL;
    12941294    uint32_t                    s1Last;
    12951295   
  • trunk/src/libs/libtpms-0.9.6/src/tpm2/BnMath.c

    r91612 r98878  
    427427    while(bn->size <= offset)
    428428        bn->d[bn->size++] = 0;
    429     bn->d[offset] |= (crypt_uword_t)(1 << RADIX_MOD(bitNum));
     429    bn->d[offset] |= ((crypt_uword_t)1 << RADIX_MOD(bitNum));
    430430    return TRUE;
    431431}
  • trunk/src/libs/libtpms-0.9.6/src/tpm2/CryptUtil.c

    r91612 r98878  
    733733                              }
    734734                          // make sure secret will fit
    735                           if(secret->t.size > data->t.size)
     735                          if(secret->t.size > sizeof(data->t.buffer))
    736736                              return TPM_RC_FAILURE;
    737737                          data->t.size = secret->t.size;
     
    831831    TPM2B_HMAC_KEY          key;            // decryption key
    832832    UINT32                  cipherSize = 0; // size of cipher text
     833
     834    if (leadingSizeInByte > bufferSize)
     835        return TPM_RC_INSUFFICIENT;
     836
    833837    // Retrieve encrypted data size.
    834838    if(leadingSizeInByte == 2)
     
    838842            cipherSize = (UINT32)BYTE_ARRAY_TO_UINT16(buffer);
    839843            buffer = &buffer[2];   // advance the buffer
     844            bufferSize -= 2;
    840845        }
    841846#ifdef  TPM4B
     
    845850            cipherSize = BYTE_ARRAY_TO_UINT32(buffer);
    846851            buffer = &buffer[4];   //advance pointer
     852            bufferSize -= 4;
    847853        }
    848854#endif
  • trunk/src/libs/libtpms-0.9.6/src/tpm2/Marshal.c

    r91612 r98878  
    21962196{
    21972197    UINT16 written = 0;
    2198     BYTE *sizePtr;
     2198    BYTE *sizePtr = NULL;
    21992199
    22002200    if (buffer != NULL) {
  • trunk/src/libs/libtpms-0.9.6/src/tpm2/NVMarshal.c

    r91612 r98878  
    14351435    for (i = 0; i < array_size; i++)
    14361436        written += UINT16_Marshal(&data->contextArray[i], buffer, size);
     1437
     1438    if (s_ContextSlotMask != 0x00ff && s_ContextSlotMask != 0xffff) {
     1439        /* TPM wasn't initialized, so s_ContextSlotMask wasn't set */
     1440        s_ContextSlotMask = 0xffff;
     1441    }
    14371442    written += UINT16_Marshal(&s_ContextSlotMask, buffer, size);
    14381443
     
    38933898    NV_HEADER hdr;
    38943899    UINT32 array_size;
    3895     UINT32 exp_array_size;
     3900    UINT32 exp_array_size = 0;
    38963901
    38973902    if (rc == TPM_RC_SUCCESS) {
  • trunk/src/libs/libtpms-0.9.6/src/tpm2/Time.c

    r91612 r98878  
    137137            // update the time
    138138            go.clock = newTime;
     139
     140            /* libtpms: Changing the clock alone does not cause the permanent
     141             *          state to be written to storage, there must be other
     142             *          reasons as well.
     143             */
     144            UPDATE_TYPE old_g_updateNV = g_updateNV;    // libtpms added
     145
    139146            NvWrite(NV_ORDERLY_DATA, sizeof(go), &go);
     147
     148            g_updateNV = old_g_updateNV;                // libtpms added
    140149        }
    141150    else
  • trunk/src/libs/libtpms-0.9.6/src/tpm2/crypto/openssl/CryptRsa.c

    r91612 r98878  
    13571357                    ERROR_RETURN(TPM_RC_FAILURE);
    13581358                memcpy(tmp, label->buffer, label->size);
     1359                if (EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, tmp, label->size) <= 0)
     1360                    ERROR_RETURN(TPM_RC_FAILURE);
    13591361            }
    1360             // label->size == 0 is supported
    1361             if (EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, tmp, label->size) <= 0)
    1362                 ERROR_RETURN(TPM_RC_FAILURE);
    13631362            tmp = NULL;
    13641363            break;
  • trunk/src/libs/libtpms-0.9.6/src/tpm2/crypto/openssl/Helpers.c

    r91612 r98878  
    440440        ERROR_RETURN(TPM_RC_FAILURE)
    441441
    442     RSA_set_flags(rsakey, RSA_FLAG_NO_BLINDING);
    443 
    444442    retVal = TPM_RC_SUCCESS;
    445443
     
    522520        /* Q = N/P; no remainder */
    523521        BN_set_flags(P, BN_FLG_CONSTTIME); // P is secret
    524         BN_div(Q, Qr, N, P, ctx);
    525         if(!BN_is_zero(Qr))
     522        if (!BN_div(Q, Qr, N, P, ctx) || !BN_is_zero(Qr))
    526523            ERROR_RETURN(TPM_RC_BINDING);
    527524        BN_set_flags(Q, BN_FLG_CONSTTIME); // Q is secret
  • trunk/src/libs/libtpms-0.9.6/src/tpm_debug.h

    r91612 r98878  
    6767#endif
    6868
     69#ifdef printf
     70# undef  printf
     71#endif
    6972#define printf(...) TPMLIB_LogPrintf(__VA_ARGS__);
    7073
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette