Skip to content

Commit

Permalink
Merge pull request #68 from cconlon/signatureSynchronize
Browse files Browse the repository at this point in the history
JCE: add synchronization to protected methods in WolfCryptSignature
  • Loading branch information
douzzer authored Mar 30, 2024
2 parents 4ac446e + d03ebc7 commit 9f1c542
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/com/wolfssl/provider/jce/WolfCryptSignature.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ private void wolfCryptInitPublicKey(PublicKey key, byte[] encodedKey)
}

@Override
protected void engineInitSign(PrivateKey privateKey)
protected synchronized void engineInitSign(PrivateKey privateKey)
throws InvalidKeyException {

int ret;
Expand Down Expand Up @@ -279,7 +279,7 @@ protected void engineInitSign(PrivateKey privateKey)
}

@Override
protected void engineInitVerify(PublicKey publicKey)
protected synchronized void engineInitVerify(PublicKey publicKey)
throws InvalidKeyException {

int ret;
Expand Down Expand Up @@ -353,7 +353,7 @@ protected void engineSetParameter(String param, Object value)
}

@Override
protected byte[] engineSign() throws SignatureException {
protected synchronized byte[] engineSign() throws SignatureException {

int ret = 0;
int encodedSz = 0;
Expand Down Expand Up @@ -442,7 +442,7 @@ protected byte[] engineSign() throws SignatureException {
}

@Override
protected void engineUpdate(byte b) throws SignatureException {
protected synchronized void engineUpdate(byte b) throws SignatureException {

byte[] tmp = new byte[1];
tmp[0] = b;
Expand All @@ -454,7 +454,7 @@ protected void engineUpdate(byte b) throws SignatureException {
}

@Override
protected void engineUpdate(byte[] b, int off, int len)
protected synchronized void engineUpdate(byte[] b, int off, int len)
throws SignatureException {

switch (this.digestType) {
Expand Down Expand Up @@ -484,7 +484,7 @@ protected void engineUpdate(byte[] b, int off, int len)
}

@Override
protected boolean engineVerify(byte[] sigBytes)
protected synchronized boolean engineVerify(byte[] sigBytes)
throws SignatureException {

int ret = 0;
Expand Down

0 comments on commit 9f1c542

Please sign in to comment.