Skip to content

Commit

Permalink
Fix JPMS split packages (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
05nelsonm authored Jun 26, 2023
1 parent 6c4ce42 commit 6c141ef
Show file tree
Hide file tree
Showing 28 changed files with 94 additions and 75 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ POM_DEVELOPER_ID=KotlinCrypto
POM_DEVELOPER_NAME=Kotlin Crypto
POM_DEVELOPER_URL=https://github.com/KotlinCrypto/

VERSION_NAME=0.2.8-SNAPSHOT
VERSION_NAME=0.3.0-SNAPSHOT
# 0.1.0-alpha01 = 00 01 00 11
# 0.1.0-beta01 = 00 01 00 21
# 0.1.0-rc01 = 00 01 00 31
# 0.1.0 = 00 01 00 99
# 1.1.0 = 01 01 00 99
VERSION_CODE=20899
VERSION_CODE=30099
8 changes: 4 additions & 4 deletions library/digest/api/digest.api
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
public abstract class org/kotlincrypto/core/Digest : java/security/MessageDigest, java/lang/Cloneable, org/kotlincrypto/core/Algorithm, org/kotlincrypto/core/Copyable, org/kotlincrypto/core/Resettable, org/kotlincrypto/core/Updatable {
public abstract class org/kotlincrypto/core/digest/Digest : java/security/MessageDigest, java/lang/Cloneable, org/kotlincrypto/core/Algorithm, org/kotlincrypto/core/Copyable, org/kotlincrypto/core/Resettable, org/kotlincrypto/core/Updatable {
public final fun algorithm ()Ljava/lang/String;
public final fun blockSize ()I
public final fun clone ()Ljava/lang/Object;
protected abstract fun compress ([BI)V
public synthetic fun copy ()Ljava/lang/Object;
public final fun copy ()Lorg/kotlincrypto/core/Digest;
protected abstract fun copy (Lorg/kotlincrypto/core/internal/DigestState;)Lorg/kotlincrypto/core/Digest;
public final fun copy ()Lorg/kotlincrypto/core/digest/Digest;
protected abstract fun copy (Lorg/kotlincrypto/core/digest/internal/DigestState;)Lorg/kotlincrypto/core/digest/Digest;
public final fun digest ()[B
protected abstract fun digest (JI[B)[B
public final fun digest ([B)[B
Expand All @@ -30,7 +30,7 @@ public abstract class org/kotlincrypto/core/Digest : java/security/MessageDigest
protected fun updateDigest ([BII)V
}

public abstract class org/kotlincrypto/core/internal/DigestState {
public abstract class org/kotlincrypto/core/digest/internal/DigestState {
public synthetic fun <init> (Ljava/lang/String;IILkotlin/jvm/internal/DefaultConstructorMarker;)V
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.kotlincrypto.core
package org.kotlincrypto.core.digest

import org.kotlincrypto.core.internal.DigestState
import org.kotlincrypto.core.*
import org.kotlincrypto.core.digest.internal.DigestState

/**
* Core abstraction for Message Digest implementations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
**/
@file:Suppress("KotlinRedundantDiagnosticSuppress")

package org.kotlincrypto.core.internal
package org.kotlincrypto.core.digest.internal

import org.kotlincrypto.core.Digest
import org.kotlincrypto.core.digest.Digest

@Suppress("NOTHING_TO_INLINE")
internal inline fun Digest.commonToString(): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.kotlincrypto.core.internal
package org.kotlincrypto.core.digest.internal

import org.kotlincrypto.core.Copyable
import org.kotlincrypto.core.Resettable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.kotlincrypto.core.internal
package org.kotlincrypto.core.digest.internal

/**
* Used as a holder for copying/cloning of digests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.kotlincrypto.core
package org.kotlincrypto.core.digest

import kotlin.test.Test
import kotlin.test.assertEquals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.kotlincrypto.core
package org.kotlincrypto.core.digest

import org.kotlincrypto.core.internal.DigestState
import org.kotlincrypto.core.InternalKotlinCryptoApi
import org.kotlincrypto.core.digest.internal.DigestState

@Suppress("UnnecessaryOptInAnnotation")
@OptIn(InternalKotlinCryptoApi::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.kotlincrypto.core
package org.kotlincrypto.core.digest

import org.kotlincrypto.core.Updatable
import kotlin.test.Test
import kotlin.test.fail

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.kotlincrypto.core
package org.kotlincrypto.core.digest

import org.kotlincrypto.core.internal.DigestDelegate
import org.kotlincrypto.core.internal.DigestState
import org.kotlincrypto.core.internal.commonCheckArgs
import org.kotlincrypto.core.internal.commonToString
import org.kotlincrypto.core.*
import org.kotlincrypto.core.digest.internal.DigestDelegate
import org.kotlincrypto.core.digest.internal.DigestState
import org.kotlincrypto.core.digest.internal.commonCheckArgs
import org.kotlincrypto.core.digest.internal.commonToString
import java.nio.ByteBuffer
import java.security.DigestException
import java.security.MessageDigest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.kotlincrypto.core
package org.kotlincrypto.core.digest

import java.security.MessageDigest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.kotlincrypto.core
package org.kotlincrypto.core.digest

import org.kotlincrypto.core.internal.DigestState
import org.kotlincrypto.core.InternalKotlinCryptoApi
import org.kotlincrypto.core.digest.internal.DigestState
import java.lang.AssertionError
import java.security.MessageDigest
import kotlin.random.Random
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.kotlincrypto.core
package org.kotlincrypto.core.digest

import org.kotlincrypto.core.internal.DigestDelegate
import org.kotlincrypto.core.internal.DigestState
import org.kotlincrypto.core.internal.commonCheckArgs
import org.kotlincrypto.core.internal.commonToString
import org.kotlincrypto.core.*
import org.kotlincrypto.core.digest.internal.DigestDelegate
import org.kotlincrypto.core.digest.internal.DigestState
import org.kotlincrypto.core.digest.internal.commonCheckArgs
import org.kotlincrypto.core.digest.internal.commonToString

/**
* Core abstraction for Message Digest implementations.
Expand Down
12 changes: 6 additions & 6 deletions library/mac/api/mac.api
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
public abstract class org/kotlincrypto/core/Mac : javax/crypto/Mac, org/kotlincrypto/core/Algorithm, org/kotlincrypto/core/Copyable, org/kotlincrypto/core/Resettable, org/kotlincrypto/core/Updatable {
public abstract class org/kotlincrypto/core/mac/Mac : javax/crypto/Mac, org/kotlincrypto/core/Algorithm, org/kotlincrypto/core/Copyable, org/kotlincrypto/core/Resettable, org/kotlincrypto/core/Updatable {
public final fun algorithm ()Ljava/lang/String;
public synthetic fun copy ()Ljava/lang/Object;
public final fun copy ()Lorg/kotlincrypto/core/Mac;
protected abstract fun copy (Lorg/kotlincrypto/core/Mac$Engine;)Lorg/kotlincrypto/core/Mac;
public final fun copy ()Lorg/kotlincrypto/core/mac/Mac;
protected abstract fun copy (Lorg/kotlincrypto/core/mac/Mac$Engine;)Lorg/kotlincrypto/core/mac/Mac;
public final fun equals (Ljava/lang/Object;)Z
public final fun hashCode ()I
public final fun macLength ()I
public final fun toString ()Ljava/lang/String;
}

protected abstract class org/kotlincrypto/core/Mac$Engine : javax/crypto/MacSpi, java/lang/Cloneable, org/kotlincrypto/core/Copyable, org/kotlincrypto/core/Resettable, org/kotlincrypto/core/Updatable {
protected abstract class org/kotlincrypto/core/mac/Mac$Engine : javax/crypto/MacSpi, java/lang/Cloneable, org/kotlincrypto/core/Copyable, org/kotlincrypto/core/Resettable, org/kotlincrypto/core/Updatable {
public final fun clone ()Ljava/lang/Object;
public abstract fun doFinal ()[B
protected final fun engineDoFinal ()[B
Expand All @@ -25,7 +25,7 @@ protected abstract class org/kotlincrypto/core/Mac$Engine : javax/crypto/MacSpi,
public fun update ([B)V
}

protected abstract class org/kotlincrypto/core/Mac$Engine$State {
public fun <init> (Lorg/kotlincrypto/core/Mac$Engine;)V
protected abstract class org/kotlincrypto/core/mac/Mac$Engine$State {
public fun <init> (Lorg/kotlincrypto/core/mac/Mac$Engine;)V
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.kotlincrypto.core
package org.kotlincrypto.core.mac

import org.kotlincrypto.core.*

/**
* Core abstraction for Message Authentication Code implementations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
**/
@file:Suppress("KotlinRedundantDiagnosticSuppress")

package org.kotlincrypto.core.internal
package org.kotlincrypto.core.mac.internal

import org.kotlincrypto.core.Mac
import org.kotlincrypto.core.mac.Mac

@Throws(IllegalArgumentException::class)
@Suppress("NOTHING_TO_INLINE", "UnusedReceiverParameter")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.kotlincrypto.core
package org.kotlincrypto.core.mac

import kotlin.test.Test
import kotlin.test.assertEquals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.kotlincrypto.core
package org.kotlincrypto.core.mac

import org.kotlincrypto.core.InternalKotlinCryptoApi

@Suppress("UnnecessaryOptInAnnotation")
@OptIn(InternalKotlinCryptoApi::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.kotlincrypto.core
package org.kotlincrypto.core.mac

import org.kotlincrypto.core.internal.AndroidApi21to23MacSpiProvider
import org.kotlincrypto.core.internal.commonInit
import org.kotlincrypto.core.internal.commonToString
import org.kotlincrypto.core.*
import org.kotlincrypto.core.mac.internal.AndroidApi21to23MacSpiProvider
import org.kotlincrypto.core.mac.internal.commonInit
import org.kotlincrypto.core.mac.internal.commonToString
import java.nio.ByteBuffer
import java.security.InvalidKeyException
import java.security.Key
Expand Down Expand Up @@ -133,7 +134,7 @@ protected actual constructor(
// already know it's initialized because the API is designed to require the key upon instantiation
// so init is never needed to be called, nor is init function available from commonMain source set.
throw InvalidKeyException(
"org.kotlincrypto.core.Mac does not support re-initialization " +
"org.kotlincrypto.core.mac.Mac does not support re-initialization " +
"(it's already initialized). A new instance is required to be created."
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.kotlincrypto.core.internal
package org.kotlincrypto.core.mac.internal

import org.kotlincrypto.core.KC_ANDROID_SDK_INT
import org.kotlincrypto.core.InternalKotlinCryptoApi
Expand All @@ -24,9 +24,9 @@ import javax.crypto.MacSpi
/**
* Android API 21-23 requires that a Provider be set, otherwise
* when [javax.crypto.Mac.init] is called it will not use the
* provided [org.kotlincrypto.core.Mac.Engine] (i.e., [spi]).
* provided [org.kotlincrypto.core.mac.Mac.Engine] (i.e., [spi]).
*
* This simply wraps the [org.kotlincrypto.core.Mac.Engine]
* This simply wraps the [org.kotlincrypto.core.mac.Mac.Engine]
* such that initial [javax.crypto.Mac.init] call sets it
* as the spiImpl, and does not look to system providers
* for an instance that supports the [algorithm].
Expand Down Expand Up @@ -61,11 +61,11 @@ internal class AndroidApi21to23MacSpiProvider private constructor(
override fun newInstance(constructorParameter: Any?): Any = synchronized(this@AndroidApi21to23MacSpiProvider) {
val engine = spi ?: throw NoSuchAlgorithmException("algorithm[$algorithm] not supported")

// javax.crypto.Mac.init was called with a blanked key via org.kotlincrypto.core.Mac's
// javax.crypto.Mac.init was called with a blanked key via org.kotlincrypto.core.mac.Mac's
// init block in order to set javax.crypto.Mac.initialized to true. Return
// the MacSpi (i.e. org.kotlincrypto.core.Mac.Engine), and null the reference as
// the MacSpi (i.e. org.kotlincrypto.core.mac.Mac.Engine), and null the reference as
// we cannot provide a new instance if called again and do not want to return the
// same, already initialized org.kotlincrypto.core.Mac.Engine
// same, already initialized org.kotlincrypto.core.mac.Mac.Engine
spi = null

return engine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.kotlincrypto.core
package org.kotlincrypto.core.mac

import junit.framework.TestCase.assertEquals
import org.kotlincrypto.core.mac.TestMac
import java.security.InvalidKeyException
import javax.crypto.spec.SecretKeySpec
import kotlin.test.Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.kotlincrypto.core
package org.kotlincrypto.core.mac

import org.kotlincrypto.core.internal.commonInit
import org.kotlincrypto.core.internal.commonToString
import org.kotlincrypto.core.*
import org.kotlincrypto.core.mac.internal.commonInit
import org.kotlincrypto.core.mac.internal.commonToString

/**
* Core abstraction for Message Authentication Code implementations.
Expand Down
30 changes: 15 additions & 15 deletions library/xof/api/xof.api
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
public abstract class org/kotlincrypto/core/Xof : org/kotlincrypto/core/Algorithm, org/kotlincrypto/core/Copyable, org/kotlincrypto/core/Resettable, org/kotlincrypto/core/Updatable {
protected abstract fun newReader ()Lorg/kotlincrypto/core/Xof$Reader;
public final fun reader ()Lorg/kotlincrypto/core/Xof$Reader;
public final fun reader (Z)Lorg/kotlincrypto/core/Xof$Reader;
public static synthetic fun reader$default (Lorg/kotlincrypto/core/Xof;ZILjava/lang/Object;)Lorg/kotlincrypto/core/Xof$Reader;
public abstract class org/kotlincrypto/core/xof/Xof : org/kotlincrypto/core/Algorithm, org/kotlincrypto/core/Copyable, org/kotlincrypto/core/Resettable, org/kotlincrypto/core/Updatable {
protected abstract fun newReader ()Lorg/kotlincrypto/core/xof/Xof$Reader;
public final fun reader ()Lorg/kotlincrypto/core/xof/Xof$Reader;
public final fun reader (Z)Lorg/kotlincrypto/core/xof/Xof$Reader;
public static synthetic fun reader$default (Lorg/kotlincrypto/core/xof/Xof;ZILjava/lang/Object;)Lorg/kotlincrypto/core/xof/Xof$Reader;
public final fun toString ()Ljava/lang/String;
public final fun use (Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public final fun use (ZLkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static synthetic fun use$default (Lorg/kotlincrypto/core/Xof;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun use$default (Lorg/kotlincrypto/core/xof/Xof;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/Object;
}

public abstract class org/kotlincrypto/core/Xof$Reader {
public fun <init> (Lorg/kotlincrypto/core/Xof;)V
public abstract class org/kotlincrypto/core/xof/Xof$Reader {
public fun <init> (Lorg/kotlincrypto/core/xof/Xof;)V
public final fun bytesRead ()J
public final fun close ()V
protected abstract fun closeProtected ()V
Expand All @@ -22,20 +22,20 @@ public abstract class org/kotlincrypto/core/Xof$Reader {
public final fun use (Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
}

public abstract interface class org/kotlincrypto/core/XofAlgorithm : org/kotlincrypto/core/Algorithm {
public abstract interface class org/kotlincrypto/core/xof/XofAlgorithm : org/kotlincrypto/core/Algorithm {
}

public abstract class org/kotlincrypto/core/XofFactory {
public abstract class org/kotlincrypto/core/xof/XofFactory {
}

protected abstract class org/kotlincrypto/core/XofFactory$XofDelegate : org/kotlincrypto/core/Xof, org/kotlincrypto/core/Algorithm, org/kotlincrypto/core/Resettable, org/kotlincrypto/core/Updatable {
protected fun <init> (Lorg/kotlincrypto/core/XofFactory;Lorg/kotlincrypto/core/XofAlgorithm;)V
protected abstract class org/kotlincrypto/core/xof/XofFactory$XofDelegate : org/kotlincrypto/core/xof/Xof, org/kotlincrypto/core/Algorithm, org/kotlincrypto/core/Resettable, org/kotlincrypto/core/Updatable {
protected fun <init> (Lorg/kotlincrypto/core/xof/XofFactory;Lorg/kotlincrypto/core/xof/XofAlgorithm;)V
public fun algorithm ()Ljava/lang/String;
public final fun equals (Ljava/lang/Object;)Z
protected final fun getDelegate ()Lorg/kotlincrypto/core/XofAlgorithm;
protected final fun getDelegate ()Lorg/kotlincrypto/core/xof/XofAlgorithm;
public final fun hashCode ()I
protected final fun newReader ()Lorg/kotlincrypto/core/Xof$Reader;
protected abstract fun newReader (Lorg/kotlincrypto/core/XofAlgorithm;)Lorg/kotlincrypto/core/Xof$Reader;
protected final fun newReader ()Lorg/kotlincrypto/core/xof/Xof$Reader;
protected abstract fun newReader (Lorg/kotlincrypto/core/xof/XofAlgorithm;)Lorg/kotlincrypto/core/xof/Xof$Reader;
public fun reset ()V
public fun update (B)V
public fun update ([B)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.kotlincrypto.core
package org.kotlincrypto.core.xof

import org.kotlincrypto.core.*
import org.kotlincrypto.endians.BigEndian.Companion.toBigEndian
import kotlin.jvm.JvmName
import kotlin.jvm.JvmOverloads
Expand Down
Loading

0 comments on commit 6c141ef

Please sign in to comment.