⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pkcs7_asn.c

📁 PGP8.0源码 请认真阅读您的文件包然后写出其具体功能
💻 C
📖 第 1 页 / 共 3 页
字号:
/*____________________________________________________________________________
	Copyright (C) 2002 PGP Corporation
	All rights reserved.

	$Id: pkcs7_asn.c,v 1.6 2002/08/06 20:11:09 dallen Exp $
____________________________________________________________________________*/
/*******************************************************************
 *
 * This file was generated by TIS/ASN1COMP Ver. 4.3, an ASN.1 compiler.
 * TIS/ASN1COMP is Copyright (C) 2002 PGP Corporation
 *
 * This file was AUTOMATICALLY GENERATED on Mon Aug  2 15:51:29 1999
 *
 ******************************************************************/


#include <string.h>

#include "pkcs7_asn.h"

/*******************************************************************
 *
 * Code for manipulating ASN.1 DER data and structure.
 *
 *  NewXXX: Allocate the top level of a structure.
 *
 *  FreeXXX: Release all the data of an ASN structure.
 *
 *  SizeofXXX: Return the size of the DER block that would
 *               be created from the structure.
 *
 *  PackXXX: Take an ASN structure and return the DER.
 *
 *  unPackXXX: Take the DER and return an ASN structure.
 *
 ******************************************************************/


/******************************************************************
 * Routines for CertificateRevocationLists
 ******************************************************************/

PKICertificateRevocationLists *PKINewCertificateRevocationLists(
    PKICONTEXT *ctx)
{
    PKICertificateRevocationLists *f;

    if (ctx == NULL)
        return NULL;

    f = (PKICertificateRevocationLists *)PKIAlloc(ctx->memMgr, sizeof(PKICertificateRevocationLists));
    if (f != NULL)
        (void)memset(f, 0, sizeof(PKICertificateRevocationLists));
    return (f);

} /* PKINewCertificateRevocationLists */

void PKIFreeCertificateRevocationLists(
    PKICONTEXT *ctx,
    PKICertificateRevocationLists *f)
{
    if (ctx == NULL)
        return;

    PKIDropInPlaceCertificateRevocationLists(ctx, f);
    if (f != NULL)
        PKIFree(ctx->memMgr, f);

} /* PKIFreeCertificateRevocationLists */

size_t PKISizeofCertificateRevocationLists(
    PKICONTEXT *ctx,
    PKICertificateRevocationLists *asnstruct,
    int outerSizeFlag)
{
    (void)ctx; /* for future use */

    return(PKISizeofCertificateRevocationListsInternal(asnstruct, outerSizeFlag, PKIFALSE));
} /* PKISizeofCertificateRevocationLists */

size_t PKIPackCertificateRevocationLists(
    PKICONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PKICertificateRevocationLists *asnstruct,
    int *erret )
{
    return(PKIPackCertificateRevocationListsInternal(ctx, buf, buflen, asnstruct, PKIID_CertificateRevocationLists, erret));
} /* PKIPackCertificateRevocationLists */

size_t PKIUnpackCertificateRevocationLists(
    PKICONTEXT *ctx,
    PKICertificateRevocationLists **asnstruct,
    const unsigned char *buf,
    size_t buflen,
    int *erret)
{
    size_t bytesused;
    bytesused=PKIUnpackCertificateRevocationListsInternal(ctx, asnstruct, buf, buflen,
                      PKIID_CertificateRevocationLists, erret);
    if(*erret==0 && bytesused==0)
        PKIERR(PKIErrUnpackUnderrun);
    return bytesused;
}

/******************************************************************
 * Routines for ContentInfo
 ******************************************************************/

PKIContentInfo *PKINewContentInfo(
    PKICONTEXT *ctx)
{
    PKIContentInfo *f;

    if (ctx == NULL)
        return NULL;

    f = (PKIContentInfo *)PKIAlloc(ctx->memMgr, sizeof(PKIContentInfo));
    if (f != NULL)
        (void)memset(f, 0, sizeof(PKIContentInfo));
    return (f);

} /* PKINewContentInfo */

void PKIFreeContentInfo(
    PKICONTEXT *ctx,
    PKIContentInfo *f)
{
    if (ctx == NULL)
        return;

    PKIDropInPlaceContentInfo(ctx, f);
    if (f != NULL)
        PKIFree(ctx->memMgr, f);

} /* PKIFreeContentInfo */

size_t PKISizeofContentInfo(
    PKICONTEXT *ctx,
    PKIContentInfo *asnstruct,
    int outerSizeFlag)
{
    (void)ctx; /* for future use */

    return(PKISizeofContentInfoInternal(asnstruct, outerSizeFlag, PKIFALSE));
} /* PKISizeofContentInfo */

size_t PKIPackContentInfo(
    PKICONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PKIContentInfo *asnstruct,
    int *erret )
{
    return(PKIPackContentInfoInternal(ctx, buf, buflen, asnstruct, PKIID_ContentInfo, erret));
} /* PKIPackContentInfo */

size_t PKIUnpackContentInfo(
    PKICONTEXT *ctx,
    PKIContentInfo **asnstruct,
    const unsigned char *buf,
    size_t buflen,
    int *erret)
{
    size_t bytesused;
    bytesused=PKIUnpackContentInfoInternal(ctx, asnstruct, buf, buflen,
                      PKIID_ContentInfo, erret);
    if(*erret==0 && bytesused==0)
        PKIERR(PKIErrUnpackUnderrun);
    return bytesused;
}

/******************************************************************
 * Routines for ExtendedCertificateInfo
 ******************************************************************/

PKIExtendedCertificateInfo *PKINewExtendedCertificateInfo(
    PKICONTEXT *ctx)
{
    PKIExtendedCertificateInfo *f;

    if (ctx == NULL)
        return NULL;

    f = (PKIExtendedCertificateInfo *)PKIAlloc(ctx->memMgr, sizeof(PKIExtendedCertificateInfo));
    if (f != NULL)
        (void)memset(f, 0, sizeof(PKIExtendedCertificateInfo));
    return (f);

} /* PKINewExtendedCertificateInfo */

void PKIFreeExtendedCertificateInfo(
    PKICONTEXT *ctx,
    PKIExtendedCertificateInfo *f)
{
    if (ctx == NULL)
        return;

    PKIDropInPlaceExtendedCertificateInfo(ctx, f);
    if (f != NULL)
        PKIFree(ctx->memMgr, f);

} /* PKIFreeExtendedCertificateInfo */

size_t PKISizeofExtendedCertificateInfo(
    PKICONTEXT *ctx,
    PKIExtendedCertificateInfo *asnstruct,
    int outerSizeFlag)
{
    (void)ctx; /* for future use */

    return(PKISizeofExtendedCertificateInfoInternal(asnstruct, outerSizeFlag, PKIFALSE));
} /* PKISizeofExtendedCertificateInfo */

size_t PKIPackExtendedCertificateInfo(
    PKICONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PKIExtendedCertificateInfo *asnstruct,
    int *erret )
{
    return(PKIPackExtendedCertificateInfoInternal(ctx, buf, buflen, asnstruct, PKIID_ExtendedCertificateInfo, erret));
} /* PKIPackExtendedCertificateInfo */

size_t PKIUnpackExtendedCertificateInfo(
    PKICONTEXT *ctx,
    PKIExtendedCertificateInfo **asnstruct,
    const unsigned char *buf,
    size_t buflen,
    int *erret)
{
    size_t bytesused;
    bytesused=PKIUnpackExtendedCertificateInfoInternal(ctx, asnstruct, buf, buflen,
                      PKIID_ExtendedCertificateInfo, erret);
    if(*erret==0 && bytesused==0)
        PKIERR(PKIErrUnpackUnderrun);
    return bytesused;
}

/******************************************************************
 * Routines for IssuerAndSerialNumber
 ******************************************************************/

PKIIssuerAndSerialNumber *PKINewIssuerAndSerialNumber(
    PKICONTEXT *ctx)
{
    PKIIssuerAndSerialNumber *f;

    if (ctx == NULL)
        return NULL;

    f = (PKIIssuerAndSerialNumber *)PKIAlloc(ctx->memMgr, sizeof(PKIIssuerAndSerialNumber));
    if (f != NULL)
        (void)memset(f, 0, sizeof(PKIIssuerAndSerialNumber));
    return (f);

} /* PKINewIssuerAndSerialNumber */

void PKIFreeIssuerAndSerialNumber(
    PKICONTEXT *ctx,
    PKIIssuerAndSerialNumber *f)
{
    if (ctx == NULL)
        return;

    PKIDropInPlaceIssuerAndSerialNumber(ctx, f);
    if (f != NULL)
        PKIFree(ctx->memMgr, f);

} /* PKIFreeIssuerAndSerialNumber */

size_t PKISizeofIssuerAndSerialNumber(
    PKICONTEXT *ctx,
    PKIIssuerAndSerialNumber *asnstruct,
    int outerSizeFlag)
{
    (void)ctx; /* for future use */

    return(PKISizeofIssuerAndSerialNumberInternal(asnstruct, outerSizeFlag, PKIFALSE));
} /* PKISizeofIssuerAndSerialNumber */

size_t PKIPackIssuerAndSerialNumber(
    PKICONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PKIIssuerAndSerialNumber *asnstruct,
    int *erret )
{
    return(PKIPackIssuerAndSerialNumberInternal(ctx, buf, buflen, asnstruct, PKIID_IssuerAndSerialNumber, erret));
} /* PKIPackIssuerAndSerialNumber */

size_t PKIUnpackIssuerAndSerialNumber(
    PKICONTEXT *ctx,
    PKIIssuerAndSerialNumber **asnstruct,
    const unsigned char *buf,
    size_t buflen,
    int *erret)
{
    size_t bytesused;
    bytesused=PKIUnpackIssuerAndSerialNumberInternal(ctx, asnstruct, buf, buflen,
                      PKIID_IssuerAndSerialNumber, erret);
    if(*erret==0 && bytesused==0)
        PKIERR(PKIErrUnpackUnderrun);
    return bytesused;
}

/******************************************************************
 * Routines for DigestAlgorithmIdentifiers
 ******************************************************************/

PKIDigestAlgorithmIdentifiers *PKINewDigestAlgorithmIdentifiers(
    PKICONTEXT *ctx)
{
    PKIDigestAlgorithmIdentifiers *f;

    if (ctx == NULL)
        return NULL;

    f = (PKIDigestAlgorithmIdentifiers *)PKIAlloc(ctx->memMgr, sizeof(PKIDigestAlgorithmIdentifiers));
    if (f != NULL)
        (void)memset(f, 0, sizeof(PKIDigestAlgorithmIdentifiers));
    return (f);

} /* PKINewDigestAlgorithmIdentifiers */

void PKIFreeDigestAlgorithmIdentifiers(
    PKICONTEXT *ctx,
    PKIDigestAlgorithmIdentifiers *f)
{
    if (ctx == NULL)
        return;

    PKIDropInPlaceDigestAlgorithmIdentifiers(ctx, f);
    if (f != NULL)
        PKIFree(ctx->memMgr, f);

} /* PKIFreeDigestAlgorithmIdentifiers */

size_t PKISizeofDigestAlgorithmIdentifiers(
    PKICONTEXT *ctx,
    PKIDigestAlgorithmIdentifiers *asnstruct,
    int outerSizeFlag)
{
    (void)ctx; /* for future use */

    return(PKISizeofDigestAlgorithmIdentifiersInternal(asnstruct, outerSizeFlag, PKIFALSE));
} /* PKISizeofDigestAlgorithmIdentifiers */

size_t PKIPackDigestAlgorithmIdentifiers(
    PKICONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PKIDigestAlgorithmIdentifiers *asnstruct,
    int *erret )
{
    return(PKIPackDigestAlgorithmIdentifiersInternal(ctx, buf, buflen, asnstruct, PKIID_DigestAlgorithmIdentifiers, erret));
} /* PKIPackDigestAlgorithmIdentifiers */

size_t PKIUnpackDigestAlgorithmIdentifiers(
    PKICONTEXT *ctx,
    PKIDigestAlgorithmIdentifiers **asnstruct,
    const unsigned char *buf,
    size_t buflen,
    int *erret)
{
    size_t bytesused;
    bytesused=PKIUnpackDigestAlgorithmIdentifiersInternal(ctx, asnstruct, buf, buflen,
                      PKIID_DigestAlgorithmIdentifiers, erret);
    if(*erret==0 && bytesused==0)
        PKIERR(PKIErrUnpackUnderrun);
    return bytesused;
}

/******************************************************************
 * Routines for DigestInfo
 ******************************************************************/

PKIDigestInfo *PKINewDigestInfo(
    PKICONTEXT *ctx)
{
    PKIDigestInfo *f;

    if (ctx == NULL)
        return NULL;

    f = (PKIDigestInfo *)PKIAlloc(ctx->memMgr, sizeof(PKIDigestInfo));
    if (f != NULL)
        (void)memset(f, 0, sizeof(PKIDigestInfo));
    return (f);

} /* PKINewDigestInfo */

void PKIFreeDigestInfo(

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -