Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 |