APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.crypto.provider

pack-priv final Class GHASH

extends Object
implements Cloneable, GCM
Class Inheritance
All Implemented Interfaces
com.sun.crypto.provider.GCM, java.lang.Cloneable
Imports
java.lang.invoke.MethodHandles, .VarHandle, java.nio.ByteBuffer, .ByteOrder, java.security.ProviderException, jdk.internal.vm.annotation.IntrinsicCandidate

This class represents the GHASH function defined in NIST 800-38D under section 6.4. It needs to be constructed w/ a hash subkey, i.e. block H. Given input of 128-bit blocks, it will process and output a 128-bit block.

This function is used in the implementation of GCM mode.

Since
1.8

Field Summary

Modifier and TypeField and Description
private static final int
private static final VarHandle
private static final int
private final long[]
private final long[]

Constructor Summary

AccessConstructor and Description
pack-priv
GHASH(byte[]
the hash subkey
subkeyH
)

Initializes the cipher in the specified mode with the given key and iv.

private

Method Summary

Modifier and TypeMethod and Description
private static void
blockMult(long[] st, long[] subH)

public GHASH
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.

pack-priv byte[]
pack-priv int
doFinal(ByteBuffer src, int inLen)

pack-priv int
doFinal(byte[] in, int inOfs, int inLen)

public int
doFinal(byte[] in, int inOfs, int inLen, byte[] out, int outOfs)

Implements com.sun.crypto.provider.GCM.doFinal.

public int
private static void
ghashRangeCheck(byte[] in, int inOfs, int inLen, long[] st, long[] subH)

private static void
processBlock(byte[] data, int ofs, long[] st, long[] subH)

private static void
processBlocks(byte[] data, int inOfs, int blocks, long[] st, long[] subH)

private void
pack-priv int
update(byte[] in)

pack-priv int
update(byte[] in, int inOfs, int inLen)

pack-priv int
update(ByteBuffer ct, int inLen)

public int
update(byte[] in, int inOfs, int inLen, byte[] out, int outOfs)

Implements com.sun.crypto.provider.GCM.update.

None of the out or dst values are necessary, they are to satisfy the GCM interface requirement

public int
update(byte[] in, int inOfs, int inLen, ByteBuffer dst)

Implements com.sun.crypto.provider.GCM.update.

public int
Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

AES_BLOCK_SIZEback to summary
private static final int AES_BLOCK_SIZE
asLongViewback to summary
private static final VarHandle asLongView
MAX_LENback to summary
private static final int MAX_LEN
stateback to summary
private final long[] state
subkeyHtblback to summary
private final long[] subkeyHtbl

Constructor Detail

GHASHback to summary
pack-priv GHASH(byte[] subkeyH) throws ProviderException

Initializes the cipher in the specified mode with the given key and iv.

Parameters
subkeyH:byte[]

the hash subkey

Exceptions
ProviderException:
if the given key is inappropriate for initializing this digest
GHASHback to summary
private GHASH(GHASH g)

Method Detail

blockMultback to summary
private static void blockMult(long[] st, long[] subH)
cloneback to summary
public GHASH clone()

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Annotations
@Override
digestback to summary
pack-priv byte[] digest()
doFinalback to summary
pack-priv int doFinal(ByteBuffer src, int inLen)
doFinalback to summary
pack-priv int doFinal(byte[] in, int inOfs, int inLen)
doFinalback to summary
public int doFinal(byte[] in, int inOfs, int inLen, byte[] out, int outOfs)

Implements com.sun.crypto.provider.GCM.doFinal.

Annotations
@Override
doFinalback to summary
public int doFinal(ByteBuffer src, ByteBuffer dst)

Implements com.sun.crypto.provider.GCM.doFinal.

Annotations
@Override
ghashRangeCheckback to summary
private static void ghashRangeCheck(byte[] in, int inOfs, int inLen, long[] st, long[] subH)
processBlockback to summary
private static void processBlock(byte[] data, int ofs, long[] st, long[] subH)
processBlocksback to summary
private static void processBlocks(byte[] data, int inOfs, int blocks, long[] st, long[] subH)
Annotations
@IntrinsicCandidate
processBlocksDirectback to summary
private void processBlocksDirect(ByteBuffer ct, int inLen)
updateback to summary
pack-priv int update(byte[] in)
updateback to summary
pack-priv int update(byte[] in, int inOfs, int inLen)
updateback to summary
pack-priv int update(ByteBuffer ct, int inLen)
updateback to summary
public int update(byte[] in, int inOfs, int inLen, byte[] out, int outOfs)

Implements com.sun.crypto.provider.GCM.update.

None of the out or dst values are necessary, they are to satisfy the GCM interface requirement

Annotations
@Override
updateback to summary
public int update(byte[] in, int inOfs, int inLen, ByteBuffer dst)

Implements com.sun.crypto.provider.GCM.update.

Annotations
@Override
updateback to summary
public int update(ByteBuffer src, ByteBuffer dst)

Implements com.sun.crypto.provider.GCM.update.

Annotations
@Override