security/nss/lib/pki/certdecode.c

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #ifndef PKIT_H
michael@0 6 #include "pkit.h"
michael@0 7 #endif /* PKIT_H */
michael@0 8
michael@0 9 #ifndef PKIM_H
michael@0 10 #include "pkim.h"
michael@0 11 #endif /* PKIM_H */
michael@0 12
michael@0 13 /* This is defined in pki3hack.c */
michael@0 14 NSS_EXTERN nssDecodedCert *
michael@0 15 nssDecodedPKIXCertificate_Create (
michael@0 16 NSSArena *arenaOpt,
michael@0 17 NSSDER *encoding
michael@0 18 );
michael@0 19
michael@0 20 NSS_IMPLEMENT PRStatus
michael@0 21 nssDecodedPKIXCertificate_Destroy (
michael@0 22 nssDecodedCert *dc
michael@0 23 );
michael@0 24
michael@0 25 NSS_IMPLEMENT nssDecodedCert *
michael@0 26 nssDecodedCert_Create (
michael@0 27 NSSArena *arenaOpt,
michael@0 28 NSSDER *encoding,
michael@0 29 NSSCertificateType type
michael@0 30 )
michael@0 31 {
michael@0 32 nssDecodedCert *rvDC = NULL;
michael@0 33 switch(type) {
michael@0 34 case NSSCertificateType_PKIX:
michael@0 35 rvDC = nssDecodedPKIXCertificate_Create(arenaOpt, encoding);
michael@0 36 break;
michael@0 37 default:
michael@0 38 #if 0
michael@0 39 nss_SetError(NSS_ERROR_INVALID_ARGUMENT);
michael@0 40 #endif
michael@0 41 return (nssDecodedCert *)NULL;
michael@0 42 }
michael@0 43 return rvDC;
michael@0 44 }
michael@0 45
michael@0 46 NSS_IMPLEMENT PRStatus
michael@0 47 nssDecodedCert_Destroy (
michael@0 48 nssDecodedCert *dc
michael@0 49 )
michael@0 50 {
michael@0 51 if (!dc) {
michael@0 52 return PR_FAILURE;
michael@0 53 }
michael@0 54 switch(dc->type) {
michael@0 55 case NSSCertificateType_PKIX:
michael@0 56 return nssDecodedPKIXCertificate_Destroy(dc);
michael@0 57 default:
michael@0 58 #if 0
michael@0 59 nss_SetError(NSS_ERROR_INVALID_ARGUMENT);
michael@0 60 #endif
michael@0 61 break;
michael@0 62 }
michael@0 63 return PR_FAILURE;
michael@0 64 }
michael@0 65

mercurial