From 62ee4461d76d3fce1a39d19c64f3b49346a445dc Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Tue, 21 Nov 2023 10:20:00 +0700 Subject: Add InitAdditionalInput1 to HMacDsaKCalculator --- crypto/src/crypto/signers/HMacDsaKCalculator.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'crypto/src') diff --git a/crypto/src/crypto/signers/HMacDsaKCalculator.cs b/crypto/src/crypto/signers/HMacDsaKCalculator.cs index 67dadede8..780d4d465 100644 --- a/crypto/src/crypto/signers/HMacDsaKCalculator.cs +++ b/crypto/src/crypto/signers/HMacDsaKCalculator.cs @@ -94,6 +94,7 @@ namespace Org.BouncyCastle.Crypto.Signers hMac.BlockUpdate(x, 0, x.Length); hMac.BlockUpdate(m, 0, m.Length); #endif + InitAdditionalInput1(hMac); hMac.DoFinal(K, 0); hMac.Init(new KeyParameter(K)); @@ -134,7 +135,7 @@ namespace Org.BouncyCastle.Crypto.Signers } } - /// Supports use of additional input. + /// Supply additional input to HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1)). /// /// RFC 6979 3.6. Additional data may be added to the input of HMAC [..]. A use case may be a protocol that /// requires a non-deterministic signature algorithm on a system that does not have access to a high-quality @@ -150,6 +151,15 @@ namespace Org.BouncyCastle.Crypto.Signers { } + /// Supply additional input to HMAC_K(V || 0x01 || int2octets(x) || bits2octets(h1)). + /// + /// Refer to comments for . + /// + /// The to which the additional input should be added. + protected virtual void InitAdditionalInput1(HMac hmac1) + { + } + private BigInteger BitsToInt(byte[] t) { BigInteger v = new BigInteger(1, t); -- cgit 1.4.1