1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/crmf/encutil.c Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,34 @@ 1.4 +/* -*- Mode: C; tab-width: 8 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "secasn1.h" 1.10 +#include "crmf.h" 1.11 +#include "crmfi.h" 1.12 + 1.13 +void 1.14 +crmf_encoder_out(void *arg, const char *buf, unsigned long len, 1.15 + int depth, SEC_ASN1EncodingPart data_kind) 1.16 +{ 1.17 + struct crmfEncoderOutput *output; 1.18 + 1.19 + output = (struct crmfEncoderOutput*) arg; 1.20 + output->fn (output->outputArg, buf, len); 1.21 +} 1.22 + 1.23 +SECStatus 1.24 +cmmf_user_encode(void *src, CRMFEncoderOutputCallback inCallback, void *inArg, 1.25 + const SEC_ASN1Template *inTemplate) 1.26 +{ 1.27 + struct crmfEncoderOutput output; 1.28 + 1.29 + PORT_Assert(src != NULL); 1.30 + if (src == NULL) { 1.31 + return SECFailure; 1.32 + } 1.33 + output.fn = inCallback; 1.34 + output.outputArg = inArg; 1.35 + return SEC_ASN1Encode(src, inTemplate, crmf_encoder_out, &output); 1.36 +} 1.37 +