From 0dc381391aba31946133a44d8f5d2b02c3595c6e Mon Sep 17 00:00:00 2001 From: zylquinal Date: Wed, 19 Jun 2024 10:14:30 +0700 Subject: [PATCH] java 22 support --- build.gradle | 12 - .../com/zylquinal/argon2/api/ArgonDirect.java | 2 +- .../argon2/internal/Argon2_Context.java | 1055 +++-- .../argon2/internal/NativeUtils.java | 35 +- .../argon2/internal/RuntimeHelper.java | 256 -- .../zylquinal/argon2/internal/__fsid_t.java | 164 +- .../argon2/internal/allocate_fptr.java | 77 +- .../argon2/internal/argon2_context$0.java | 45 + .../argon2/internal/argon2_context$2.java | 14 - .../zylquinal/argon2/internal/argon2_h.java | 3437 ++++++++++++----- .../argon2/internal/constants$0.java | 31 - .../argon2/internal/constants$1.java | 53 - .../argon2/internal/constants$10.java | 35 - .../argon2/internal/constants$2.java | 18 - .../argon2/internal/constants$3.java | 18 - .../argon2/internal/constants$4.java | 18 - .../argon2/internal/constants$5.java | 46 - .../argon2/internal/constants$6.java | 45 - .../argon2/internal/constants$7.java | 50 - .../argon2/internal/constants$8.java | 39 - .../argon2/internal/constants$9.java | 38 - .../argon2/internal/deallocate_fptr.java | 76 +- .../argon2/internal/max_align_t.java | 131 +- src/main/java/module-info.java | 1 + 24 files changed, 3529 insertions(+), 2167 deletions(-) delete mode 100644 src/main/java/com/zylquinal/argon2/internal/RuntimeHelper.java create mode 100644 src/main/java/com/zylquinal/argon2/internal/argon2_context$0.java delete mode 100644 src/main/java/com/zylquinal/argon2/internal/argon2_context$2.java delete mode 100644 src/main/java/com/zylquinal/argon2/internal/constants$0.java delete mode 100644 src/main/java/com/zylquinal/argon2/internal/constants$1.java delete mode 100644 src/main/java/com/zylquinal/argon2/internal/constants$10.java delete mode 100644 src/main/java/com/zylquinal/argon2/internal/constants$2.java delete mode 100644 src/main/java/com/zylquinal/argon2/internal/constants$3.java delete mode 100644 src/main/java/com/zylquinal/argon2/internal/constants$4.java delete mode 100644 src/main/java/com/zylquinal/argon2/internal/constants$5.java delete mode 100644 src/main/java/com/zylquinal/argon2/internal/constants$6.java delete mode 100644 src/main/java/com/zylquinal/argon2/internal/constants$7.java delete mode 100644 src/main/java/com/zylquinal/argon2/internal/constants$8.java delete mode 100644 src/main/java/com/zylquinal/argon2/internal/constants$9.java diff --git a/build.gradle b/build.gradle index e809d7a..fe5efc3 100755 --- a/build.gradle +++ b/build.gradle @@ -18,18 +18,6 @@ dependencies { testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' } -tasks.withType(JavaCompile).configureEach { - options.compilerArgs += "--enable-preview" -} - -tasks.withType(Test).configureEach { - jvmArgs += "--enable-preview" -} - -tasks.withType(JavaExec).configureEach { - jvmArgs += "--enable-preview" -} - test { useJUnitPlatform() } \ No newline at end of file diff --git a/src/main/java/com/zylquinal/argon2/api/ArgonDirect.java b/src/main/java/com/zylquinal/argon2/api/ArgonDirect.java index e2defa6..8cd37c3 100644 --- a/src/main/java/com/zylquinal/argon2/api/ArgonDirect.java +++ b/src/main/java/com/zylquinal/argon2/api/ArgonDirect.java @@ -74,7 +74,7 @@ public static byte[] rawHash(byte @NotNull [] password, byte @NotNull [] salt, b int memoryCost, int parallelism, int iterations, @NotNull ArgonVersion version, @NotNull ArgonFlag flag, @NotNull ArgonVariant variant) { try (Arena arena = Arena.ofConfined()) { MemorySegment struct = Argon2_Context.layout(password, salt, secret, associatedData, hashLength, memoryCost, parallelism, iterations, version, flag, arena); - MemorySegment outAddress = Argon2_Context.out$get(struct); + MemorySegment outAddress = Argon2_Context.out(struct); int result = argon2_h.argon2_ctx(struct, variant.variant()); if (result != 0) throw new ArgonException(ArgonStatus.of(result)); return outAddress.asSlice(0, hashLength).toArray(ValueLayout.OfByte.JAVA_BYTE); diff --git a/src/main/java/com/zylquinal/argon2/internal/Argon2_Context.java b/src/main/java/com/zylquinal/argon2/internal/Argon2_Context.java index 62bf7c3..79ba2c5 100644 --- a/src/main/java/com/zylquinal/argon2/internal/Argon2_Context.java +++ b/src/main/java/com/zylquinal/argon2/internal/Argon2_Context.java @@ -1,26 +1,33 @@ +// Generated by jextract + package com.zylquinal.argon2.internal; import com.zylquinal.argon2.api.enumeration.ArgonFlag; import com.zylquinal.argon2.api.enumeration.ArgonVersion; import org.jetbrains.annotations.NotNull; -import java.lang.foreign.Arena; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.invoke.VarHandle; +import java.lang.invoke.*; +import java.lang.foreign.*; +import java.nio.ByteOrder; +import java.util.*; +import java.util.function.*; +import java.util.stream.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; + /** - * {@snippet : + * {@snippet lang = c: * struct Argon2_Context { - * uint8_t* out; + * uint8_t *out; * uint32_t outlen; - * uint8_t* pwd; + * uint8_t *pwd; * uint32_t pwdlen; - * uint8_t* salt; + * uint8_t *salt; * uint32_t saltlen; - * uint8_t* secret; + * uint8_t *secret; * uint32_t secretlen; - * uint8_t* ad; + * uint8_t *ad; * uint32_t adlen; * uint32_t t_cost; * uint32_t m_cost; @@ -30,27 +37,77 @@ * allocate_fptr allocate_cbk; * deallocate_fptr free_cbk; * uint32_t flags; - * }; * } + *} */ public class Argon2_Context { - /** - * Creates a MemorySegment of {@link Argon2_Context#$LAYOUT()}. - * - * @param password the password to hash - * @param salt the salt to use - * @param secret the secret to use - * @param associatedData the associated data to use - * @param hashLength the length of the hash - * @param memoryCost the memory cost - * @param parallelism the parallelism - * @param iterations the iterations - * @param version the version to use - * @param flag the flag to use - * @param arena the arena to use - * @return the {@link MemorySegment} of {@link Argon2_Context#$LAYOUT()} - */ + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + argon2_h.C_POINTER.withName("out"), + argon2_h.C_INT.withName("outlen"), + MemoryLayout.paddingLayout(4), + argon2_h.C_POINTER.withName("pwd"), + argon2_h.C_INT.withName("pwdlen"), + MemoryLayout.paddingLayout(4), + argon2_h.C_POINTER.withName("salt"), + argon2_h.C_INT.withName("saltlen"), + MemoryLayout.paddingLayout(4), + argon2_h.C_POINTER.withName("secret"), + argon2_h.C_INT.withName("secretlen"), + MemoryLayout.paddingLayout(4), + argon2_h.C_POINTER.withName("ad"), + argon2_h.C_INT.withName("adlen"), + argon2_h.C_INT.withName("t_cost"), + argon2_h.C_INT.withName("m_cost"), + argon2_h.C_INT.withName("lanes"), + argon2_h.C_INT.withName("threads"), + argon2_h.C_INT.withName("version"), + argon2_h.C_POINTER.withName("allocate_cbk"), + argon2_h.C_POINTER.withName("free_cbk"), + argon2_h.C_INT.withName("flags"), + MemoryLayout.paddingLayout(4) + ).withName("Argon2_Context"); + private static final AddressLayout out$LAYOUT = (AddressLayout) $LAYOUT.select(groupElement("out")); + private static final long out$OFFSET = 0; + private static final OfInt outlen$LAYOUT = (OfInt) $LAYOUT.select(groupElement("outlen")); + private static final long outlen$OFFSET = 8; + private static final AddressLayout pwd$LAYOUT = (AddressLayout) $LAYOUT.select(groupElement("pwd")); + private static final long pwd$OFFSET = 16; + private static final OfInt pwdlen$LAYOUT = (OfInt) $LAYOUT.select(groupElement("pwdlen")); + private static final long pwdlen$OFFSET = 24; + private static final AddressLayout salt$LAYOUT = (AddressLayout) $LAYOUT.select(groupElement("salt")); + private static final long salt$OFFSET = 32; + private static final OfInt saltlen$LAYOUT = (OfInt) $LAYOUT.select(groupElement("saltlen")); + private static final long saltlen$OFFSET = 40; + private static final AddressLayout secret$LAYOUT = (AddressLayout) $LAYOUT.select(groupElement("secret")); + private static final long secret$OFFSET = 48; + private static final OfInt secretlen$LAYOUT = (OfInt) $LAYOUT.select(groupElement("secretlen")); + private static final long secretlen$OFFSET = 56; + private static final AddressLayout ad$LAYOUT = (AddressLayout) $LAYOUT.select(groupElement("ad")); + private static final long ad$OFFSET = 64; + private static final OfInt adlen$LAYOUT = (OfInt) $LAYOUT.select(groupElement("adlen")); + private static final long adlen$OFFSET = 72; + private static final OfInt t_cost$LAYOUT = (OfInt) $LAYOUT.select(groupElement("t_cost")); + private static final long t_cost$OFFSET = 76; + private static final OfInt m_cost$LAYOUT = (OfInt) $LAYOUT.select(groupElement("m_cost")); + private static final long m_cost$OFFSET = 80; + private static final OfInt lanes$LAYOUT = (OfInt) $LAYOUT.select(groupElement("lanes")); + private static final long lanes$OFFSET = 84; + private static final OfInt threads$LAYOUT = (OfInt) $LAYOUT.select(groupElement("threads")); + private static final long threads$OFFSET = 88; + private static final OfInt version$LAYOUT = (OfInt) $LAYOUT.select(groupElement("version")); + private static final long version$OFFSET = 92; + private static final AddressLayout allocate_cbk$LAYOUT = (AddressLayout) $LAYOUT.select(groupElement("allocate_cbk")); + private static final long allocate_cbk$OFFSET = 96; + private static final AddressLayout free_cbk$LAYOUT = (AddressLayout) $LAYOUT.select(groupElement("free_cbk")); + private static final long free_cbk$OFFSET = 104; + private static final OfInt flags$LAYOUT = (OfInt) $LAYOUT.select(groupElement("flags")); + private static final long flags$OFFSET = 112; + + Argon2_Context() { + // Should not be called directly + } + public static MemorySegment layout(byte @NotNull [] password, byte @NotNull [] salt, byte[] secret, byte[] associatedData, int hashLength, int memoryCost, int parallelism, int iterations, @NotNull ArgonVersion version, @NotNull ArgonFlag flag, Arena arena) { @@ -65,527 +122,797 @@ public static MemorySegment layout(byte @NotNull [] password, byte @NotNull [] s if (secret != null) secretPtr.copyFrom(MemorySegment.ofArray(secret)); if (associatedData != null) associatedDataPtr.copyFrom(MemorySegment.ofArray(associatedData)); - MemorySegment struct = arena.allocate(Argon2_Context.$LAYOUT()); - Argon2_Context.pwd$set(struct, passwordPtr); - Argon2_Context.pwdlen$set(struct, password.length); - Argon2_Context.salt$set(struct, saltPtr); - Argon2_Context.saltlen$set(struct, salt.length); - Argon2_Context.secret$set(struct, secretPtr); - Argon2_Context.secretlen$set(struct, secret == null ? 0 : secret.length); - Argon2_Context.ad$set(struct, associatedDataPtr); - Argon2_Context.adlen$set(struct, associatedData == null ? 0 : associatedData.length); - Argon2_Context.out$set(struct, outPtr); - Argon2_Context.outlen$set(struct, hashLength); - Argon2_Context.t_cost$set(struct, iterations); - Argon2_Context.m_cost$set(struct, memoryCost); - Argon2_Context.lanes$set(struct, parallelism); - Argon2_Context.threads$set(struct, parallelism); - Argon2_Context.version$set(struct, version.version()); - Argon2_Context.flags$set(struct, flag.value()); + MemorySegment struct = arena.allocate(Argon2_Context.layout()); + Argon2_Context.pwd(struct, passwordPtr); + Argon2_Context.pwdlen(struct, password.length); + Argon2_Context.salt(struct, saltPtr); + Argon2_Context.saltlen(struct, salt.length); + Argon2_Context.secret(struct, secretPtr); + Argon2_Context.secretlen(struct, secret == null ? 0 : secret.length); + Argon2_Context.ad(struct, associatedDataPtr); + Argon2_Context.adlen(struct, associatedData == null ? 0 : associatedData.length); + Argon2_Context.out(struct, outPtr); + Argon2_Context.outlen(struct, hashLength); + Argon2_Context.t_cost(struct, iterations); + Argon2_Context.m_cost(struct, memoryCost); + Argon2_Context.lanes(struct, parallelism); + Argon2_Context.threads(struct, parallelism); + Argon2_Context.version(struct, version.version()); + Argon2_Context.flags(struct, flag.value()); return struct; } - public static MemoryLayout $LAYOUT() { - return constants$1.const$5; + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; } - public static VarHandle out$VH() { - return constants$2.const$0; + + /** + * Layout for field: + * {@snippet lang = c: + * uint8_t *out + *} + */ + public static final AddressLayout out$layout() { + return out$LAYOUT; } + + /** + * Offset for field: + * {@snippet lang = c: + * uint8_t *out + *} + */ + public static final long out$offset() { + return out$OFFSET; + } + /** * Getter for field: - * {@snippet : - * uint8_t* out; - * } + * {@snippet lang = c: + * uint8_t *out + *} */ - public static MemorySegment out$get(MemorySegment seg) { - return (MemorySegment)constants$2.const$0.get(seg); + public static MemorySegment out(MemorySegment struct) { + return struct.get(out$LAYOUT, out$OFFSET); } + /** * Setter for field: - * {@snippet : - * uint8_t* out; - * } + * {@snippet lang = c: + * uint8_t *out + *} */ - public static void out$set(MemorySegment seg, MemorySegment x) { - constants$2.const$0.set(seg, x); + public static void out(MemorySegment struct, MemorySegment fieldValue) { + struct.set(out$LAYOUT, out$OFFSET, fieldValue); } - public static MemorySegment out$get(MemorySegment seg, long index) { - return (MemorySegment)constants$2.const$0.get(seg.asSlice(index*sizeof())); - } - public static void out$set(MemorySegment seg, long index, MemorySegment x) { - constants$2.const$0.set(seg.asSlice(index*sizeof()), x); + + /** + * Layout for field: + * {@snippet lang = c: + * uint32_t outlen + *} + */ + public static final OfInt outlen$layout() { + return outlen$LAYOUT; } - public static VarHandle outlen$VH() { - return constants$2.const$1; + + /** + * Offset for field: + * {@snippet lang = c: + * uint32_t outlen + *} + */ + public static final long outlen$offset() { + return outlen$OFFSET; } + /** * Getter for field: - * {@snippet : - * uint32_t outlen; - * } + * {@snippet lang = c: + * uint32_t outlen + *} */ - public static int outlen$get(MemorySegment seg) { - return (int)constants$2.const$1.get(seg); + public static int outlen(MemorySegment struct) { + return struct.get(outlen$LAYOUT, outlen$OFFSET); } + /** * Setter for field: - * {@snippet : - * uint32_t outlen; - * } + * {@snippet lang = c: + * uint32_t outlen + *} */ - public static void outlen$set(MemorySegment seg, int x) { - constants$2.const$1.set(seg, x); + public static void outlen(MemorySegment struct, int fieldValue) { + struct.set(outlen$LAYOUT, outlen$OFFSET, fieldValue); } - public static int outlen$get(MemorySegment seg, long index) { - return (int)constants$2.const$1.get(seg.asSlice(index*sizeof())); - } - public static void outlen$set(MemorySegment seg, long index, int x) { - constants$2.const$1.set(seg.asSlice(index*sizeof()), x); + + /** + * Layout for field: + * {@snippet lang = c: + * uint8_t *pwd + *} + */ + public static final AddressLayout pwd$layout() { + return pwd$LAYOUT; } - public static VarHandle pwd$VH() { - return constants$2.const$2; + + /** + * Offset for field: + * {@snippet lang = c: + * uint8_t *pwd + *} + */ + public static final long pwd$offset() { + return pwd$OFFSET; } + /** * Getter for field: - * {@snippet : - * uint8_t* pwd; - * } + * {@snippet lang = c: + * uint8_t *pwd + *} */ - public static MemorySegment pwd$get(MemorySegment seg) { - return (MemorySegment)constants$2.const$2.get(seg); + public static MemorySegment pwd(MemorySegment struct) { + return struct.get(pwd$LAYOUT, pwd$OFFSET); } + /** * Setter for field: - * {@snippet : - * uint8_t* pwd; - * } + * {@snippet lang = c: + * uint8_t *pwd + *} */ - public static void pwd$set(MemorySegment seg, MemorySegment x) { - constants$2.const$2.set(seg, x); + public static void pwd(MemorySegment struct, MemorySegment fieldValue) { + struct.set(pwd$LAYOUT, pwd$OFFSET, fieldValue); } - public static MemorySegment pwd$get(MemorySegment seg, long index) { - return (MemorySegment)constants$2.const$2.get(seg.asSlice(index*sizeof())); - } - public static void pwd$set(MemorySegment seg, long index, MemorySegment x) { - constants$2.const$2.set(seg.asSlice(index*sizeof()), x); + + /** + * Layout for field: + * {@snippet lang = c: + * uint32_t pwdlen + *} + */ + public static final OfInt pwdlen$layout() { + return pwdlen$LAYOUT; } - public static VarHandle pwdlen$VH() { - return constants$2.const$3; + + /** + * Offset for field: + * {@snippet lang = c: + * uint32_t pwdlen + *} + */ + public static final long pwdlen$offset() { + return pwdlen$OFFSET; } + /** * Getter for field: - * {@snippet : - * uint32_t pwdlen; - * } + * {@snippet lang = c: + * uint32_t pwdlen + *} */ - public static int pwdlen$get(MemorySegment seg) { - return (int)constants$2.const$3.get(seg); + public static int pwdlen(MemorySegment struct) { + return struct.get(pwdlen$LAYOUT, pwdlen$OFFSET); } + /** * Setter for field: - * {@snippet : - * uint32_t pwdlen; - * } + * {@snippet lang = c: + * uint32_t pwdlen + *} */ - public static void pwdlen$set(MemorySegment seg, int x) { - constants$2.const$3.set(seg, x); + public static void pwdlen(MemorySegment struct, int fieldValue) { + struct.set(pwdlen$LAYOUT, pwdlen$OFFSET, fieldValue); } - public static int pwdlen$get(MemorySegment seg, long index) { - return (int)constants$2.const$3.get(seg.asSlice(index*sizeof())); - } - public static void pwdlen$set(MemorySegment seg, long index, int x) { - constants$2.const$3.set(seg.asSlice(index*sizeof()), x); + + /** + * Layout for field: + * {@snippet lang = c: + * uint8_t *salt + *} + */ + public static final AddressLayout salt$layout() { + return salt$LAYOUT; } - public static VarHandle salt$VH() { - return constants$2.const$4; + + /** + * Offset for field: + * {@snippet lang = c: + * uint8_t *salt + *} + */ + public static final long salt$offset() { + return salt$OFFSET; } + /** * Getter for field: - * {@snippet : - * uint8_t* salt; - * } + * {@snippet lang = c: + * uint8_t *salt + *} */ - public static MemorySegment salt$get(MemorySegment seg) { - return (MemorySegment)constants$2.const$4.get(seg); + public static MemorySegment salt(MemorySegment struct) { + return struct.get(salt$LAYOUT, salt$OFFSET); } + /** * Setter for field: - * {@snippet : - * uint8_t* salt; - * } + * {@snippet lang = c: + * uint8_t *salt + *} */ - public static void salt$set(MemorySegment seg, MemorySegment x) { - constants$2.const$4.set(seg, x); - } - public static MemorySegment salt$get(MemorySegment seg, long index) { - return (MemorySegment)constants$2.const$4.get(seg.asSlice(index*sizeof())); + public static void salt(MemorySegment struct, MemorySegment fieldValue) { + struct.set(salt$LAYOUT, salt$OFFSET, fieldValue); } - public static void salt$set(MemorySegment seg, long index, MemorySegment x) { - constants$2.const$4.set(seg.asSlice(index*sizeof()), x); + + /** + * Layout for field: + * {@snippet lang = c: + * uint32_t saltlen + *} + */ + public static final OfInt saltlen$layout() { + return saltlen$LAYOUT; } - public static VarHandle saltlen$VH() { - return constants$2.const$5; + + /** + * Offset for field: + * {@snippet lang = c: + * uint32_t saltlen + *} + */ + public static final long saltlen$offset() { + return saltlen$OFFSET; } + /** * Getter for field: - * {@snippet : - * uint32_t saltlen; - * } + * {@snippet lang = c: + * uint32_t saltlen + *} */ - public static int saltlen$get(MemorySegment seg) { - return (int)constants$2.const$5.get(seg); + public static int saltlen(MemorySegment struct) { + return struct.get(saltlen$LAYOUT, saltlen$OFFSET); } + /** * Setter for field: - * {@snippet : - * uint32_t saltlen; - * } + * {@snippet lang = c: + * uint32_t saltlen + *} */ - public static void saltlen$set(MemorySegment seg, int x) { - constants$2.const$5.set(seg, x); - } - public static int saltlen$get(MemorySegment seg, long index) { - return (int)constants$2.const$5.get(seg.asSlice(index*sizeof())); + public static void saltlen(MemorySegment struct, int fieldValue) { + struct.set(saltlen$LAYOUT, saltlen$OFFSET, fieldValue); } - public static void saltlen$set(MemorySegment seg, long index, int x) { - constants$2.const$5.set(seg.asSlice(index*sizeof()), x); + + /** + * Layout for field: + * {@snippet lang = c: + * uint8_t *secret + *} + */ + public static final AddressLayout secret$layout() { + return secret$LAYOUT; } - public static VarHandle secret$VH() { - return constants$3.const$0; + + /** + * Offset for field: + * {@snippet lang = c: + * uint8_t *secret + *} + */ + public static final long secret$offset() { + return secret$OFFSET; } + /** * Getter for field: - * {@snippet : - * uint8_t* secret; - * } + * {@snippet lang = c: + * uint8_t *secret + *} */ - public static MemorySegment secret$get(MemorySegment seg) { - return (MemorySegment)constants$3.const$0.get(seg); + public static MemorySegment secret(MemorySegment struct) { + return struct.get(secret$LAYOUT, secret$OFFSET); } + /** * Setter for field: - * {@snippet : - * uint8_t* secret; - * } + * {@snippet lang = c: + * uint8_t *secret + *} */ - public static void secret$set(MemorySegment seg, MemorySegment x) { - constants$3.const$0.set(seg, x); - } - public static MemorySegment secret$get(MemorySegment seg, long index) { - return (MemorySegment)constants$3.const$0.get(seg.asSlice(index*sizeof())); + public static void secret(MemorySegment struct, MemorySegment fieldValue) { + struct.set(secret$LAYOUT, secret$OFFSET, fieldValue); } - public static void secret$set(MemorySegment seg, long index, MemorySegment x) { - constants$3.const$0.set(seg.asSlice(index*sizeof()), x); + + /** + * Layout for field: + * {@snippet lang = c: + * uint32_t secretlen + *} + */ + public static final OfInt secretlen$layout() { + return secretlen$LAYOUT; } - public static VarHandle secretlen$VH() { - return constants$3.const$1; + + /** + * Offset for field: + * {@snippet lang = c: + * uint32_t secretlen + *} + */ + public static final long secretlen$offset() { + return secretlen$OFFSET; } + /** * Getter for field: - * {@snippet : - * uint32_t secretlen; - * } + * {@snippet lang = c: + * uint32_t secretlen + *} */ - public static int secretlen$get(MemorySegment seg) { - return (int)constants$3.const$1.get(seg); + public static int secretlen(MemorySegment struct) { + return struct.get(secretlen$LAYOUT, secretlen$OFFSET); } + /** * Setter for field: - * {@snippet : - * uint32_t secretlen; - * } + * {@snippet lang = c: + * uint32_t secretlen + *} */ - public static void secretlen$set(MemorySegment seg, int x) { - constants$3.const$1.set(seg, x); - } - public static int secretlen$get(MemorySegment seg, long index) { - return (int)constants$3.const$1.get(seg.asSlice(index*sizeof())); + public static void secretlen(MemorySegment struct, int fieldValue) { + struct.set(secretlen$LAYOUT, secretlen$OFFSET, fieldValue); } - public static void secretlen$set(MemorySegment seg, long index, int x) { - constants$3.const$1.set(seg.asSlice(index*sizeof()), x); + + /** + * Layout for field: + * {@snippet lang = c: + * uint8_t *ad + *} + */ + public static final AddressLayout ad$layout() { + return ad$LAYOUT; } - public static VarHandle ad$VH() { - return constants$3.const$2; + + /** + * Offset for field: + * {@snippet lang = c: + * uint8_t *ad + *} + */ + public static final long ad$offset() { + return ad$OFFSET; } + /** * Getter for field: - * {@snippet : - * uint8_t* ad; - * } + * {@snippet lang = c: + * uint8_t *ad + *} */ - public static MemorySegment ad$get(MemorySegment seg) { - return (MemorySegment)constants$3.const$2.get(seg); + public static MemorySegment ad(MemorySegment struct) { + return struct.get(ad$LAYOUT, ad$OFFSET); } + /** * Setter for field: - * {@snippet : - * uint8_t* ad; - * } + * {@snippet lang = c: + * uint8_t *ad + *} */ - public static void ad$set(MemorySegment seg, MemorySegment x) { - constants$3.const$2.set(seg, x); - } - public static MemorySegment ad$get(MemorySegment seg, long index) { - return (MemorySegment)constants$3.const$2.get(seg.asSlice(index*sizeof())); + public static void ad(MemorySegment struct, MemorySegment fieldValue) { + struct.set(ad$LAYOUT, ad$OFFSET, fieldValue); } - public static void ad$set(MemorySegment seg, long index, MemorySegment x) { - constants$3.const$2.set(seg.asSlice(index*sizeof()), x); + + /** + * Layout for field: + * {@snippet lang = c: + * uint32_t adlen + *} + */ + public static final OfInt adlen$layout() { + return adlen$LAYOUT; } - public static VarHandle adlen$VH() { - return constants$3.const$3; + + /** + * Offset for field: + * {@snippet lang = c: + * uint32_t adlen + *} + */ + public static final long adlen$offset() { + return adlen$OFFSET; } + /** * Getter for field: - * {@snippet : - * uint32_t adlen; - * } + * {@snippet lang = c: + * uint32_t adlen + *} */ - public static int adlen$get(MemorySegment seg) { - return (int)constants$3.const$3.get(seg); + public static int adlen(MemorySegment struct) { + return struct.get(adlen$LAYOUT, adlen$OFFSET); } + /** * Setter for field: - * {@snippet : - * uint32_t adlen; - * } + * {@snippet lang = c: + * uint32_t adlen + *} */ - public static void adlen$set(MemorySegment seg, int x) { - constants$3.const$3.set(seg, x); + public static void adlen(MemorySegment struct, int fieldValue) { + struct.set(adlen$LAYOUT, adlen$OFFSET, fieldValue); } - public static int adlen$get(MemorySegment seg, long index) { - return (int)constants$3.const$3.get(seg.asSlice(index*sizeof())); - } - public static void adlen$set(MemorySegment seg, long index, int x) { - constants$3.const$3.set(seg.asSlice(index*sizeof()), x); + + /** + * Layout for field: + * {@snippet lang = c: + * uint32_t t_cost + *} + */ + public static final OfInt t_cost$layout() { + return t_cost$LAYOUT; } - public static VarHandle t_cost$VH() { - return constants$3.const$4; + + /** + * Offset for field: + * {@snippet lang = c: + * uint32_t t_cost + *} + */ + public static final long t_cost$offset() { + return t_cost$OFFSET; } + /** * Getter for field: - * {@snippet : - * uint32_t t_cost; - * } + * {@snippet lang = c: + * uint32_t t_cost + *} */ - public static int t_cost$get(MemorySegment seg) { - return (int)constants$3.const$4.get(seg); + public static int t_cost(MemorySegment struct) { + return struct.get(t_cost$LAYOUT, t_cost$OFFSET); } + /** * Setter for field: - * {@snippet : - * uint32_t t_cost; - * } + * {@snippet lang = c: + * uint32_t t_cost + *} */ - public static void t_cost$set(MemorySegment seg, int x) { - constants$3.const$4.set(seg, x); - } - public static int t_cost$get(MemorySegment seg, long index) { - return (int)constants$3.const$4.get(seg.asSlice(index*sizeof())); + public static void t_cost(MemorySegment struct, int fieldValue) { + struct.set(t_cost$LAYOUT, t_cost$OFFSET, fieldValue); } - public static void t_cost$set(MemorySegment seg, long index, int x) { - constants$3.const$4.set(seg.asSlice(index*sizeof()), x); + + /** + * Layout for field: + * {@snippet lang = c: + * uint32_t m_cost + *} + */ + public static final OfInt m_cost$layout() { + return m_cost$LAYOUT; } - public static VarHandle m_cost$VH() { - return constants$3.const$5; + + /** + * Offset for field: + * {@snippet lang = c: + * uint32_t m_cost + *} + */ + public static final long m_cost$offset() { + return m_cost$OFFSET; } + /** * Getter for field: - * {@snippet : - * uint32_t m_cost; - * } + * {@snippet lang = c: + * uint32_t m_cost + *} */ - public static int m_cost$get(MemorySegment seg) { - return (int)constants$3.const$5.get(seg); + public static int m_cost(MemorySegment struct) { + return struct.get(m_cost$LAYOUT, m_cost$OFFSET); } + /** * Setter for field: - * {@snippet : - * uint32_t m_cost; - * } + * {@snippet lang = c: + * uint32_t m_cost + *} */ - public static void m_cost$set(MemorySegment seg, int x) { - constants$3.const$5.set(seg, x); - } - public static int m_cost$get(MemorySegment seg, long index) { - return (int)constants$3.const$5.get(seg.asSlice(index*sizeof())); + public static void m_cost(MemorySegment struct, int fieldValue) { + struct.set(m_cost$LAYOUT, m_cost$OFFSET, fieldValue); } - public static void m_cost$set(MemorySegment seg, long index, int x) { - constants$3.const$5.set(seg.asSlice(index*sizeof()), x); + + /** + * Layout for field: + * {@snippet lang = c: + * uint32_t lanes + *} + */ + public static final OfInt lanes$layout() { + return lanes$LAYOUT; } - public static VarHandle lanes$VH() { - return constants$4.const$0; + + /** + * Offset for field: + * {@snippet lang = c: + * uint32_t lanes + *} + */ + public static final long lanes$offset() { + return lanes$OFFSET; } + /** * Getter for field: - * {@snippet : - * uint32_t lanes; - * } + * {@snippet lang = c: + * uint32_t lanes + *} */ - public static int lanes$get(MemorySegment seg) { - return (int)constants$4.const$0.get(seg); + public static int lanes(MemorySegment struct) { + return struct.get(lanes$LAYOUT, lanes$OFFSET); } + /** * Setter for field: - * {@snippet : - * uint32_t lanes; - * } + * {@snippet lang = c: + * uint32_t lanes + *} */ - public static void lanes$set(MemorySegment seg, int x) { - constants$4.const$0.set(seg, x); - } - public static int lanes$get(MemorySegment seg, long index) { - return (int)constants$4.const$0.get(seg.asSlice(index*sizeof())); + public static void lanes(MemorySegment struct, int fieldValue) { + struct.set(lanes$LAYOUT, lanes$OFFSET, fieldValue); } - public static void lanes$set(MemorySegment seg, long index, int x) { - constants$4.const$0.set(seg.asSlice(index*sizeof()), x); + + /** + * Layout for field: + * {@snippet lang = c: + * uint32_t threads + *} + */ + public static final OfInt threads$layout() { + return threads$LAYOUT; } - public static VarHandle threads$VH() { - return constants$4.const$1; + + /** + * Offset for field: + * {@snippet lang = c: + * uint32_t threads + *} + */ + public static final long threads$offset() { + return threads$OFFSET; } + /** * Getter for field: - * {@snippet : - * uint32_t threads; - * } + * {@snippet lang = c: + * uint32_t threads + *} */ - public static int threads$get(MemorySegment seg) { - return (int)constants$4.const$1.get(seg); + public static int threads(MemorySegment struct) { + return struct.get(threads$LAYOUT, threads$OFFSET); } + /** * Setter for field: - * {@snippet : - * uint32_t threads; - * } + * {@snippet lang = c: + * uint32_t threads + *} */ - public static void threads$set(MemorySegment seg, int x) { - constants$4.const$1.set(seg, x); - } - public static int threads$get(MemorySegment seg, long index) { - return (int)constants$4.const$1.get(seg.asSlice(index*sizeof())); + public static void threads(MemorySegment struct, int fieldValue) { + struct.set(threads$LAYOUT, threads$OFFSET, fieldValue); } - public static void threads$set(MemorySegment seg, long index, int x) { - constants$4.const$1.set(seg.asSlice(index*sizeof()), x); + + /** + * Layout for field: + * {@snippet lang = c: + * uint32_t version + *} + */ + public static final OfInt version$layout() { + return version$LAYOUT; } - public static VarHandle version$VH() { - return constants$4.const$2; + + /** + * Offset for field: + * {@snippet lang = c: + * uint32_t version + *} + */ + public static final long version$offset() { + return version$OFFSET; } + /** * Getter for field: - * {@snippet : - * uint32_t version; - * } + * {@snippet lang = c: + * uint32_t version + *} */ - public static int version$get(MemorySegment seg) { - return (int)constants$4.const$2.get(seg); + public static int version(MemorySegment struct) { + return struct.get(version$LAYOUT, version$OFFSET); } + /** * Setter for field: - * {@snippet : - * uint32_t version; - * } + * {@snippet lang = c: + * uint32_t version + *} */ - public static void version$set(MemorySegment seg, int x) { - constants$4.const$2.set(seg, x); - } - public static int version$get(MemorySegment seg, long index) { - return (int)constants$4.const$2.get(seg.asSlice(index*sizeof())); + public static void version(MemorySegment struct, int fieldValue) { + struct.set(version$LAYOUT, version$OFFSET, fieldValue); } - public static void version$set(MemorySegment seg, long index, int x) { - constants$4.const$2.set(seg.asSlice(index*sizeof()), x); + + /** + * Layout for field: + * {@snippet lang = c: + * allocate_fptr allocate_cbk + *} + */ + public static final AddressLayout allocate_cbk$layout() { + return allocate_cbk$LAYOUT; } - public static VarHandle allocate_cbk$VH() { - return constants$4.const$3; + + /** + * Offset for field: + * {@snippet lang = c: + * allocate_fptr allocate_cbk + *} + */ + public static final long allocate_cbk$offset() { + return allocate_cbk$OFFSET; } + /** * Getter for field: - * {@snippet : - * allocate_fptr allocate_cbk; - * } + * {@snippet lang = c: + * allocate_fptr allocate_cbk + *} */ - public static MemorySegment allocate_cbk$get(MemorySegment seg) { - return (MemorySegment)constants$4.const$3.get(seg); + public static MemorySegment allocate_cbk(MemorySegment struct) { + return struct.get(allocate_cbk$LAYOUT, allocate_cbk$OFFSET); } + /** * Setter for field: - * {@snippet : - * allocate_fptr allocate_cbk; - * } + * {@snippet lang = c: + * allocate_fptr allocate_cbk + *} */ - public static void allocate_cbk$set(MemorySegment seg, MemorySegment x) { - constants$4.const$3.set(seg, x); + public static void allocate_cbk(MemorySegment struct, MemorySegment fieldValue) { + struct.set(allocate_cbk$LAYOUT, allocate_cbk$OFFSET, fieldValue); } - public static MemorySegment allocate_cbk$get(MemorySegment seg, long index) { - return (MemorySegment)constants$4.const$3.get(seg.asSlice(index*sizeof())); - } - public static void allocate_cbk$set(MemorySegment seg, long index, MemorySegment x) { - constants$4.const$3.set(seg.asSlice(index*sizeof()), x); - } - public static allocate_fptr allocate_cbk(MemorySegment segment, Arena scope) { - return allocate_fptr.ofAddress(allocate_cbk$get(segment), scope); + + /** + * Layout for field: + * {@snippet lang = c: + * deallocate_fptr free_cbk + *} + */ + public static final AddressLayout free_cbk$layout() { + return free_cbk$LAYOUT; } - public static VarHandle free_cbk$VH() { - return constants$4.const$4; + + /** + * Offset for field: + * {@snippet lang = c: + * deallocate_fptr free_cbk + *} + */ + public static final long free_cbk$offset() { + return free_cbk$OFFSET; } + /** * Getter for field: - * {@snippet : - * deallocate_fptr free_cbk; - * } + * {@snippet lang = c: + * deallocate_fptr free_cbk + *} */ - public static MemorySegment free_cbk$get(MemorySegment seg) { - return (MemorySegment)constants$4.const$4.get(seg); + public static MemorySegment free_cbk(MemorySegment struct) { + return struct.get(free_cbk$LAYOUT, free_cbk$OFFSET); } + /** * Setter for field: - * {@snippet : - * deallocate_fptr free_cbk; - * } + * {@snippet lang = c: + * deallocate_fptr free_cbk + *} */ - public static void free_cbk$set(MemorySegment seg, MemorySegment x) { - constants$4.const$4.set(seg, x); - } - public static MemorySegment free_cbk$get(MemorySegment seg, long index) { - return (MemorySegment)constants$4.const$4.get(seg.asSlice(index*sizeof())); - } - public static void free_cbk$set(MemorySegment seg, long index, MemorySegment x) { - constants$4.const$4.set(seg.asSlice(index*sizeof()), x); + public static void free_cbk(MemorySegment struct, MemorySegment fieldValue) { + struct.set(free_cbk$LAYOUT, free_cbk$OFFSET, fieldValue); } - public static deallocate_fptr free_cbk(MemorySegment segment, Arena scope) { - return deallocate_fptr.ofAddress(free_cbk$get(segment), scope); + + /** + * Layout for field: + * {@snippet lang = c: + * uint32_t flags + *} + */ + public static final OfInt flags$layout() { + return flags$LAYOUT; } - public static VarHandle flags$VH() { - return constants$4.const$5; + + /** + * Offset for field: + * {@snippet lang = c: + * uint32_t flags + *} + */ + public static final long flags$offset() { + return flags$OFFSET; } + /** * Getter for field: - * {@snippet : - * uint32_t flags; - * } + * {@snippet lang = c: + * uint32_t flags + *} */ - public static int flags$get(MemorySegment seg) { - return (int)constants$4.const$5.get(seg); + public static int flags(MemorySegment struct) { + return struct.get(flags$LAYOUT, flags$OFFSET); } + /** * Setter for field: - * {@snippet : - * uint32_t flags; - * } + * {@snippet lang = c: + * uint32_t flags + *} */ - public static void flags$set(MemorySegment seg, int x) { - constants$4.const$5.set(seg, x); + public static void flags(MemorySegment struct, int fieldValue) { + struct.set(flags$LAYOUT, flags$OFFSET, fieldValue); } - public static int flags$get(MemorySegment seg, long index) { - return (int)constants$4.const$5.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void flags$set(MemorySegment seg, long index, int x) { - constants$4.const$5.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { + return layout().byteSize(); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static MemorySegment ofAddress(MemorySegment addr, Arena arena) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, arena); } -} + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); + } + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { + return reinterpret(addr, 1, arena, cleanup); + } + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); + } +} diff --git a/src/main/java/com/zylquinal/argon2/internal/NativeUtils.java b/src/main/java/com/zylquinal/argon2/internal/NativeUtils.java index a337fd4..0efffb6 100755 --- a/src/main/java/com/zylquinal/argon2/internal/NativeUtils.java +++ b/src/main/java/com/zylquinal/argon2/internal/NativeUtils.java @@ -26,6 +26,7 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; +import java.lang.foreign.SymbolLookup; import java.net.URISyntaxException; import java.net.URL; import java.nio.file.*; @@ -67,15 +68,15 @@ private NativeUtils() { * exiting. * Method uses String as filename because the pathname is "abstract", not system-dependent. * - * @param path The path of file inside JAR as absolute path (beginning with '/'), e.g. /package/File.ext * @throws IOException If temporary file creation or read/write operation fails * @throws IllegalArgumentException If source file (param path) does not exist * @throws IllegalArgumentException If the path is not absolute or if the filename is shorter than three characters * (restriction of {@link File#createTempFile(java.lang.String, java.lang.String)}). * @throws FileNotFoundException If the file could not be found inside the JAR. */ - public static void loadLibraryFromJar(String path) throws IOException { + public static void loadLibraryFromJar() throws IOException { // Obtain filename from path + String path = lib(); String[] parts = path.split("/"); String filename = (parts.length > 1) ? parts[parts.length - 1] : null; @@ -86,7 +87,7 @@ public static void loadLibraryFromJar(String path) throws IOException { // Prepare temporary file if (temporaryDir == null) { - temporaryDir = createTempDirectory(NATIVE_FOLDER_PATH_PREFIX); + temporaryDir = createTempDirectory(); temporaryDir.deleteOnExit(); } @@ -119,6 +120,30 @@ public static void loadLibraryFromJar(String path) throws IOException { } } + public static String lib() { + String osName = System.getProperty("os.name").toLowerCase(); + String osArch = System.getProperty("os.arch"); + String libName = "libargon2"; + if (osName.contains("win")) { + osName = "windows"; + libName += ".dll"; + } else if (osName.contains("mac")) { + osName = "darwin"; + libName += ".dylib"; + } else if (osName.contains("linux")) { + osName = "linux"; + libName += ".so"; + } + + if (osArch.contains("amd64") || osArch.contains("x86_64")) { + osArch = "x86-64"; + } else if (osArch.contains("i386") || osArch.contains("i86")) { + osArch = "x86"; + } + + return "%s-%s/%s".formatted(osName, osArch, libName); + } + public static byte[] readFromResources(Path path) { var classLoader = NativeUtils.class.getClassLoader(); if (IS_JAR) return readFromResourcesJar(path); @@ -151,9 +176,9 @@ private static boolean isPosixCompliant() { } } - private static File createTempDirectory(String prefix) throws IOException { + private static File createTempDirectory() throws IOException { String tempDir = System.getProperty("java.io.tmpdir"); - File generatedDir = new File(tempDir, prefix + System.nanoTime()); + File generatedDir = new File(tempDir, NativeUtils.NATIVE_FOLDER_PATH_PREFIX + System.nanoTime()); if (!generatedDir.mkdir()) throw new IOException("Failed to create temp directory " + generatedDir.getName()); diff --git a/src/main/java/com/zylquinal/argon2/internal/RuntimeHelper.java b/src/main/java/com/zylquinal/argon2/internal/RuntimeHelper.java deleted file mode 100644 index 62ab816..0000000 --- a/src/main/java/com/zylquinal/argon2/internal/RuntimeHelper.java +++ /dev/null @@ -1,256 +0,0 @@ -package com.zylquinal.argon2.internal; - -import java.io.IOException; -import java.lang.foreign.*; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodType; - -import static java.lang.foreign.ValueLayout.*; - -final class RuntimeHelper { - - private static final Linker LINKER = Linker.nativeLinker(); - private static final ClassLoader LOADER = RuntimeHelper.class.getClassLoader(); - private static final MethodHandles.Lookup MH_LOOKUP = MethodHandles.lookup(); - private static final SymbolLookup SYMBOL_LOOKUP; - private static final SegmentAllocator THROWING_ALLOCATOR = (x, y) -> { throw new AssertionError("should not reach here"); }; - static final AddressLayout POINTER = ValueLayout.ADDRESS.withTargetLayout(MemoryLayout.sequenceLayout(32, JAVA_BYTE)); - - final static SegmentAllocator CONSTANT_ALLOCATOR = - (size, align) -> Arena.ofAuto().allocate(size, align); - - static { - try { - NativeUtils.loadLibraryFromJar(lib()); - } catch (IOException e) { - throw new RuntimeException("Failed to load libargon2 library"); - } - SymbolLookup loaderLookup = SymbolLookup.loaderLookup(); - SYMBOL_LOOKUP = name -> loaderLookup.find(name).or(() -> LINKER.defaultLookup().find(name)); - } - - - // Suppresses default constructor, ensuring non-instantiability. - private RuntimeHelper() {} - - private static String lib() { - String osName = System.getProperty("os.name").toLowerCase(); - String osArch = System.getProperty("os.arch"); - String libName = "libargon2"; - if (osName.contains("win")) { - osName = "windows"; - libName += ".dll"; - } else if (osName.contains("mac")) { - osName = "darwin"; - libName += ".dylib"; - } else if (osName.contains("linux")) { - osName = "linux"; - libName += ".so"; - } - - if (osArch.contains("amd64") || osArch.contains("x86_64")) { - osArch = "x86-64"; - } else if (osArch.contains("i386") || osArch.contains("i86")) { - osArch = "x86"; - } - - return "%s-%s/%s".formatted(osName, osArch, libName); - } - - static T requireNonNull(T obj, String symbolName) { - if (obj == null) { - throw new UnsatisfiedLinkError("unresolved symbol: " + symbolName); - } - return obj; - } - - static MemorySegment lookupGlobalVariable(String name, MemoryLayout layout) { - return SYMBOL_LOOKUP.find(name) - .map(s -> s.reinterpret(layout.byteSize())) - .orElse(null); - } - - static MethodHandle downcallHandle(String name, FunctionDescriptor fdesc) { - return SYMBOL_LOOKUP.find(name). - map(addr -> LINKER.downcallHandle(addr, fdesc)). - orElse(null); - } - - static MethodHandle downcallHandle(FunctionDescriptor fdesc) { - return LINKER.downcallHandle(fdesc); - } - - static MethodHandle downcallHandleVariadic(String name, FunctionDescriptor fdesc) { - return SYMBOL_LOOKUP.find(name). - map(addr -> VarargsInvoker.make(addr, fdesc)). - orElse(null); - } - - static MethodHandle upcallHandle(Class fi, String name, FunctionDescriptor fdesc) { - try { - return MH_LOOKUP.findVirtual(fi, name, fdesc.toMethodType()); - } catch (Throwable ex) { - throw new AssertionError(ex); - } - } - - static MemorySegment upcallStub(MethodHandle fiHandle, Z z, FunctionDescriptor fdesc, Arena scope) { - try { - fiHandle = fiHandle.bindTo(z); - return LINKER.upcallStub(fiHandle, fdesc, scope); - } catch (Throwable ex) { - throw new AssertionError(ex); - } - } - - static MemorySegment asArray(MemorySegment addr, MemoryLayout layout, int numElements, Arena arena) { - return addr.reinterpret(numElements * layout.byteSize(), arena, null); - } - - // Internals only below this point - - private static final class VarargsInvoker { - private static final MethodHandle INVOKE_MH; - private final MemorySegment symbol; - private final FunctionDescriptor function; - - private VarargsInvoker(MemorySegment symbol, FunctionDescriptor function) { - this.symbol = symbol; - this.function = function; - } - - static { - try { - INVOKE_MH = MethodHandles.lookup().findVirtual(VarargsInvoker.class, "invoke", MethodType.methodType(Object.class, SegmentAllocator.class, Object[].class)); - } catch (ReflectiveOperationException e) { - throw new RuntimeException(e); - } - } - - static MethodHandle make(MemorySegment symbol, FunctionDescriptor function) { - VarargsInvoker invoker = new VarargsInvoker(symbol, function); - MethodHandle handle = INVOKE_MH.bindTo(invoker).asCollector(Object[].class, function.argumentLayouts().size() + 1); - MethodType mtype = MethodType.methodType(function.returnLayout().isPresent() ? carrier(function.returnLayout().get(), true) : void.class); - for (MemoryLayout layout : function.argumentLayouts()) { - mtype = mtype.appendParameterTypes(carrier(layout, false)); - } - mtype = mtype.appendParameterTypes(Object[].class); - boolean needsAllocator = function.returnLayout().isPresent() && - function.returnLayout().get() instanceof GroupLayout; - if (needsAllocator) { - mtype = mtype.insertParameterTypes(0, SegmentAllocator.class); - } else { - handle = MethodHandles.insertArguments(handle, 0, THROWING_ALLOCATOR); - } - return handle.asType(mtype); - } - - static Class carrier(MemoryLayout layout, boolean ret) { - if (layout instanceof ValueLayout valueLayout) { - return valueLayout.carrier(); - } else if (layout instanceof GroupLayout) { - return MemorySegment.class; - } else { - throw new AssertionError("Cannot get here!"); - } - } - - private Object invoke(SegmentAllocator allocator, Object[] args) throws Throwable { - // one trailing Object[] - int nNamedArgs = function.argumentLayouts().size(); - assert(args.length == nNamedArgs + 1); - // The last argument is the array of vararg collector - Object[] unnamedArgs = (Object[]) args[args.length - 1]; - - int argsCount = nNamedArgs + unnamedArgs.length; - Class[] argTypes = new Class[argsCount]; - MemoryLayout[] argLayouts = new MemoryLayout[nNamedArgs + unnamedArgs.length]; - - int pos = 0; - for (pos = 0; pos < nNamedArgs; pos++) { - argLayouts[pos] = function.argumentLayouts().get(pos); - } - - assert pos == nNamedArgs; - for (Object o: unnamedArgs) { - argLayouts[pos] = variadicLayout(normalize(o.getClass())); - pos++; - } - assert pos == argsCount; - - FunctionDescriptor f = (function.returnLayout().isEmpty()) ? - FunctionDescriptor.ofVoid(argLayouts) : - FunctionDescriptor.of(function.returnLayout().get(), argLayouts); - MethodHandle mh = LINKER.downcallHandle(symbol, f); - boolean needsAllocator = function.returnLayout().isPresent() && - function.returnLayout().get() instanceof GroupLayout; - if (needsAllocator) { - mh = mh.bindTo(allocator); - } - // flatten argument list so that it can be passed to an asSpreader MH - Object[] allArgs = new Object[nNamedArgs + unnamedArgs.length]; - System.arraycopy(args, 0, allArgs, 0, nNamedArgs); - System.arraycopy(unnamedArgs, 0, allArgs, nNamedArgs, unnamedArgs.length); - - return mh.asSpreader(Object[].class, argsCount).invoke(allArgs); - } - - private static Class unboxIfNeeded(Class clazz) { - if (clazz == Boolean.class) { - return boolean.class; - } else if (clazz == Void.class) { - return void.class; - } else if (clazz == Byte.class) { - return byte.class; - } else if (clazz == Character.class) { - return char.class; - } else if (clazz == Short.class) { - return short.class; - } else if (clazz == Integer.class) { - return int.class; - } else if (clazz == Long.class) { - return long.class; - } else if (clazz == Float.class) { - return float.class; - } else if (clazz == Double.class) { - return double.class; - } else { - return clazz; - } - } - - private Class promote(Class c) { - if (c == byte.class || c == char.class || c == short.class || c == int.class) { - return long.class; - } else if (c == float.class) { - return double.class; - } else { - return c; - } - } - - private Class normalize(Class c) { - c = unboxIfNeeded(c); - if (c.isPrimitive()) { - return promote(c); - } - if (c == MemorySegment.class) { - return MemorySegment.class; - } - throw new IllegalArgumentException("Invalid type for ABI: " + c.getTypeName()); - } - - private MemoryLayout variadicLayout(Class c) { - if (c == long.class) { - return JAVA_LONG; - } else if (c == double.class) { - return JAVA_DOUBLE; - } else if (c == MemorySegment.class) { - return ADDRESS; - } else { - throw new IllegalArgumentException("Unhandled variadic argument class: " + c); - } - } - } -} diff --git a/src/main/java/com/zylquinal/argon2/internal/__fsid_t.java b/src/main/java/com/zylquinal/argon2/internal/__fsid_t.java index 248c6cd..45e5333 100644 --- a/src/main/java/com/zylquinal/argon2/internal/__fsid_t.java +++ b/src/main/java/com/zylquinal/argon2/internal/__fsid_t.java @@ -1,30 +1,160 @@ +// Generated by jextract + package com.zylquinal.argon2.internal; -import java.lang.foreign.Arena; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; +import java.lang.invoke.*; +import java.lang.foreign.*; +import java.nio.ByteOrder; +import java.util.*; +import java.util.function.*; +import java.util.stream.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; + /** - * {@snippet : + * {@snippet lang=c : * struct { - * int[] __val 2]; - * }; + * int __val[2]; + * } * } */ public class __fsid_t { - public static MemoryLayout $LAYOUT() { - return constants$0.const$0; + __fsid_t() { + // Should not be called directly } - public static MemorySegment __val$slice(MemorySegment seg) { - return seg.asSlice(0, 8); + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + MemoryLayout.sequenceLayout(2, argon2_h.C_INT).withName("__val") + ).withName("$anon$155:12"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + private static final SequenceLayout __val$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("__val")); + + /** + * Layout for field: + * {@snippet lang=c : + * int __val[2] + * } + */ + public static final SequenceLayout __val$layout() { + return __val$LAYOUT; } - public static MemorySegment ofAddress(MemorySegment addr, Arena arena) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, arena); } -} + private static final long __val$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * int __val[2] + * } + */ + public static final long __val$offset() { + return __val$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int __val[2] + * } + */ + public static MemorySegment __val(MemorySegment struct) { + return struct.asSlice(__val$OFFSET, __val$LAYOUT.byteSize()); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int __val[2] + * } + */ + public static void __val(MemorySegment struct, MemorySegment fieldValue) { + MemorySegment.copy(fieldValue, 0L, struct, __val$OFFSET, __val$LAYOUT.byteSize()); + } + + private static long[] __val$DIMS = { 2 }; + + /** + * Dimensions for array field: + * {@snippet lang=c : + * int __val[2] + * } + */ + public static long[] __val$dimensions() { + return __val$DIMS; + } + private static final VarHandle __val$ELEM_HANDLE = __val$LAYOUT.varHandle(sequenceElement()); + + /** + * Indexed getter for field: + * {@snippet lang=c : + * int __val[2] + * } + */ + public static int __val(MemorySegment struct, long index0) { + return (int)__val$ELEM_HANDLE.get(struct, 0L, index0); + } + + /** + * Indexed setter for field: + * {@snippet lang=c : + * int __val[2] + * } + */ + public static void __val(MemorySegment struct, long index0, int fieldValue) { + __val$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); + } + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); + } + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); + } + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); + } + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { + return reinterpret(addr, 1, arena, cleanup); + } + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); + } +} diff --git a/src/main/java/com/zylquinal/argon2/internal/allocate_fptr.java b/src/main/java/com/zylquinal/argon2/internal/allocate_fptr.java index c4e4f58..66ad6e4 100644 --- a/src/main/java/com/zylquinal/argon2/internal/allocate_fptr.java +++ b/src/main/java/com/zylquinal/argon2/internal/allocate_fptr.java @@ -1,28 +1,69 @@ +// Generated by jextract + package com.zylquinal.argon2.internal; -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; +import java.lang.invoke.*; +import java.lang.foreign.*; +import java.nio.ByteOrder; +import java.util.*; +import java.util.function.*; +import java.util.stream.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; + /** - * {@snippet : - * int (*allocate_fptr)(unsigned char** memory,unsigned long bytes_to_allocate); + * {@snippet lang=c : + * typedef int (*allocate_fptr)(uint8_t **, size_t) * } */ -public interface allocate_fptr { +public class allocate_fptr { - int apply(MemorySegment memory, long bytes_to_allocate); - static MemorySegment allocate(allocate_fptr fi, Arena scope) { - return RuntimeHelper.upcallStub(constants$1.const$0, fi, constants$0.const$5, scope); + allocate_fptr() { + // Should not be called directly } - static allocate_fptr ofAddress(MemorySegment addr, Arena arena) { - MemorySegment symbol = addr.reinterpret(arena, null); - return (MemorySegment _memory, long _bytes_to_allocate) -> { - try { - return (int)constants$1.const$1.invokeExact(symbol, _memory, _bytes_to_allocate); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment memory, long bytes_to_allocate); + } + + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_POINTER, + argon2_h.C_LONG + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = argon2_h.upcallHandle(Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); } -} + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr,MemorySegment memory, long bytes_to_allocate) { + try { + return (int) DOWN$MH.invokeExact(funcPtr, memory, bytes_to_allocate); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} diff --git a/src/main/java/com/zylquinal/argon2/internal/argon2_context$0.java b/src/main/java/com/zylquinal/argon2/internal/argon2_context$0.java new file mode 100644 index 0000000..4182ac5 --- /dev/null +++ b/src/main/java/com/zylquinal/argon2/internal/argon2_context$0.java @@ -0,0 +1,45 @@ +// Generated by jextract + +package com.zylquinal.argon2.internal; + +import java.lang.invoke.*; +import java.lang.foreign.*; +import java.nio.ByteOrder; +import java.util.*; +import java.util.function.*; +import java.util.stream.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; + +/** + * {@snippet lang=c : + * typedef struct Argon2_Context { + * uint8_t *out; + * uint32_t outlen; + * uint8_t *pwd; + * uint32_t pwdlen; + * uint8_t *salt; + * uint32_t saltlen; + * uint8_t *secret; + * uint32_t secretlen; + * uint8_t *ad; + * uint32_t adlen; + * uint32_t t_cost; + * uint32_t m_cost; + * uint32_t lanes; + * uint32_t threads; + * uint32_t version; + * allocate_fptr allocate_cbk; + * deallocate_fptr free_cbk; + * uint32_t flags; + * } argon2_context + * } + */ +public class argon2_context$0 extends Argon2_Context { + + argon2_context$0() { + // Should not be called directly + } +} + diff --git a/src/main/java/com/zylquinal/argon2/internal/argon2_context$2.java b/src/main/java/com/zylquinal/argon2/internal/argon2_context$2.java deleted file mode 100644 index 5092417..0000000 --- a/src/main/java/com/zylquinal/argon2/internal/argon2_context$2.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.zylquinal.argon2.internal; - -/** - * {@snippet : - * typedef struct Argon2_Context argon2_context; - * } - */ -public final class argon2_context$2 extends Argon2_Context { - - // Suppresses default constructor, ensuring non-instantiability. - private argon2_context$2() {} -} - - diff --git a/src/main/java/com/zylquinal/argon2/internal/argon2_h.java b/src/main/java/com/zylquinal/argon2/internal/argon2_h.java index 3875fef..cf58e9d 100644 --- a/src/main/java/com/zylquinal/argon2/internal/argon2_h.java +++ b/src/main/java/com/zylquinal/argon2/internal/argon2_h.java @@ -1,3159 +1,4512 @@ +// Generated by jextract + package com.zylquinal.argon2.internal; -import java.lang.foreign.AddressLayout; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.VarHandle; +import java.io.IOException; +import java.lang.invoke.*; +import java.lang.foreign.*; +import java.nio.ByteOrder; +import java.util.*; +import java.util.function.*; +import java.util.stream.*; import static java.lang.foreign.ValueLayout.*; -public class argon2_h { - - public static final OfByte C_CHAR = JAVA_BYTE; - public static final OfShort C_SHORT = JAVA_SHORT; - public static final OfInt C_INT = JAVA_INT; - public static final OfLong C_LONG = JAVA_LONG; - public static final OfLong C_LONG_LONG = JAVA_LONG; - public static final OfFloat C_FLOAT = JAVA_FLOAT; - public static final OfDouble C_DOUBLE = JAVA_DOUBLE; - public static final AddressLayout C_POINTER = RuntimeHelper.POINTER; - /** - * {@snippet : +import static java.lang.foreign.MemoryLayout.PathElement.*; + +public class argon2_h { + + argon2_h() { + // Should not be called directly + } + + static final Linker LINKER = Linker.nativeLinker(); + static final Arena LIBRARY_ARENA = Arena.ofAuto(); + static final boolean TRACE_DOWNCALLS = Boolean.getBoolean("jextract.trace.downcalls"); + + static void traceDowncall(String name, Object... args) { + String traceArgs = Arrays.stream(args) + .map(Object::toString) + .collect(Collectors.joining(", ")); + System.out.printf("%s(%s)\n", name, traceArgs); + } + + static MemorySegment findOrThrow(String symbol) { + return SYMBOL_LOOKUP.find(symbol) + .orElseThrow(() -> new UnsatisfiedLinkError("unresolved symbol: " + symbol)); + } + + static MethodHandle upcallHandle(Class fi, String name, FunctionDescriptor fdesc) { + try { + return MethodHandles.lookup().findVirtual(fi, name, fdesc.toMethodType()); + } catch (ReflectiveOperationException ex) { + throw new AssertionError(ex); + } + } + + static MemoryLayout align(MemoryLayout layout, long align) { + return switch (layout) { + case PaddingLayout p -> p; + case ValueLayout v -> v.withByteAlignment(align); + case GroupLayout g -> { + MemoryLayout[] alignedMembers = g.memberLayouts().stream() + .map(m -> align(m, align)).toArray(MemoryLayout[]::new); + yield g instanceof StructLayout ? + MemoryLayout.structLayout(alignedMembers) : MemoryLayout.unionLayout(alignedMembers); + } + case SequenceLayout s -> MemoryLayout.sequenceLayout(s.elementCount(), align(s.elementLayout(), align)); + }; + } + + static final SymbolLookup SYMBOL_LOOKUP; + + static { + try { + NativeUtils.loadLibraryFromJar(); + } catch (IOException e) { + throw new RuntimeException("Failed to load libargon2 library"); + } + SymbolLookup loaderLookup = SymbolLookup.loaderLookup(); + SYMBOL_LOOKUP = name -> loaderLookup.find(name).or(() -> LINKER.defaultLookup().find(name)); + } + + public static final OfBoolean C_BOOL = ValueLayout.JAVA_BOOLEAN; + public static final OfByte C_CHAR = ValueLayout.JAVA_BYTE; + public static final OfShort C_SHORT = ValueLayout.JAVA_SHORT; + public static final OfInt C_INT = ValueLayout.JAVA_INT; + public static final OfLong C_LONG_LONG = ValueLayout.JAVA_LONG; + public static final OfFloat C_FLOAT = ValueLayout.JAVA_FLOAT; + public static final OfDouble C_DOUBLE = ValueLayout.JAVA_DOUBLE; + public static final AddressLayout C_POINTER = ValueLayout.ADDRESS + .withTargetLayout(MemoryLayout.sequenceLayout(Long.MAX_VALUE, JAVA_BYTE)); + public static final OfLong C_LONG = ValueLayout.JAVA_LONG; + private static final int _STDINT_H = (int)1L; + /** + * {@snippet lang=c : * #define _STDINT_H 1 * } */ public static int _STDINT_H() { - return (int)1L; + return _STDINT_H; } + private static final int _FEATURES_H = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define _FEATURES_H 1 * } */ public static int _FEATURES_H() { - return (int)1L; + return _FEATURES_H; } + private static final int _DEFAULT_SOURCE = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define _DEFAULT_SOURCE 1 * } */ public static int _DEFAULT_SOURCE() { - return (int)1L; + return _DEFAULT_SOURCE; } + private static final int __GLIBC_USE_ISOC2X = (int)0L; /** - * {@snippet : + * {@snippet lang=c : * #define __GLIBC_USE_ISOC2X 0 * } */ public static int __GLIBC_USE_ISOC2X() { - return (int)0L; + return __GLIBC_USE_ISOC2X; } + private static final int __USE_ISOC11 = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __USE_ISOC11 1 * } */ public static int __USE_ISOC11() { - return (int)1L; + return __USE_ISOC11; } + private static final int __USE_ISOC99 = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __USE_ISOC99 1 * } */ public static int __USE_ISOC99() { - return (int)1L; + return __USE_ISOC99; } + private static final int __USE_ISOC95 = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __USE_ISOC95 1 * } */ public static int __USE_ISOC95() { - return (int)1L; + return __USE_ISOC95; } + private static final int __USE_POSIX_IMPLICITLY = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __USE_POSIX_IMPLICITLY 1 * } */ public static int __USE_POSIX_IMPLICITLY() { - return (int)1L; + return __USE_POSIX_IMPLICITLY; } + private static final int _POSIX_SOURCE = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_SOURCE 1 * } */ public static int _POSIX_SOURCE() { - return (int)1L; + return _POSIX_SOURCE; } + private static final int __USE_POSIX = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __USE_POSIX 1 * } */ public static int __USE_POSIX() { - return (int)1L; + return __USE_POSIX; } + private static final int __USE_POSIX2 = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __USE_POSIX2 1 * } */ public static int __USE_POSIX2() { - return (int)1L; + return __USE_POSIX2; } + private static final int __USE_POSIX199309 = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __USE_POSIX199309 1 * } */ public static int __USE_POSIX199309() { - return (int)1L; + return __USE_POSIX199309; } + private static final int __USE_POSIX199506 = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __USE_POSIX199506 1 * } */ public static int __USE_POSIX199506() { - return (int)1L; + return __USE_POSIX199506; } + private static final int __USE_XOPEN2K = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __USE_XOPEN2K 1 * } */ public static int __USE_XOPEN2K() { - return (int)1L; + return __USE_XOPEN2K; } + private static final int __USE_XOPEN2K8 = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __USE_XOPEN2K8 1 * } */ public static int __USE_XOPEN2K8() { - return (int)1L; + return __USE_XOPEN2K8; } + private static final int _ATFILE_SOURCE = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define _ATFILE_SOURCE 1 * } */ public static int _ATFILE_SOURCE() { - return (int)1L; + return _ATFILE_SOURCE; } + private static final int __WORDSIZE = (int)64L; /** - * {@snippet : + * {@snippet lang=c : * #define __WORDSIZE 64 * } */ public static int __WORDSIZE() { - return (int)64L; + return __WORDSIZE; } + private static final int __WORDSIZE_TIME64_COMPAT32 = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __WORDSIZE_TIME64_COMPAT32 1 * } */ public static int __WORDSIZE_TIME64_COMPAT32() { - return (int)1L; + return __WORDSIZE_TIME64_COMPAT32; } + private static final int __SYSCALL_WORDSIZE = (int)64L; /** - * {@snippet : + * {@snippet lang=c : * #define __SYSCALL_WORDSIZE 64 * } */ public static int __SYSCALL_WORDSIZE() { - return (int)64L; + return __SYSCALL_WORDSIZE; } + private static final int __USE_MISC = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __USE_MISC 1 * } */ public static int __USE_MISC() { - return (int)1L; + return __USE_MISC; } + private static final int __USE_ATFILE = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __USE_ATFILE 1 * } */ public static int __USE_ATFILE() { - return (int)1L; + return __USE_ATFILE; } + private static final int __USE_FORTIFY_LEVEL = (int)0L; /** - * {@snippet : + * {@snippet lang=c : * #define __USE_FORTIFY_LEVEL 0 * } */ public static int __USE_FORTIFY_LEVEL() { - return (int)0L; + return __USE_FORTIFY_LEVEL; } + private static final int __GLIBC_USE_DEPRECATED_GETS = (int)0L; /** - * {@snippet : + * {@snippet lang=c : * #define __GLIBC_USE_DEPRECATED_GETS 0 * } */ public static int __GLIBC_USE_DEPRECATED_GETS() { - return (int)0L; + return __GLIBC_USE_DEPRECATED_GETS; } + private static final int __GLIBC_USE_DEPRECATED_SCANF = (int)0L; /** - * {@snippet : + * {@snippet lang=c : * #define __GLIBC_USE_DEPRECATED_SCANF 0 * } */ public static int __GLIBC_USE_DEPRECATED_SCANF() { - return (int)0L; - } - /** - * {@snippet : - * #define __GLIBC_USE_C2X_STRTOL 0 - * } - */ - public static int __GLIBC_USE_C2X_STRTOL() { - return (int)0L; + return __GLIBC_USE_DEPRECATED_SCANF; } + private static final int _STDC_PREDEF_H = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define _STDC_PREDEF_H 1 * } */ public static int _STDC_PREDEF_H() { - return (int)1L; + return _STDC_PREDEF_H; } + private static final int __STDC_IEC_559__ = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __STDC_IEC_559__ 1 * } */ public static int __STDC_IEC_559__() { - return (int)1L; + return __STDC_IEC_559__; } + private static final int __STDC_IEC_559_COMPLEX__ = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __STDC_IEC_559_COMPLEX__ 1 * } */ public static int __STDC_IEC_559_COMPLEX__() { - return (int)1L; + return __STDC_IEC_559_COMPLEX__; } + private static final int __GNU_LIBRARY__ = (int)6L; /** - * {@snippet : + * {@snippet lang=c : * #define __GNU_LIBRARY__ 6 * } */ public static int __GNU_LIBRARY__() { - return (int)6L; + return __GNU_LIBRARY__; } + private static final int __GLIBC__ = (int)2L; /** - * {@snippet : + * {@snippet lang=c : * #define __GLIBC__ 2 * } */ public static int __GLIBC__() { - return (int)2L; + return __GLIBC__; } + private static final int __GLIBC_MINOR__ = (int)35L; /** - * {@snippet : - * #define __GLIBC_MINOR__ 38 + * {@snippet lang=c : + * #define __GLIBC_MINOR__ 35 * } */ public static int __GLIBC_MINOR__() { - return (int)38L; + return __GLIBC_MINOR__; } + private static final int _SYS_CDEFS_H = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define _SYS_CDEFS_H 1 * } */ public static int _SYS_CDEFS_H() { - return (int)1L; + return _SYS_CDEFS_H; } + private static final int __glibc_c99_flexarr_available = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __glibc_c99_flexarr_available 1 * } */ public static int __glibc_c99_flexarr_available() { - return (int)1L; + return __glibc_c99_flexarr_available; } + private static final int __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI = (int)0L; /** - * {@snippet : + * {@snippet lang=c : * #define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0 * } */ public static int __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI() { - return (int)0L; + return __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI; } + private static final int __HAVE_GENERIC_SELECTION = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __HAVE_GENERIC_SELECTION 1 * } */ public static int __HAVE_GENERIC_SELECTION() { - return (int)1L; + return __HAVE_GENERIC_SELECTION; } + private static final int __GLIBC_USE_LIB_EXT2 = (int)0L; /** - * {@snippet : + * {@snippet lang=c : * #define __GLIBC_USE_LIB_EXT2 0 * } */ public static int __GLIBC_USE_LIB_EXT2() { - return (int)0L; + return __GLIBC_USE_LIB_EXT2; } + private static final int __GLIBC_USE_IEC_60559_BFP_EXT = (int)0L; /** - * {@snippet : + * {@snippet lang=c : * #define __GLIBC_USE_IEC_60559_BFP_EXT 0 * } */ public static int __GLIBC_USE_IEC_60559_BFP_EXT() { - return (int)0L; + return __GLIBC_USE_IEC_60559_BFP_EXT; } + private static final int __GLIBC_USE_IEC_60559_BFP_EXT_C2X = (int)0L; /** - * {@snippet : + * {@snippet lang=c : * #define __GLIBC_USE_IEC_60559_BFP_EXT_C2X 0 * } */ public static int __GLIBC_USE_IEC_60559_BFP_EXT_C2X() { - return (int)0L; + return __GLIBC_USE_IEC_60559_BFP_EXT_C2X; } + private static final int __GLIBC_USE_IEC_60559_EXT = (int)0L; /** - * {@snippet : + * {@snippet lang=c : * #define __GLIBC_USE_IEC_60559_EXT 0 * } */ public static int __GLIBC_USE_IEC_60559_EXT() { - return (int)0L; + return __GLIBC_USE_IEC_60559_EXT; } + private static final int __GLIBC_USE_IEC_60559_FUNCS_EXT = (int)0L; /** - * {@snippet : + * {@snippet lang=c : * #define __GLIBC_USE_IEC_60559_FUNCS_EXT 0 * } */ public static int __GLIBC_USE_IEC_60559_FUNCS_EXT() { - return (int)0L; + return __GLIBC_USE_IEC_60559_FUNCS_EXT; } + private static final int __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X = (int)0L; /** - * {@snippet : + * {@snippet lang=c : * #define __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X 0 * } */ public static int __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X() { - return (int)0L; + return __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X; } + private static final int __GLIBC_USE_IEC_60559_TYPES_EXT = (int)0L; /** - * {@snippet : + * {@snippet lang=c : * #define __GLIBC_USE_IEC_60559_TYPES_EXT 0 * } */ public static int __GLIBC_USE_IEC_60559_TYPES_EXT() { - return (int)0L; + return __GLIBC_USE_IEC_60559_TYPES_EXT; } + private static final int _BITS_TYPES_H = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define _BITS_TYPES_H 1 * } */ public static int _BITS_TYPES_H() { - return (int)1L; + return _BITS_TYPES_H; } + private static final int _BITS_TYPESIZES_H = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define _BITS_TYPESIZES_H 1 * } */ public static int _BITS_TYPESIZES_H() { - return (int)1L; + return _BITS_TYPESIZES_H; } + private static final int __OFF_T_MATCHES_OFF64_T = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __OFF_T_MATCHES_OFF64_T 1 * } */ public static int __OFF_T_MATCHES_OFF64_T() { - return (int)1L; + return __OFF_T_MATCHES_OFF64_T; } + private static final int __INO_T_MATCHES_INO64_T = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __INO_T_MATCHES_INO64_T 1 * } */ public static int __INO_T_MATCHES_INO64_T() { - return (int)1L; + return __INO_T_MATCHES_INO64_T; } + private static final int __RLIM_T_MATCHES_RLIM64_T = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __RLIM_T_MATCHES_RLIM64_T 1 * } */ public static int __RLIM_T_MATCHES_RLIM64_T() { - return (int)1L; + return __RLIM_T_MATCHES_RLIM64_T; } + private static final int __STATFS_MATCHES_STATFS64 = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __STATFS_MATCHES_STATFS64 1 * } */ public static int __STATFS_MATCHES_STATFS64() { - return (int)1L; + return __STATFS_MATCHES_STATFS64; } + private static final int __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 * } */ public static int __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64() { - return (int)1L; + return __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64; } + private static final int __FD_SETSIZE = (int)1024L; /** - * {@snippet : + * {@snippet lang=c : * #define __FD_SETSIZE 1024 * } */ public static int __FD_SETSIZE() { - return (int)1024L; + return __FD_SETSIZE; } + private static final int _BITS_TIME64_H = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define _BITS_TIME64_H 1 * } */ public static int _BITS_TIME64_H() { - return (int)1L; + return _BITS_TIME64_H; } + private static final int _BITS_WCHAR_H = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define _BITS_WCHAR_H 1 * } */ public static int _BITS_WCHAR_H() { - return (int)1L; + return _BITS_WCHAR_H; } + private static final int _BITS_STDINT_INTN_H = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define _BITS_STDINT_INTN_H 1 * } */ public static int _BITS_STDINT_INTN_H() { - return (int)1L; + return _BITS_STDINT_INTN_H; } + private static final int _BITS_STDINT_UINTN_H = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define _BITS_STDINT_UINTN_H 1 * } */ public static int _BITS_STDINT_UINTN_H() { - return (int)1L; + return _BITS_STDINT_UINTN_H; } + private static final int _LIBC_LIMITS_H_ = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define _LIBC_LIMITS_H_ 1 * } */ public static int _LIBC_LIMITS_H_() { - return (int)1L; + return _LIBC_LIMITS_H_; } + private static final int MB_LEN_MAX = (int)16L; /** - * {@snippet : + * {@snippet lang=c : * #define MB_LEN_MAX 16 * } */ public static int MB_LEN_MAX() { - return (int)16L; + return MB_LEN_MAX; } + private static final int _BITS_POSIX1_LIM_H = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define _BITS_POSIX1_LIM_H 1 * } */ public static int _BITS_POSIX1_LIM_H() { - return (int)1L; + return _BITS_POSIX1_LIM_H; } + private static final int _POSIX_AIO_LISTIO_MAX = (int)2L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_AIO_LISTIO_MAX 2 * } */ public static int _POSIX_AIO_LISTIO_MAX() { - return (int)2L; + return _POSIX_AIO_LISTIO_MAX; } + private static final int _POSIX_AIO_MAX = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_AIO_MAX 1 * } */ public static int _POSIX_AIO_MAX() { - return (int)1L; + return _POSIX_AIO_MAX; } + private static final int _POSIX_ARG_MAX = (int)4096L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_ARG_MAX 4096 * } */ public static int _POSIX_ARG_MAX() { - return (int)4096L; + return _POSIX_ARG_MAX; } + private static final int _POSIX_CHILD_MAX = (int)25L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_CHILD_MAX 25 * } */ public static int _POSIX_CHILD_MAX() { - return (int)25L; + return _POSIX_CHILD_MAX; } + private static final int _POSIX_DELAYTIMER_MAX = (int)32L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_DELAYTIMER_MAX 32 * } */ public static int _POSIX_DELAYTIMER_MAX() { - return (int)32L; + return _POSIX_DELAYTIMER_MAX; } + private static final int _POSIX_HOST_NAME_MAX = (int)255L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_HOST_NAME_MAX 255 * } */ public static int _POSIX_HOST_NAME_MAX() { - return (int)255L; + return _POSIX_HOST_NAME_MAX; } + private static final int _POSIX_LINK_MAX = (int)8L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_LINK_MAX 8 * } */ public static int _POSIX_LINK_MAX() { - return (int)8L; + return _POSIX_LINK_MAX; } + private static final int _POSIX_LOGIN_NAME_MAX = (int)9L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_LOGIN_NAME_MAX 9 * } */ public static int _POSIX_LOGIN_NAME_MAX() { - return (int)9L; + return _POSIX_LOGIN_NAME_MAX; } + private static final int _POSIX_MAX_CANON = (int)255L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_MAX_CANON 255 * } */ public static int _POSIX_MAX_CANON() { - return (int)255L; + return _POSIX_MAX_CANON; } + private static final int _POSIX_MAX_INPUT = (int)255L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_MAX_INPUT 255 * } */ public static int _POSIX_MAX_INPUT() { - return (int)255L; + return _POSIX_MAX_INPUT; } + private static final int _POSIX_MQ_OPEN_MAX = (int)8L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_MQ_OPEN_MAX 8 * } */ public static int _POSIX_MQ_OPEN_MAX() { - return (int)8L; + return _POSIX_MQ_OPEN_MAX; } + private static final int _POSIX_MQ_PRIO_MAX = (int)32L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_MQ_PRIO_MAX 32 * } */ public static int _POSIX_MQ_PRIO_MAX() { - return (int)32L; + return _POSIX_MQ_PRIO_MAX; } + private static final int _POSIX_NAME_MAX = (int)14L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_NAME_MAX 14 * } */ public static int _POSIX_NAME_MAX() { - return (int)14L; + return _POSIX_NAME_MAX; } + private static final int _POSIX_NGROUPS_MAX = (int)8L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_NGROUPS_MAX 8 * } */ public static int _POSIX_NGROUPS_MAX() { - return (int)8L; + return _POSIX_NGROUPS_MAX; } + private static final int _POSIX_OPEN_MAX = (int)20L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_OPEN_MAX 20 * } */ public static int _POSIX_OPEN_MAX() { - return (int)20L; + return _POSIX_OPEN_MAX; } + private static final int _POSIX_PATH_MAX = (int)256L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_PATH_MAX 256 * } */ public static int _POSIX_PATH_MAX() { - return (int)256L; + return _POSIX_PATH_MAX; } + private static final int _POSIX_PIPE_BUF = (int)512L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_PIPE_BUF 512 * } */ public static int _POSIX_PIPE_BUF() { - return (int)512L; + return _POSIX_PIPE_BUF; } + private static final int _POSIX_RE_DUP_MAX = (int)255L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_RE_DUP_MAX 255 * } */ public static int _POSIX_RE_DUP_MAX() { - return (int)255L; + return _POSIX_RE_DUP_MAX; } + private static final int _POSIX_RTSIG_MAX = (int)8L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_RTSIG_MAX 8 * } */ public static int _POSIX_RTSIG_MAX() { - return (int)8L; + return _POSIX_RTSIG_MAX; } + private static final int _POSIX_SEM_NSEMS_MAX = (int)256L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_SEM_NSEMS_MAX 256 * } */ public static int _POSIX_SEM_NSEMS_MAX() { - return (int)256L; + return _POSIX_SEM_NSEMS_MAX; } + private static final int _POSIX_SEM_VALUE_MAX = (int)32767L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_SEM_VALUE_MAX 32767 * } */ public static int _POSIX_SEM_VALUE_MAX() { - return (int)32767L; + return _POSIX_SEM_VALUE_MAX; } + private static final int _POSIX_SIGQUEUE_MAX = (int)32L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_SIGQUEUE_MAX 32 * } */ public static int _POSIX_SIGQUEUE_MAX() { - return (int)32L; + return _POSIX_SIGQUEUE_MAX; } + private static final int _POSIX_SSIZE_MAX = (int)32767L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_SSIZE_MAX 32767 * } */ public static int _POSIX_SSIZE_MAX() { - return (int)32767L; + return _POSIX_SSIZE_MAX; } + private static final int _POSIX_STREAM_MAX = (int)8L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_STREAM_MAX 8 * } */ public static int _POSIX_STREAM_MAX() { - return (int)8L; + return _POSIX_STREAM_MAX; } + private static final int _POSIX_SYMLINK_MAX = (int)255L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_SYMLINK_MAX 255 * } */ public static int _POSIX_SYMLINK_MAX() { - return (int)255L; + return _POSIX_SYMLINK_MAX; } + private static final int _POSIX_SYMLOOP_MAX = (int)8L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_SYMLOOP_MAX 8 * } */ public static int _POSIX_SYMLOOP_MAX() { - return (int)8L; + return _POSIX_SYMLOOP_MAX; } + private static final int _POSIX_TIMER_MAX = (int)32L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_TIMER_MAX 32 * } */ public static int _POSIX_TIMER_MAX() { - return (int)32L; + return _POSIX_TIMER_MAX; } + private static final int _POSIX_TTY_NAME_MAX = (int)9L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_TTY_NAME_MAX 9 * } */ public static int _POSIX_TTY_NAME_MAX() { - return (int)9L; + return _POSIX_TTY_NAME_MAX; } + private static final int _POSIX_TZNAME_MAX = (int)6L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_TZNAME_MAX 6 * } */ public static int _POSIX_TZNAME_MAX() { - return (int)6L; + return _POSIX_TZNAME_MAX; } + private static final int _POSIX_CLOCKRES_MIN = (int)20000000L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_CLOCKRES_MIN 20000000 * } */ public static int _POSIX_CLOCKRES_MIN() { - return (int)20000000L; + return _POSIX_CLOCKRES_MIN; } + private static final int NR_OPEN = (int)1024L; /** - * {@snippet : + * {@snippet lang=c : * #define NR_OPEN 1024 * } */ public static int NR_OPEN() { - return (int)1024L; + return NR_OPEN; } + private static final int NGROUPS_MAX = (int)65536L; /** - * {@snippet : + * {@snippet lang=c : * #define NGROUPS_MAX 65536 * } */ public static int NGROUPS_MAX() { - return (int)65536L; + return NGROUPS_MAX; } + private static final int ARG_MAX = (int)131072L; /** - * {@snippet : + * {@snippet lang=c : * #define ARG_MAX 131072 * } */ public static int ARG_MAX() { - return (int)131072L; + return ARG_MAX; } + private static final int LINK_MAX = (int)127L; /** - * {@snippet : + * {@snippet lang=c : * #define LINK_MAX 127 * } */ public static int LINK_MAX() { - return (int)127L; + return LINK_MAX; } + private static final int MAX_CANON = (int)255L; /** - * {@snippet : + * {@snippet lang=c : * #define MAX_CANON 255 * } */ public static int MAX_CANON() { - return (int)255L; + return MAX_CANON; } + private static final int MAX_INPUT = (int)255L; /** - * {@snippet : + * {@snippet lang=c : * #define MAX_INPUT 255 * } */ public static int MAX_INPUT() { - return (int)255L; + return MAX_INPUT; } + private static final int NAME_MAX = (int)255L; /** - * {@snippet : + * {@snippet lang=c : * #define NAME_MAX 255 * } */ public static int NAME_MAX() { - return (int)255L; + return NAME_MAX; } + private static final int PATH_MAX = (int)4096L; /** - * {@snippet : + * {@snippet lang=c : * #define PATH_MAX 4096 * } */ public static int PATH_MAX() { - return (int)4096L; + return PATH_MAX; } + private static final int PIPE_BUF = (int)4096L; /** - * {@snippet : + * {@snippet lang=c : * #define PIPE_BUF 4096 * } */ public static int PIPE_BUF() { - return (int)4096L; + return PIPE_BUF; } + private static final int XATTR_NAME_MAX = (int)255L; /** - * {@snippet : + * {@snippet lang=c : * #define XATTR_NAME_MAX 255 * } */ public static int XATTR_NAME_MAX() { - return (int)255L; + return XATTR_NAME_MAX; } + private static final int XATTR_SIZE_MAX = (int)65536L; /** - * {@snippet : + * {@snippet lang=c : * #define XATTR_SIZE_MAX 65536 * } */ public static int XATTR_SIZE_MAX() { - return (int)65536L; + return XATTR_SIZE_MAX; } + private static final int XATTR_LIST_MAX = (int)65536L; /** - * {@snippet : + * {@snippet lang=c : * #define XATTR_LIST_MAX 65536 * } */ public static int XATTR_LIST_MAX() { - return (int)65536L; + return XATTR_LIST_MAX; } + private static final int RTSIG_MAX = (int)32L; /** - * {@snippet : + * {@snippet lang=c : * #define RTSIG_MAX 32 * } */ public static int RTSIG_MAX() { - return (int)32L; + return RTSIG_MAX; } + private static final int _POSIX_THREAD_KEYS_MAX = (int)128L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_THREAD_KEYS_MAX 128 * } */ public static int _POSIX_THREAD_KEYS_MAX() { - return (int)128L; + return _POSIX_THREAD_KEYS_MAX; } + private static final int PTHREAD_KEYS_MAX = (int)1024L; /** - * {@snippet : + * {@snippet lang=c : * #define PTHREAD_KEYS_MAX 1024 * } */ public static int PTHREAD_KEYS_MAX() { - return (int)1024L; + return PTHREAD_KEYS_MAX; } + private static final int _POSIX_THREAD_DESTRUCTOR_ITERATIONS = (int)4L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 * } */ public static int _POSIX_THREAD_DESTRUCTOR_ITERATIONS() { - return (int)4L; + return _POSIX_THREAD_DESTRUCTOR_ITERATIONS; } + private static final int _POSIX_THREAD_THREADS_MAX = (int)64L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_THREAD_THREADS_MAX 64 * } */ public static int _POSIX_THREAD_THREADS_MAX() { - return (int)64L; + return _POSIX_THREAD_THREADS_MAX; } + private static final int AIO_PRIO_DELTA_MAX = (int)20L; /** - * {@snippet : + * {@snippet lang=c : * #define AIO_PRIO_DELTA_MAX 20 * } */ public static int AIO_PRIO_DELTA_MAX() { - return (int)20L; + return AIO_PRIO_DELTA_MAX; } + private static final int PTHREAD_STACK_MIN = (int)16384L; /** - * {@snippet : + * {@snippet lang=c : * #define PTHREAD_STACK_MIN 16384 * } */ public static int PTHREAD_STACK_MIN() { - return (int)16384L; + return PTHREAD_STACK_MIN; } + private static final int DELAYTIMER_MAX = (int)2147483647L; /** - * {@snippet : + * {@snippet lang=c : * #define DELAYTIMER_MAX 2147483647 * } */ public static int DELAYTIMER_MAX() { - return (int)2147483647L; + return DELAYTIMER_MAX; } + private static final int TTY_NAME_MAX = (int)32L; /** - * {@snippet : + * {@snippet lang=c : * #define TTY_NAME_MAX 32 * } */ public static int TTY_NAME_MAX() { - return (int)32L; + return TTY_NAME_MAX; } + private static final int LOGIN_NAME_MAX = (int)256L; /** - * {@snippet : + * {@snippet lang=c : * #define LOGIN_NAME_MAX 256 * } */ public static int LOGIN_NAME_MAX() { - return (int)256L; + return LOGIN_NAME_MAX; } + private static final int HOST_NAME_MAX = (int)64L; /** - * {@snippet : + * {@snippet lang=c : * #define HOST_NAME_MAX 64 * } */ public static int HOST_NAME_MAX() { - return (int)64L; + return HOST_NAME_MAX; } + private static final int MQ_PRIO_MAX = (int)32768L; /** - * {@snippet : + * {@snippet lang=c : * #define MQ_PRIO_MAX 32768 * } */ public static int MQ_PRIO_MAX() { - return (int)32768L; + return MQ_PRIO_MAX; } + private static final int _BITS_POSIX2_LIM_H = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define _BITS_POSIX2_LIM_H 1 * } */ public static int _BITS_POSIX2_LIM_H() { - return (int)1L; + return _BITS_POSIX2_LIM_H; } + private static final int _POSIX2_BC_BASE_MAX = (int)99L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX2_BC_BASE_MAX 99 * } */ public static int _POSIX2_BC_BASE_MAX() { - return (int)99L; + return _POSIX2_BC_BASE_MAX; } + private static final int _POSIX2_BC_DIM_MAX = (int)2048L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX2_BC_DIM_MAX 2048 * } */ public static int _POSIX2_BC_DIM_MAX() { - return (int)2048L; + return _POSIX2_BC_DIM_MAX; } + private static final int _POSIX2_BC_SCALE_MAX = (int)99L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX2_BC_SCALE_MAX 99 * } */ public static int _POSIX2_BC_SCALE_MAX() { - return (int)99L; + return _POSIX2_BC_SCALE_MAX; } + private static final int _POSIX2_BC_STRING_MAX = (int)1000L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX2_BC_STRING_MAX 1000 * } */ public static int _POSIX2_BC_STRING_MAX() { - return (int)1000L; + return _POSIX2_BC_STRING_MAX; } + private static final int _POSIX2_COLL_WEIGHTS_MAX = (int)2L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX2_COLL_WEIGHTS_MAX 2 * } */ public static int _POSIX2_COLL_WEIGHTS_MAX() { - return (int)2L; + return _POSIX2_COLL_WEIGHTS_MAX; } + private static final int _POSIX2_EXPR_NEST_MAX = (int)32L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX2_EXPR_NEST_MAX 32 * } */ public static int _POSIX2_EXPR_NEST_MAX() { - return (int)32L; + return _POSIX2_EXPR_NEST_MAX; } + private static final int _POSIX2_LINE_MAX = (int)2048L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX2_LINE_MAX 2048 * } */ public static int _POSIX2_LINE_MAX() { - return (int)2048L; + return _POSIX2_LINE_MAX; } + private static final int _POSIX2_RE_DUP_MAX = (int)255L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX2_RE_DUP_MAX 255 * } */ public static int _POSIX2_RE_DUP_MAX() { - return (int)255L; + return _POSIX2_RE_DUP_MAX; } + private static final int _POSIX2_CHARCLASS_NAME_MAX = (int)14L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX2_CHARCLASS_NAME_MAX 14 * } */ public static int _POSIX2_CHARCLASS_NAME_MAX() { - return (int)14L; + return _POSIX2_CHARCLASS_NAME_MAX; } + private static final int COLL_WEIGHTS_MAX = (int)255L; /** - * {@snippet : + * {@snippet lang=c : * #define COLL_WEIGHTS_MAX 255 * } */ public static int COLL_WEIGHTS_MAX() { - return (int)255L; + return COLL_WEIGHTS_MAX; } + private static final int CHARCLASS_NAME_MAX = (int)2048L; /** - * {@snippet : + * {@snippet lang=c : * #define CHARCLASS_NAME_MAX 2048 * } */ public static int CHARCLASS_NAME_MAX() { - return (int)2048L; + return CHARCLASS_NAME_MAX; } /** - * {@snippet : - * typedef unsigned char __u_char; + * {@snippet lang=c : + * typedef unsigned char __u_char * } */ - public static final OfByte __u_char = JAVA_BYTE; + public static final OfByte __u_char = argon2_h.C_CHAR; /** - * {@snippet : - * typedef unsigned short __u_short; + * {@snippet lang=c : + * typedef unsigned short __u_short * } */ - public static final OfShort __u_short = JAVA_SHORT; + public static final OfShort __u_short = argon2_h.C_SHORT; /** - * {@snippet : - * typedef unsigned int __u_int; + * {@snippet lang=c : + * typedef unsigned int __u_int * } */ - public static final OfInt __u_int = JAVA_INT; + public static final OfInt __u_int = argon2_h.C_INT; /** - * {@snippet : - * typedef unsigned long __u_long; + * {@snippet lang=c : + * typedef unsigned long __u_long * } */ - public static final OfLong __u_long = JAVA_LONG; + public static final OfLong __u_long = argon2_h.C_LONG; /** - * {@snippet : - * typedef signed char __int8_t; + * {@snippet lang=c : + * typedef signed char __int8_t * } */ - public static final OfByte __int8_t = JAVA_BYTE; + public static final OfByte __int8_t = argon2_h.C_CHAR; /** - * {@snippet : - * typedef unsigned char __uint8_t; + * {@snippet lang=c : + * typedef unsigned char __uint8_t * } */ - public static final OfByte __uint8_t = JAVA_BYTE; + public static final OfByte __uint8_t = argon2_h.C_CHAR; /** - * {@snippet : - * typedef short __int16_t; + * {@snippet lang=c : + * typedef short __int16_t * } */ - public static final OfShort __int16_t = JAVA_SHORT; + public static final OfShort __int16_t = argon2_h.C_SHORT; /** - * {@snippet : - * typedef unsigned short __uint16_t; + * {@snippet lang=c : + * typedef unsigned short __uint16_t * } */ - public static final OfShort __uint16_t = JAVA_SHORT; + public static final OfShort __uint16_t = argon2_h.C_SHORT; /** - * {@snippet : - * typedef int __int32_t; + * {@snippet lang=c : + * typedef int __int32_t * } */ - public static final OfInt __int32_t = JAVA_INT; + public static final OfInt __int32_t = argon2_h.C_INT; /** - * {@snippet : - * typedef unsigned int __uint32_t; + * {@snippet lang=c : + * typedef unsigned int __uint32_t * } */ - public static final OfInt __uint32_t = JAVA_INT; + public static final OfInt __uint32_t = argon2_h.C_INT; /** - * {@snippet : - * typedef long __int64_t; + * {@snippet lang=c : + * typedef long __int64_t * } */ - public static final OfLong __int64_t = JAVA_LONG; + public static final OfLong __int64_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned long __uint64_t; + * {@snippet lang=c : + * typedef unsigned long __uint64_t * } */ - public static final OfLong __uint64_t = JAVA_LONG; + public static final OfLong __uint64_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef signed char __int_least8_t; + * {@snippet lang=c : + * typedef __int8_t __int_least8_t * } */ - public static final OfByte __int_least8_t = JAVA_BYTE; + public static final OfByte __int_least8_t = argon2_h.C_CHAR; /** - * {@snippet : - * typedef unsigned char __uint_least8_t; + * {@snippet lang=c : + * typedef __uint8_t __uint_least8_t * } */ - public static final OfByte __uint_least8_t = JAVA_BYTE; + public static final OfByte __uint_least8_t = argon2_h.C_CHAR; /** - * {@snippet : - * typedef short __int_least16_t; + * {@snippet lang=c : + * typedef __int16_t __int_least16_t * } */ - public static final OfShort __int_least16_t = JAVA_SHORT; + public static final OfShort __int_least16_t = argon2_h.C_SHORT; /** - * {@snippet : - * typedef unsigned short __uint_least16_t; + * {@snippet lang=c : + * typedef __uint16_t __uint_least16_t * } */ - public static final OfShort __uint_least16_t = JAVA_SHORT; + public static final OfShort __uint_least16_t = argon2_h.C_SHORT; /** - * {@snippet : - * typedef int __int_least32_t; + * {@snippet lang=c : + * typedef __int32_t __int_least32_t * } */ - public static final OfInt __int_least32_t = JAVA_INT; + public static final OfInt __int_least32_t = argon2_h.C_INT; /** - * {@snippet : - * typedef unsigned int __uint_least32_t; + * {@snippet lang=c : + * typedef __uint32_t __uint_least32_t * } */ - public static final OfInt __uint_least32_t = JAVA_INT; + public static final OfInt __uint_least32_t = argon2_h.C_INT; /** - * {@snippet : - * typedef long __int_least64_t; + * {@snippet lang=c : + * typedef __int64_t __int_least64_t * } */ - public static final OfLong __int_least64_t = JAVA_LONG; + public static final OfLong __int_least64_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned long __uint_least64_t; + * {@snippet lang=c : + * typedef __uint64_t __uint_least64_t * } */ - public static final OfLong __uint_least64_t = JAVA_LONG; + public static final OfLong __uint_least64_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef long __quad_t; + * {@snippet lang=c : + * typedef long __quad_t * } */ - public static final OfLong __quad_t = JAVA_LONG; + public static final OfLong __quad_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned long __u_quad_t; + * {@snippet lang=c : + * typedef unsigned long __u_quad_t * } */ - public static final OfLong __u_quad_t = JAVA_LONG; + public static final OfLong __u_quad_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef long __intmax_t; + * {@snippet lang=c : + * typedef long __intmax_t * } */ - public static final OfLong __intmax_t = JAVA_LONG; + public static final OfLong __intmax_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned long __uintmax_t; + * {@snippet lang=c : + * typedef unsigned long __uintmax_t * } */ - public static final OfLong __uintmax_t = JAVA_LONG; + public static final OfLong __uintmax_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned long __dev_t; + * {@snippet lang=c : + * typedef unsigned long __dev_t * } */ - public static final OfLong __dev_t = JAVA_LONG; + public static final OfLong __dev_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned int __uid_t; + * {@snippet lang=c : + * typedef unsigned int __uid_t * } */ - public static final OfInt __uid_t = JAVA_INT; + public static final OfInt __uid_t = argon2_h.C_INT; /** - * {@snippet : - * typedef unsigned int __gid_t; + * {@snippet lang=c : + * typedef unsigned int __gid_t * } */ - public static final OfInt __gid_t = JAVA_INT; + public static final OfInt __gid_t = argon2_h.C_INT; /** - * {@snippet : - * typedef unsigned long __ino_t; + * {@snippet lang=c : + * typedef unsigned long __ino_t * } */ - public static final OfLong __ino_t = JAVA_LONG; + public static final OfLong __ino_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned long __ino64_t; + * {@snippet lang=c : + * typedef unsigned long __ino64_t * } */ - public static final OfLong __ino64_t = JAVA_LONG; + public static final OfLong __ino64_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned int __mode_t; + * {@snippet lang=c : + * typedef unsigned int __mode_t * } */ - public static final OfInt __mode_t = JAVA_INT; + public static final OfInt __mode_t = argon2_h.C_INT; /** - * {@snippet : - * typedef unsigned long __nlink_t; + * {@snippet lang=c : + * typedef unsigned long __nlink_t * } */ - public static final OfLong __nlink_t = JAVA_LONG; + public static final OfLong __nlink_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef long __off_t; + * {@snippet lang=c : + * typedef long __off_t * } */ - public static final OfLong __off_t = JAVA_LONG; + public static final OfLong __off_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef long __off64_t; + * {@snippet lang=c : + * typedef long __off64_t * } */ - public static final OfLong __off64_t = JAVA_LONG; + public static final OfLong __off64_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef int __pid_t; + * {@snippet lang=c : + * typedef int __pid_t * } */ - public static final OfInt __pid_t = JAVA_INT; + public static final OfInt __pid_t = argon2_h.C_INT; /** - * {@snippet : - * typedef long __clock_t; + * {@snippet lang=c : + * typedef long __clock_t * } */ - public static final OfLong __clock_t = JAVA_LONG; + public static final OfLong __clock_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned long __rlim_t; + * {@snippet lang=c : + * typedef unsigned long __rlim_t * } */ - public static final OfLong __rlim_t = JAVA_LONG; + public static final OfLong __rlim_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned long __rlim64_t; + * {@snippet lang=c : + * typedef unsigned long __rlim64_t * } */ - public static final OfLong __rlim64_t = JAVA_LONG; + public static final OfLong __rlim64_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned int __id_t; + * {@snippet lang=c : + * typedef unsigned int __id_t * } */ - public static final OfInt __id_t = JAVA_INT; + public static final OfInt __id_t = argon2_h.C_INT; /** - * {@snippet : - * typedef long __time_t; + * {@snippet lang=c : + * typedef long __time_t * } */ - public static final OfLong __time_t = JAVA_LONG; + public static final OfLong __time_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned int __useconds_t; + * {@snippet lang=c : + * typedef unsigned int __useconds_t * } */ - public static final OfInt __useconds_t = JAVA_INT; + public static final OfInt __useconds_t = argon2_h.C_INT; /** - * {@snippet : - * typedef long __suseconds_t; + * {@snippet lang=c : + * typedef long __suseconds_t * } */ - public static final OfLong __suseconds_t = JAVA_LONG; + public static final OfLong __suseconds_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef long __suseconds64_t; + * {@snippet lang=c : + * typedef long __suseconds64_t * } */ - public static final OfLong __suseconds64_t = JAVA_LONG; + public static final OfLong __suseconds64_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef int __daddr_t; + * {@snippet lang=c : + * typedef int __daddr_t * } */ - public static final OfInt __daddr_t = JAVA_INT; + public static final OfInt __daddr_t = argon2_h.C_INT; /** - * {@snippet : - * typedef int __key_t; + * {@snippet lang=c : + * typedef int __key_t * } */ - public static final OfInt __key_t = JAVA_INT; + public static final OfInt __key_t = argon2_h.C_INT; /** - * {@snippet : - * typedef int __clockid_t; + * {@snippet lang=c : + * typedef int __clockid_t * } */ - public static final OfInt __clockid_t = JAVA_INT; + public static final OfInt __clockid_t = argon2_h.C_INT; /** - * {@snippet : - * typedef void* __timer_t; + * {@snippet lang=c : + * typedef void *__timer_t * } */ - public static final AddressLayout __timer_t = RuntimeHelper.POINTER; + public static final AddressLayout __timer_t = argon2_h.C_POINTER; /** - * {@snippet : - * typedef long __blksize_t; + * {@snippet lang=c : + * typedef long __blksize_t * } */ - public static final OfLong __blksize_t = JAVA_LONG; + public static final OfLong __blksize_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef long __blkcnt_t; + * {@snippet lang=c : + * typedef long __blkcnt_t * } */ - public static final OfLong __blkcnt_t = JAVA_LONG; + public static final OfLong __blkcnt_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef long __blkcnt64_t; + * {@snippet lang=c : + * typedef long __blkcnt64_t * } */ - public static final OfLong __blkcnt64_t = JAVA_LONG; + public static final OfLong __blkcnt64_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned long __fsblkcnt_t; + * {@snippet lang=c : + * typedef unsigned long __fsblkcnt_t * } */ - public static final OfLong __fsblkcnt_t = JAVA_LONG; + public static final OfLong __fsblkcnt_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned long __fsblkcnt64_t; + * {@snippet lang=c : + * typedef unsigned long __fsblkcnt64_t * } */ - public static final OfLong __fsblkcnt64_t = JAVA_LONG; + public static final OfLong __fsblkcnt64_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned long __fsfilcnt_t; + * {@snippet lang=c : + * typedef unsigned long __fsfilcnt_t * } */ - public static final OfLong __fsfilcnt_t = JAVA_LONG; + public static final OfLong __fsfilcnt_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned long __fsfilcnt64_t; + * {@snippet lang=c : + * typedef unsigned long __fsfilcnt64_t * } */ - public static final OfLong __fsfilcnt64_t = JAVA_LONG; + public static final OfLong __fsfilcnt64_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef long __fsword_t; + * {@snippet lang=c : + * typedef long __fsword_t * } */ - public static final OfLong __fsword_t = JAVA_LONG; + public static final OfLong __fsword_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef long __ssize_t; + * {@snippet lang=c : + * typedef long __ssize_t * } */ - public static final OfLong __ssize_t = JAVA_LONG; + public static final OfLong __ssize_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef long __syscall_slong_t; + * {@snippet lang=c : + * typedef long __syscall_slong_t * } */ - public static final OfLong __syscall_slong_t = JAVA_LONG; + public static final OfLong __syscall_slong_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned long __syscall_ulong_t; + * {@snippet lang=c : + * typedef unsigned long __syscall_ulong_t * } */ - public static final OfLong __syscall_ulong_t = JAVA_LONG; + public static final OfLong __syscall_ulong_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef long __loff_t; + * {@snippet lang=c : + * typedef __off64_t __loff_t * } */ - public static final OfLong __loff_t = JAVA_LONG; + public static final OfLong __loff_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef char* __caddr_t; + * {@snippet lang=c : + * typedef char *__caddr_t * } */ - public static final AddressLayout __caddr_t = RuntimeHelper.POINTER; + public static final AddressLayout __caddr_t = argon2_h.C_POINTER; /** - * {@snippet : - * typedef long __intptr_t; + * {@snippet lang=c : + * typedef long __intptr_t * } */ - public static final OfLong __intptr_t = JAVA_LONG; + public static final OfLong __intptr_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned int __socklen_t; + * {@snippet lang=c : + * typedef unsigned int __socklen_t * } */ - public static final OfInt __socklen_t = JAVA_INT; + public static final OfInt __socklen_t = argon2_h.C_INT; /** - * {@snippet : - * typedef int __sig_atomic_t; + * {@snippet lang=c : + * typedef int __sig_atomic_t * } */ - public static final OfInt __sig_atomic_t = JAVA_INT; + public static final OfInt __sig_atomic_t = argon2_h.C_INT; /** - * {@snippet : - * typedef signed char int8_t; + * {@snippet lang=c : + * typedef __int8_t int8_t * } */ - public static final OfByte int8_t = JAVA_BYTE; + public static final OfByte int8_t = argon2_h.C_CHAR; /** - * {@snippet : - * typedef short int16_t; + * {@snippet lang=c : + * typedef __int16_t int16_t * } */ - public static final OfShort int16_t = JAVA_SHORT; + public static final OfShort int16_t = argon2_h.C_SHORT; /** - * {@snippet : - * typedef int int32_t; + * {@snippet lang=c : + * typedef __int32_t int32_t * } */ - public static final OfInt int32_t = JAVA_INT; + public static final OfInt int32_t = argon2_h.C_INT; /** - * {@snippet : - * typedef long int64_t; + * {@snippet lang=c : + * typedef __int64_t int64_t * } */ - public static final OfLong int64_t = JAVA_LONG; + public static final OfLong int64_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned char uint8_t; + * {@snippet lang=c : + * typedef __uint8_t uint8_t * } */ - public static final OfByte uint8_t = JAVA_BYTE; + public static final OfByte uint8_t = argon2_h.C_CHAR; /** - * {@snippet : - * typedef unsigned short uint16_t; + * {@snippet lang=c : + * typedef __uint16_t uint16_t * } */ - public static final OfShort uint16_t = JAVA_SHORT; + public static final OfShort uint16_t = argon2_h.C_SHORT; /** - * {@snippet : - * typedef unsigned int uint32_t; + * {@snippet lang=c : + * typedef __uint32_t uint32_t * } */ - public static final OfInt uint32_t = JAVA_INT; + public static final OfInt uint32_t = argon2_h.C_INT; /** - * {@snippet : - * typedef unsigned long uint64_t; + * {@snippet lang=c : + * typedef __uint64_t uint64_t * } */ - public static final OfLong uint64_t = JAVA_LONG; + public static final OfLong uint64_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef signed char int_least8_t; + * {@snippet lang=c : + * typedef __int_least8_t int_least8_t * } */ - public static final OfByte int_least8_t = JAVA_BYTE; + public static final OfByte int_least8_t = argon2_h.C_CHAR; /** - * {@snippet : - * typedef short int_least16_t; + * {@snippet lang=c : + * typedef __int_least16_t int_least16_t * } */ - public static final OfShort int_least16_t = JAVA_SHORT; + public static final OfShort int_least16_t = argon2_h.C_SHORT; /** - * {@snippet : - * typedef int int_least32_t; + * {@snippet lang=c : + * typedef __int_least32_t int_least32_t * } */ - public static final OfInt int_least32_t = JAVA_INT; + public static final OfInt int_least32_t = argon2_h.C_INT; /** - * {@snippet : - * typedef long int_least64_t; + * {@snippet lang=c : + * typedef __int_least64_t int_least64_t * } */ - public static final OfLong int_least64_t = JAVA_LONG; + public static final OfLong int_least64_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned char uint_least8_t; + * {@snippet lang=c : + * typedef __uint_least8_t uint_least8_t * } */ - public static final OfByte uint_least8_t = JAVA_BYTE; + public static final OfByte uint_least8_t = argon2_h.C_CHAR; /** - * {@snippet : - * typedef unsigned short uint_least16_t; + * {@snippet lang=c : + * typedef __uint_least16_t uint_least16_t * } */ - public static final OfShort uint_least16_t = JAVA_SHORT; + public static final OfShort uint_least16_t = argon2_h.C_SHORT; /** - * {@snippet : - * typedef unsigned int uint_least32_t; + * {@snippet lang=c : + * typedef __uint_least32_t uint_least32_t * } */ - public static final OfInt uint_least32_t = JAVA_INT; + public static final OfInt uint_least32_t = argon2_h.C_INT; /** - * {@snippet : - * typedef unsigned long uint_least64_t; + * {@snippet lang=c : + * typedef __uint_least64_t uint_least64_t * } */ - public static final OfLong uint_least64_t = JAVA_LONG; + public static final OfLong uint_least64_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef signed char int_fast8_t; + * {@snippet lang=c : + * typedef signed char int_fast8_t * } */ - public static final OfByte int_fast8_t = JAVA_BYTE; + public static final OfByte int_fast8_t = argon2_h.C_CHAR; /** - * {@snippet : - * typedef long int_fast16_t; + * {@snippet lang=c : + * typedef long int_fast16_t * } */ - public static final OfLong int_fast16_t = JAVA_LONG; + public static final OfLong int_fast16_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef long int_fast32_t; + * {@snippet lang=c : + * typedef long int_fast32_t * } */ - public static final OfLong int_fast32_t = JAVA_LONG; + public static final OfLong int_fast32_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef long int_fast64_t; + * {@snippet lang=c : + * typedef long int_fast64_t * } */ - public static final OfLong int_fast64_t = JAVA_LONG; + public static final OfLong int_fast64_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned char uint_fast8_t; + * {@snippet lang=c : + * typedef unsigned char uint_fast8_t * } */ - public static final OfByte uint_fast8_t = JAVA_BYTE; + public static final OfByte uint_fast8_t = argon2_h.C_CHAR; /** - * {@snippet : - * typedef unsigned long uint_fast16_t; + * {@snippet lang=c : + * typedef unsigned long uint_fast16_t * } */ - public static final OfLong uint_fast16_t = JAVA_LONG; + public static final OfLong uint_fast16_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned long uint_fast32_t; + * {@snippet lang=c : + * typedef unsigned long uint_fast32_t * } */ - public static final OfLong uint_fast32_t = JAVA_LONG; + public static final OfLong uint_fast32_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned long uint_fast64_t; + * {@snippet lang=c : + * typedef unsigned long uint_fast64_t * } */ - public static final OfLong uint_fast64_t = JAVA_LONG; + public static final OfLong uint_fast64_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef long intptr_t; + * {@snippet lang=c : + * typedef long intptr_t * } */ - public static final OfLong intptr_t = JAVA_LONG; + public static final OfLong intptr_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned long uintptr_t; + * {@snippet lang=c : + * typedef unsigned long uintptr_t * } */ - public static final OfLong uintptr_t = JAVA_LONG; + public static final OfLong uintptr_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef long intmax_t; + * {@snippet lang=c : + * typedef __intmax_t intmax_t * } */ - public static final OfLong intmax_t = JAVA_LONG; + public static final OfLong intmax_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned long uintmax_t; + * {@snippet lang=c : + * typedef __uintmax_t uintmax_t * } */ - public static final OfLong uintmax_t = JAVA_LONG; + public static final OfLong uintmax_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef long ptrdiff_t; + * {@snippet lang=c : + * typedef long ptrdiff_t * } */ - public static final OfLong ptrdiff_t = JAVA_LONG; + public static final OfLong ptrdiff_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef unsigned long size_t; + * {@snippet lang=c : + * typedef unsigned long size_t * } */ - public static final OfLong size_t = JAVA_LONG; + public static final OfLong size_t = argon2_h.C_LONG; /** - * {@snippet : - * typedef int wchar_t; + * {@snippet lang=c : + * typedef int wchar_t * } */ - public static final OfInt wchar_t = JAVA_INT; - public static MemoryLayout FLAG_clear_internal_memory$LAYOUT() { - return JAVA_INT; + public static final OfInt wchar_t = argon2_h.C_INT; + + private static class FLAG_clear_internal_memory$constants { + public static final OfInt LAYOUT = argon2_h.C_INT; + public static final MemorySegment SEGMENT = argon2_h.findOrThrow("FLAG_clear_internal_memory").reinterpret(LAYOUT.byteSize()); } - public static VarHandle FLAG_clear_internal_memory$VH() { - return constants$0.const$3; + + /** + * Layout for variable: + * {@snippet lang=c : + * extern int FLAG_clear_internal_memory + * } + */ + public static OfInt FLAG_clear_internal_memory$layout() { + return FLAG_clear_internal_memory$constants.LAYOUT; } - public static MemorySegment FLAG_clear_internal_memory$SEGMENT() { - return RuntimeHelper.requireNonNull(constants$0.const$4,"FLAG_clear_internal_memory"); + + /** + * Segment for variable: + * {@snippet lang=c : + * extern int FLAG_clear_internal_memory + * } + */ + public static MemorySegment FLAG_clear_internal_memory$segment() { + return FLAG_clear_internal_memory$constants.SEGMENT; } + /** * Getter for variable: - * {@snippet : - * int FLAG_clear_internal_memory; + * {@snippet lang=c : + * extern int FLAG_clear_internal_memory * } */ - public static int FLAG_clear_internal_memory$get() { - return (int) constants$0.const$3.get(RuntimeHelper.requireNonNull(constants$0.const$4, "FLAG_clear_internal_memory")); + public static int FLAG_clear_internal_memory() { + return FLAG_clear_internal_memory$constants.SEGMENT.get(FLAG_clear_internal_memory$constants.LAYOUT, 0L); } + /** * Setter for variable: - * {@snippet : - * int FLAG_clear_internal_memory; + * {@snippet lang=c : + * extern int FLAG_clear_internal_memory * } */ - public static void FLAG_clear_internal_memory$set(int x) { - constants$0.const$3.set(RuntimeHelper.requireNonNull(constants$0.const$4, "FLAG_clear_internal_memory"), x); + public static void FLAG_clear_internal_memory(int varValue) { + FLAG_clear_internal_memory$constants.SEGMENT.set(FLAG_clear_internal_memory$constants.LAYOUT, 0L, varValue); } + private static final int ARGON2_OK = (int)0L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_OK = 0; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_OK = 0 * } */ public static int ARGON2_OK() { - return (int)0L; + return ARGON2_OK; } + private static final int ARGON2_OUTPUT_PTR_NULL = (int)-1L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_OUTPUT_PTR_NULL = -1; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_OUTPUT_PTR_NULL = -1 * } */ public static int ARGON2_OUTPUT_PTR_NULL() { - return (int)-1L; + return ARGON2_OUTPUT_PTR_NULL; } + private static final int ARGON2_OUTPUT_TOO_SHORT = (int)-2L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_OUTPUT_TOO_SHORT = -2; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_OUTPUT_TOO_SHORT = -2 * } */ public static int ARGON2_OUTPUT_TOO_SHORT() { - return (int)-2L; + return ARGON2_OUTPUT_TOO_SHORT; } + private static final int ARGON2_OUTPUT_TOO_LONG = (int)-3L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_OUTPUT_TOO_LONG = -3; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_OUTPUT_TOO_LONG = -3 * } */ public static int ARGON2_OUTPUT_TOO_LONG() { - return (int)-3L; + return ARGON2_OUTPUT_TOO_LONG; } + private static final int ARGON2_PWD_TOO_SHORT = (int)-4L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_PWD_TOO_SHORT = -4; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_PWD_TOO_SHORT = -4 * } */ public static int ARGON2_PWD_TOO_SHORT() { - return (int)-4L; + return ARGON2_PWD_TOO_SHORT; } + private static final int ARGON2_PWD_TOO_LONG = (int)-5L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_PWD_TOO_LONG = -5; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_PWD_TOO_LONG = -5 * } */ public static int ARGON2_PWD_TOO_LONG() { - return (int)-5L; + return ARGON2_PWD_TOO_LONG; } + private static final int ARGON2_SALT_TOO_SHORT = (int)-6L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_SALT_TOO_SHORT = -6; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_SALT_TOO_SHORT = -6 * } */ public static int ARGON2_SALT_TOO_SHORT() { - return (int)-6L; + return ARGON2_SALT_TOO_SHORT; } + private static final int ARGON2_SALT_TOO_LONG = (int)-7L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_SALT_TOO_LONG = -7; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_SALT_TOO_LONG = -7 * } */ public static int ARGON2_SALT_TOO_LONG() { - return (int)-7L; + return ARGON2_SALT_TOO_LONG; } + private static final int ARGON2_AD_TOO_SHORT = (int)-8L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_AD_TOO_SHORT = -8; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_AD_TOO_SHORT = -8 * } */ public static int ARGON2_AD_TOO_SHORT() { - return (int)-8L; + return ARGON2_AD_TOO_SHORT; } + private static final int ARGON2_AD_TOO_LONG = (int)-9L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_AD_TOO_LONG = -9; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_AD_TOO_LONG = -9 * } */ public static int ARGON2_AD_TOO_LONG() { - return (int)-9L; + return ARGON2_AD_TOO_LONG; } + private static final int ARGON2_SECRET_TOO_SHORT = (int)-10L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_SECRET_TOO_SHORT = -10; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_SECRET_TOO_SHORT = -10 * } */ public static int ARGON2_SECRET_TOO_SHORT() { - return (int)-10L; + return ARGON2_SECRET_TOO_SHORT; } + private static final int ARGON2_SECRET_TOO_LONG = (int)-11L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_SECRET_TOO_LONG = -11; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_SECRET_TOO_LONG = -11 * } */ public static int ARGON2_SECRET_TOO_LONG() { - return (int)-11L; + return ARGON2_SECRET_TOO_LONG; } + private static final int ARGON2_TIME_TOO_SMALL = (int)-12L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_TIME_TOO_SMALL = -12; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_TIME_TOO_SMALL = -12 * } */ public static int ARGON2_TIME_TOO_SMALL() { - return (int)-12L; + return ARGON2_TIME_TOO_SMALL; } + private static final int ARGON2_TIME_TOO_LARGE = (int)-13L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_TIME_TOO_LARGE = -13; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_TIME_TOO_LARGE = -13 * } */ public static int ARGON2_TIME_TOO_LARGE() { - return (int)-13L; + return ARGON2_TIME_TOO_LARGE; } + private static final int ARGON2_MEMORY_TOO_LITTLE = (int)-14L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_MEMORY_TOO_LITTLE = -14; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_MEMORY_TOO_LITTLE = -14 * } */ public static int ARGON2_MEMORY_TOO_LITTLE() { - return (int)-14L; + return ARGON2_MEMORY_TOO_LITTLE; } + private static final int ARGON2_MEMORY_TOO_MUCH = (int)-15L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_MEMORY_TOO_MUCH = -15; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_MEMORY_TOO_MUCH = -15 * } */ public static int ARGON2_MEMORY_TOO_MUCH() { - return (int)-15L; + return ARGON2_MEMORY_TOO_MUCH; } + private static final int ARGON2_LANES_TOO_FEW = (int)-16L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_LANES_TOO_FEW = -16; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_LANES_TOO_FEW = -16 * } */ public static int ARGON2_LANES_TOO_FEW() { - return (int)-16L; + return ARGON2_LANES_TOO_FEW; } + private static final int ARGON2_LANES_TOO_MANY = (int)-17L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_LANES_TOO_MANY = -17; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_LANES_TOO_MANY = -17 * } */ public static int ARGON2_LANES_TOO_MANY() { - return (int)-17L; + return ARGON2_LANES_TOO_MANY; } + private static final int ARGON2_PWD_PTR_MISMATCH = (int)-18L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_PWD_PTR_MISMATCH = -18; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_PWD_PTR_MISMATCH = -18 * } */ public static int ARGON2_PWD_PTR_MISMATCH() { - return (int)-18L; + return ARGON2_PWD_PTR_MISMATCH; } + private static final int ARGON2_SALT_PTR_MISMATCH = (int)-19L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_SALT_PTR_MISMATCH = -19; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_SALT_PTR_MISMATCH = -19 * } */ public static int ARGON2_SALT_PTR_MISMATCH() { - return (int)-19L; + return ARGON2_SALT_PTR_MISMATCH; } + private static final int ARGON2_SECRET_PTR_MISMATCH = (int)-20L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_SECRET_PTR_MISMATCH = -20; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_SECRET_PTR_MISMATCH = -20 * } */ public static int ARGON2_SECRET_PTR_MISMATCH() { - return (int)-20L; + return ARGON2_SECRET_PTR_MISMATCH; } + private static final int ARGON2_AD_PTR_MISMATCH = (int)-21L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_AD_PTR_MISMATCH = -21; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_AD_PTR_MISMATCH = -21 * } */ public static int ARGON2_AD_PTR_MISMATCH() { - return (int)-21L; + return ARGON2_AD_PTR_MISMATCH; } + private static final int ARGON2_MEMORY_ALLOCATION_ERROR = (int)-22L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_MEMORY_ALLOCATION_ERROR = -22; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_MEMORY_ALLOCATION_ERROR = -22 * } */ public static int ARGON2_MEMORY_ALLOCATION_ERROR() { - return (int)-22L; + return ARGON2_MEMORY_ALLOCATION_ERROR; } + private static final int ARGON2_FREE_MEMORY_CBK_NULL = (int)-23L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_FREE_MEMORY_CBK_NULL = -23; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_FREE_MEMORY_CBK_NULL = -23 * } */ public static int ARGON2_FREE_MEMORY_CBK_NULL() { - return (int)-23L; + return ARGON2_FREE_MEMORY_CBK_NULL; } + private static final int ARGON2_ALLOCATE_MEMORY_CBK_NULL = (int)-24L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_ALLOCATE_MEMORY_CBK_NULL = -24; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_ALLOCATE_MEMORY_CBK_NULL = -24 * } */ public static int ARGON2_ALLOCATE_MEMORY_CBK_NULL() { - return (int)-24L; + return ARGON2_ALLOCATE_MEMORY_CBK_NULL; } + private static final int ARGON2_INCORRECT_PARAMETER = (int)-25L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_INCORRECT_PARAMETER = -25; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_INCORRECT_PARAMETER = -25 * } */ public static int ARGON2_INCORRECT_PARAMETER() { - return (int)-25L; + return ARGON2_INCORRECT_PARAMETER; } + private static final int ARGON2_INCORRECT_TYPE = (int)-26L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_INCORRECT_TYPE = -26; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_INCORRECT_TYPE = -26 * } */ public static int ARGON2_INCORRECT_TYPE() { - return (int)-26L; + return ARGON2_INCORRECT_TYPE; } + private static final int ARGON2_OUT_PTR_MISMATCH = (int)-27L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_OUT_PTR_MISMATCH = -27; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_OUT_PTR_MISMATCH = -27 * } */ public static int ARGON2_OUT_PTR_MISMATCH() { - return (int)-27L; + return ARGON2_OUT_PTR_MISMATCH; } + private static final int ARGON2_THREADS_TOO_FEW = (int)-28L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_THREADS_TOO_FEW = -28; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_THREADS_TOO_FEW = -28 * } */ public static int ARGON2_THREADS_TOO_FEW() { - return (int)-28L; + return ARGON2_THREADS_TOO_FEW; } + private static final int ARGON2_THREADS_TOO_MANY = (int)-29L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_THREADS_TOO_MANY = -29; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_THREADS_TOO_MANY = -29 * } */ public static int ARGON2_THREADS_TOO_MANY() { - return (int)-29L; + return ARGON2_THREADS_TOO_MANY; } + private static final int ARGON2_MISSING_ARGS = (int)-30L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_MISSING_ARGS = -30; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_MISSING_ARGS = -30 * } */ public static int ARGON2_MISSING_ARGS() { - return (int)-30L; + return ARGON2_MISSING_ARGS; } + private static final int ARGON2_ENCODING_FAIL = (int)-31L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_ENCODING_FAIL = -31; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_ENCODING_FAIL = -31 * } */ public static int ARGON2_ENCODING_FAIL() { - return (int)-31L; + return ARGON2_ENCODING_FAIL; } + private static final int ARGON2_DECODING_FAIL = (int)-32L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_DECODING_FAIL = -32; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_DECODING_FAIL = -32 * } */ public static int ARGON2_DECODING_FAIL() { - return (int)-32L; + return ARGON2_DECODING_FAIL; } + private static final int ARGON2_THREAD_FAIL = (int)-33L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_THREAD_FAIL = -33; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_THREAD_FAIL = -33 * } */ public static int ARGON2_THREAD_FAIL() { - return (int)-33L; + return ARGON2_THREAD_FAIL; } + private static final int ARGON2_DECODING_LENGTH_FAIL = (int)-34L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_DECODING_LENGTH_FAIL = -34; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_DECODING_LENGTH_FAIL = -34 * } */ public static int ARGON2_DECODING_LENGTH_FAIL() { - return (int)-34L; + return ARGON2_DECODING_LENGTH_FAIL; } + private static final int ARGON2_VERIFY_MISMATCH = (int)-35L; /** - * {@snippet : - * enum Argon2_ErrorCodes.ARGON2_VERIFY_MISMATCH = -35; + * {@snippet lang=c : + * enum Argon2_ErrorCodes.ARGON2_VERIFY_MISMATCH = -35 * } */ public static int ARGON2_VERIFY_MISMATCH() { - return (int)-35L; + return ARGON2_VERIFY_MISMATCH; } + private static final int Argon2_d = (int)0L; /** - * {@snippet : - * enum Argon2_type.Argon2_d = 0; + * {@snippet lang=c : + * enum Argon2_type.Argon2_d = 0 * } */ public static int Argon2_d() { - return (int)0L; + return Argon2_d; } + private static final int Argon2_i = (int)1L; /** - * {@snippet : - * enum Argon2_type.Argon2_i = 1; + * {@snippet lang=c : + * enum Argon2_type.Argon2_i = 1 * } */ public static int Argon2_i() { - return (int)1L; + return Argon2_i; } + private static final int Argon2_id = (int)2L; /** - * {@snippet : - * enum Argon2_type.Argon2_id = 2; + * {@snippet lang=c : + * enum Argon2_type.Argon2_id = 2 * } */ public static int Argon2_id() { - return (int)2L; + return Argon2_id; } + private static final int ARGON2_VERSION_10 = (int)16L; /** - * {@snippet : - * enum Argon2_version.ARGON2_VERSION_10 = 16; + * {@snippet lang=c : + * enum Argon2_version.ARGON2_VERSION_10 = 16 * } */ public static int ARGON2_VERSION_10() { - return (int)16L; + return ARGON2_VERSION_10; } + private static final int ARGON2_VERSION_13 = (int)19L; /** - * {@snippet : - * enum Argon2_version.ARGON2_VERSION_13 = 19; + * {@snippet lang=c : + * enum Argon2_version.ARGON2_VERSION_13 = 19 * } */ public static int ARGON2_VERSION_13() { - return (int)19L; + return ARGON2_VERSION_13; } + private static final int ARGON2_VERSION_NUMBER = (int)19L; /** - * {@snippet : - * enum Argon2_version.ARGON2_VERSION_NUMBER = 19; + * {@snippet lang=c : + * enum Argon2_version.ARGON2_VERSION_NUMBER = 19 * } */ public static int ARGON2_VERSION_NUMBER() { - return (int)19L; + return ARGON2_VERSION_NUMBER; + } + + private static class argon2_type2string { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_POINTER, + argon2_h.C_INT, + argon2_h.C_INT + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2_type2string"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * const char *argon2_type2string(argon2_type type, int uppercase) + * } + */ + public static FunctionDescriptor argon2_type2string$descriptor() { + return argon2_type2string.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * const char *argon2_type2string(argon2_type type, int uppercase) + * } + */ + public static MethodHandle argon2_type2string$handle() { + return argon2_type2string.HANDLE; } - public static MethodHandle argon2_type2string$MH() { - return RuntimeHelper.requireNonNull(constants$5.const$1,"argon2_type2string"); + + /** + * Address for: + * {@snippet lang=c : + * const char *argon2_type2string(argon2_type type, int uppercase) + * } + */ + public static MemorySegment argon2_type2string$address() { + return argon2_type2string.ADDR; } + /** - * {@snippet : - * char* argon2_type2string(argon2_type type, int uppercase); + * {@snippet lang=c : + * const char *argon2_type2string(argon2_type type, int uppercase) * } */ public static MemorySegment argon2_type2string(int type, int uppercase) { - var mh$ = argon2_type2string$MH(); + var mh$ = argon2_type2string.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2_type2string", type, uppercase); + } return (MemorySegment)mh$.invokeExact(type, uppercase); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2_ctx$MH() { - return RuntimeHelper.requireNonNull(constants$5.const$3,"argon2_ctx"); + + private static class argon2_ctx { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_POINTER, + argon2_h.C_INT + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2_ctx"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int argon2_ctx(argon2_context *context, argon2_type type) + * } + */ + public static FunctionDescriptor argon2_ctx$descriptor() { + return argon2_ctx.DESC; } + /** - * {@snippet : - * int argon2_ctx(argon2_context* context, argon2_type type); + * Downcall method handle for: + * {@snippet lang=c : + * int argon2_ctx(argon2_context *context, argon2_type type) + * } + */ + public static MethodHandle argon2_ctx$handle() { + return argon2_ctx.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int argon2_ctx(argon2_context *context, argon2_type type) + * } + */ + public static MemorySegment argon2_ctx$address() { + return argon2_ctx.ADDR; + } + + /** + * {@snippet lang=c : + * int argon2_ctx(argon2_context *context, argon2_type type) * } */ public static int argon2_ctx(MemorySegment context, int type) { - var mh$ = argon2_ctx$MH(); + var mh$ = argon2_ctx.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2_ctx", context, type); + } return (int)mh$.invokeExact(context, type); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2i_hash_encoded$MH() { - return RuntimeHelper.requireNonNull(constants$5.const$5,"argon2i_hash_encoded"); + + private static class argon2i_hash_encoded { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_POINTER, + argon2_h.C_LONG, + argon2_h.C_POINTER, + argon2_h.C_LONG, + argon2_h.C_LONG, + argon2_h.C_POINTER, + argon2_h.C_LONG + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2i_hash_encoded"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int argon2i_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, const size_t hashlen, char *encoded, const size_t encodedlen) + * } + */ + public static FunctionDescriptor argon2i_hash_encoded$descriptor() { + return argon2i_hash_encoded.DESC; } + /** - * {@snippet : - * int argon2i_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, void* pwd, const size_t pwdlen, void* salt, const size_t saltlen, const size_t hashlen, char* encoded, const size_t encodedlen); + * Downcall method handle for: + * {@snippet lang=c : + * int argon2i_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, const size_t hashlen, char *encoded, const size_t encodedlen) + * } + */ + public static MethodHandle argon2i_hash_encoded$handle() { + return argon2i_hash_encoded.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int argon2i_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, const size_t hashlen, char *encoded, const size_t encodedlen) + * } + */ + public static MemorySegment argon2i_hash_encoded$address() { + return argon2i_hash_encoded.ADDR; + } + + /** + * {@snippet lang=c : + * int argon2i_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, const size_t hashlen, char *encoded, const size_t encodedlen) * } */ public static int argon2i_hash_encoded(int t_cost, int m_cost, int parallelism, MemorySegment pwd, long pwdlen, MemorySegment salt, long saltlen, long hashlen, MemorySegment encoded, long encodedlen) { - var mh$ = argon2i_hash_encoded$MH(); + var mh$ = argon2i_hash_encoded.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2i_hash_encoded", t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, hashlen, encoded, encodedlen); + } return (int)mh$.invokeExact(t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, hashlen, encoded, encodedlen); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2i_hash_raw$MH() { - return RuntimeHelper.requireNonNull(constants$6.const$1,"argon2i_hash_raw"); + + private static class argon2i_hash_raw { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_POINTER, + argon2_h.C_LONG, + argon2_h.C_POINTER, + argon2_h.C_LONG, + argon2_h.C_POINTER, + argon2_h.C_LONG + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2i_hash_raw"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int argon2i_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, void *hash, const size_t hashlen) + * } + */ + public static FunctionDescriptor argon2i_hash_raw$descriptor() { + return argon2i_hash_raw.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * int argon2i_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, void *hash, const size_t hashlen) + * } + */ + public static MethodHandle argon2i_hash_raw$handle() { + return argon2i_hash_raw.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int argon2i_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, void *hash, const size_t hashlen) + * } + */ + public static MemorySegment argon2i_hash_raw$address() { + return argon2i_hash_raw.ADDR; } + /** - * {@snippet : - * int argon2i_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, void* pwd, const size_t pwdlen, void* salt, const size_t saltlen, void* hash, const size_t hashlen); + * {@snippet lang=c : + * int argon2i_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, void *hash, const size_t hashlen) * } */ public static int argon2i_hash_raw(int t_cost, int m_cost, int parallelism, MemorySegment pwd, long pwdlen, MemorySegment salt, long saltlen, MemorySegment hash, long hashlen) { - var mh$ = argon2i_hash_raw$MH(); + var mh$ = argon2i_hash_raw.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2i_hash_raw", t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, hash, hashlen); + } return (int)mh$.invokeExact(t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, hash, hashlen); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2d_hash_encoded$MH() { - return RuntimeHelper.requireNonNull(constants$6.const$2,"argon2d_hash_encoded"); + + private static class argon2d_hash_encoded { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_POINTER, + argon2_h.C_LONG, + argon2_h.C_POINTER, + argon2_h.C_LONG, + argon2_h.C_LONG, + argon2_h.C_POINTER, + argon2_h.C_LONG + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2d_hash_encoded"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int argon2d_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, const size_t hashlen, char *encoded, const size_t encodedlen) + * } + */ + public static FunctionDescriptor argon2d_hash_encoded$descriptor() { + return argon2d_hash_encoded.DESC; } + /** - * {@snippet : - * int argon2d_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, void* pwd, const size_t pwdlen, void* salt, const size_t saltlen, const size_t hashlen, char* encoded, const size_t encodedlen); + * Downcall method handle for: + * {@snippet lang=c : + * int argon2d_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, const size_t hashlen, char *encoded, const size_t encodedlen) + * } + */ + public static MethodHandle argon2d_hash_encoded$handle() { + return argon2d_hash_encoded.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int argon2d_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, const size_t hashlen, char *encoded, const size_t encodedlen) + * } + */ + public static MemorySegment argon2d_hash_encoded$address() { + return argon2d_hash_encoded.ADDR; + } + + /** + * {@snippet lang=c : + * int argon2d_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, const size_t hashlen, char *encoded, const size_t encodedlen) * } */ public static int argon2d_hash_encoded(int t_cost, int m_cost, int parallelism, MemorySegment pwd, long pwdlen, MemorySegment salt, long saltlen, long hashlen, MemorySegment encoded, long encodedlen) { - var mh$ = argon2d_hash_encoded$MH(); + var mh$ = argon2d_hash_encoded.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2d_hash_encoded", t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, hashlen, encoded, encodedlen); + } return (int)mh$.invokeExact(t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, hashlen, encoded, encodedlen); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2d_hash_raw$MH() { - return RuntimeHelper.requireNonNull(constants$6.const$3,"argon2d_hash_raw"); + + private static class argon2d_hash_raw { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_POINTER, + argon2_h.C_LONG, + argon2_h.C_POINTER, + argon2_h.C_LONG, + argon2_h.C_POINTER, + argon2_h.C_LONG + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2d_hash_raw"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int argon2d_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, void *hash, const size_t hashlen) + * } + */ + public static FunctionDescriptor argon2d_hash_raw$descriptor() { + return argon2d_hash_raw.DESC; } + /** - * {@snippet : - * int argon2d_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, void* pwd, const size_t pwdlen, void* salt, const size_t saltlen, void* hash, const size_t hashlen); + * Downcall method handle for: + * {@snippet lang=c : + * int argon2d_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, void *hash, const size_t hashlen) + * } + */ + public static MethodHandle argon2d_hash_raw$handle() { + return argon2d_hash_raw.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int argon2d_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, void *hash, const size_t hashlen) + * } + */ + public static MemorySegment argon2d_hash_raw$address() { + return argon2d_hash_raw.ADDR; + } + + /** + * {@snippet lang=c : + * int argon2d_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, void *hash, const size_t hashlen) * } */ public static int argon2d_hash_raw(int t_cost, int m_cost, int parallelism, MemorySegment pwd, long pwdlen, MemorySegment salt, long saltlen, MemorySegment hash, long hashlen) { - var mh$ = argon2d_hash_raw$MH(); + var mh$ = argon2d_hash_raw.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2d_hash_raw", t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, hash, hashlen); + } return (int)mh$.invokeExact(t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, hash, hashlen); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2id_hash_encoded$MH() { - return RuntimeHelper.requireNonNull(constants$6.const$4,"argon2id_hash_encoded"); + + private static class argon2id_hash_encoded { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_POINTER, + argon2_h.C_LONG, + argon2_h.C_POINTER, + argon2_h.C_LONG, + argon2_h.C_LONG, + argon2_h.C_POINTER, + argon2_h.C_LONG + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2id_hash_encoded"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int argon2id_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, const size_t hashlen, char *encoded, const size_t encodedlen) + * } + */ + public static FunctionDescriptor argon2id_hash_encoded$descriptor() { + return argon2id_hash_encoded.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * int argon2id_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, const size_t hashlen, char *encoded, const size_t encodedlen) + * } + */ + public static MethodHandle argon2id_hash_encoded$handle() { + return argon2id_hash_encoded.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int argon2id_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, const size_t hashlen, char *encoded, const size_t encodedlen) + * } + */ + public static MemorySegment argon2id_hash_encoded$address() { + return argon2id_hash_encoded.ADDR; } + /** - * {@snippet : - * int argon2id_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, void* pwd, const size_t pwdlen, void* salt, const size_t saltlen, const size_t hashlen, char* encoded, const size_t encodedlen); + * {@snippet lang=c : + * int argon2id_hash_encoded(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, const size_t hashlen, char *encoded, const size_t encodedlen) * } */ public static int argon2id_hash_encoded(int t_cost, int m_cost, int parallelism, MemorySegment pwd, long pwdlen, MemorySegment salt, long saltlen, long hashlen, MemorySegment encoded, long encodedlen) { - var mh$ = argon2id_hash_encoded$MH(); + var mh$ = argon2id_hash_encoded.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2id_hash_encoded", t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, hashlen, encoded, encodedlen); + } return (int)mh$.invokeExact(t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, hashlen, encoded, encodedlen); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2id_hash_raw$MH() { - return RuntimeHelper.requireNonNull(constants$6.const$5,"argon2id_hash_raw"); + + private static class argon2id_hash_raw { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_POINTER, + argon2_h.C_LONG, + argon2_h.C_POINTER, + argon2_h.C_LONG, + argon2_h.C_POINTER, + argon2_h.C_LONG + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2id_hash_raw"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int argon2id_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, void *hash, const size_t hashlen) + * } + */ + public static FunctionDescriptor argon2id_hash_raw$descriptor() { + return argon2id_hash_raw.DESC; } + /** - * {@snippet : - * int argon2id_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, void* pwd, const size_t pwdlen, void* salt, const size_t saltlen, void* hash, const size_t hashlen); + * Downcall method handle for: + * {@snippet lang=c : + * int argon2id_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, void *hash, const size_t hashlen) + * } + */ + public static MethodHandle argon2id_hash_raw$handle() { + return argon2id_hash_raw.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int argon2id_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, void *hash, const size_t hashlen) + * } + */ + public static MemorySegment argon2id_hash_raw$address() { + return argon2id_hash_raw.ADDR; + } + + /** + * {@snippet lang=c : + * int argon2id_hash_raw(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, void *hash, const size_t hashlen) * } */ public static int argon2id_hash_raw(int t_cost, int m_cost, int parallelism, MemorySegment pwd, long pwdlen, MemorySegment salt, long saltlen, MemorySegment hash, long hashlen) { - var mh$ = argon2id_hash_raw$MH(); + var mh$ = argon2id_hash_raw.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2id_hash_raw", t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, hash, hashlen); + } return (int)mh$.invokeExact(t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, hash, hashlen); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2_hash$MH() { - return RuntimeHelper.requireNonNull(constants$7.const$1,"argon2_hash"); + + private static class argon2_hash { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_POINTER, + argon2_h.C_LONG, + argon2_h.C_POINTER, + argon2_h.C_LONG, + argon2_h.C_POINTER, + argon2_h.C_LONG, + argon2_h.C_POINTER, + argon2_h.C_LONG, + argon2_h.C_INT, + argon2_h.C_INT + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2_hash"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int argon2_hash(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, void *hash, const size_t hashlen, char *encoded, const size_t encodedlen, argon2_type type, const uint32_t version) + * } + */ + public static FunctionDescriptor argon2_hash$descriptor() { + return argon2_hash.DESC; } + /** - * {@snippet : - * int argon2_hash(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, void* pwd, const size_t pwdlen, void* salt, const size_t saltlen, void* hash, const size_t hashlen, char* encoded, const size_t encodedlen, argon2_type type, const uint32_t version); + * Downcall method handle for: + * {@snippet lang=c : + * int argon2_hash(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, void *hash, const size_t hashlen, char *encoded, const size_t encodedlen, argon2_type type, const uint32_t version) + * } + */ + public static MethodHandle argon2_hash$handle() { + return argon2_hash.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int argon2_hash(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, void *hash, const size_t hashlen, char *encoded, const size_t encodedlen, argon2_type type, const uint32_t version) + * } + */ + public static MemorySegment argon2_hash$address() { + return argon2_hash.ADDR; + } + + /** + * {@snippet lang=c : + * int argon2_hash(const uint32_t t_cost, const uint32_t m_cost, const uint32_t parallelism, const void *pwd, const size_t pwdlen, const void *salt, const size_t saltlen, void *hash, const size_t hashlen, char *encoded, const size_t encodedlen, argon2_type type, const uint32_t version) * } */ public static int argon2_hash(int t_cost, int m_cost, int parallelism, MemorySegment pwd, long pwdlen, MemorySegment salt, long saltlen, MemorySegment hash, long hashlen, MemorySegment encoded, long encodedlen, int type, int version) { - var mh$ = argon2_hash$MH(); + var mh$ = argon2_hash.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2_hash", t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, hash, hashlen, encoded, encodedlen, type, version); + } return (int)mh$.invokeExact(t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen, hash, hashlen, encoded, encodedlen, type, version); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2i_verify$MH() { - return RuntimeHelper.requireNonNull(constants$7.const$3,"argon2i_verify"); + + private static class argon2i_verify { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_POINTER, + argon2_h.C_POINTER, + argon2_h.C_LONG + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2i_verify"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int argon2i_verify(const char *encoded, const void *pwd, const size_t pwdlen) + * } + */ + public static FunctionDescriptor argon2i_verify$descriptor() { + return argon2i_verify.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * int argon2i_verify(const char *encoded, const void *pwd, const size_t pwdlen) + * } + */ + public static MethodHandle argon2i_verify$handle() { + return argon2i_verify.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int argon2i_verify(const char *encoded, const void *pwd, const size_t pwdlen) + * } + */ + public static MemorySegment argon2i_verify$address() { + return argon2i_verify.ADDR; } + /** - * {@snippet : - * int argon2i_verify(char* encoded, void* pwd, const size_t pwdlen); + * {@snippet lang=c : + * int argon2i_verify(const char *encoded, const void *pwd, const size_t pwdlen) * } */ public static int argon2i_verify(MemorySegment encoded, MemorySegment pwd, long pwdlen) { - var mh$ = argon2i_verify$MH(); + var mh$ = argon2i_verify.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2i_verify", encoded, pwd, pwdlen); + } return (int)mh$.invokeExact(encoded, pwd, pwdlen); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2d_verify$MH() { - return RuntimeHelper.requireNonNull(constants$7.const$4,"argon2d_verify"); + + private static class argon2d_verify { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_POINTER, + argon2_h.C_POINTER, + argon2_h.C_LONG + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2d_verify"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int argon2d_verify(const char *encoded, const void *pwd, const size_t pwdlen) + * } + */ + public static FunctionDescriptor argon2d_verify$descriptor() { + return argon2d_verify.DESC; } + /** - * {@snippet : - * int argon2d_verify(char* encoded, void* pwd, const size_t pwdlen); + * Downcall method handle for: + * {@snippet lang=c : + * int argon2d_verify(const char *encoded, const void *pwd, const size_t pwdlen) + * } + */ + public static MethodHandle argon2d_verify$handle() { + return argon2d_verify.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int argon2d_verify(const char *encoded, const void *pwd, const size_t pwdlen) + * } + */ + public static MemorySegment argon2d_verify$address() { + return argon2d_verify.ADDR; + } + + /** + * {@snippet lang=c : + * int argon2d_verify(const char *encoded, const void *pwd, const size_t pwdlen) * } */ public static int argon2d_verify(MemorySegment encoded, MemorySegment pwd, long pwdlen) { - var mh$ = argon2d_verify$MH(); + var mh$ = argon2d_verify.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2d_verify", encoded, pwd, pwdlen); + } return (int)mh$.invokeExact(encoded, pwd, pwdlen); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2id_verify$MH() { - return RuntimeHelper.requireNonNull(constants$7.const$5,"argon2id_verify"); + + private static class argon2id_verify { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_POINTER, + argon2_h.C_POINTER, + argon2_h.C_LONG + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2id_verify"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int argon2id_verify(const char *encoded, const void *pwd, const size_t pwdlen) + * } + */ + public static FunctionDescriptor argon2id_verify$descriptor() { + return argon2id_verify.DESC; } + /** - * {@snippet : - * int argon2id_verify(char* encoded, void* pwd, const size_t pwdlen); + * Downcall method handle for: + * {@snippet lang=c : + * int argon2id_verify(const char *encoded, const void *pwd, const size_t pwdlen) + * } + */ + public static MethodHandle argon2id_verify$handle() { + return argon2id_verify.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int argon2id_verify(const char *encoded, const void *pwd, const size_t pwdlen) + * } + */ + public static MemorySegment argon2id_verify$address() { + return argon2id_verify.ADDR; + } + + /** + * {@snippet lang=c : + * int argon2id_verify(const char *encoded, const void *pwd, const size_t pwdlen) * } */ public static int argon2id_verify(MemorySegment encoded, MemorySegment pwd, long pwdlen) { - var mh$ = argon2id_verify$MH(); + var mh$ = argon2id_verify.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2id_verify", encoded, pwd, pwdlen); + } return (int)mh$.invokeExact(encoded, pwd, pwdlen); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2_verify$MH() { - return RuntimeHelper.requireNonNull(constants$8.const$1,"argon2_verify"); + + private static class argon2_verify { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_POINTER, + argon2_h.C_POINTER, + argon2_h.C_LONG, + argon2_h.C_INT + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2_verify"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int argon2_verify(const char *encoded, const void *pwd, const size_t pwdlen, argon2_type type) + * } + */ + public static FunctionDescriptor argon2_verify$descriptor() { + return argon2_verify.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * int argon2_verify(const char *encoded, const void *pwd, const size_t pwdlen, argon2_type type) + * } + */ + public static MethodHandle argon2_verify$handle() { + return argon2_verify.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int argon2_verify(const char *encoded, const void *pwd, const size_t pwdlen, argon2_type type) + * } + */ + public static MemorySegment argon2_verify$address() { + return argon2_verify.ADDR; } + /** - * {@snippet : - * int argon2_verify(char* encoded, void* pwd, const size_t pwdlen, argon2_type type); + * {@snippet lang=c : + * int argon2_verify(const char *encoded, const void *pwd, const size_t pwdlen, argon2_type type) * } */ public static int argon2_verify(MemorySegment encoded, MemorySegment pwd, long pwdlen, int type) { - var mh$ = argon2_verify$MH(); + var mh$ = argon2_verify.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2_verify", encoded, pwd, pwdlen, type); + } return (int)mh$.invokeExact(encoded, pwd, pwdlen, type); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2d_ctx$MH() { - return RuntimeHelper.requireNonNull(constants$8.const$3,"argon2d_ctx"); + + private static class argon2d_ctx { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_POINTER + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2d_ctx"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int argon2d_ctx(argon2_context *context) + * } + */ + public static FunctionDescriptor argon2d_ctx$descriptor() { + return argon2d_ctx.DESC; } + /** - * {@snippet : - * int argon2d_ctx(argon2_context* context); + * Downcall method handle for: + * {@snippet lang=c : + * int argon2d_ctx(argon2_context *context) + * } + */ + public static MethodHandle argon2d_ctx$handle() { + return argon2d_ctx.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int argon2d_ctx(argon2_context *context) + * } + */ + public static MemorySegment argon2d_ctx$address() { + return argon2d_ctx.ADDR; + } + + /** + * {@snippet lang=c : + * int argon2d_ctx(argon2_context *context) * } */ public static int argon2d_ctx(MemorySegment context) { - var mh$ = argon2d_ctx$MH(); + var mh$ = argon2d_ctx.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2d_ctx", context); + } return (int)mh$.invokeExact(context); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2i_ctx$MH() { - return RuntimeHelper.requireNonNull(constants$8.const$4,"argon2i_ctx"); + + private static class argon2i_ctx { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_POINTER + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2i_ctx"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int argon2i_ctx(argon2_context *context) + * } + */ + public static FunctionDescriptor argon2i_ctx$descriptor() { + return argon2i_ctx.DESC; } + /** - * {@snippet : - * int argon2i_ctx(argon2_context* context); + * Downcall method handle for: + * {@snippet lang=c : + * int argon2i_ctx(argon2_context *context) + * } + */ + public static MethodHandle argon2i_ctx$handle() { + return argon2i_ctx.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int argon2i_ctx(argon2_context *context) + * } + */ + public static MemorySegment argon2i_ctx$address() { + return argon2i_ctx.ADDR; + } + + /** + * {@snippet lang=c : + * int argon2i_ctx(argon2_context *context) * } */ public static int argon2i_ctx(MemorySegment context) { - var mh$ = argon2i_ctx$MH(); + var mh$ = argon2i_ctx.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2i_ctx", context); + } return (int)mh$.invokeExact(context); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2id_ctx$MH() { - return RuntimeHelper.requireNonNull(constants$8.const$5,"argon2id_ctx"); + + private static class argon2id_ctx { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_POINTER + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2id_ctx"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int argon2id_ctx(argon2_context *context) + * } + */ + public static FunctionDescriptor argon2id_ctx$descriptor() { + return argon2id_ctx.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * int argon2id_ctx(argon2_context *context) + * } + */ + public static MethodHandle argon2id_ctx$handle() { + return argon2id_ctx.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int argon2id_ctx(argon2_context *context) + * } + */ + public static MemorySegment argon2id_ctx$address() { + return argon2id_ctx.ADDR; } + /** - * {@snippet : - * int argon2id_ctx(argon2_context* context); + * {@snippet lang=c : + * int argon2id_ctx(argon2_context *context) * } */ public static int argon2id_ctx(MemorySegment context) { - var mh$ = argon2id_ctx$MH(); + var mh$ = argon2id_ctx.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2id_ctx", context); + } return (int)mh$.invokeExact(context); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2d_verify_ctx$MH() { - return RuntimeHelper.requireNonNull(constants$9.const$1,"argon2d_verify_ctx"); + + private static class argon2d_verify_ctx { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_POINTER, + argon2_h.C_POINTER + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2d_verify_ctx"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int argon2d_verify_ctx(argon2_context *context, const char *hash) + * } + */ + public static FunctionDescriptor argon2d_verify_ctx$descriptor() { + return argon2d_verify_ctx.DESC; } + /** - * {@snippet : - * int argon2d_verify_ctx(argon2_context* context, char* hash); + * Downcall method handle for: + * {@snippet lang=c : + * int argon2d_verify_ctx(argon2_context *context, const char *hash) + * } + */ + public static MethodHandle argon2d_verify_ctx$handle() { + return argon2d_verify_ctx.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int argon2d_verify_ctx(argon2_context *context, const char *hash) + * } + */ + public static MemorySegment argon2d_verify_ctx$address() { + return argon2d_verify_ctx.ADDR; + } + + /** + * {@snippet lang=c : + * int argon2d_verify_ctx(argon2_context *context, const char *hash) * } */ public static int argon2d_verify_ctx(MemorySegment context, MemorySegment hash) { - var mh$ = argon2d_verify_ctx$MH(); + var mh$ = argon2d_verify_ctx.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2d_verify_ctx", context, hash); + } return (int)mh$.invokeExact(context, hash); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2i_verify_ctx$MH() { - return RuntimeHelper.requireNonNull(constants$9.const$2,"argon2i_verify_ctx"); + + private static class argon2i_verify_ctx { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_POINTER, + argon2_h.C_POINTER + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2i_verify_ctx"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int argon2i_verify_ctx(argon2_context *context, const char *hash) + * } + */ + public static FunctionDescriptor argon2i_verify_ctx$descriptor() { + return argon2i_verify_ctx.DESC; } + /** - * {@snippet : - * int argon2i_verify_ctx(argon2_context* context, char* hash); + * Downcall method handle for: + * {@snippet lang=c : + * int argon2i_verify_ctx(argon2_context *context, const char *hash) + * } + */ + public static MethodHandle argon2i_verify_ctx$handle() { + return argon2i_verify_ctx.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int argon2i_verify_ctx(argon2_context *context, const char *hash) + * } + */ + public static MemorySegment argon2i_verify_ctx$address() { + return argon2i_verify_ctx.ADDR; + } + + /** + * {@snippet lang=c : + * int argon2i_verify_ctx(argon2_context *context, const char *hash) * } */ public static int argon2i_verify_ctx(MemorySegment context, MemorySegment hash) { - var mh$ = argon2i_verify_ctx$MH(); + var mh$ = argon2i_verify_ctx.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2i_verify_ctx", context, hash); + } return (int)mh$.invokeExact(context, hash); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2id_verify_ctx$MH() { - return RuntimeHelper.requireNonNull(constants$9.const$3,"argon2id_verify_ctx"); + + private static class argon2id_verify_ctx { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_POINTER, + argon2_h.C_POINTER + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2id_verify_ctx"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int argon2id_verify_ctx(argon2_context *context, const char *hash) + * } + */ + public static FunctionDescriptor argon2id_verify_ctx$descriptor() { + return argon2id_verify_ctx.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * int argon2id_verify_ctx(argon2_context *context, const char *hash) + * } + */ + public static MethodHandle argon2id_verify_ctx$handle() { + return argon2id_verify_ctx.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int argon2id_verify_ctx(argon2_context *context, const char *hash) + * } + */ + public static MemorySegment argon2id_verify_ctx$address() { + return argon2id_verify_ctx.ADDR; } + /** - * {@snippet : - * int argon2id_verify_ctx(argon2_context* context, char* hash); + * {@snippet lang=c : + * int argon2id_verify_ctx(argon2_context *context, const char *hash) * } */ public static int argon2id_verify_ctx(MemorySegment context, MemorySegment hash) { - var mh$ = argon2id_verify_ctx$MH(); + var mh$ = argon2id_verify_ctx.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2id_verify_ctx", context, hash); + } return (int)mh$.invokeExact(context, hash); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2_verify_ctx$MH() { - return RuntimeHelper.requireNonNull(constants$9.const$5,"argon2_verify_ctx"); + + private static class argon2_verify_ctx { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_INT, + argon2_h.C_POINTER, + argon2_h.C_POINTER, + argon2_h.C_INT + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2_verify_ctx"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int argon2_verify_ctx(argon2_context *context, const char *hash, argon2_type type) + * } + */ + public static FunctionDescriptor argon2_verify_ctx$descriptor() { + return argon2_verify_ctx.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * int argon2_verify_ctx(argon2_context *context, const char *hash, argon2_type type) + * } + */ + public static MethodHandle argon2_verify_ctx$handle() { + return argon2_verify_ctx.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int argon2_verify_ctx(argon2_context *context, const char *hash, argon2_type type) + * } + */ + public static MemorySegment argon2_verify_ctx$address() { + return argon2_verify_ctx.ADDR; } + /** - * {@snippet : - * int argon2_verify_ctx(argon2_context* context, char* hash, argon2_type type); + * {@snippet lang=c : + * int argon2_verify_ctx(argon2_context *context, const char *hash, argon2_type type) * } */ public static int argon2_verify_ctx(MemorySegment context, MemorySegment hash, int type) { - var mh$ = argon2_verify_ctx$MH(); + var mh$ = argon2_verify_ctx.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2_verify_ctx", context, hash, type); + } return (int)mh$.invokeExact(context, hash, type); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2_error_message$MH() { - return RuntimeHelper.requireNonNull(constants$10.const$1,"argon2_error_message"); + + private static class argon2_error_message { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_POINTER, + argon2_h.C_INT + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2_error_message"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * const char *argon2_error_message(int error_code) + * } + */ + public static FunctionDescriptor argon2_error_message$descriptor() { + return argon2_error_message.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * const char *argon2_error_message(int error_code) + * } + */ + public static MethodHandle argon2_error_message$handle() { + return argon2_error_message.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * const char *argon2_error_message(int error_code) + * } + */ + public static MemorySegment argon2_error_message$address() { + return argon2_error_message.ADDR; } + /** - * {@snippet : - * char* argon2_error_message(int error_code); + * {@snippet lang=c : + * const char *argon2_error_message(int error_code) * } */ public static MemorySegment argon2_error_message(int error_code) { - var mh$ = argon2_error_message$MH(); + var mh$ = argon2_error_message.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2_error_message", error_code); + } return (MemorySegment)mh$.invokeExact(error_code); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle argon2_encodedlen$MH() { - return RuntimeHelper.requireNonNull(constants$10.const$3,"argon2_encodedlen"); + + private static class argon2_encodedlen { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + argon2_h.C_LONG, + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_INT, + argon2_h.C_INT + ); + + public static final MemorySegment ADDR = argon2_h.findOrThrow("argon2_encodedlen"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * size_t argon2_encodedlen(uint32_t t_cost, uint32_t m_cost, uint32_t parallelism, uint32_t saltlen, uint32_t hashlen, argon2_type type) + * } + */ + public static FunctionDescriptor argon2_encodedlen$descriptor() { + return argon2_encodedlen.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * size_t argon2_encodedlen(uint32_t t_cost, uint32_t m_cost, uint32_t parallelism, uint32_t saltlen, uint32_t hashlen, argon2_type type) + * } + */ + public static MethodHandle argon2_encodedlen$handle() { + return argon2_encodedlen.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * size_t argon2_encodedlen(uint32_t t_cost, uint32_t m_cost, uint32_t parallelism, uint32_t saltlen, uint32_t hashlen, argon2_type type) + * } + */ + public static MemorySegment argon2_encodedlen$address() { + return argon2_encodedlen.ADDR; } + /** - * {@snippet : - * size_t argon2_encodedlen(uint32_t t_cost, uint32_t m_cost, uint32_t parallelism, uint32_t saltlen, uint32_t hashlen, argon2_type type); + * {@snippet lang=c : + * size_t argon2_encodedlen(uint32_t t_cost, uint32_t m_cost, uint32_t parallelism, uint32_t saltlen, uint32_t hashlen, argon2_type type) * } */ public static long argon2_encodedlen(int t_cost, int m_cost, int parallelism, int saltlen, int hashlen, int type) { - var mh$ = argon2_encodedlen$MH(); + var mh$ = argon2_encodedlen.HANDLE; try { + if (TRACE_DOWNCALLS) { + traceDowncall("argon2_encodedlen", t_cost, m_cost, parallelism, saltlen, hashlen, type); + } return (long)mh$.invokeExact(t_cost, m_cost, parallelism, saltlen, hashlen, type); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } + private static final long _POSIX_C_SOURCE = 200809L; /** - * {@snippet : + * {@snippet lang=c : * #define _POSIX_C_SOURCE 200809 * } */ public static long _POSIX_C_SOURCE() { - return 200809L; + return _POSIX_C_SOURCE; } + private static final int __TIMESIZE = (int)64L; /** - * {@snippet : + * {@snippet lang=c : * #define __TIMESIZE 64 * } */ public static int __TIMESIZE() { - return (int)64L; + return __TIMESIZE; } + private static final long __STDC_IEC_60559_BFP__ = 201404L; /** - * {@snippet : + * {@snippet lang=c : * #define __STDC_IEC_60559_BFP__ 201404 * } */ public static long __STDC_IEC_60559_BFP__() { - return 201404L; + return __STDC_IEC_60559_BFP__; } + private static final long __STDC_IEC_60559_COMPLEX__ = 201404L; /** - * {@snippet : + * {@snippet lang=c : * #define __STDC_IEC_60559_COMPLEX__ 201404 * } */ public static long __STDC_IEC_60559_COMPLEX__() { - return 201404L; + return __STDC_IEC_60559_COMPLEX__; } + private static final long __STDC_ISO_10646__ = 201706L; /** - * {@snippet : + * {@snippet lang=c : * #define __STDC_ISO_10646__ 201706 * } */ public static long __STDC_ISO_10646__() { - return 201706L; + return __STDC_ISO_10646__; } + private static final int __WCHAR_MAX = (int)2147483647L; /** - * {@snippet : + * {@snippet lang=c : * #define __WCHAR_MAX 2147483647 * } */ public static int __WCHAR_MAX() { - return (int)2147483647L; + return __WCHAR_MAX; } + private static final int __WCHAR_MIN = (int)-2147483648L; /** - * {@snippet : + * {@snippet lang=c : * #define __WCHAR_MIN -2147483648 * } */ public static int __WCHAR_MIN() { - return (int)-2147483648L; + return __WCHAR_MIN; } + private static final int INT8_MIN = (int)-128L; /** - * {@snippet : + * {@snippet lang=c : * #define INT8_MIN -128 * } */ public static int INT8_MIN() { - return (int)-128L; + return INT8_MIN; } + private static final int INT16_MIN = (int)-32768L; /** - * {@snippet : + * {@snippet lang=c : * #define INT16_MIN -32768 * } */ public static int INT16_MIN() { - return (int)-32768L; + return INT16_MIN; } + private static final int INT32_MIN = (int)-2147483648L; /** - * {@snippet : + * {@snippet lang=c : * #define INT32_MIN -2147483648 * } */ public static int INT32_MIN() { - return (int)-2147483648L; + return INT32_MIN; } + private static final long INT64_MIN = -9223372036854775808L; /** - * {@snippet : + * {@snippet lang=c : * #define INT64_MIN -9223372036854775808 * } */ public static long INT64_MIN() { - return -9223372036854775808L; + return INT64_MIN; } + private static final int INT8_MAX = (int)127L; /** - * {@snippet : + * {@snippet lang=c : * #define INT8_MAX 127 * } */ public static int INT8_MAX() { - return (int)127L; + return INT8_MAX; } + private static final int INT16_MAX = (int)32767L; /** - * {@snippet : + * {@snippet lang=c : * #define INT16_MAX 32767 * } */ public static int INT16_MAX() { - return (int)32767L; + return INT16_MAX; } + private static final int INT32_MAX = (int)2147483647L; /** - * {@snippet : + * {@snippet lang=c : * #define INT32_MAX 2147483647 * } */ public static int INT32_MAX() { - return (int)2147483647L; + return INT32_MAX; } + private static final long INT64_MAX = 9223372036854775807L; /** - * {@snippet : + * {@snippet lang=c : * #define INT64_MAX 9223372036854775807 * } */ public static long INT64_MAX() { - return 9223372036854775807L; + return INT64_MAX; } + private static final int UINT8_MAX = (int)255L; /** - * {@snippet : + * {@snippet lang=c : * #define UINT8_MAX 255 * } */ public static int UINT8_MAX() { - return (int)255L; + return UINT8_MAX; } + private static final int UINT16_MAX = (int)65535L; /** - * {@snippet : + * {@snippet lang=c : * #define UINT16_MAX 65535 * } */ public static int UINT16_MAX() { - return (int)65535L; + return UINT16_MAX; } + private static final int UINT32_MAX = (int)4294967295L; /** - * {@snippet : + * {@snippet lang=c : * #define UINT32_MAX 4294967295 * } */ public static int UINT32_MAX() { - return (int)4294967295L; + return UINT32_MAX; } + private static final long UINT64_MAX = -1L; /** - * {@snippet : + * {@snippet lang=c : * #define UINT64_MAX -1 * } */ public static long UINT64_MAX() { - return -1L; + return UINT64_MAX; } + private static final int INT_LEAST8_MIN = (int)-128L; /** - * {@snippet : + * {@snippet lang=c : * #define INT_LEAST8_MIN -128 * } */ public static int INT_LEAST8_MIN() { - return (int)-128L; + return INT_LEAST8_MIN; } + private static final int INT_LEAST16_MIN = (int)-32768L; /** - * {@snippet : + * {@snippet lang=c : * #define INT_LEAST16_MIN -32768 * } */ public static int INT_LEAST16_MIN() { - return (int)-32768L; + return INT_LEAST16_MIN; } + private static final int INT_LEAST32_MIN = (int)-2147483648L; /** - * {@snippet : + * {@snippet lang=c : * #define INT_LEAST32_MIN -2147483648 * } */ public static int INT_LEAST32_MIN() { - return (int)-2147483648L; + return INT_LEAST32_MIN; } + private static final long INT_LEAST64_MIN = -9223372036854775808L; /** - * {@snippet : + * {@snippet lang=c : * #define INT_LEAST64_MIN -9223372036854775808 * } */ public static long INT_LEAST64_MIN() { - return -9223372036854775808L; + return INT_LEAST64_MIN; } + private static final int INT_LEAST8_MAX = (int)127L; /** - * {@snippet : + * {@snippet lang=c : * #define INT_LEAST8_MAX 127 * } */ public static int INT_LEAST8_MAX() { - return (int)127L; + return INT_LEAST8_MAX; } + private static final int INT_LEAST16_MAX = (int)32767L; /** - * {@snippet : + * {@snippet lang=c : * #define INT_LEAST16_MAX 32767 * } */ public static int INT_LEAST16_MAX() { - return (int)32767L; + return INT_LEAST16_MAX; } + private static final int INT_LEAST32_MAX = (int)2147483647L; /** - * {@snippet : + * {@snippet lang=c : * #define INT_LEAST32_MAX 2147483647 * } */ public static int INT_LEAST32_MAX() { - return (int)2147483647L; + return INT_LEAST32_MAX; } + private static final long INT_LEAST64_MAX = 9223372036854775807L; /** - * {@snippet : + * {@snippet lang=c : * #define INT_LEAST64_MAX 9223372036854775807 * } */ public static long INT_LEAST64_MAX() { - return 9223372036854775807L; + return INT_LEAST64_MAX; } + private static final int UINT_LEAST8_MAX = (int)255L; /** - * {@snippet : + * {@snippet lang=c : * #define UINT_LEAST8_MAX 255 * } */ public static int UINT_LEAST8_MAX() { - return (int)255L; + return UINT_LEAST8_MAX; } + private static final int UINT_LEAST16_MAX = (int)65535L; /** - * {@snippet : + * {@snippet lang=c : * #define UINT_LEAST16_MAX 65535 * } */ public static int UINT_LEAST16_MAX() { - return (int)65535L; + return UINT_LEAST16_MAX; } + private static final int UINT_LEAST32_MAX = (int)4294967295L; /** - * {@snippet : + * {@snippet lang=c : * #define UINT_LEAST32_MAX 4294967295 * } */ public static int UINT_LEAST32_MAX() { - return (int)4294967295L; + return UINT_LEAST32_MAX; } + private static final long UINT_LEAST64_MAX = -1L; /** - * {@snippet : + * {@snippet lang=c : * #define UINT_LEAST64_MAX -1 * } */ public static long UINT_LEAST64_MAX() { - return -1L; + return UINT_LEAST64_MAX; } + private static final int INT_FAST8_MIN = (int)-128L; /** - * {@snippet : + * {@snippet lang=c : * #define INT_FAST8_MIN -128 * } */ public static int INT_FAST8_MIN() { - return (int)-128L; + return INT_FAST8_MIN; } + private static final long INT_FAST16_MIN = -9223372036854775808L; /** - * {@snippet : + * {@snippet lang=c : * #define INT_FAST16_MIN -9223372036854775808 * } */ public static long INT_FAST16_MIN() { - return -9223372036854775808L; + return INT_FAST16_MIN; } + private static final long INT_FAST32_MIN = -9223372036854775808L; /** - * {@snippet : + * {@snippet lang=c : * #define INT_FAST32_MIN -9223372036854775808 * } */ public static long INT_FAST32_MIN() { - return -9223372036854775808L; + return INT_FAST32_MIN; } + private static final long INT_FAST64_MIN = -9223372036854775808L; /** - * {@snippet : + * {@snippet lang=c : * #define INT_FAST64_MIN -9223372036854775808 * } */ public static long INT_FAST64_MIN() { - return -9223372036854775808L; + return INT_FAST64_MIN; } + private static final int INT_FAST8_MAX = (int)127L; /** - * {@snippet : + * {@snippet lang=c : * #define INT_FAST8_MAX 127 * } */ public static int INT_FAST8_MAX() { - return (int)127L; + return INT_FAST8_MAX; } + private static final long INT_FAST16_MAX = 9223372036854775807L; /** - * {@snippet : + * {@snippet lang=c : * #define INT_FAST16_MAX 9223372036854775807 * } */ public static long INT_FAST16_MAX() { - return 9223372036854775807L; + return INT_FAST16_MAX; } + private static final long INT_FAST32_MAX = 9223372036854775807L; /** - * {@snippet : + * {@snippet lang=c : * #define INT_FAST32_MAX 9223372036854775807 * } */ public static long INT_FAST32_MAX() { - return 9223372036854775807L; + return INT_FAST32_MAX; } + private static final long INT_FAST64_MAX = 9223372036854775807L; /** - * {@snippet : + * {@snippet lang=c : * #define INT_FAST64_MAX 9223372036854775807 * } */ public static long INT_FAST64_MAX() { - return 9223372036854775807L; + return INT_FAST64_MAX; } + private static final int UINT_FAST8_MAX = (int)255L; /** - * {@snippet : + * {@snippet lang=c : * #define UINT_FAST8_MAX 255 * } */ public static int UINT_FAST8_MAX() { - return (int)255L; + return UINT_FAST8_MAX; } + private static final long UINT_FAST16_MAX = -1L; /** - * {@snippet : + * {@snippet lang=c : * #define UINT_FAST16_MAX -1 * } */ public static long UINT_FAST16_MAX() { - return -1L; + return UINT_FAST16_MAX; } + private static final long UINT_FAST32_MAX = -1L; /** - * {@snippet : + * {@snippet lang=c : * #define UINT_FAST32_MAX -1 * } */ public static long UINT_FAST32_MAX() { - return -1L; + return UINT_FAST32_MAX; } + private static final long UINT_FAST64_MAX = -1L; /** - * {@snippet : + * {@snippet lang=c : * #define UINT_FAST64_MAX -1 * } */ public static long UINT_FAST64_MAX() { - return -1L; + return UINT_FAST64_MAX; } + private static final long INTPTR_MIN = -9223372036854775808L; /** - * {@snippet : + * {@snippet lang=c : * #define INTPTR_MIN -9223372036854775808 * } */ public static long INTPTR_MIN() { - return -9223372036854775808L; + return INTPTR_MIN; } + private static final long INTPTR_MAX = 9223372036854775807L; /** - * {@snippet : + * {@snippet lang=c : * #define INTPTR_MAX 9223372036854775807 * } */ public static long INTPTR_MAX() { - return 9223372036854775807L; + return INTPTR_MAX; } + private static final long UINTPTR_MAX = -1L; /** - * {@snippet : + * {@snippet lang=c : * #define UINTPTR_MAX -1 * } */ public static long UINTPTR_MAX() { - return -1L; + return UINTPTR_MAX; } + private static final long INTMAX_MIN = -9223372036854775808L; /** - * {@snippet : + * {@snippet lang=c : * #define INTMAX_MIN -9223372036854775808 * } */ public static long INTMAX_MIN() { - return -9223372036854775808L; + return INTMAX_MIN; } + private static final long INTMAX_MAX = 9223372036854775807L; /** - * {@snippet : + * {@snippet lang=c : * #define INTMAX_MAX 9223372036854775807 * } */ public static long INTMAX_MAX() { - return 9223372036854775807L; + return INTMAX_MAX; } + private static final long UINTMAX_MAX = -1L; /** - * {@snippet : + * {@snippet lang=c : * #define UINTMAX_MAX -1 * } */ public static long UINTMAX_MAX() { - return -1L; + return UINTMAX_MAX; } + private static final long PTRDIFF_MIN = -9223372036854775808L; /** - * {@snippet : + * {@snippet lang=c : * #define PTRDIFF_MIN -9223372036854775808 * } */ public static long PTRDIFF_MIN() { - return -9223372036854775808L; + return PTRDIFF_MIN; } + private static final long PTRDIFF_MAX = 9223372036854775807L; /** - * {@snippet : + * {@snippet lang=c : * #define PTRDIFF_MAX 9223372036854775807 * } */ public static long PTRDIFF_MAX() { - return 9223372036854775807L; + return PTRDIFF_MAX; } + private static final int SIG_ATOMIC_MIN = (int)-2147483648L; /** - * {@snippet : + * {@snippet lang=c : * #define SIG_ATOMIC_MIN -2147483648 * } */ public static int SIG_ATOMIC_MIN() { - return (int)-2147483648L; + return SIG_ATOMIC_MIN; } + private static final int SIG_ATOMIC_MAX = (int)2147483647L; /** - * {@snippet : + * {@snippet lang=c : * #define SIG_ATOMIC_MAX 2147483647 * } */ public static int SIG_ATOMIC_MAX() { - return (int)2147483647L; + return SIG_ATOMIC_MAX; } + private static final long SIZE_MAX = -1L; /** - * {@snippet : + * {@snippet lang=c : * #define SIZE_MAX -1 * } */ public static long SIZE_MAX() { - return -1L; + return SIZE_MAX; } + private static final int WCHAR_MIN = (int)-2147483648L; /** - * {@snippet : + * {@snippet lang=c : * #define WCHAR_MIN -2147483648 * } */ public static int WCHAR_MIN() { - return (int)-2147483648L; + return WCHAR_MIN; } + private static final int WCHAR_MAX = (int)2147483647L; /** - * {@snippet : + * {@snippet lang=c : * #define WCHAR_MAX 2147483647 * } */ public static int WCHAR_MAX() { - return (int)2147483647L; + return WCHAR_MAX; } + private static final int WINT_MIN = (int)0L; /** - * {@snippet : + * {@snippet lang=c : * #define WINT_MIN 0 * } */ public static int WINT_MIN() { - return (int)0L; + return WINT_MIN; } + private static final int WINT_MAX = (int)4294967295L; /** - * {@snippet : + * {@snippet lang=c : * #define WINT_MAX 4294967295 * } */ public static int WINT_MAX() { - return (int)4294967295L; + return WINT_MAX; } + private static final MemorySegment NULL = MemorySegment.ofAddress(0L); /** - * {@snippet : - * #define NULL 0 + * {@snippet lang=c : + * #define NULL (void*) 0 * } */ public static MemorySegment NULL() { - return constants$10.const$4; + return NULL; } + private static final long LLONG_MIN = -9223372036854775808L; /** - * {@snippet : + * {@snippet lang=c : * #define LLONG_MIN -9223372036854775808 * } */ public static long LLONG_MIN() { - return -9223372036854775808L; + return LLONG_MIN; } + private static final long LLONG_MAX = 9223372036854775807L; /** - * {@snippet : + * {@snippet lang=c : * #define LLONG_MAX 9223372036854775807 * } */ public static long LLONG_MAX() { - return 9223372036854775807L; + return LLONG_MAX; } + private static final long ULLONG_MAX = -1L; /** - * {@snippet : + * {@snippet lang=c : * #define ULLONG_MAX -1 * } */ public static long ULLONG_MAX() { - return -1L; + return ULLONG_MAX; } + private static final int PTHREAD_DESTRUCTOR_ITERATIONS = (int)4L; /** - * {@snippet : + * {@snippet lang=c : * #define PTHREAD_DESTRUCTOR_ITERATIONS 4 * } */ public static int PTHREAD_DESTRUCTOR_ITERATIONS() { - return (int)4L; + return PTHREAD_DESTRUCTOR_ITERATIONS; } + private static final int SEM_VALUE_MAX = (int)2147483647L; /** - * {@snippet : + * {@snippet lang=c : * #define SEM_VALUE_MAX 2147483647 * } */ public static int SEM_VALUE_MAX() { - return (int)2147483647L; + return SEM_VALUE_MAX; } + private static final long SSIZE_MAX = 9223372036854775807L; /** - * {@snippet : + * {@snippet lang=c : * #define SSIZE_MAX 9223372036854775807 * } */ public static long SSIZE_MAX() { - return 9223372036854775807L; + return SSIZE_MAX; } + private static final int BC_BASE_MAX = (int)99L; /** - * {@snippet : + * {@snippet lang=c : * #define BC_BASE_MAX 99 * } */ public static int BC_BASE_MAX() { - return (int)99L; + return BC_BASE_MAX; } + private static final int BC_DIM_MAX = (int)2048L; /** - * {@snippet : + * {@snippet lang=c : * #define BC_DIM_MAX 2048 * } */ public static int BC_DIM_MAX() { - return (int)2048L; + return BC_DIM_MAX; } + private static final int BC_SCALE_MAX = (int)99L; /** - * {@snippet : + * {@snippet lang=c : * #define BC_SCALE_MAX 99 * } */ public static int BC_SCALE_MAX() { - return (int)99L; + return BC_SCALE_MAX; } + private static final int BC_STRING_MAX = (int)1000L; /** - * {@snippet : + * {@snippet lang=c : * #define BC_STRING_MAX 1000 * } */ public static int BC_STRING_MAX() { - return (int)1000L; + return BC_STRING_MAX; } + private static final int EXPR_NEST_MAX = (int)32L; /** - * {@snippet : + * {@snippet lang=c : * #define EXPR_NEST_MAX 32 * } */ public static int EXPR_NEST_MAX() { - return (int)32L; + return EXPR_NEST_MAX; } + private static final int LINE_MAX = (int)2048L; /** - * {@snippet : + * {@snippet lang=c : * #define LINE_MAX 2048 * } */ public static int LINE_MAX() { - return (int)2048L; + return LINE_MAX; } + private static final int RE_DUP_MAX = (int)32767L; /** - * {@snippet : + * {@snippet lang=c : * #define RE_DUP_MAX 32767 * } */ public static int RE_DUP_MAX() { - return (int)32767L; + return RE_DUP_MAX; } + private static final int SCHAR_MAX = (int)127L; /** - * {@snippet : + * {@snippet lang=c : * #define SCHAR_MAX 127 * } */ public static int SCHAR_MAX() { - return (int)127L; + return SCHAR_MAX; } + private static final int SHRT_MAX = (int)32767L; /** - * {@snippet : + * {@snippet lang=c : * #define SHRT_MAX 32767 * } */ public static int SHRT_MAX() { - return (int)32767L; + return SHRT_MAX; } + private static final int INT_MAX = (int)2147483647L; /** - * {@snippet : + * {@snippet lang=c : * #define INT_MAX 2147483647 * } */ public static int INT_MAX() { - return (int)2147483647L; + return INT_MAX; } + private static final long LONG_MAX = 9223372036854775807L; /** - * {@snippet : + * {@snippet lang=c : * #define LONG_MAX 9223372036854775807 * } */ public static long LONG_MAX() { - return 9223372036854775807L; + return LONG_MAX; } + private static final int SCHAR_MIN = (int)-128L; /** - * {@snippet : + * {@snippet lang=c : * #define SCHAR_MIN -128 * } */ public static int SCHAR_MIN() { - return (int)-128L; + return SCHAR_MIN; } + private static final int SHRT_MIN = (int)-32768L; /** - * {@snippet : + * {@snippet lang=c : * #define SHRT_MIN -32768 * } */ public static int SHRT_MIN() { - return (int)-32768L; + return SHRT_MIN; } + private static final int INT_MIN = (int)-2147483648L; /** - * {@snippet : + * {@snippet lang=c : * #define INT_MIN -2147483648 * } */ public static int INT_MIN() { - return (int)-2147483648L; + return INT_MIN; } + private static final long LONG_MIN = -9223372036854775808L; /** - * {@snippet : + * {@snippet lang=c : * #define LONG_MIN -9223372036854775808 * } */ public static long LONG_MIN() { - return -9223372036854775808L; + return LONG_MIN; } + private static final int UCHAR_MAX = (int)255L; /** - * {@snippet : + * {@snippet lang=c : * #define UCHAR_MAX 255 * } */ public static int UCHAR_MAX() { - return (int)255L; + return UCHAR_MAX; } + private static final int USHRT_MAX = (int)65535L; /** - * {@snippet : + * {@snippet lang=c : * #define USHRT_MAX 65535 * } */ public static int USHRT_MAX() { - return (int)65535L; + return USHRT_MAX; } + private static final int UINT_MAX = (int)4294967295L; /** - * {@snippet : + * {@snippet lang=c : * #define UINT_MAX 4294967295 * } */ public static int UINT_MAX() { - return (int)4294967295L; + return UINT_MAX; } + private static final long ULONG_MAX = -1L; /** - * {@snippet : + * {@snippet lang=c : * #define ULONG_MAX -1 * } */ public static long ULONG_MAX() { - return -1L; + return ULONG_MAX; } + private static final int CHAR_BIT = (int)8L; /** - * {@snippet : + * {@snippet lang=c : * #define CHAR_BIT 8 * } */ public static int CHAR_BIT() { - return (int)8L; + return CHAR_BIT; } + private static final int CHAR_MIN = (int)-128L; /** - * {@snippet : + * {@snippet lang=c : * #define CHAR_MIN -128 * } */ public static int CHAR_MIN() { - return (int)-128L; + return CHAR_MIN; } + private static final int CHAR_MAX = (int)127L; /** - * {@snippet : + * {@snippet lang=c : * #define CHAR_MAX 127 * } */ public static int CHAR_MAX() { - return (int)127L; + return CHAR_MAX; } + private static final int ARGON2_MIN_LANES = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_MIN_LANES 1 * } */ public static int ARGON2_MIN_LANES() { - return (int)1L; + return ARGON2_MIN_LANES; } + private static final int ARGON2_MAX_LANES = (int)16777215L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_MAX_LANES 16777215 * } */ public static int ARGON2_MAX_LANES() { - return (int)16777215L; + return ARGON2_MAX_LANES; } + private static final int ARGON2_MIN_THREADS = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_MIN_THREADS 1 * } */ public static int ARGON2_MIN_THREADS() { - return (int)1L; + return ARGON2_MIN_THREADS; } + private static final int ARGON2_MAX_THREADS = (int)16777215L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_MAX_THREADS 16777215 * } */ public static int ARGON2_MAX_THREADS() { - return (int)16777215L; + return ARGON2_MAX_THREADS; } + private static final int ARGON2_SYNC_POINTS = (int)4L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_SYNC_POINTS 4 * } */ public static int ARGON2_SYNC_POINTS() { - return (int)4L; + return ARGON2_SYNC_POINTS; } + private static final int ARGON2_MIN_OUTLEN = (int)4L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_MIN_OUTLEN 4 * } */ public static int ARGON2_MIN_OUTLEN() { - return (int)4L; + return ARGON2_MIN_OUTLEN; } + private static final int ARGON2_MAX_OUTLEN = (int)4294967295L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_MAX_OUTLEN 4294967295 * } */ public static int ARGON2_MAX_OUTLEN() { - return (int)4294967295L; + return ARGON2_MAX_OUTLEN; } + private static final int ARGON2_MIN_MEMORY = (int)8L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_MIN_MEMORY 8 * } */ public static int ARGON2_MIN_MEMORY() { - return (int)8L; + return ARGON2_MIN_MEMORY; } + private static final long ARGON2_MAX_MEMORY_BITS = 32L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_MAX_MEMORY_BITS 32 * } */ public static long ARGON2_MAX_MEMORY_BITS() { - return 32L; + return ARGON2_MAX_MEMORY_BITS; } + private static final long ARGON2_MAX_MEMORY = 4294967295L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_MAX_MEMORY 4294967295 * } */ public static long ARGON2_MAX_MEMORY() { - return 4294967295L; + return ARGON2_MAX_MEMORY; } + private static final int ARGON2_MIN_TIME = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_MIN_TIME 1 * } */ public static int ARGON2_MIN_TIME() { - return (int)1L; + return ARGON2_MIN_TIME; } + private static final int ARGON2_MAX_TIME = (int)4294967295L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_MAX_TIME 4294967295 * } */ public static int ARGON2_MAX_TIME() { - return (int)4294967295L; + return ARGON2_MAX_TIME; } + private static final int ARGON2_MIN_PWD_LENGTH = (int)0L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_MIN_PWD_LENGTH 0 * } */ public static int ARGON2_MIN_PWD_LENGTH() { - return (int)0L; + return ARGON2_MIN_PWD_LENGTH; } + private static final int ARGON2_MAX_PWD_LENGTH = (int)4294967295L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_MAX_PWD_LENGTH 4294967295 * } */ public static int ARGON2_MAX_PWD_LENGTH() { - return (int)4294967295L; + return ARGON2_MAX_PWD_LENGTH; } + private static final int ARGON2_MIN_AD_LENGTH = (int)0L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_MIN_AD_LENGTH 0 * } */ public static int ARGON2_MIN_AD_LENGTH() { - return (int)0L; + return ARGON2_MIN_AD_LENGTH; } + private static final int ARGON2_MAX_AD_LENGTH = (int)4294967295L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_MAX_AD_LENGTH 4294967295 * } */ public static int ARGON2_MAX_AD_LENGTH() { - return (int)4294967295L; + return ARGON2_MAX_AD_LENGTH; } + private static final int ARGON2_MIN_SALT_LENGTH = (int)8L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_MIN_SALT_LENGTH 8 * } */ public static int ARGON2_MIN_SALT_LENGTH() { - return (int)8L; + return ARGON2_MIN_SALT_LENGTH; } + private static final int ARGON2_MAX_SALT_LENGTH = (int)4294967295L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_MAX_SALT_LENGTH 4294967295 * } */ public static int ARGON2_MAX_SALT_LENGTH() { - return (int)4294967295L; + return ARGON2_MAX_SALT_LENGTH; } + private static final int ARGON2_MIN_SECRET = (int)0L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_MIN_SECRET 0 * } */ public static int ARGON2_MIN_SECRET() { - return (int)0L; + return ARGON2_MIN_SECRET; } + private static final int ARGON2_MAX_SECRET = (int)4294967295L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_MAX_SECRET 4294967295 * } */ public static int ARGON2_MAX_SECRET() { - return (int)4294967295L; + return ARGON2_MAX_SECRET; } + private static final int ARGON2_DEFAULT_FLAGS = (int)0L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_DEFAULT_FLAGS 0 * } */ public static int ARGON2_DEFAULT_FLAGS() { - return (int)0L; + return ARGON2_DEFAULT_FLAGS; } + private static final int ARGON2_FLAG_CLEAR_PASSWORD = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_FLAG_CLEAR_PASSWORD 1 * } */ public static int ARGON2_FLAG_CLEAR_PASSWORD() { - return (int)1L; + return ARGON2_FLAG_CLEAR_PASSWORD; } + private static final int ARGON2_FLAG_CLEAR_SECRET = (int)2L; /** - * {@snippet : + * {@snippet lang=c : * #define ARGON2_FLAG_CLEAR_SECRET 2 * } */ public static int ARGON2_FLAG_CLEAR_SECRET() { - return (int)2L; + return ARGON2_FLAG_CLEAR_SECRET; } } - diff --git a/src/main/java/com/zylquinal/argon2/internal/constants$0.java b/src/main/java/com/zylquinal/argon2/internal/constants$0.java deleted file mode 100644 index 63233b6..0000000 --- a/src/main/java/com/zylquinal/argon2/internal/constants$0.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.zylquinal.argon2.internal; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; - -import static java.lang.foreign.ValueLayout.*; -final class constants$0 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$0() {} - static final StructLayout const$0 = MemoryLayout.structLayout( - MemoryLayout.sequenceLayout(2, JAVA_INT).withName("__val") - ).withName(""); - static final StructLayout const$1 = MemoryLayout.structLayout( - JAVA_LONG.withName("__clang_max_align_nonce1"), - MemoryLayout.paddingLayout(8), - MemoryLayout.paddingLayout(16).withName("__clang_max_align_nonce2") - ).withName(""); - static final VarHandle const$2 = constants$0.const$1.varHandle(PathElement.groupElement("__clang_max_align_nonce1")); - static final VarHandle const$3 = JAVA_INT.varHandle(); - static final MemorySegment const$4 = RuntimeHelper.lookupGlobalVariable("FLAG_clear_internal_memory", JAVA_INT); - static final FunctionDescriptor const$5 = FunctionDescriptor.of(JAVA_INT, - RuntimeHelper.POINTER, - JAVA_LONG - ); -} - - diff --git a/src/main/java/com/zylquinal/argon2/internal/constants$1.java b/src/main/java/com/zylquinal/argon2/internal/constants$1.java deleted file mode 100644 index dc836c2..0000000 --- a/src/main/java/com/zylquinal/argon2/internal/constants$1.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.zylquinal.argon2.internal; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.StructLayout; -import java.lang.invoke.MethodHandle; - -import static java.lang.foreign.ValueLayout.JAVA_INT; -import static java.lang.foreign.ValueLayout.JAVA_LONG; -final class constants$1 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$1() {} - static final MethodHandle const$0 = RuntimeHelper.upcallHandle(allocate_fptr.class, "apply", constants$0.const$5); - static final MethodHandle const$1 = RuntimeHelper.downcallHandle( - constants$0.const$5 - ); - static final FunctionDescriptor const$2 = FunctionDescriptor.ofVoid( - RuntimeHelper.POINTER, - JAVA_LONG - ); - static final MethodHandle const$3 = RuntimeHelper.upcallHandle(deallocate_fptr.class, "apply", constants$1.const$2); - static final MethodHandle const$4 = RuntimeHelper.downcallHandle( - constants$1.const$2 - ); - static final StructLayout const$5 = MemoryLayout.structLayout( - RuntimeHelper.POINTER.withName("out"), - JAVA_INT.withName("outlen"), - MemoryLayout.paddingLayout(4), - RuntimeHelper.POINTER.withName("pwd"), - JAVA_INT.withName("pwdlen"), - MemoryLayout.paddingLayout(4), - RuntimeHelper.POINTER.withName("salt"), - JAVA_INT.withName("saltlen"), - MemoryLayout.paddingLayout(4), - RuntimeHelper.POINTER.withName("secret"), - JAVA_INT.withName("secretlen"), - MemoryLayout.paddingLayout(4), - RuntimeHelper.POINTER.withName("ad"), - JAVA_INT.withName("adlen"), - JAVA_INT.withName("t_cost"), - JAVA_INT.withName("m_cost"), - JAVA_INT.withName("lanes"), - JAVA_INT.withName("threads"), - JAVA_INT.withName("version"), - RuntimeHelper.POINTER.withName("allocate_cbk"), - RuntimeHelper.POINTER.withName("free_cbk"), - JAVA_INT.withName("flags"), - MemoryLayout.paddingLayout(4) - ).withName("Argon2_Context"); -} - - diff --git a/src/main/java/com/zylquinal/argon2/internal/constants$10.java b/src/main/java/com/zylquinal/argon2/internal/constants$10.java deleted file mode 100644 index 957dcd2..0000000 --- a/src/main/java/com/zylquinal/argon2/internal/constants$10.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.zylquinal.argon2.internal; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -import static java.lang.foreign.ValueLayout.JAVA_INT; -import static java.lang.foreign.ValueLayout.JAVA_LONG; -final class constants$10 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$10() {} - static final FunctionDescriptor const$0 = FunctionDescriptor.of(RuntimeHelper.POINTER, - JAVA_INT - ); - static final MethodHandle const$1 = RuntimeHelper.downcallHandle( - "argon2_error_message", - constants$10.const$0 - ); - static final FunctionDescriptor const$2 = FunctionDescriptor.of(JAVA_LONG, - JAVA_INT, - JAVA_INT, - JAVA_INT, - JAVA_INT, - JAVA_INT, - JAVA_INT - ); - static final MethodHandle const$3 = RuntimeHelper.downcallHandle( - "argon2_encodedlen", - constants$10.const$2 - ); - static final MemorySegment const$4 = MemorySegment.ofAddress(0L); -} - - diff --git a/src/main/java/com/zylquinal/argon2/internal/constants$2.java b/src/main/java/com/zylquinal/argon2/internal/constants$2.java deleted file mode 100644 index c1c8994..0000000 --- a/src/main/java/com/zylquinal/argon2/internal/constants$2.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.zylquinal.argon2.internal; - -import java.lang.invoke.VarHandle; - -import static java.lang.foreign.ValueLayout.PathElement; -final class constants$2 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$2() {} - static final VarHandle const$0 = constants$1.const$5.varHandle(PathElement.groupElement("out")); - static final VarHandle const$1 = constants$1.const$5.varHandle(PathElement.groupElement("outlen")); - static final VarHandle const$2 = constants$1.const$5.varHandle(PathElement.groupElement("pwd")); - static final VarHandle const$3 = constants$1.const$5.varHandle(PathElement.groupElement("pwdlen")); - static final VarHandle const$4 = constants$1.const$5.varHandle(PathElement.groupElement("salt")); - static final VarHandle const$5 = constants$1.const$5.varHandle(PathElement.groupElement("saltlen")); -} - - diff --git a/src/main/java/com/zylquinal/argon2/internal/constants$3.java b/src/main/java/com/zylquinal/argon2/internal/constants$3.java deleted file mode 100644 index 4dde149..0000000 --- a/src/main/java/com/zylquinal/argon2/internal/constants$3.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.zylquinal.argon2.internal; - -import java.lang.invoke.VarHandle; - -import static java.lang.foreign.ValueLayout.PathElement; -final class constants$3 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$3() {} - static final VarHandle const$0 = constants$1.const$5.varHandle(PathElement.groupElement("secret")); - static final VarHandle const$1 = constants$1.const$5.varHandle(PathElement.groupElement("secretlen")); - static final VarHandle const$2 = constants$1.const$5.varHandle(PathElement.groupElement("ad")); - static final VarHandle const$3 = constants$1.const$5.varHandle(PathElement.groupElement("adlen")); - static final VarHandle const$4 = constants$1.const$5.varHandle(PathElement.groupElement("t_cost")); - static final VarHandle const$5 = constants$1.const$5.varHandle(PathElement.groupElement("m_cost")); -} - - diff --git a/src/main/java/com/zylquinal/argon2/internal/constants$4.java b/src/main/java/com/zylquinal/argon2/internal/constants$4.java deleted file mode 100644 index dc4b63c..0000000 --- a/src/main/java/com/zylquinal/argon2/internal/constants$4.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.zylquinal.argon2.internal; - -import java.lang.invoke.VarHandle; - -import static java.lang.foreign.ValueLayout.PathElement; -final class constants$4 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$4() {} - static final VarHandle const$0 = constants$1.const$5.varHandle(PathElement.groupElement("lanes")); - static final VarHandle const$1 = constants$1.const$5.varHandle(PathElement.groupElement("threads")); - static final VarHandle const$2 = constants$1.const$5.varHandle(PathElement.groupElement("version")); - static final VarHandle const$3 = constants$1.const$5.varHandle(PathElement.groupElement("allocate_cbk")); - static final VarHandle const$4 = constants$1.const$5.varHandle(PathElement.groupElement("free_cbk")); - static final VarHandle const$5 = constants$1.const$5.varHandle(PathElement.groupElement("flags")); -} - - diff --git a/src/main/java/com/zylquinal/argon2/internal/constants$5.java b/src/main/java/com/zylquinal/argon2/internal/constants$5.java deleted file mode 100644 index 8e9bb87..0000000 --- a/src/main/java/com/zylquinal/argon2/internal/constants$5.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.zylquinal.argon2.internal; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -import static java.lang.foreign.ValueLayout.JAVA_INT; -import static java.lang.foreign.ValueLayout.JAVA_LONG; -final class constants$5 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$5() {} - static final FunctionDescriptor const$0 = FunctionDescriptor.of(RuntimeHelper.POINTER, - JAVA_INT, - JAVA_INT - ); - static final MethodHandle const$1 = RuntimeHelper.downcallHandle( - "argon2_type2string", - constants$5.const$0 - ); - static final FunctionDescriptor const$2 = FunctionDescriptor.of(JAVA_INT, - RuntimeHelper.POINTER, - JAVA_INT - ); - static final MethodHandle const$3 = RuntimeHelper.downcallHandle( - "argon2_ctx", - constants$5.const$2 - ); - static final FunctionDescriptor const$4 = FunctionDescriptor.of(JAVA_INT, - JAVA_INT, - JAVA_INT, - JAVA_INT, - RuntimeHelper.POINTER, - JAVA_LONG, - RuntimeHelper.POINTER, - JAVA_LONG, - JAVA_LONG, - RuntimeHelper.POINTER, - JAVA_LONG - ); - static final MethodHandle const$5 = RuntimeHelper.downcallHandle( - "argon2i_hash_encoded", - constants$5.const$4 - ); -} - - diff --git a/src/main/java/com/zylquinal/argon2/internal/constants$6.java b/src/main/java/com/zylquinal/argon2/internal/constants$6.java deleted file mode 100644 index 7f05dc8..0000000 --- a/src/main/java/com/zylquinal/argon2/internal/constants$6.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.zylquinal.argon2.internal; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -import static java.lang.foreign.ValueLayout.JAVA_INT; -import static java.lang.foreign.ValueLayout.JAVA_LONG; -final class constants$6 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$6() {} - static final FunctionDescriptor const$0 = FunctionDescriptor.of(JAVA_INT, - JAVA_INT, - JAVA_INT, - JAVA_INT, - RuntimeHelper.POINTER, - JAVA_LONG, - RuntimeHelper.POINTER, - JAVA_LONG, - RuntimeHelper.POINTER, - JAVA_LONG - ); - static final MethodHandle const$1 = RuntimeHelper.downcallHandle( - "argon2i_hash_raw", - constants$6.const$0 - ); - static final MethodHandle const$2 = RuntimeHelper.downcallHandle( - "argon2d_hash_encoded", - constants$5.const$4 - ); - static final MethodHandle const$3 = RuntimeHelper.downcallHandle( - "argon2d_hash_raw", - constants$6.const$0 - ); - static final MethodHandle const$4 = RuntimeHelper.downcallHandle( - "argon2id_hash_encoded", - constants$5.const$4 - ); - static final MethodHandle const$5 = RuntimeHelper.downcallHandle( - "argon2id_hash_raw", - constants$6.const$0 - ); -} - - diff --git a/src/main/java/com/zylquinal/argon2/internal/constants$7.java b/src/main/java/com/zylquinal/argon2/internal/constants$7.java deleted file mode 100644 index 31bd54f..0000000 --- a/src/main/java/com/zylquinal/argon2/internal/constants$7.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.zylquinal.argon2.internal; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -import static java.lang.foreign.ValueLayout.JAVA_INT; -import static java.lang.foreign.ValueLayout.JAVA_LONG; -final class constants$7 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$7() {} - static final FunctionDescriptor const$0 = FunctionDescriptor.of(JAVA_INT, - JAVA_INT, - JAVA_INT, - JAVA_INT, - RuntimeHelper.POINTER, - JAVA_LONG, - RuntimeHelper.POINTER, - JAVA_LONG, - RuntimeHelper.POINTER, - JAVA_LONG, - RuntimeHelper.POINTER, - JAVA_LONG, - JAVA_INT, - JAVA_INT - ); - static final MethodHandle const$1 = RuntimeHelper.downcallHandle( - "argon2_hash", - constants$7.const$0 - ); - static final FunctionDescriptor const$2 = FunctionDescriptor.of(JAVA_INT, - RuntimeHelper.POINTER, - RuntimeHelper.POINTER, - JAVA_LONG - ); - static final MethodHandle const$3 = RuntimeHelper.downcallHandle( - "argon2i_verify", - constants$7.const$2 - ); - static final MethodHandle const$4 = RuntimeHelper.downcallHandle( - "argon2d_verify", - constants$7.const$2 - ); - static final MethodHandle const$5 = RuntimeHelper.downcallHandle( - "argon2id_verify", - constants$7.const$2 - ); -} - - diff --git a/src/main/java/com/zylquinal/argon2/internal/constants$8.java b/src/main/java/com/zylquinal/argon2/internal/constants$8.java deleted file mode 100644 index 132bc7a..0000000 --- a/src/main/java/com/zylquinal/argon2/internal/constants$8.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.zylquinal.argon2.internal; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -import static java.lang.foreign.ValueLayout.JAVA_INT; -import static java.lang.foreign.ValueLayout.JAVA_LONG; -final class constants$8 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$8() {} - static final FunctionDescriptor const$0 = FunctionDescriptor.of(JAVA_INT, - RuntimeHelper.POINTER, - RuntimeHelper.POINTER, - JAVA_LONG, - JAVA_INT - ); - static final MethodHandle const$1 = RuntimeHelper.downcallHandle( - "argon2_verify", - constants$8.const$0 - ); - static final FunctionDescriptor const$2 = FunctionDescriptor.of(JAVA_INT, - RuntimeHelper.POINTER - ); - static final MethodHandle const$3 = RuntimeHelper.downcallHandle( - "argon2d_ctx", - constants$8.const$2 - ); - static final MethodHandle const$4 = RuntimeHelper.downcallHandle( - "argon2i_ctx", - constants$8.const$2 - ); - static final MethodHandle const$5 = RuntimeHelper.downcallHandle( - "argon2id_ctx", - constants$8.const$2 - ); -} - - diff --git a/src/main/java/com/zylquinal/argon2/internal/constants$9.java b/src/main/java/com/zylquinal/argon2/internal/constants$9.java deleted file mode 100644 index ca07e9b..0000000 --- a/src/main/java/com/zylquinal/argon2/internal/constants$9.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.zylquinal.argon2.internal; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -import static java.lang.foreign.ValueLayout.JAVA_INT; -final class constants$9 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$9() {} - static final FunctionDescriptor const$0 = FunctionDescriptor.of(JAVA_INT, - RuntimeHelper.POINTER, - RuntimeHelper.POINTER - ); - static final MethodHandle const$1 = RuntimeHelper.downcallHandle( - "argon2d_verify_ctx", - constants$9.const$0 - ); - static final MethodHandle const$2 = RuntimeHelper.downcallHandle( - "argon2i_verify_ctx", - constants$9.const$0 - ); - static final MethodHandle const$3 = RuntimeHelper.downcallHandle( - "argon2id_verify_ctx", - constants$9.const$0 - ); - static final FunctionDescriptor const$4 = FunctionDescriptor.of(JAVA_INT, - RuntimeHelper.POINTER, - RuntimeHelper.POINTER, - JAVA_INT - ); - static final MethodHandle const$5 = RuntimeHelper.downcallHandle( - "argon2_verify_ctx", - constants$9.const$4 - ); -} - - diff --git a/src/main/java/com/zylquinal/argon2/internal/deallocate_fptr.java b/src/main/java/com/zylquinal/argon2/internal/deallocate_fptr.java index bc222e9..07d1fc3 100644 --- a/src/main/java/com/zylquinal/argon2/internal/deallocate_fptr.java +++ b/src/main/java/com/zylquinal/argon2/internal/deallocate_fptr.java @@ -1,28 +1,68 @@ +// Generated by jextract + package com.zylquinal.argon2.internal; -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; +import java.lang.invoke.*; +import java.lang.foreign.*; +import java.nio.ByteOrder; +import java.util.*; +import java.util.function.*; +import java.util.stream.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; + /** - * {@snippet : - * void (*deallocate_fptr)(unsigned char* memory,unsigned long bytes_to_allocate); + * {@snippet lang=c : + * typedef void (*deallocate_fptr)(uint8_t *, size_t) * } */ -public interface deallocate_fptr { +public class deallocate_fptr { - void apply(MemorySegment memory, long bytes_to_allocate); - static MemorySegment allocate(deallocate_fptr fi, Arena scope) { - return RuntimeHelper.upcallStub(constants$1.const$3, fi, constants$1.const$2, scope); + deallocate_fptr() { + // Should not be called directly } - static deallocate_fptr ofAddress(MemorySegment addr, Arena arena) { - MemorySegment symbol = addr.reinterpret(arena, null); - return (MemorySegment _memory, long _bytes_to_allocate) -> { - try { - constants$1.const$4.invokeExact(symbol, _memory, _bytes_to_allocate); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + void apply(MemorySegment memory, long bytes_to_allocate); + } + + private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( + argon2_h.C_POINTER, + argon2_h.C_LONG + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = argon2_h.upcallHandle(Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); } -} + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static void invoke(MemorySegment funcPtr,MemorySegment memory, long bytes_to_allocate) { + try { + DOWN$MH.invokeExact(funcPtr, memory, bytes_to_allocate); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} diff --git a/src/main/java/com/zylquinal/argon2/internal/max_align_t.java b/src/main/java/com/zylquinal/argon2/internal/max_align_t.java index 1fda3ca..2a894a8 100644 --- a/src/main/java/com/zylquinal/argon2/internal/max_align_t.java +++ b/src/main/java/com/zylquinal/argon2/internal/max_align_t.java @@ -1,56 +1,129 @@ +// Generated by jextract + package com.zylquinal.argon2.internal; -import java.lang.foreign.Arena; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.invoke.VarHandle; +import java.lang.invoke.*; +import java.lang.foreign.*; +import java.nio.ByteOrder; +import java.util.*; +import java.util.function.*; +import java.util.stream.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; + /** - * {@snippet : + * {@snippet lang=c : * struct { * long long __clang_max_align_nonce1; * long double __clang_max_align_nonce2; - * }; + * } * } */ public class max_align_t { - public static MemoryLayout $LAYOUT() { - return constants$0.const$1; + max_align_t() { + // Should not be called directly + } + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + argon2_h.C_LONG_LONG.withName("__clang_max_align_nonce1"), + MemoryLayout.paddingLayout(24) + ).withName("$anon$19:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; + } + + private static final OfLong __clang_max_align_nonce1$LAYOUT = (OfLong)$LAYOUT.select(groupElement("__clang_max_align_nonce1")); + + /** + * Layout for field: + * {@snippet lang=c : + * long long __clang_max_align_nonce1 + * } + */ + public static final OfLong __clang_max_align_nonce1$layout() { + return __clang_max_align_nonce1$LAYOUT; } - public static VarHandle __clang_max_align_nonce1$VH() { - return constants$0.const$2; + + private static final long __clang_max_align_nonce1$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * long long __clang_max_align_nonce1 + * } + */ + public static final long __clang_max_align_nonce1$offset() { + return __clang_max_align_nonce1$OFFSET; } + /** * Getter for field: - * {@snippet : - * long long __clang_max_align_nonce1; + * {@snippet lang=c : + * long long __clang_max_align_nonce1 * } */ - public static long __clang_max_align_nonce1$get(MemorySegment seg) { - return (long)constants$0.const$2.get(seg); + public static long __clang_max_align_nonce1(MemorySegment struct) { + return struct.get(__clang_max_align_nonce1$LAYOUT, __clang_max_align_nonce1$OFFSET); } + /** * Setter for field: - * {@snippet : - * long long __clang_max_align_nonce1; + * {@snippet lang=c : + * long long __clang_max_align_nonce1 * } */ - public static void __clang_max_align_nonce1$set(MemorySegment seg, long x) { - constants$0.const$2.set(seg, x); + public static void __clang_max_align_nonce1(MemorySegment struct, long fieldValue) { + struct.set(__clang_max_align_nonce1$LAYOUT, __clang_max_align_nonce1$OFFSET, fieldValue); } - public static long __clang_max_align_nonce1$get(MemorySegment seg, long index) { - return (long)constants$0.const$2.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void __clang_max_align_nonce1$set(MemorySegment seg, long index, long x) { - constants$0.const$2.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); + } + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { + return reinterpret(addr, 1, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, Arena arena) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, arena); } -} + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); + } +} diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index de03bc4..6851bb8 100755 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,6 +1,7 @@ module argon.main { requires lombok; requires org.jetbrains.annotations; + opens com.zylquinal.argon2.api; opens com.zylquinal.argon2.api.enumeration; opens com.zylquinal.argon2.api.exception;