1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/pki/pki3hack.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,164 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef PKINSS3HACK_H 1.9 +#define PKINSS3HACK_H 1.10 + 1.11 +#ifndef NSSDEVT_H 1.12 +#include "nssdevt.h" 1.13 +#endif /* NSSDEVT_H */ 1.14 + 1.15 +#ifndef DEVT_H 1.16 +#include "devt.h" 1.17 +#endif /* DEVT_H */ 1.18 + 1.19 +#ifndef NSSPKIT_H 1.20 +#include "nsspkit.h" 1.21 +#endif /* NSSPKIT_H */ 1.22 + 1.23 +#include "base.h" 1.24 + 1.25 +#include "cert.h" 1.26 + 1.27 +PR_BEGIN_EXTERN_C 1.28 + 1.29 +#define NSSITEM_FROM_SECITEM(nssit, secit) \ 1.30 + (nssit)->data = (void *)(secit)->data; \ 1.31 + (nssit)->size = (PRUint32)(secit)->len; 1.32 + 1.33 +#define SECITEM_FROM_NSSITEM(secit, nssit) \ 1.34 + (secit)->data = (unsigned char *)(nssit)->data; \ 1.35 + (secit)->len = (unsigned int)(nssit)->size; 1.36 + 1.37 +NSS_EXTERN NSSTrustDomain * 1.38 +STAN_GetDefaultTrustDomain(); 1.39 + 1.40 +NSS_EXTERN NSSCryptoContext * 1.41 +STAN_GetDefaultCryptoContext(); 1.42 + 1.43 +NSS_EXTERN PRStatus 1.44 +STAN_InitTokenForSlotInfo(NSSTrustDomain *td, PK11SlotInfo *slot); 1.45 + 1.46 +NSS_EXTERN PRStatus 1.47 +STAN_ResetTokenInterator(NSSTrustDomain *td); 1.48 + 1.49 +NSS_EXTERN PRStatus 1.50 +STAN_LoadDefaultNSS3TrustDomain(void); 1.51 + 1.52 +NSS_EXTERN PRStatus 1.53 +STAN_Shutdown(); 1.54 + 1.55 +NSS_EXTERN SECStatus 1.56 +STAN_AddModuleToDefaultTrustDomain(SECMODModule *module); 1.57 + 1.58 +NSS_EXTERN SECStatus 1.59 +STAN_RemoveModuleFromDefaultTrustDomain(SECMODModule *module); 1.60 + 1.61 +NSS_EXTERN CERTCertificate * 1.62 +STAN_ForceCERTCertificateUpdate(NSSCertificate *c); 1.63 + 1.64 +NSS_EXTERN CERTCertificate * 1.65 +STAN_GetCERTCertificate(NSSCertificate *c); 1.66 + 1.67 +NSS_EXTERN CERTCertificate * 1.68 +STAN_GetCERTCertificateOrRelease(NSSCertificate *c); 1.69 + 1.70 +NSS_EXTERN NSSCertificate * 1.71 +STAN_GetNSSCertificate(CERTCertificate *c); 1.72 + 1.73 +NSS_EXTERN CERTCertTrust * 1.74 +nssTrust_GetCERTCertTrustForCert(NSSCertificate *c, CERTCertificate *cc); 1.75 + 1.76 +NSS_EXTERN PRStatus 1.77 +STAN_DeleteCertTrustMatchingSlot(NSSCertificate *c); 1.78 + 1.79 +NSS_EXTERN PRStatus 1.80 +STAN_ChangeCertTrust(CERTCertificate *cc, CERTCertTrust *trust); 1.81 + 1.82 +NSS_EXTERN PRStatus 1.83 +nssPKIX509_GetIssuerAndSerialFromDER(NSSDER *der, NSSArena *arena, 1.84 + NSSDER *issuer, NSSDER *serial); 1.85 + 1.86 +NSS_EXTERN char * 1.87 +STAN_GetCERTCertificateName(PLArenaPool *arenaOpt, NSSCertificate *c); 1.88 + 1.89 +NSS_EXTERN char * 1.90 +STAN_GetCERTCertificateNameForInstance(PLArenaPool *arenaOpt, 1.91 + NSSCertificate *c, 1.92 + nssCryptokiInstance *instance); 1.93 + 1.94 +/* exposing this */ 1.95 +NSS_EXTERN NSSCertificate * 1.96 +NSSCertificate_Create 1.97 +( 1.98 + NSSArena *arenaOpt 1.99 +); 1.100 + 1.101 +/* This function is being put here because it is a hack for 1.102 + * PK11_FindCertFromNickname. 1.103 + */ 1.104 +NSS_EXTERN NSSCertificate * 1.105 +nssTrustDomain_FindBestCertificateByNicknameForToken 1.106 +( 1.107 + NSSTrustDomain *td, 1.108 + NSSToken *token, 1.109 + NSSUTF8 *name, 1.110 + NSSTime *timeOpt, /* NULL for "now" */ 1.111 + NSSUsage *usage, 1.112 + NSSPolicies *policiesOpt /* NULL for none */ 1.113 +); 1.114 + 1.115 +/* This function is being put here because it is a hack for 1.116 + * PK11_FindCertsFromNickname. 1.117 + */ 1.118 +NSS_EXTERN NSSCertificate ** 1.119 +nssTrustDomain_FindCertificatesByNicknameForToken 1.120 +( 1.121 + NSSTrustDomain *td, 1.122 + NSSToken *token, 1.123 + NSSUTF8 *name, 1.124 + NSSCertificate *rvOpt[], 1.125 + PRUint32 maximumOpt, /* 0 for no max */ 1.126 + NSSArena *arenaOpt 1.127 +); 1.128 + 1.129 +/* CERT_TraversePermCertsForSubject */ 1.130 +NSS_EXTERN PRStatus 1.131 +nssTrustDomain_TraverseCertificatesBySubject 1.132 +( 1.133 + NSSTrustDomain *td, 1.134 + NSSDER *subject, 1.135 + PRStatus (*callback)(NSSCertificate *c, void *arg), 1.136 + void *arg 1.137 +); 1.138 + 1.139 +/* CERT_TraversePermCertsForNickname */ 1.140 +NSS_EXTERN PRStatus 1.141 +nssTrustDomain_TraverseCertificatesByNickname 1.142 +( 1.143 + NSSTrustDomain *td, 1.144 + NSSUTF8 *nickname, 1.145 + PRStatus (*callback)(NSSCertificate *c, void *arg), 1.146 + void *arg 1.147 +); 1.148 + 1.149 +/* SEC_TraversePermCerts */ 1.150 +NSS_EXTERN PRStatus 1.151 +nssTrustDomain_TraverseCertificates 1.152 +( 1.153 + NSSTrustDomain *td, 1.154 + PRStatus (*callback)(NSSCertificate *c, void *arg), 1.155 + void *arg 1.156 +); 1.157 + 1.158 +/* CERT_AddTempCertToPerm */ 1.159 +NSS_EXTERN PRStatus 1.160 +nssTrustDomain_AddTempCertToPerm 1.161 +( 1.162 + NSSCertificate *c 1.163 +); 1.164 + 1.165 +PR_END_EXTERN_C 1.166 + 1.167 +#endif /* PKINSS3HACK_H */