diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-11-21 10:20:00 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-11-21 10:20:00 +0700 |
commit | 62ee4461d76d3fce1a39d19c64f3b49346a445dc (patch) | |
tree | fdfe970ec0e1c837bdd1c983000e6d0674e1d6de | |
parent | Implement SetIssuerUniqueId (diff) | |
download | BouncyCastle.NET-ed25519-62ee4461d76d3fce1a39d19c64f3b49346a445dc.tar.xz |
Add InitAdditionalInput1 to HMacDsaKCalculator
-rw-r--r-- | crypto/src/crypto/signers/HMacDsaKCalculator.cs | 12 |
1 files changed, 11 insertions, 1 deletions
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 } } - /// <summary>Supports use of additional input.</summary> + /// <summary>Supply additional input to HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1)).</summary> /// <remarks> /// 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 { } + /// <summary>Supply additional input to HMAC_K(V || 0x01 || int2octets(x) || bits2octets(h1)).</summary> + /// <remarks> + /// Refer to comments for <see cref="InitAdditionalInput0(HMac)"/>. + /// </remarks> + /// <param name="hmac1">The <see cref="HMac"/> to which the additional input should be added.</param> + protected virtual void InitAdditionalInput1(HMac hmac1) + { + } + private BigInteger BitsToInt(byte[] t) { BigInteger v = new BigInteger(1, t); |