]> git.proxmox.com Git - libtpms.git/commitdiff
tpm2: Add unused BnNewVariable() to TpmtoOsslMath.c
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Sun, 17 Nov 2019 20:20:19 +0000 (15:20 -0500)
committerStefan Berger <stefanb@us.ibm.com>
Tue, 14 Apr 2020 20:03:45 +0000 (16:03 -0400)
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
src/tpm2/crypto/openssl/TpmToOsslMath.c
src/tpm2/crypto/openssl/TpmToOsslMath.h

index 13f634bea916eaabb122dd9b9515ae2873d5bf53..a05d660dfcb8f4322719f9776b659d6e9e64a24c 100644 (file)
@@ -189,6 +189,26 @@ void BIGNUM_print(
     return;
 }
 #endif
+
+/* B.2.3.2.3.4. BnNewVariable() */
+/* This function allocates a new variable in the provided context. If the context does not exist or
+   the allocation fails, it is a catastrophic failure. */
+#if 0
+static BIGNUM *
+BnNewVariable(
+             BN_CTX          *CTX
+             )
+{
+    BIGNUM          *new;
+    //
+    // This check is intended to protect against calling this function without
+    // having initialized the CTX.
+    if((CTX == NULL) || ((new = BN_CTX_get(CTX)) == NULL))
+       FAIL(FATAL_ERROR_ALLOCATION);
+    return new;
+}
+#endif
+
 #if LIBRARY_COMPATIBILITY_CHECK
 void
 MathLibraryCompatibilityCheck(
index eb4475260b2d26e3ca054b669d79f2e93c0900af..d9539522b2e9b039caaba09e5ac627e5ca1d30f1 100644 (file)
@@ -134,6 +134,9 @@ typedef OSSL_CURVE_DATA      *bigCurve;
                EC_GROUP_free(E->G);                                    \
            OsslContextLeave(E->CTX);                                   \
        }
+#define BN_NEW()        BnNewVariable(CTX)
+
+
 /* This definition would change if there were something to report */
 #define MathLibSimulationEnd()
 #endif // MATH_LIB_DEFINED