CryptoPkg: Support BrainpoolP512r1 algorithm

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4830

Allow BrainpoolP512r1 to be leveraged when the corresponding curve ID
is passed to crypto libraries in EDK2

Signed-off-by: Michael G.A. Holland <michael.holland@intel.com>
This commit is contained in:
Michael G.A. Holland 2024-08-21 12:18:38 -05:00 committed by mergify[bot]
parent 41a51d1735
commit 9cd66aca1a
2 changed files with 13 additions and 3 deletions

View File

@ -23,9 +23,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define CRYPTO_NID_SHA512 0x0003 #define CRYPTO_NID_SHA512 0x0003
// Key Exchange // Key Exchange
#define CRYPTO_NID_SECP256R1 0x0204 #define CRYPTO_NID_SECP256R1 0x0204
#define CRYPTO_NID_SECP384R1 0x0205 #define CRYPTO_NID_SECP384R1 0x0205
#define CRYPTO_NID_SECP521R1 0x0206 #define CRYPTO_NID_SECP521R1 0x0206
#define CRYPTO_NID_BRAINPOOLP512R1 0x03A5
/// ///
/// MD5 digest size in bytes /// MD5 digest size in bytes

View File

@ -42,6 +42,9 @@ CryptoNidToOpensslNid (
case CRYPTO_NID_SECP521R1: case CRYPTO_NID_SECP521R1:
Nid = NID_secp521r1; Nid = NID_secp521r1;
break; break;
case CRYPTO_NID_BRAINPOOLP512R1:
Nid = NID_brainpoolP512r1;
break;
default: default:
return -1; return -1;
} }
@ -833,6 +836,9 @@ EcDsaSign (
case NID_secp521r1: case NID_secp521r1:
HalfSize = 66; HalfSize = 66;
break; break;
case NID_brainpoolP512r1:
HalfSize = 64;
break;
default: default:
return FALSE; return FALSE;
} }
@ -961,6 +967,9 @@ EcDsaVerify (
case NID_secp521r1: case NID_secp521r1:
HalfSize = 66; HalfSize = 66;
break; break;
case NID_brainpoolP512r1:
HalfSize = 64;
break;
default: default:
return FALSE; return FALSE;
} }