mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8320743: AEAD ciphers throw undocumented exceptions on overflow
Reviewed-by: ascarpino
This commit is contained in:
parent
207832952b
commit
3e78ff16d3
2 changed files with 7 additions and 7 deletions
|
@ -245,7 +245,7 @@ abstract class ChaCha20Cipher extends CipherSpi {
|
|||
params.init((new DerValue(
|
||||
DerValue.tag_OctetString, nonceData).toByteArray()));
|
||||
} catch (NoSuchAlgorithmException | IOException exc) {
|
||||
throw new RuntimeException(exc);
|
||||
throw new ProviderException(exc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -353,7 +353,7 @@ abstract class ChaCha20Cipher extends CipherSpi {
|
|||
break;
|
||||
default:
|
||||
// Should never happen
|
||||
throw new RuntimeException("ChaCha20 in unsupported mode");
|
||||
throw new ProviderException("ChaCha20 in unsupported mode");
|
||||
}
|
||||
init(opmode, key, newNonce);
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ abstract class ChaCha20Cipher extends CipherSpi {
|
|||
}
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("Invalid mode: " + mode);
|
||||
throw new ProviderException("Invalid mode: " + mode);
|
||||
}
|
||||
|
||||
// Continue with initialization
|
||||
|
@ -730,7 +730,7 @@ abstract class ChaCha20Cipher extends CipherSpi {
|
|||
try {
|
||||
engine.doFinal(in, inOfs, inLen, output, 0);
|
||||
} catch (ShortBufferException | KeyException exc) {
|
||||
throw new RuntimeException(exc);
|
||||
throw new ProviderException(exc);
|
||||
} finally {
|
||||
// Reset the cipher's state to post-init values.
|
||||
resetStartState();
|
||||
|
@ -767,7 +767,7 @@ abstract class ChaCha20Cipher extends CipherSpi {
|
|||
try {
|
||||
bytesUpdated = engine.doFinal(in, inOfs, inLen, out, outOfs);
|
||||
} catch (KeyException ke) {
|
||||
throw new RuntimeException(ke);
|
||||
throw new ProviderException(ke);
|
||||
} finally {
|
||||
// Reset the cipher's state to post-init values.
|
||||
resetStartState();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue