Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fips140-3: don't cache iv in audit crypto #30785

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2118,14 +2118,10 @@ private static Cipher createCipher(int cipherMode, byte[] key, String cipher,

if (cipher.indexOf("ECB") == -1) {
if (cipher.indexOf("AES") != -1) {
if (ivs16 == null) {
setIVS16(key);
}
setIVS16(key);
ci.init(cipherMode, sKey, ivs16);
} else {
if (ivs8 == null) {
setIVS8(key);
}
setIVS8(key);
ci.init(cipherMode, sKey, ivs8);
}
} else {
Expand Down Expand Up @@ -2225,21 +2221,18 @@ public static synchronized void setIVS8(byte[] key) {
if (tc.isEntryEnabled())
Tr.entry(tc, "setIVS8");

if (ivs8 == null) // only set it once
{
try {
byte[] iv8 = new byte[8];
for (int i = 0; i < 8; i++) {
iv8[i] = key[i];
}
ivs8 = new IvParameterSpec(iv8);
if (tc.isDebugEnabled())
Tr.debug(tc, "setIVS8: ivs8 successfully set");
} catch (Exception e) {
if (tc.isDebugEnabled())
Tr.debug(tc, "setIVS8 unxepected exception setting initialization vector", new Object[] { e });
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.security.ltpa.LTPAToken2Factory.initialize", "2539");
try {
byte[] iv8 = new byte[8];
for (int i = 0; i < 8; i++) {
iv8[i] = key[i];
}
ivs8 = new IvParameterSpec(iv8);
if (tc.isDebugEnabled())
Tr.debug(tc, "setIVS8: ivs8 successfully set");
} catch (Exception e) {
if (tc.isDebugEnabled())
Tr.debug(tc, "setIVS8 unxepected exception setting initialization vector", new Object[] { e });
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.security.ltpa.LTPAToken2Factory.initialize", "2539");
}
}

Expand All @@ -2250,21 +2243,18 @@ public static synchronized void setIVS16(byte[] key) {
if (tc.isEntryEnabled())
Tr.entry(tc, "setIVS16");

if (ivs16 == null) // only set it once
{
try {
byte[] iv16 = new byte[16];
for (int i = 0; i < 16; i++) {
iv16[i] = key[i];
}
ivs16 = new IvParameterSpec(iv16);
if (tc.isDebugEnabled())
Tr.debug(tc, "setIVS16: ivs16 successfully set");
} catch (Exception e) {
if (tc.isDebugEnabled())
Tr.debug(tc, "setIVS16 unxepected exception setting initialization vector", new Object[] { e });
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.security.ltpa.LTPAToken2Factory.initialize", "2568");
try {
byte[] iv16 = new byte[16];
for (int i = 0; i < 16; i++) {
iv16[i] = key[i];
}
ivs16 = new IvParameterSpec(iv16);
if (tc.isDebugEnabled())
Tr.debug(tc, "setIVS16: ivs16 successfully set");
} catch (Exception e) {
if (tc.isDebugEnabled())
Tr.debug(tc, "setIVS16 unxepected exception setting initialization vector", new Object[] { e });
com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.security.ltpa.LTPAToken2Factory.initialize", "2568");
}
}
}