diff options
author | David Hook <dgh@cryptoworkshop.com> | 2022-08-22 10:44:10 +1000 |
---|---|---|
committer | David Hook <dgh@cryptoworkshop.com> | 2022-08-22 10:44:10 +1000 |
commit | da2a01eac0ee6d6a15c12e5ccfb5b425965d4cb4 (patch) | |
tree | b391d41328ea6489517bfb0dfd02621696c0074d | |
parent | SIKE: added warning, keysize test (diff) | |
download | BouncyCastle.NET-ed25519-da2a01eac0ee6d6a15c12e5ccfb5b425965d4cb4.tar.xz |
added input check
-rw-r--r-- | crypto/src/crypto/engines/SM2Engine.cs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/src/crypto/engines/SM2Engine.cs b/crypto/src/crypto/engines/SM2Engine.cs index ab7e9cd17..1a121c192 100644 --- a/crypto/src/crypto/engines/SM2Engine.cs +++ b/crypto/src/crypto/engines/SM2Engine.cs @@ -62,6 +62,11 @@ namespace Org.BouncyCastle.Crypto.Engines public virtual byte[] ProcessBlock(byte[] input, int inOff, int inLen) { + if ((inOff + inLen) > input.Length || inLen == 0) + { + throw new DataLengthException("input buffer too short"); + } + if (mForEncryption) { return Encrypt(input, inOff, inLen); |