Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C; tab-width: 8 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "secasn1.h" |
michael@0 | 7 | #include "crmf.h" |
michael@0 | 8 | #include "crmfi.h" |
michael@0 | 9 | |
michael@0 | 10 | void |
michael@0 | 11 | crmf_encoder_out(void *arg, const char *buf, unsigned long len, |
michael@0 | 12 | int depth, SEC_ASN1EncodingPart data_kind) |
michael@0 | 13 | { |
michael@0 | 14 | struct crmfEncoderOutput *output; |
michael@0 | 15 | |
michael@0 | 16 | output = (struct crmfEncoderOutput*) arg; |
michael@0 | 17 | output->fn (output->outputArg, buf, len); |
michael@0 | 18 | } |
michael@0 | 19 | |
michael@0 | 20 | SECStatus |
michael@0 | 21 | cmmf_user_encode(void *src, CRMFEncoderOutputCallback inCallback, void *inArg, |
michael@0 | 22 | const SEC_ASN1Template *inTemplate) |
michael@0 | 23 | { |
michael@0 | 24 | struct crmfEncoderOutput output; |
michael@0 | 25 | |
michael@0 | 26 | PORT_Assert(src != NULL); |
michael@0 | 27 | if (src == NULL) { |
michael@0 | 28 | return SECFailure; |
michael@0 | 29 | } |
michael@0 | 30 | output.fn = inCallback; |
michael@0 | 31 | output.outputArg = inArg; |
michael@0 | 32 | return SEC_ASN1Encode(src, inTemplate, crmf_encoder_out, &output); |
michael@0 | 33 | } |
michael@0 | 34 |