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