michael@0: /* -*- Mode: C; tab-width: 8 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "secasn1.h" michael@0: #include "crmf.h" michael@0: #include "crmfi.h" michael@0: michael@0: void michael@0: crmf_encoder_out(void *arg, const char *buf, unsigned long len, michael@0: int depth, SEC_ASN1EncodingPart data_kind) michael@0: { michael@0: struct crmfEncoderOutput *output; michael@0: michael@0: output = (struct crmfEncoderOutput*) arg; michael@0: output->fn (output->outputArg, buf, len); michael@0: } michael@0: michael@0: SECStatus michael@0: cmmf_user_encode(void *src, CRMFEncoderOutputCallback inCallback, void *inArg, michael@0: const SEC_ASN1Template *inTemplate) michael@0: { michael@0: struct crmfEncoderOutput output; michael@0: michael@0: PORT_Assert(src != NULL); michael@0: if (src == NULL) { michael@0: return SECFailure; michael@0: } michael@0: output.fn = inCallback; michael@0: output.outputArg = inArg; michael@0: return SEC_ASN1Encode(src, inTemplate, crmf_encoder_out, &output); michael@0: } michael@0: