// WARNING: This file has automatically been generated
// Code generated by https://git.io/c-for-go. DO NOT EDIT.

package generated

/*
#cgo LDFLAGS: -L${SRCDIR}/..
#cgo pkg-config: ${SRCDIR}/../filcrypto.pc
#include "../filcrypto.h"
#include <stdlib.h>
#include "cgo_helpers.h"
*/
import "C"
import (
	"runtime"
	"unsafe"
)

// FilAggregate function as declared in filecoin-ffi/filcrypto.h:349
func FilAggregate(flattenedSignaturesPtr []byte, flattenedSignaturesLen uint) *FilAggregateResponse {
	cflattenedSignaturesPtr, cflattenedSignaturesPtrAllocMap := copyPUint8TBytes((*sliceHeader)(unsafe.Pointer(&flattenedSignaturesPtr)))
	cflattenedSignaturesLen, cflattenedSignaturesLenAllocMap := (C.size_t)(flattenedSignaturesLen), cgoAllocsUnknown
	__ret := C.fil_aggregate(cflattenedSignaturesPtr, cflattenedSignaturesLen)
	runtime.KeepAlive(cflattenedSignaturesLenAllocMap)
	runtime.KeepAlive(cflattenedSignaturesPtrAllocMap)
	__v := NewFilAggregateResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilAggregateSealProofs function as declared in filecoin-ffi/filcrypto.h:352
func FilAggregateSealProofs(registeredProof FilRegisteredSealProof, registeredAggregation FilRegisteredAggregationProof, commRsPtr []Fil32ByteArray, commRsLen uint, seedsPtr []Fil32ByteArray, seedsLen uint, sealCommitResponsesPtr []FilSealCommitPhase2Response, sealCommitResponsesLen uint) *FilAggregateProof {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredSealProof)(registeredProof), cgoAllocsUnknown
	cregisteredAggregation, cregisteredAggregationAllocMap := (C.fil_RegisteredAggregationProof)(registeredAggregation), cgoAllocsUnknown
	ccommRsPtr, ccommRsPtrAllocMap := unpackArgSFil32ByteArray(commRsPtr)
	ccommRsLen, ccommRsLenAllocMap := (C.size_t)(commRsLen), cgoAllocsUnknown
	cseedsPtr, cseedsPtrAllocMap := unpackArgSFil32ByteArray(seedsPtr)
	cseedsLen, cseedsLenAllocMap := (C.size_t)(seedsLen), cgoAllocsUnknown
	csealCommitResponsesPtr, csealCommitResponsesPtrAllocMap := unpackArgSFilSealCommitPhase2Response(sealCommitResponsesPtr)
	csealCommitResponsesLen, csealCommitResponsesLenAllocMap := (C.size_t)(sealCommitResponsesLen), cgoAllocsUnknown
	__ret := C.fil_aggregate_seal_proofs(cregisteredProof, cregisteredAggregation, ccommRsPtr, ccommRsLen, cseedsPtr, cseedsLen, csealCommitResponsesPtr, csealCommitResponsesLen)
	runtime.KeepAlive(csealCommitResponsesLenAllocMap)
	packSFilSealCommitPhase2Response(sealCommitResponsesPtr, csealCommitResponsesPtr)
	runtime.KeepAlive(csealCommitResponsesPtrAllocMap)
	runtime.KeepAlive(cseedsLenAllocMap)
	packSFil32ByteArray(seedsPtr, cseedsPtr)
	runtime.KeepAlive(cseedsPtrAllocMap)
	runtime.KeepAlive(ccommRsLenAllocMap)
	packSFil32ByteArray(commRsPtr, ccommRsPtr)
	runtime.KeepAlive(ccommRsPtrAllocMap)
	runtime.KeepAlive(cregisteredAggregationAllocMap)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilAggregateProofRef(unsafe.Pointer(__ret))
	return __v
}

// FilClearCache function as declared in filecoin-ffi/filcrypto.h:361
func FilClearCache(sectorSize uint64, cacheDirPath string) *FilClearCacheResponse {
	csectorSize, csectorSizeAllocMap := (C.uint64_t)(sectorSize), cgoAllocsUnknown
	cacheDirPath = safeString(cacheDirPath)
	ccacheDirPath, ccacheDirPathAllocMap := unpackPCharString(cacheDirPath)
	__ret := C.fil_clear_cache(csectorSize, ccacheDirPath)
	runtime.KeepAlive(cacheDirPath)
	runtime.KeepAlive(ccacheDirPathAllocMap)
	runtime.KeepAlive(csectorSizeAllocMap)
	__v := NewFilClearCacheResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilCreateZeroSignature function as declared in filecoin-ffi/filcrypto.h:368
func FilCreateZeroSignature() *FilZeroSignatureResponse {
	__ret := C.fil_create_zero_signature()
	__v := NewFilZeroSignatureResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilDestroyAggregateProof function as declared in filecoin-ffi/filcrypto.h:374
func FilDestroyAggregateProof(ptr *FilAggregateProof) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_aggregate_proof(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyAggregateResponse function as declared in filecoin-ffi/filcrypto.h:376
func FilDestroyAggregateResponse(ptr *FilAggregateResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_aggregate_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyClearCacheResponse function as declared in filecoin-ffi/filcrypto.h:378
func FilDestroyClearCacheResponse(ptr *FilClearCacheResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_clear_cache_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyFauxrepResponse function as declared in filecoin-ffi/filcrypto.h:380
func FilDestroyFauxrepResponse(ptr *FilFauxRepResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_fauxrep_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyFinalizeTicketResponse function as declared in filecoin-ffi/filcrypto.h:382
func FilDestroyFinalizeTicketResponse(ptr *FilFinalizeTicketResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_finalize_ticket_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyGenerateDataCommitmentResponse function as declared in filecoin-ffi/filcrypto.h:384
func FilDestroyGenerateDataCommitmentResponse(ptr *FilGenerateDataCommitmentResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_generate_data_commitment_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyGenerateFallbackSectorChallengesResponse function as declared in filecoin-ffi/filcrypto.h:386
func FilDestroyGenerateFallbackSectorChallengesResponse(ptr *FilGenerateFallbackSectorChallengesResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_generate_fallback_sector_challenges_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyGeneratePieceCommitmentResponse function as declared in filecoin-ffi/filcrypto.h:388
func FilDestroyGeneratePieceCommitmentResponse(ptr *FilGeneratePieceCommitmentResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_generate_piece_commitment_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyGenerateSingleVanillaProofResponse function as declared in filecoin-ffi/filcrypto.h:390
func FilDestroyGenerateSingleVanillaProofResponse(ptr *FilGenerateSingleVanillaProofResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_generate_single_vanilla_proof_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyGenerateWindowPostResponse function as declared in filecoin-ffi/filcrypto.h:392
func FilDestroyGenerateWindowPostResponse(ptr *FilGenerateWindowPoStResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_generate_window_post_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyGenerateWinningPostResponse function as declared in filecoin-ffi/filcrypto.h:394
func FilDestroyGenerateWinningPostResponse(ptr *FilGenerateWinningPoStResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_generate_winning_post_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyGenerateWinningPostSectorChallenge function as declared in filecoin-ffi/filcrypto.h:396
func FilDestroyGenerateWinningPostSectorChallenge(ptr *FilGenerateWinningPoStSectorChallenge) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_generate_winning_post_sector_challenge(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyGpuDeviceResponse function as declared in filecoin-ffi/filcrypto.h:398
func FilDestroyGpuDeviceResponse(ptr *FilGpuDeviceResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_gpu_device_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyHashResponse function as declared in filecoin-ffi/filcrypto.h:400
func FilDestroyHashResponse(ptr *FilHashResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_hash_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyInitLogFdResponse function as declared in filecoin-ffi/filcrypto.h:402
func FilDestroyInitLogFdResponse(ptr *FilInitLogFdResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_init_log_fd_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyPrivateKeyGenerateResponse function as declared in filecoin-ffi/filcrypto.h:404
func FilDestroyPrivateKeyGenerateResponse(ptr *FilPrivateKeyGenerateResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_private_key_generate_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyPrivateKeyPublicKeyResponse function as declared in filecoin-ffi/filcrypto.h:406
func FilDestroyPrivateKeyPublicKeyResponse(ptr *FilPrivateKeyPublicKeyResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_private_key_public_key_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyPrivateKeySignResponse function as declared in filecoin-ffi/filcrypto.h:408
func FilDestroyPrivateKeySignResponse(ptr *FilPrivateKeySignResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_private_key_sign_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroySealCommitPhase1Response function as declared in filecoin-ffi/filcrypto.h:410
func FilDestroySealCommitPhase1Response(ptr *FilSealCommitPhase1Response) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_seal_commit_phase1_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroySealCommitPhase2Response function as declared in filecoin-ffi/filcrypto.h:412
func FilDestroySealCommitPhase2Response(ptr *FilSealCommitPhase2Response) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_seal_commit_phase2_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroySealPreCommitPhase1Response function as declared in filecoin-ffi/filcrypto.h:414
func FilDestroySealPreCommitPhase1Response(ptr *FilSealPreCommitPhase1Response) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_seal_pre_commit_phase1_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroySealPreCommitPhase2Response function as declared in filecoin-ffi/filcrypto.h:416
func FilDestroySealPreCommitPhase2Response(ptr *FilSealPreCommitPhase2Response) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_seal_pre_commit_phase2_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyStringResponse function as declared in filecoin-ffi/filcrypto.h:418
func FilDestroyStringResponse(ptr *FilStringResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_string_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyUnsealRangeResponse function as declared in filecoin-ffi/filcrypto.h:420
func FilDestroyUnsealRangeResponse(ptr *FilUnsealRangeResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_unseal_range_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyVerifyAggregateSealResponse function as declared in filecoin-ffi/filcrypto.h:426
func FilDestroyVerifyAggregateSealResponse(ptr *FilVerifyAggregateSealProofResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_verify_aggregate_seal_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyVerifySealResponse function as declared in filecoin-ffi/filcrypto.h:432
func FilDestroyVerifySealResponse(ptr *FilVerifySealResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_verify_seal_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyVerifyWindowPostResponse function as declared in filecoin-ffi/filcrypto.h:434
func FilDestroyVerifyWindowPostResponse(ptr *FilVerifyWindowPoStResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_verify_window_post_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyVerifyWinningPostResponse function as declared in filecoin-ffi/filcrypto.h:440
func FilDestroyVerifyWinningPostResponse(ptr *FilVerifyWinningPoStResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_verify_winning_post_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyWriteWithAlignmentResponse function as declared in filecoin-ffi/filcrypto.h:442
func FilDestroyWriteWithAlignmentResponse(ptr *FilWriteWithAlignmentResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_write_with_alignment_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyWriteWithoutAlignmentResponse function as declared in filecoin-ffi/filcrypto.h:444
func FilDestroyWriteWithoutAlignmentResponse(ptr *FilWriteWithoutAlignmentResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_write_without_alignment_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDestroyZeroSignatureResponse function as declared in filecoin-ffi/filcrypto.h:446
func FilDestroyZeroSignatureResponse(ptr *FilZeroSignatureResponse) {
	cptr, cptrAllocMap := ptr.PassRef()
	C.fil_destroy_zero_signature_response(cptr)
	runtime.KeepAlive(cptrAllocMap)
}

// FilDropSignature function as declared in filecoin-ffi/filcrypto.h:451
func FilDropSignature(sig []byte) {
	csig, csigAllocMap := copyPUint8TBytes((*sliceHeader)(unsafe.Pointer(&sig)))
	C.fil_drop_signature(csig)
	runtime.KeepAlive(csigAllocMap)
}

// FilFauxrep function as declared in filecoin-ffi/filcrypto.h:453
func FilFauxrep(registeredProof FilRegisteredSealProof, cacheDirPath string, sealedSectorPath string) *FilFauxRepResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredSealProof)(registeredProof), cgoAllocsUnknown
	cacheDirPath = safeString(cacheDirPath)
	ccacheDirPath, ccacheDirPathAllocMap := unpackPCharString(cacheDirPath)
	sealedSectorPath = safeString(sealedSectorPath)
	csealedSectorPath, csealedSectorPathAllocMap := unpackPCharString(sealedSectorPath)
	__ret := C.fil_fauxrep(cregisteredProof, ccacheDirPath, csealedSectorPath)
	runtime.KeepAlive(sealedSectorPath)
	runtime.KeepAlive(csealedSectorPathAllocMap)
	runtime.KeepAlive(cacheDirPath)
	runtime.KeepAlive(ccacheDirPathAllocMap)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilFauxRepResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilFauxrep2 function as declared in filecoin-ffi/filcrypto.h:457
func FilFauxrep2(registeredProof FilRegisteredSealProof, cacheDirPath string, existingPAuxPath string) *FilFauxRepResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredSealProof)(registeredProof), cgoAllocsUnknown
	cacheDirPath = safeString(cacheDirPath)
	ccacheDirPath, ccacheDirPathAllocMap := unpackPCharString(cacheDirPath)
	existingPAuxPath = safeString(existingPAuxPath)
	cexistingPAuxPath, cexistingPAuxPathAllocMap := unpackPCharString(existingPAuxPath)
	__ret := C.fil_fauxrep2(cregisteredProof, ccacheDirPath, cexistingPAuxPath)
	runtime.KeepAlive(existingPAuxPath)
	runtime.KeepAlive(cexistingPAuxPathAllocMap)
	runtime.KeepAlive(cacheDirPath)
	runtime.KeepAlive(ccacheDirPathAllocMap)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilFauxRepResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGenerateDataCommitment function as declared in filecoin-ffi/filcrypto.h:464
func FilGenerateDataCommitment(registeredProof FilRegisteredSealProof, piecesPtr []FilPublicPieceInfo, piecesLen uint) *FilGenerateDataCommitmentResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredSealProof)(registeredProof), cgoAllocsUnknown
	cpiecesPtr, cpiecesPtrAllocMap := unpackArgSFilPublicPieceInfo(piecesPtr)
	cpiecesLen, cpiecesLenAllocMap := (C.size_t)(piecesLen), cgoAllocsUnknown
	__ret := C.fil_generate_data_commitment(cregisteredProof, cpiecesPtr, cpiecesLen)
	runtime.KeepAlive(cpiecesLenAllocMap)
	packSFilPublicPieceInfo(piecesPtr, cpiecesPtr)
	runtime.KeepAlive(cpiecesPtrAllocMap)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilGenerateDataCommitmentResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGenerateFallbackSectorChallenges function as declared in filecoin-ffi/filcrypto.h:472
func FilGenerateFallbackSectorChallenges(registeredProof FilRegisteredPoStProof, randomness Fil32ByteArray, sectorIdsPtr []uint64, sectorIdsLen uint, proverId Fil32ByteArray) *FilGenerateFallbackSectorChallengesResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredPoStProof)(registeredProof), cgoAllocsUnknown
	crandomness, crandomnessAllocMap := randomness.PassValue()
	csectorIdsPtr, csectorIdsPtrAllocMap := copyPUint64TBytes((*sliceHeader)(unsafe.Pointer(&sectorIdsPtr)))
	csectorIdsLen, csectorIdsLenAllocMap := (C.size_t)(sectorIdsLen), cgoAllocsUnknown
	cproverId, cproverIdAllocMap := proverId.PassValue()
	__ret := C.fil_generate_fallback_sector_challenges(cregisteredProof, crandomness, csectorIdsPtr, csectorIdsLen, cproverId)
	runtime.KeepAlive(cproverIdAllocMap)
	runtime.KeepAlive(csectorIdsLenAllocMap)
	runtime.KeepAlive(csectorIdsPtrAllocMap)
	runtime.KeepAlive(crandomnessAllocMap)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilGenerateFallbackSectorChallengesResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGeneratePieceCommitment function as declared in filecoin-ffi/filcrypto.h:482
func FilGeneratePieceCommitment(registeredProof FilRegisteredSealProof, pieceFdRaw int32, unpaddedPieceSize uint64) *FilGeneratePieceCommitmentResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredSealProof)(registeredProof), cgoAllocsUnknown
	cpieceFdRaw, cpieceFdRawAllocMap := (C.int)(pieceFdRaw), cgoAllocsUnknown
	cunpaddedPieceSize, cunpaddedPieceSizeAllocMap := (C.uint64_t)(unpaddedPieceSize), cgoAllocsUnknown
	__ret := C.fil_generate_piece_commitment(cregisteredProof, cpieceFdRaw, cunpaddedPieceSize)
	runtime.KeepAlive(cunpaddedPieceSizeAllocMap)
	runtime.KeepAlive(cpieceFdRawAllocMap)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilGeneratePieceCommitmentResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGenerateSingleVanillaProof function as declared in filecoin-ffi/filcrypto.h:490
func FilGenerateSingleVanillaProof(replica FilPrivateReplicaInfo, challengesPtr []uint64, challengesLen uint) *FilGenerateSingleVanillaProofResponse {
	creplica, creplicaAllocMap := replica.PassValue()
	cchallengesPtr, cchallengesPtrAllocMap := copyPUint64TBytes((*sliceHeader)(unsafe.Pointer(&challengesPtr)))
	cchallengesLen, cchallengesLenAllocMap := (C.size_t)(challengesLen), cgoAllocsUnknown
	__ret := C.fil_generate_single_vanilla_proof(creplica, cchallengesPtr, cchallengesLen)
	runtime.KeepAlive(cchallengesLenAllocMap)
	runtime.KeepAlive(cchallengesPtrAllocMap)
	runtime.KeepAlive(creplicaAllocMap)
	__v := NewFilGenerateSingleVanillaProofResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGenerateWindowPost function as declared in filecoin-ffi/filcrypto.h:498
func FilGenerateWindowPost(randomness Fil32ByteArray, replicasPtr []FilPrivateReplicaInfo, replicasLen uint, proverId Fil32ByteArray) *FilGenerateWindowPoStResponse {
	crandomness, crandomnessAllocMap := randomness.PassValue()
	creplicasPtr, creplicasPtrAllocMap := unpackArgSFilPrivateReplicaInfo(replicasPtr)
	creplicasLen, creplicasLenAllocMap := (C.size_t)(replicasLen), cgoAllocsUnknown
	cproverId, cproverIdAllocMap := proverId.PassValue()
	__ret := C.fil_generate_window_post(crandomness, creplicasPtr, creplicasLen, cproverId)
	runtime.KeepAlive(cproverIdAllocMap)
	runtime.KeepAlive(creplicasLenAllocMap)
	packSFilPrivateReplicaInfo(replicasPtr, creplicasPtr)
	runtime.KeepAlive(creplicasPtrAllocMap)
	runtime.KeepAlive(crandomnessAllocMap)
	__v := NewFilGenerateWindowPoStResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGenerateWindowPost function as declared in filecoin-ffi/filcrypto.h:498
func FilAggregateWindowPoStProofs(registeredAggregation FilRegisteredAggregationProof, randomnessesPtr []Fil32ByteArray, randomnessesLen uint, proofsPtr []FilPoStProof, proofsLen uint) *FilAggregateProof {
	cregisteredAggregation, cregisteredAggregationAllocMap := (C.fil_RegisteredAggregationProof)(registeredAggregation), cgoAllocsUnknown
	crandomnessesPtr, crandomnessesPtrAllocMap := unpackArgSFil32ByteArray(randomnessesPtr)
	crandomnessesLen, crandomnessesLenAllocMap := (C.size_t)(randomnessesLen), cgoAllocsUnknown
	cproofsPtr, cproofsPtrAllocMap := unpackArgSFilPoStProof(proofsPtr)
	cproofsLen, cproofsLenAllocMap := (C.size_t)(proofsLen), cgoAllocsUnknown
	__ret := C.fil_aggregate_window_post_proofs(cregisteredAggregation, crandomnessesPtr, crandomnessesLen, cproofsPtr, cproofsLen)
	runtime.KeepAlive(cproofsLenAllocMap)
	packSFilPoStProof(proofsPtr, cproofsPtr)
	runtime.KeepAlive(cproofsPtrAllocMap)
	runtime.KeepAlive(crandomnessesLenAllocMap)
	packSFil32ByteArray(randomnessesPtr, crandomnessesPtr)
	runtime.KeepAlive(crandomnessesPtrAllocMap)
	runtime.KeepAlive(cregisteredAggregationAllocMap)
	__v := NewFilAggregateProofRef(unsafe.Pointer(__ret))
	return __v
}

// FilGenerateWindowPostWithVanilla function as declared in filecoin-ffi/filcrypto.h:507
func FilGenerateWindowPostWithVanilla(registeredProof FilRegisteredPoStProof, randomness Fil32ByteArray, proverId Fil32ByteArray, vanillaProofsPtr []FilVanillaProof, vanillaProofsLen uint) *FilGenerateWindowPoStResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredPoStProof)(registeredProof), cgoAllocsUnknown
	crandomness, crandomnessAllocMap := randomness.PassValue()
	cproverId, cproverIdAllocMap := proverId.PassValue()
	cvanillaProofsPtr, cvanillaProofsPtrAllocMap := unpackArgSFilVanillaProof(vanillaProofsPtr)
	cvanillaProofsLen, cvanillaProofsLenAllocMap := (C.size_t)(vanillaProofsLen), cgoAllocsUnknown
	__ret := C.fil_generate_window_post_with_vanilla(cregisteredProof, crandomness, cproverId, cvanillaProofsPtr, cvanillaProofsLen)
	runtime.KeepAlive(cvanillaProofsLenAllocMap)
	packSFilVanillaProof(vanillaProofsPtr, cvanillaProofsPtr)
	runtime.KeepAlive(cvanillaProofsPtrAllocMap)
	runtime.KeepAlive(cproverIdAllocMap)
	runtime.KeepAlive(crandomnessAllocMap)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilGenerateWindowPoStResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGenerateWinningPost function as declared in filecoin-ffi/filcrypto.h:517
func FilGenerateWinningPost(randomness Fil32ByteArray, replicasPtr []FilPrivateReplicaInfo, replicasLen uint, proverId Fil32ByteArray) *FilGenerateWinningPoStResponse {
	crandomness, crandomnessAllocMap := randomness.PassValue()
	creplicasPtr, creplicasPtrAllocMap := unpackArgSFilPrivateReplicaInfo(replicasPtr)
	creplicasLen, creplicasLenAllocMap := (C.size_t)(replicasLen), cgoAllocsUnknown
	cproverId, cproverIdAllocMap := proverId.PassValue()
	__ret := C.fil_generate_winning_post(crandomness, creplicasPtr, creplicasLen, cproverId)
	runtime.KeepAlive(cproverIdAllocMap)
	runtime.KeepAlive(creplicasLenAllocMap)
	packSFilPrivateReplicaInfo(replicasPtr, creplicasPtr)
	runtime.KeepAlive(creplicasPtrAllocMap)
	runtime.KeepAlive(crandomnessAllocMap)
	__v := NewFilGenerateWinningPoStResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGenerateWinningPostSectorChallenge function as declared in filecoin-ffi/filcrypto.h:526
func FilGenerateWinningPostSectorChallenge(registeredProof FilRegisteredPoStProof, randomness Fil32ByteArray, sectorSetLen uint64, proverId Fil32ByteArray) *FilGenerateWinningPoStSectorChallenge {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredPoStProof)(registeredProof), cgoAllocsUnknown
	crandomness, crandomnessAllocMap := randomness.PassValue()
	csectorSetLen, csectorSetLenAllocMap := (C.uint64_t)(sectorSetLen), cgoAllocsUnknown
	cproverId, cproverIdAllocMap := proverId.PassValue()
	__ret := C.fil_generate_winning_post_sector_challenge(cregisteredProof, crandomness, csectorSetLen, cproverId)
	runtime.KeepAlive(cproverIdAllocMap)
	runtime.KeepAlive(csectorSetLenAllocMap)
	runtime.KeepAlive(crandomnessAllocMap)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilGenerateWinningPoStSectorChallengeRef(unsafe.Pointer(__ret))
	return __v
}

// FilGenerateWinningPostWithVanilla function as declared in filecoin-ffi/filcrypto.h:535
func FilGenerateWinningPostWithVanilla(registeredProof FilRegisteredPoStProof, randomness Fil32ByteArray, proverId Fil32ByteArray, vanillaProofsPtr []FilVanillaProof, vanillaProofsLen uint) *FilGenerateWinningPoStResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredPoStProof)(registeredProof), cgoAllocsUnknown
	crandomness, crandomnessAllocMap := randomness.PassValue()
	cproverId, cproverIdAllocMap := proverId.PassValue()
	cvanillaProofsPtr, cvanillaProofsPtrAllocMap := unpackArgSFilVanillaProof(vanillaProofsPtr)
	cvanillaProofsLen, cvanillaProofsLenAllocMap := (C.size_t)(vanillaProofsLen), cgoAllocsUnknown
	__ret := C.fil_generate_winning_post_with_vanilla(cregisteredProof, crandomness, cproverId, cvanillaProofsPtr, cvanillaProofsLen)
	runtime.KeepAlive(cvanillaProofsLenAllocMap)
	packSFilVanillaProof(vanillaProofsPtr, cvanillaProofsPtr)
	runtime.KeepAlive(cvanillaProofsPtrAllocMap)
	runtime.KeepAlive(cproverIdAllocMap)
	runtime.KeepAlive(crandomnessAllocMap)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilGenerateWinningPoStResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGetGpuDevices function as declared in filecoin-ffi/filcrypto.h:544
func FilGetGpuDevices() *FilGpuDeviceResponse {
	__ret := C.fil_get_gpu_devices()
	__v := NewFilGpuDeviceResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGetMaxUserBytesPerStagedSector function as declared in filecoin-ffi/filcrypto.h:550
func FilGetMaxUserBytesPerStagedSector(registeredProof FilRegisteredSealProof) uint64 {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredSealProof)(registeredProof), cgoAllocsUnknown
	__ret := C.fil_get_max_user_bytes_per_staged_sector(cregisteredProof)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := (uint64)(__ret)
	return __v
}

// FilGetPostCircuitIdentifier function as declared in filecoin-ffi/filcrypto.h:556
func FilGetPostCircuitIdentifier(registeredProof FilRegisteredPoStProof) *FilStringResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredPoStProof)(registeredProof), cgoAllocsUnknown
	__ret := C.fil_get_post_circuit_identifier(cregisteredProof)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilStringResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGetPostParamsCid function as declared in filecoin-ffi/filcrypto.h:562
func FilGetPostParamsCid(registeredProof FilRegisteredPoStProof) *FilStringResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredPoStProof)(registeredProof), cgoAllocsUnknown
	__ret := C.fil_get_post_params_cid(cregisteredProof)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilStringResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGetPostParamsPath function as declared in filecoin-ffi/filcrypto.h:569
func FilGetPostParamsPath(registeredProof FilRegisteredPoStProof) *FilStringResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredPoStProof)(registeredProof), cgoAllocsUnknown
	__ret := C.fil_get_post_params_path(cregisteredProof)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilStringResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGetPostVerifyingKeyCid function as declared in filecoin-ffi/filcrypto.h:575
func FilGetPostVerifyingKeyCid(registeredProof FilRegisteredPoStProof) *FilStringResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredPoStProof)(registeredProof), cgoAllocsUnknown
	__ret := C.fil_get_post_verifying_key_cid(cregisteredProof)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilStringResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGetPostVerifyingKeyPath function as declared in filecoin-ffi/filcrypto.h:582
func FilGetPostVerifyingKeyPath(registeredProof FilRegisteredPoStProof) *FilStringResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredPoStProof)(registeredProof), cgoAllocsUnknown
	__ret := C.fil_get_post_verifying_key_path(cregisteredProof)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilStringResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGetPostVersion function as declared in filecoin-ffi/filcrypto.h:588
func FilGetPostVersion(registeredProof FilRegisteredPoStProof) *FilStringResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredPoStProof)(registeredProof), cgoAllocsUnknown
	__ret := C.fil_get_post_version(cregisteredProof)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilStringResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGetSealCircuitIdentifier function as declared in filecoin-ffi/filcrypto.h:594
func FilGetSealCircuitIdentifier(registeredProof FilRegisteredSealProof) *FilStringResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredSealProof)(registeredProof), cgoAllocsUnknown
	__ret := C.fil_get_seal_circuit_identifier(cregisteredProof)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilStringResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGetSealParamsCid function as declared in filecoin-ffi/filcrypto.h:600
func FilGetSealParamsCid(registeredProof FilRegisteredSealProof) *FilStringResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredSealProof)(registeredProof), cgoAllocsUnknown
	__ret := C.fil_get_seal_params_cid(cregisteredProof)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilStringResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGetSealParamsPath function as declared in filecoin-ffi/filcrypto.h:607
func FilGetSealParamsPath(registeredProof FilRegisteredSealProof) *FilStringResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredSealProof)(registeredProof), cgoAllocsUnknown
	__ret := C.fil_get_seal_params_path(cregisteredProof)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilStringResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGetSealVerifyingKeyCid function as declared in filecoin-ffi/filcrypto.h:613
func FilGetSealVerifyingKeyCid(registeredProof FilRegisteredSealProof) *FilStringResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredSealProof)(registeredProof), cgoAllocsUnknown
	__ret := C.fil_get_seal_verifying_key_cid(cregisteredProof)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilStringResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGetSealVerifyingKeyPath function as declared in filecoin-ffi/filcrypto.h:620
func FilGetSealVerifyingKeyPath(registeredProof FilRegisteredSealProof) *FilStringResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredSealProof)(registeredProof), cgoAllocsUnknown
	__ret := C.fil_get_seal_verifying_key_path(cregisteredProof)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilStringResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilGetSealVersion function as declared in filecoin-ffi/filcrypto.h:626
func FilGetSealVersion(registeredProof FilRegisteredSealProof) *FilStringResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredSealProof)(registeredProof), cgoAllocsUnknown
	__ret := C.fil_get_seal_version(cregisteredProof)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilStringResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilHash function as declared in filecoin-ffi/filcrypto.h:636
func FilHash(messagePtr []byte, messageLen uint) *FilHashResponse {
	cmessagePtr, cmessagePtrAllocMap := copyPUint8TBytes((*sliceHeader)(unsafe.Pointer(&messagePtr)))
	cmessageLen, cmessageLenAllocMap := (C.size_t)(messageLen), cgoAllocsUnknown
	__ret := C.fil_hash(cmessagePtr, cmessageLen)
	runtime.KeepAlive(cmessageLenAllocMap)
	runtime.KeepAlive(cmessagePtrAllocMap)
	__v := NewFilHashResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilHashVerify function as declared in filecoin-ffi/filcrypto.h:650
func FilHashVerify(signaturePtr []byte, flattenedMessagesPtr []byte, flattenedMessagesLen uint, messageSizesPtr []uint, messageSizesLen uint, flattenedPublicKeysPtr []byte, flattenedPublicKeysLen uint) int32 {
	csignaturePtr, csignaturePtrAllocMap := copyPUint8TBytes((*sliceHeader)(unsafe.Pointer(&signaturePtr)))
	cflattenedMessagesPtr, cflattenedMessagesPtrAllocMap := copyPUint8TBytes((*sliceHeader)(unsafe.Pointer(&flattenedMessagesPtr)))
	cflattenedMessagesLen, cflattenedMessagesLenAllocMap := (C.size_t)(flattenedMessagesLen), cgoAllocsUnknown
	cmessageSizesPtr, cmessageSizesPtrAllocMap := copyPSizeTBytes((*sliceHeader)(unsafe.Pointer(&messageSizesPtr)))
	cmessageSizesLen, cmessageSizesLenAllocMap := (C.size_t)(messageSizesLen), cgoAllocsUnknown
	cflattenedPublicKeysPtr, cflattenedPublicKeysPtrAllocMap := copyPUint8TBytes((*sliceHeader)(unsafe.Pointer(&flattenedPublicKeysPtr)))
	cflattenedPublicKeysLen, cflattenedPublicKeysLenAllocMap := (C.size_t)(flattenedPublicKeysLen), cgoAllocsUnknown
	__ret := C.fil_hash_verify(csignaturePtr, cflattenedMessagesPtr, cflattenedMessagesLen, cmessageSizesPtr, cmessageSizesLen, cflattenedPublicKeysPtr, cflattenedPublicKeysLen)
	runtime.KeepAlive(cflattenedPublicKeysLenAllocMap)
	runtime.KeepAlive(cflattenedPublicKeysPtrAllocMap)
	runtime.KeepAlive(cmessageSizesLenAllocMap)
	runtime.KeepAlive(cmessageSizesPtrAllocMap)
	runtime.KeepAlive(cflattenedMessagesLenAllocMap)
	runtime.KeepAlive(cflattenedMessagesPtrAllocMap)
	runtime.KeepAlive(csignaturePtrAllocMap)
	__v := (int32)(__ret)
	return __v
}

// FilInitLogFd function as declared in filecoin-ffi/filcrypto.h:667
func FilInitLogFd(logFd int32) *FilInitLogFdResponse {
	clogFd, clogFdAllocMap := (C.int)(logFd), cgoAllocsUnknown
	__ret := C.fil_init_log_fd(clogFd)
	runtime.KeepAlive(clogFdAllocMap)
	__v := NewFilInitLogFdResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilPrivateKeyGenerate function as declared in filecoin-ffi/filcrypto.h:672
func FilPrivateKeyGenerate() *FilPrivateKeyGenerateResponse {
	__ret := C.fil_private_key_generate()
	__v := NewFilPrivateKeyGenerateResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilPrivateKeyGenerateWithSeed function as declared in filecoin-ffi/filcrypto.h:685
func FilPrivateKeyGenerateWithSeed(rawSeed Fil32ByteArray) *FilPrivateKeyGenerateResponse {
	crawSeed, crawSeedAllocMap := rawSeed.PassValue()
	__ret := C.fil_private_key_generate_with_seed(crawSeed)
	runtime.KeepAlive(crawSeedAllocMap)
	__v := NewFilPrivateKeyGenerateResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilPrivateKeyPublicKey function as declared in filecoin-ffi/filcrypto.h:696
func FilPrivateKeyPublicKey(rawPrivateKeyPtr []byte) *FilPrivateKeyPublicKeyResponse {
	crawPrivateKeyPtr, crawPrivateKeyPtrAllocMap := copyPUint8TBytes((*sliceHeader)(unsafe.Pointer(&rawPrivateKeyPtr)))
	__ret := C.fil_private_key_public_key(crawPrivateKeyPtr)
	runtime.KeepAlive(crawPrivateKeyPtrAllocMap)
	__v := NewFilPrivateKeyPublicKeyResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilPrivateKeySign function as declared in filecoin-ffi/filcrypto.h:709
func FilPrivateKeySign(rawPrivateKeyPtr []byte, messagePtr []byte, messageLen uint) *FilPrivateKeySignResponse {
	crawPrivateKeyPtr, crawPrivateKeyPtrAllocMap := copyPUint8TBytes((*sliceHeader)(unsafe.Pointer(&rawPrivateKeyPtr)))
	cmessagePtr, cmessagePtrAllocMap := copyPUint8TBytes((*sliceHeader)(unsafe.Pointer(&messagePtr)))
	cmessageLen, cmessageLenAllocMap := (C.size_t)(messageLen), cgoAllocsUnknown
	__ret := C.fil_private_key_sign(crawPrivateKeyPtr, cmessagePtr, cmessageLen)
	runtime.KeepAlive(cmessageLenAllocMap)
	runtime.KeepAlive(cmessagePtrAllocMap)
	runtime.KeepAlive(crawPrivateKeyPtrAllocMap)
	__v := NewFilPrivateKeySignResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilSealCommitPhase1 function as declared in filecoin-ffi/filcrypto.h:717
func FilSealCommitPhase1(registeredProof FilRegisteredSealProof, commR Fil32ByteArray, commD Fil32ByteArray, cacheDirPath string, replicaPath string, sectorId uint64, proverId Fil32ByteArray, ticket Fil32ByteArray, seed Fil32ByteArray, piecesPtr []FilPublicPieceInfo, piecesLen uint) *FilSealCommitPhase1Response {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredSealProof)(registeredProof), cgoAllocsUnknown
	ccommR, ccommRAllocMap := commR.PassValue()
	ccommD, ccommDAllocMap := commD.PassValue()
	cacheDirPath = safeString(cacheDirPath)
	ccacheDirPath, ccacheDirPathAllocMap := unpackPCharString(cacheDirPath)
	replicaPath = safeString(replicaPath)
	creplicaPath, creplicaPathAllocMap := unpackPCharString(replicaPath)
	csectorId, csectorIdAllocMap := (C.uint64_t)(sectorId), cgoAllocsUnknown
	cproverId, cproverIdAllocMap := proverId.PassValue()
	cticket, cticketAllocMap := ticket.PassValue()
	cseed, cseedAllocMap := seed.PassValue()
	cpiecesPtr, cpiecesPtrAllocMap := unpackArgSFilPublicPieceInfo(piecesPtr)
	cpiecesLen, cpiecesLenAllocMap := (C.size_t)(piecesLen), cgoAllocsUnknown
	__ret := C.fil_seal_commit_phase1(cregisteredProof, ccommR, ccommD, ccacheDirPath, creplicaPath, csectorId, cproverId, cticket, cseed, cpiecesPtr, cpiecesLen)
	runtime.KeepAlive(cpiecesLenAllocMap)
	packSFilPublicPieceInfo(piecesPtr, cpiecesPtr)
	runtime.KeepAlive(cpiecesPtrAllocMap)
	runtime.KeepAlive(cseedAllocMap)
	runtime.KeepAlive(cticketAllocMap)
	runtime.KeepAlive(cproverIdAllocMap)
	runtime.KeepAlive(csectorIdAllocMap)
	runtime.KeepAlive(replicaPath)
	runtime.KeepAlive(creplicaPathAllocMap)
	runtime.KeepAlive(cacheDirPath)
	runtime.KeepAlive(ccacheDirPathAllocMap)
	runtime.KeepAlive(ccommDAllocMap)
	runtime.KeepAlive(ccommRAllocMap)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilSealCommitPhase1ResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilSealCommitPhase2 function as declared in filecoin-ffi/filcrypto.h:729
func FilSealCommitPhase2(sealCommitPhase1OutputPtr []byte, sealCommitPhase1OutputLen uint, sectorId uint64, proverId Fil32ByteArray) *FilSealCommitPhase2Response {
	csealCommitPhase1OutputPtr, csealCommitPhase1OutputPtrAllocMap := copyPUint8TBytes((*sliceHeader)(unsafe.Pointer(&sealCommitPhase1OutputPtr)))
	csealCommitPhase1OutputLen, csealCommitPhase1OutputLenAllocMap := (C.size_t)(sealCommitPhase1OutputLen), cgoAllocsUnknown
	csectorId, csectorIdAllocMap := (C.uint64_t)(sectorId), cgoAllocsUnknown
	cproverId, cproverIdAllocMap := proverId.PassValue()
	__ret := C.fil_seal_commit_phase2(csealCommitPhase1OutputPtr, csealCommitPhase1OutputLen, csectorId, cproverId)
	runtime.KeepAlive(cproverIdAllocMap)
	runtime.KeepAlive(csectorIdAllocMap)
	runtime.KeepAlive(csealCommitPhase1OutputLenAllocMap)
	runtime.KeepAlive(csealCommitPhase1OutputPtrAllocMap)
	__v := NewFilSealCommitPhase2ResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilSealPreCommitPhase1 function as declared in filecoin-ffi/filcrypto.h:738
func FilSealPreCommitPhase1(registeredProof FilRegisteredSealProof, cacheDirPath string, stagedSectorPath string, sealedSectorPath string, sectorId uint64, proverId Fil32ByteArray, ticket Fil32ByteArray, piecesPtr []FilPublicPieceInfo, piecesLen uint) *FilSealPreCommitPhase1Response {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredSealProof)(registeredProof), cgoAllocsUnknown
	cacheDirPath = safeString(cacheDirPath)
	ccacheDirPath, ccacheDirPathAllocMap := unpackPCharString(cacheDirPath)
	stagedSectorPath = safeString(stagedSectorPath)
	cstagedSectorPath, cstagedSectorPathAllocMap := unpackPCharString(stagedSectorPath)
	sealedSectorPath = safeString(sealedSectorPath)
	csealedSectorPath, csealedSectorPathAllocMap := unpackPCharString(sealedSectorPath)
	csectorId, csectorIdAllocMap := (C.uint64_t)(sectorId), cgoAllocsUnknown
	cproverId, cproverIdAllocMap := proverId.PassValue()
	cticket, cticketAllocMap := ticket.PassValue()
	cpiecesPtr, cpiecesPtrAllocMap := unpackArgSFilPublicPieceInfo(piecesPtr)
	cpiecesLen, cpiecesLenAllocMap := (C.size_t)(piecesLen), cgoAllocsUnknown
	__ret := C.fil_seal_pre_commit_phase1(cregisteredProof, ccacheDirPath, cstagedSectorPath, csealedSectorPath, csectorId, cproverId, cticket, cpiecesPtr, cpiecesLen)
	runtime.KeepAlive(cpiecesLenAllocMap)
	packSFilPublicPieceInfo(piecesPtr, cpiecesPtr)
	runtime.KeepAlive(cpiecesPtrAllocMap)
	runtime.KeepAlive(cticketAllocMap)
	runtime.KeepAlive(cproverIdAllocMap)
	runtime.KeepAlive(csectorIdAllocMap)
	runtime.KeepAlive(sealedSectorPath)
	runtime.KeepAlive(csealedSectorPathAllocMap)
	runtime.KeepAlive(stagedSectorPath)
	runtime.KeepAlive(cstagedSectorPathAllocMap)
	runtime.KeepAlive(cacheDirPath)
	runtime.KeepAlive(ccacheDirPathAllocMap)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilSealPreCommitPhase1ResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilSealPreCommitPhase2 function as declared in filecoin-ffi/filcrypto.h:752
func FilSealPreCommitPhase2(sealPreCommitPhase1OutputPtr []byte, sealPreCommitPhase1OutputLen uint, cacheDirPath string, sealedSectorPath string) *FilSealPreCommitPhase2Response {
	csealPreCommitPhase1OutputPtr, csealPreCommitPhase1OutputPtrAllocMap := copyPUint8TBytes((*sliceHeader)(unsafe.Pointer(&sealPreCommitPhase1OutputPtr)))
	csealPreCommitPhase1OutputLen, csealPreCommitPhase1OutputLenAllocMap := (C.size_t)(sealPreCommitPhase1OutputLen), cgoAllocsUnknown
	cacheDirPath = safeString(cacheDirPath)
	ccacheDirPath, ccacheDirPathAllocMap := unpackPCharString(cacheDirPath)
	sealedSectorPath = safeString(sealedSectorPath)
	csealedSectorPath, csealedSectorPathAllocMap := unpackPCharString(sealedSectorPath)
	__ret := C.fil_seal_pre_commit_phase2(csealPreCommitPhase1OutputPtr, csealPreCommitPhase1OutputLen, ccacheDirPath, csealedSectorPath)
	runtime.KeepAlive(sealedSectorPath)
	runtime.KeepAlive(csealedSectorPathAllocMap)
	runtime.KeepAlive(cacheDirPath)
	runtime.KeepAlive(ccacheDirPathAllocMap)
	runtime.KeepAlive(csealPreCommitPhase1OutputLenAllocMap)
	runtime.KeepAlive(csealPreCommitPhase1OutputPtrAllocMap)
	__v := NewFilSealPreCommitPhase2ResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilUnsealRange function as declared in filecoin-ffi/filcrypto.h:760
func FilUnsealRange(registeredProof FilRegisteredSealProof, cacheDirPath string, sealedSectorFdRaw int32, unsealOutputFdRaw int32, sectorId uint64, proverId Fil32ByteArray, ticket Fil32ByteArray, commD Fil32ByteArray, unpaddedByteIndex uint64, unpaddedBytesAmount uint64) *FilUnsealRangeResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredSealProof)(registeredProof), cgoAllocsUnknown
	cacheDirPath = safeString(cacheDirPath)
	ccacheDirPath, ccacheDirPathAllocMap := unpackPCharString(cacheDirPath)
	csealedSectorFdRaw, csealedSectorFdRawAllocMap := (C.int)(sealedSectorFdRaw), cgoAllocsUnknown
	cunsealOutputFdRaw, cunsealOutputFdRawAllocMap := (C.int)(unsealOutputFdRaw), cgoAllocsUnknown
	csectorId, csectorIdAllocMap := (C.uint64_t)(sectorId), cgoAllocsUnknown
	cproverId, cproverIdAllocMap := proverId.PassValue()
	cticket, cticketAllocMap := ticket.PassValue()
	ccommD, ccommDAllocMap := commD.PassValue()
	cunpaddedByteIndex, cunpaddedByteIndexAllocMap := (C.uint64_t)(unpaddedByteIndex), cgoAllocsUnknown
	cunpaddedBytesAmount, cunpaddedBytesAmountAllocMap := (C.uint64_t)(unpaddedBytesAmount), cgoAllocsUnknown
	__ret := C.fil_unseal_range(cregisteredProof, ccacheDirPath, csealedSectorFdRaw, cunsealOutputFdRaw, csectorId, cproverId, cticket, ccommD, cunpaddedByteIndex, cunpaddedBytesAmount)
	runtime.KeepAlive(cunpaddedBytesAmountAllocMap)
	runtime.KeepAlive(cunpaddedByteIndexAllocMap)
	runtime.KeepAlive(ccommDAllocMap)
	runtime.KeepAlive(cticketAllocMap)
	runtime.KeepAlive(cproverIdAllocMap)
	runtime.KeepAlive(csectorIdAllocMap)
	runtime.KeepAlive(cunsealOutputFdRawAllocMap)
	runtime.KeepAlive(csealedSectorFdRawAllocMap)
	runtime.KeepAlive(cacheDirPath)
	runtime.KeepAlive(ccacheDirPathAllocMap)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilUnsealRangeResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilVerify function as declared in filecoin-ffi/filcrypto.h:782
func FilVerify(signaturePtr []byte, flattenedDigestsPtr []byte, flattenedDigestsLen uint, flattenedPublicKeysPtr []byte, flattenedPublicKeysLen uint) int32 {
	csignaturePtr, csignaturePtrAllocMap := copyPUint8TBytes((*sliceHeader)(unsafe.Pointer(&signaturePtr)))
	cflattenedDigestsPtr, cflattenedDigestsPtrAllocMap := copyPUint8TBytes((*sliceHeader)(unsafe.Pointer(&flattenedDigestsPtr)))
	cflattenedDigestsLen, cflattenedDigestsLenAllocMap := (C.size_t)(flattenedDigestsLen), cgoAllocsUnknown
	cflattenedPublicKeysPtr, cflattenedPublicKeysPtrAllocMap := copyPUint8TBytes((*sliceHeader)(unsafe.Pointer(&flattenedPublicKeysPtr)))
	cflattenedPublicKeysLen, cflattenedPublicKeysLenAllocMap := (C.size_t)(flattenedPublicKeysLen), cgoAllocsUnknown
	__ret := C.fil_verify(csignaturePtr, cflattenedDigestsPtr, cflattenedDigestsLen, cflattenedPublicKeysPtr, cflattenedPublicKeysLen)
	runtime.KeepAlive(cflattenedPublicKeysLenAllocMap)
	runtime.KeepAlive(cflattenedPublicKeysPtrAllocMap)
	runtime.KeepAlive(cflattenedDigestsLenAllocMap)
	runtime.KeepAlive(cflattenedDigestsPtrAllocMap)
	runtime.KeepAlive(csignaturePtrAllocMap)
	__v := (int32)(__ret)
	return __v
}

// FilVerifyAggregateSealProof function as declared in filecoin-ffi/filcrypto.h:792
func FilVerifyAggregateSealProof(registeredProof FilRegisteredSealProof, registeredAggregation FilRegisteredAggregationProof, proverId Fil32ByteArray, proofPtr []byte, proofLen uint, commitInputsPtr []FilAggregationInputs, commitInputsLen uint) *FilVerifyAggregateSealProofResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredSealProof)(registeredProof), cgoAllocsUnknown
	cregisteredAggregation, cregisteredAggregationAllocMap := (C.fil_RegisteredAggregationProof)(registeredAggregation), cgoAllocsUnknown
	cproverId, cproverIdAllocMap := proverId.PassValue()
	cproofPtr, cproofPtrAllocMap := copyPUint8TBytes((*sliceHeader)(unsafe.Pointer(&proofPtr)))
	cproofLen, cproofLenAllocMap := (C.size_t)(proofLen), cgoAllocsUnknown
	ccommitInputsPtr, ccommitInputsPtrAllocMap := unpackArgSFilAggregationInputs(commitInputsPtr)
	ccommitInputsLen, ccommitInputsLenAllocMap := (C.size_t)(commitInputsLen), cgoAllocsUnknown
	__ret := C.fil_verify_aggregate_seal_proof(cregisteredProof, cregisteredAggregation, cproverId, cproofPtr, cproofLen, ccommitInputsPtr, ccommitInputsLen)
	runtime.KeepAlive(ccommitInputsLenAllocMap)
	packSFilAggregationInputs(commitInputsPtr, ccommitInputsPtr)
	runtime.KeepAlive(ccommitInputsPtrAllocMap)
	runtime.KeepAlive(cproofLenAllocMap)
	runtime.KeepAlive(cproofPtrAllocMap)
	runtime.KeepAlive(cproverIdAllocMap)
	runtime.KeepAlive(cregisteredAggregationAllocMap)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilVerifyAggregateSealProofResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilVerifySeal function as declared in filecoin-ffi/filcrypto.h:804
func FilVerifySeal(registeredProof FilRegisteredSealProof, commR Fil32ByteArray, commD Fil32ByteArray, proverId Fil32ByteArray, ticket Fil32ByteArray, seed Fil32ByteArray, sectorId uint64, proofPtr []byte, proofLen uint) *FilVerifySealResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredSealProof)(registeredProof), cgoAllocsUnknown
	ccommR, ccommRAllocMap := commR.PassValue()
	ccommD, ccommDAllocMap := commD.PassValue()
	cproverId, cproverIdAllocMap := proverId.PassValue()
	cticket, cticketAllocMap := ticket.PassValue()
	cseed, cseedAllocMap := seed.PassValue()
	csectorId, csectorIdAllocMap := (C.uint64_t)(sectorId), cgoAllocsUnknown
	cproofPtr, cproofPtrAllocMap := copyPUint8TBytes((*sliceHeader)(unsafe.Pointer(&proofPtr)))
	cproofLen, cproofLenAllocMap := (C.size_t)(proofLen), cgoAllocsUnknown
	__ret := C.fil_verify_seal(cregisteredProof, ccommR, ccommD, cproverId, cticket, cseed, csectorId, cproofPtr, cproofLen)
	runtime.KeepAlive(cproofLenAllocMap)
	runtime.KeepAlive(cproofPtrAllocMap)
	runtime.KeepAlive(csectorIdAllocMap)
	runtime.KeepAlive(cseedAllocMap)
	runtime.KeepAlive(cticketAllocMap)
	runtime.KeepAlive(cproverIdAllocMap)
	runtime.KeepAlive(ccommDAllocMap)
	runtime.KeepAlive(ccommRAllocMap)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilVerifySealResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilVerifyWindowPost function as declared in filecoin-ffi/filcrypto.h:817
func FilVerifyWindowPoSt(randomness Fil32ByteArray, replicasPtr []FilPublicReplicaInfo, replicasLen uint, proofsPtr []FilPoStProof, proofsLen uint, proverId Fil32ByteArray) *FilVerifyWindowPoStResponse {
	crandomness, crandomnessAllocMap := randomness.PassValue()
	creplicasPtr, creplicasPtrAllocMap := unpackArgSFilPublicReplicaInfo(replicasPtr)
	creplicasLen, creplicasLenAllocMap := (C.size_t)(replicasLen), cgoAllocsUnknown
	cproofsPtr, cproofsPtrAllocMap := unpackArgSFilPoStProof(proofsPtr)
	cproofsLen, cproofsLenAllocMap := (C.size_t)(proofsLen), cgoAllocsUnknown
	cproverId, cproverIdAllocMap := proverId.PassValue()
	__ret := C.fil_verify_window_post(crandomness, creplicasPtr, creplicasLen, cproofsPtr, cproofsLen, cproverId)
	runtime.KeepAlive(cproverIdAllocMap)
	runtime.KeepAlive(cproofsLenAllocMap)
	packSFilPoStProof(proofsPtr, cproofsPtr)
	runtime.KeepAlive(cproofsPtrAllocMap)
	runtime.KeepAlive(creplicasLenAllocMap)
	packSFilPublicReplicaInfo(replicasPtr, creplicasPtr)
	runtime.KeepAlive(creplicasPtrAllocMap)
	runtime.KeepAlive(crandomnessAllocMap)
	__v := NewFilVerifyWindowPoStResponseRef(unsafe.Pointer(__ret))
	return __v
}

func FilVerifyAggregateWindowPoStProofs(registeredProof FilRegisteredPoStProof, registeredAggregation FilRegisteredAggregationProof, proverId Fil32ByteArray, proofPtr []byte, proofLen uint, randomnessesPtr []Fil32ByteArray, randomnessesLen uint, replicasPtr []FilPublicReplicaInfo, arrPtr []uint64, arrLen uint) *FilVerifyAggregateSealProofResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredPoStProof)(registeredProof), cgoAllocsUnknown
	cregisteredAggregation, cregisteredAggregationAllocMap := (C.fil_RegisteredAggregationProof)(registeredAggregation), cgoAllocsUnknown
	cproverId, cproverIdAllocMap := proverId.PassValue()
	cproofPtr, cproofPtrAllocMap := copyPUint8TBytes((*sliceHeader)(unsafe.Pointer(&proofPtr)))
	cproofLen, cproofLenAllocMap := (C.size_t)(proofLen), cgoAllocsUnknown
	crandomnessesPtr, crandomnessesPtrAllocMap := unpackArgSFil32ByteArray(randomnessesPtr)
	crandomnessesLen, crandomnessesLenAllocMap := (C.size_t)(randomnessesLen), cgoAllocsUnknown
	creplicasPtr, creplicasPtrAllocMap := unpackArgSFilPublicReplicaInfo(replicasPtr)
	carrPtr, carrPtrAlocMap := copyPUint64TBytes((*sliceHeader)(unsafe.Pointer(&arrPtr)))
	carrLen, carrLenAlocMap := (C.size_t)(arrLen), cgoAllocsUnknown
	__ret := C.fil_verify_aggregate_window_post_proofs(cregisteredProof, cregisteredAggregation, cproverId, cproofPtr, cproofLen, crandomnessesPtr, crandomnessesLen, creplicasPtr, carrPtr, carrLen)
	runtime.KeepAlive(carrLenAlocMap)
	runtime.KeepAlive(carrPtrAlocMap)
	packSFilPublicReplicaInfo(replicasPtr, creplicasPtr)
	runtime.KeepAlive(creplicasPtrAllocMap)
	runtime.KeepAlive(crandomnessesLenAllocMap)
	packSFil32ByteArray(randomnessesPtr, crandomnessesPtr)
	runtime.KeepAlive(crandomnessesPtrAllocMap)
	runtime.KeepAlive(cproofLenAllocMap)
	runtime.KeepAlive(cproofPtrAllocMap)
	runtime.KeepAlive(cproverIdAllocMap)
	runtime.KeepAlive(cregisteredAggregationAllocMap)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilVerifyAggregateSealProofResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilVerifyWinningPost function as declared in filecoin-ffi/filcrypto.h:827
func FilVerifyWinningPost(randomness Fil32ByteArray, replicasPtr []FilPublicReplicaInfo, replicasLen uint, proofsPtr []FilPoStProof, proofsLen uint, proverId Fil32ByteArray) *FilVerifyWinningPoStResponse {
	crandomness, crandomnessAllocMap := randomness.PassValue()
	creplicasPtr, creplicasPtrAllocMap := unpackArgSFilPublicReplicaInfo(replicasPtr)
	creplicasLen, creplicasLenAllocMap := (C.size_t)(replicasLen), cgoAllocsUnknown
	cproofsPtr, cproofsPtrAllocMap := unpackArgSFilPoStProof(proofsPtr)
	cproofsLen, cproofsLenAllocMap := (C.size_t)(proofsLen), cgoAllocsUnknown
	cproverId, cproverIdAllocMap := proverId.PassValue()
	__ret := C.fil_verify_winning_post(crandomness, creplicasPtr, creplicasLen, cproofsPtr, cproofsLen, cproverId)
	runtime.KeepAlive(cproverIdAllocMap)
	runtime.KeepAlive(cproofsLenAllocMap)
	packSFilPoStProof(proofsPtr, cproofsPtr)
	runtime.KeepAlive(cproofsPtrAllocMap)
	runtime.KeepAlive(creplicasLenAllocMap)
	packSFilPublicReplicaInfo(replicasPtr, creplicasPtr)
	runtime.KeepAlive(creplicasPtrAllocMap)
	runtime.KeepAlive(crandomnessAllocMap)
	__v := NewFilVerifyWinningPoStResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilWriteWithAlignment function as declared in filecoin-ffi/filcrypto.h:838
func FilWriteWithAlignment(registeredProof FilRegisteredSealProof, srcFd int32, srcSize uint64, dstFd int32, existingPieceSizesPtr []uint64, existingPieceSizesLen uint) *FilWriteWithAlignmentResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredSealProof)(registeredProof), cgoAllocsUnknown
	csrcFd, csrcFdAllocMap := (C.int)(srcFd), cgoAllocsUnknown
	csrcSize, csrcSizeAllocMap := (C.uint64_t)(srcSize), cgoAllocsUnknown
	cdstFd, cdstFdAllocMap := (C.int)(dstFd), cgoAllocsUnknown
	cexistingPieceSizesPtr, cexistingPieceSizesPtrAllocMap := copyPUint64TBytes((*sliceHeader)(unsafe.Pointer(&existingPieceSizesPtr)))
	cexistingPieceSizesLen, cexistingPieceSizesLenAllocMap := (C.size_t)(existingPieceSizesLen), cgoAllocsUnknown
	__ret := C.fil_write_with_alignment(cregisteredProof, csrcFd, csrcSize, cdstFd, cexistingPieceSizesPtr, cexistingPieceSizesLen)
	runtime.KeepAlive(cexistingPieceSizesLenAllocMap)
	runtime.KeepAlive(cexistingPieceSizesPtrAllocMap)
	runtime.KeepAlive(cdstFdAllocMap)
	runtime.KeepAlive(csrcSizeAllocMap)
	runtime.KeepAlive(csrcFdAllocMap)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilWriteWithAlignmentResponseRef(unsafe.Pointer(__ret))
	return __v
}

// FilWriteWithoutAlignment function as declared in filecoin-ffi/filcrypto.h:849
func FilWriteWithoutAlignment(registeredProof FilRegisteredSealProof, srcFd int32, srcSize uint64, dstFd int32) *FilWriteWithoutAlignmentResponse {
	cregisteredProof, cregisteredProofAllocMap := (C.fil_RegisteredSealProof)(registeredProof), cgoAllocsUnknown
	csrcFd, csrcFdAllocMap := (C.int)(srcFd), cgoAllocsUnknown
	csrcSize, csrcSizeAllocMap := (C.uint64_t)(srcSize), cgoAllocsUnknown
	cdstFd, cdstFdAllocMap := (C.int)(dstFd), cgoAllocsUnknown
	__ret := C.fil_write_without_alignment(cregisteredProof, csrcFd, csrcSize, cdstFd)
	runtime.KeepAlive(cdstFdAllocMap)
	runtime.KeepAlive(csrcSizeAllocMap)
	runtime.KeepAlive(csrcFdAllocMap)
	runtime.KeepAlive(cregisteredProofAllocMap)
	__v := NewFilWriteWithoutAlignmentResponseRef(unsafe.Pointer(__ret))
	return __v
}
