Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 2 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ jobs:
environment: ci
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v1
- uses: joschi/setup-jdk@v1
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- uses: actions/checkout@v2
- uses: joschi/setup-jdk@v2
with:
java-version: 8
- run: |
Expand Down
40 changes: 15 additions & 25 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ jobs:
runs-on: 'ubuntu-latest'
strategy:
matrix:
java: [8,11,15,16]
java: [8,11,17]
steps:
- uses: actions/checkout@v1
- uses: joschi/setup-jdk@v1
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- uses: actions/checkout@v2
- uses: joschi/setup-jdk@v2
with:
java-version: ${{ matrix.java }}
- uses: actions/cache@v1
Expand All @@ -31,12 +29,10 @@ jobs:
runs-on: 'ubuntu-latest'
strategy:
matrix:
java: [8,11,15,16]
java: [8,11,17]
steps:
- uses: actions/checkout@v1
- uses: joschi/setup-jdk@v1
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- uses: actions/checkout@v2
- uses: joschi/setup-jdk@v2
with:
java-version: ${{ matrix.java }}
- uses: actions/cache@v1
Expand All @@ -55,12 +51,10 @@ jobs:
runs-on: 'ubuntu-latest'
strategy:
matrix:
java: [8,11,15,16]
java: [8,11,17]
steps:
- uses: actions/checkout@v1
- uses: joschi/setup-jdk@v1
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- uses: actions/checkout@v2
- uses: joschi/setup-jdk@v2
with:
java-version: ${{ matrix.java }}
- uses: actions/cache@v1
Expand All @@ -79,12 +73,10 @@ jobs:
runs-on: 'ubuntu-latest'
strategy:
matrix:
java: [8,11,15,16]
java: [8,11,17]
steps:
- uses: actions/checkout@v1
- uses: joschi/setup-jdk@v1
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- uses: actions/checkout@v2
- uses: joschi/setup-jdk@v2
with:
java-version: ${{ matrix.java }}
- uses: actions/cache@v1
Expand All @@ -103,12 +95,10 @@ jobs:
runs-on: 'ubuntu-latest'
strategy:
matrix:
java: [8,11,15,16]
java: [8,11,17]
steps:
- uses: actions/checkout@v1
- uses: joschi/setup-jdk@v1
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- uses: actions/checkout@v2
- uses: joschi/setup-jdk@v2
with:
java-version: ${{ matrix.java }}
- uses: actions/cache@v1
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ jobs:
environment: ci
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v1
- uses: joschi/setup-jdk@v1
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- uses: actions/checkout@v2
- uses: joschi/setup-jdk@v2
with:
java-version: 8
- run: |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Current Build status: ![Build Workflow](https://github.com/mirkosertic/Bytecoder
* Ability to cross-compile JVM Bytecode to JavaScript, WebAssembly, OpenCL and other languages
* Primary compile targets are JavaScript and WebAssembly
* Act as a JVM Bytecode frontend for LLVM
* Supports Java 8, 9, 10, 11, 12, 13, 14 and 15
* Supports Java 8, 9, 10, 11, 12, 13, 14, 15, 16 and 17
* Work well with Debugger Toolchains and SourceMaps
* Allow integration with other UI-Frameworks such as vue.js
* Backed by OpenJDK 15 as JRE Classlib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public TThrowable(final String aMessage, final Throwable aCause) {
cause = aCause;
}

protected TThrowable(final String aMessage, final Throwable aCause, final boolean enableSupression, final boolean writeableStackTrace) {
message = aMessage;
cause = aCause;
}

public TThrowable(final Throwable aCause) {
message = null;
cause = aCause;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,11 @@ public void clear() {

public static void reachabilityFence(final Object value) {
}

public Object getFromInactiveFinalReference() {
return this;
}

public void clearInactiveFinalReference() {
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -25,12 +25,22 @@

package com.sun.crypto.provider;

import java.security.*;
import java.security.spec.*;
import javax.crypto.*;
import javax.crypto.spec.*;
import javax.crypto.BadPaddingException;
import javax.crypto.CipherSpi;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.ShortBufferException;
import java.nio.ByteBuffer;
import java.security.AlgorithmParameters;
import java.security.GeneralSecurityException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.ProviderException;
import java.security.SecureRandom;
import java.security.spec.AlgorithmParameterSpec;
import java.util.Arrays;

/**
* This class implements the AES algorithm in its various modes
Expand Down Expand Up @@ -128,21 +138,6 @@ public AES256_CFB_NoPadding() {
super(32, "CFB", "NOPADDING");
}
}
public static final class AES128_GCM_NoPadding extends OidImpl {
public AES128_GCM_NoPadding() {
super(16, "GCM", "NOPADDING");
}
}
public static final class AES192_GCM_NoPadding extends OidImpl {
public AES192_GCM_NoPadding() {
super(24, "GCM", "NOPADDING");
}
}
public static final class AES256_GCM_NoPadding extends OidImpl {
public AES256_GCM_NoPadding() {
super(32, "GCM", "NOPADDING");
}
}

// utility method used by AESCipher and AESWrapCipher
static final void checkKeySize(Key key, int fixedKeySize)
Expand All @@ -154,9 +149,12 @@ static final void checkKeySize(Key key, int fixedKeySize)
byte[] value = key.getEncoded();
if (value == null) {
throw new InvalidKeyException("Key encoding must not be null");
} else if (value.length != fixedKeySize) {
throw new InvalidKeyException("The key must be " +
fixedKeySize + " bytes");
} else {
Arrays.fill(value, (byte)0);
if (value.length != fixedKeySize) {
throw new InvalidKeyException("The key must be " +
fixedKeySize + " bytes");
}
}
}
}
Expand All @@ -172,10 +170,6 @@ static final void checkKeySize(Key key, int fixedKeySize)
*/
private final int fixedKeySize; // in bytes, -1 if no restriction

/*
* needed to enforce ISE thrown when updateAAD is called after update for GCM mode.
*/
private boolean updateCalled;

/**
* Creates an instance of AES cipher with default ECB mode and
Expand Down Expand Up @@ -309,7 +303,6 @@ protected AlgorithmParameters engineGetParameters() {
protected void engineInit(int opmode, Key key, SecureRandom random)
throws InvalidKeyException {
checkKeySize(key, fixedKeySize);
updateCalled = false;
core.init(opmode, key, random);
}

Expand Down Expand Up @@ -342,7 +335,6 @@ protected void engineInit(int opmode, Key key,
SecureRandom random)
throws InvalidKeyException, InvalidAlgorithmParameterException {
checkKeySize(key, fixedKeySize);
updateCalled = false;
core.init(opmode, key, params, random);
}

Expand All @@ -351,7 +343,6 @@ protected void engineInit(int opmode, Key key,
SecureRandom random)
throws InvalidKeyException, InvalidAlgorithmParameterException {
checkKeySize(key, fixedKeySize);
updateCalled = false;
core.init(opmode, key, params, random);
}

Expand All @@ -376,7 +367,6 @@ protected void engineInit(int opmode, Key key,
*/
protected byte[] engineUpdate(byte[] input, int inputOffset,
int inputLen) {
updateCalled = true;
return core.update(input, inputOffset, inputLen);
}

Expand Down Expand Up @@ -406,11 +396,11 @@ protected byte[] engineUpdate(byte[] input, int inputOffset,
protected int engineUpdate(byte[] input, int inputOffset, int inputLen,
byte[] output, int outputOffset)
throws ShortBufferException {
updateCalled = true;
return core.update(input, inputOffset, inputLen, output,
outputOffset);
}


/**
* Encrypts or decrypts data in a single-part operation,
* or finishes a multiple-part operation.
Expand Down Expand Up @@ -444,7 +434,6 @@ protected int engineUpdate(byte[] input, int inputOffset, int inputLen,
protected byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen)
throws IllegalBlockSizeException, BadPaddingException {
byte[] out = core.doFinal(input, inputOffset, inputLen);
updateCalled = false;
return out;
}

Expand Down Expand Up @@ -490,7 +479,6 @@ protected int engineDoFinal(byte[] input, int inputOffset, int inputLen,
BadPaddingException {
int outLen = core.doFinal(input, inputOffset, inputLen, output,
outputOffset);
updateCalled = false;
return outLen;
}

Expand All @@ -505,6 +493,7 @@ protected int engineDoFinal(byte[] input, int inputOffset, int inputLen,
*/
protected int engineGetKeySize(Key key) throws InvalidKeyException {
byte[] encoded = key.getEncoded();
Arrays.fill(encoded, (byte)0);
if (!AESCrypt.isKeySizeValid(encoded.length)) {
throw new InvalidKeyException("Invalid AES key length: " +
encoded.length + " bytes");
Expand Down Expand Up @@ -563,83 +552,20 @@ protected Key engineUnwrap(byte[] wrappedKey,
}

/**
* Continues a multi-part update of the Additional Authentication
* Data (AAD), using a subset of the provided buffer.
* <p>
* Calls to this method provide AAD to the cipher when operating in
* modes such as AEAD (GCM/CCM). If this cipher is operating in
* either GCM or CCM mode, all AAD must be supplied before beginning
* operations on the ciphertext (via the {@code update} and {@code
* doFinal} methods).
*
* @param src the buffer containing the AAD
* @param offset the offset in {@code src} where the AAD input starts
* @param len the number of AAD bytes
*
* @throws IllegalStateException if this cipher is in a wrong state
* (e.g., has not been initialized), does not accept AAD, or if
* operating in either GCM or CCM mode and one of the {@code update}
* methods has already been called for the active
* encryption/decryption operation
* @throws UnsupportedOperationException if this method
* has not been overridden by an implementation
*
* @since 1.8
*/
@Override
protected void engineUpdateAAD(byte[] src, int offset, int len) {
if (core.getMode() == CipherCore.GCM_MODE && updateCalled) {
throw new IllegalStateException("AAD must be supplied before encryption/decryption starts");
}
core.updateAAD(src, offset, len);
}

/**
* Continues a multi-part update of the Additional Authentication
* Data (AAD).
* <p>
* Calls to this method provide AAD to the cipher when operating in
* modes such as AEAD (GCM/CCM). If this cipher is operating in
* either GCM or CCM mode, all AAD must be supplied before beginning
* operations on the ciphertext (via the {@code update} and {@code
* doFinal} methods).
* <p>
* All {@code src.remaining()} bytes starting at
* {@code src.position()} are processed.
* Upon return, the input buffer's position will be equal
* to its limit; its limit will not have changed.
*
* @param src the buffer containing the AAD
*
* @throws IllegalStateException if this cipher is in a wrong state
* (e.g., has not been initialized), does not accept AAD, or if
* operating in either GCM or CCM mode and one of the {@code update}
* methods has already been called for the active
* encryption/decryption operation
* @throws UnsupportedOperationException if this method
* has not been overridden by an implementation
*
* @since 1.8
* Finalize crypto operation with ByteBuffers
*
* @param input the input ByteBuffer
* @param output the output ByteBuffer
*
* @return output length
* @throws ShortBufferException
* @throws IllegalBlockSizeException
* @throws BadPaddingException
*/
@Override
protected void engineUpdateAAD(ByteBuffer src) {
if (core.getMode() == CipherCore.GCM_MODE && updateCalled) {
throw new IllegalStateException("AAD must be supplied before encryption/decryption starts");
}
if (src != null) {
int aadLen = src.limit() - src.position();
if (aadLen > 0) {
if (src.hasArray()) {
int aadOfs = Math.addExact(src.arrayOffset(), src.position());
core.updateAAD(src.array(), aadOfs, aadLen);
src.position(src.limit());
} else {
byte[] aad = new byte[aadLen];
src.get(aad);
core.updateAAD(aad, 0, aadLen);
}
}
}
protected int engineDoFinal(ByteBuffer input, ByteBuffer output)
throws ShortBufferException, IllegalBlockSizeException,
BadPaddingException {
return super.engineDoFinal(input, output);
}
}

Binary file not shown.
Binary file not shown.
Loading