Skip to content

Commit

Permalink
Merge pull request ibmruntimes#27 from keithc-ca/nonce
Browse files Browse the repository at this point in the history
Access nonce only when non-null
  • Loading branch information
pshipton authored Feb 18, 2021
2 parents 197706b + 85cec1c commit c8b23b0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ protected int engineGetOutputSize(int inputLen) {
*/
@Override
protected byte[] engineGetIV() {
return (nonce == null)? null : nonce.clone();
return (nonce != null) ? nonce.clone() : null;
}

/**
Expand All @@ -211,7 +211,7 @@ protected byte[] engineGetIV() {
@Override
protected AlgorithmParameters engineGetParameters() {
AlgorithmParameters params = null;
byte[] nonceData = (initialized || nonce != null) ? nonce : createRandomNonce(null);
byte[] nonceData = (nonce != null) ? nonce : createRandomNonce(null);
if (mode == MODE_AEAD) {
try {
// Force the 12-byte nonce into a DER-encoded OCTET_STRING
Expand Down

0 comments on commit c8b23b0

Please sign in to comment.