Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Functions
secplcy.h File Reference
#include "prtypes.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


struct  _sec_cp_struct
struct  SECCipherFindStr


#define SEC_POLICY_THIS_IS_THE   "\x2a\x3a\x51\xbf\x2f\x71\xb7\x73\xaa\xca\x6b\x57\x70\xcd\xc8\x9f"
#define SEC_POLICY_STRING_FOR_THE   "\x97\x15\xe2\x70\xd2\x8a\xde\xa9\xe7\xa7\x6a\xe2\x83\xe5\xb1\xf6"
#define SEC_POLICY_SSL_TAIL   "\x70\x16\x25\xc0\x2a\xb2\x4a\xca\xb6\x67\xb1\x89\x20\xdf\x87\xca"
#define SEC_POLICY_SMIME_TAIL   "\xdf\xd4\xe7\x2a\xeb\xc4\x1b\xb5\xd8\xe5\xe0\x2a\x16\x9f\xc4\xb9"
#define SEC_POLICY_PKCS12_TAIL   "\x1c\xf8\xa4\x85\x4a\xc6\x8a\xfe\xe6\xca\x03\x72\x50\x1c\xe2\xc8"


typedef struct _sec_cp_struct secCPStruct
typedef struct SECCipherFindStr


SEC_BEGIN_PROTOS SECCipherFind * sec_CipherFindInit (PRBool onlyAllowed, secCPStruct *policy, long *ciphers)
long sec_CipherFindNext (SECCipherFind *find)
char sec_IsCipherAllowed (long cipher, secCPStruct *policies, long *ciphers)
void sec_CipherFindEnd (SECCipherFind *find)

Class Documentation

struct _sec_cp_struct

Definition at line 100 of file secplcy.h.

Class Members
char begin_ciphers
char num_ciphers
char policy_string
long unused
struct SECCipherFindStr

Definition at line 109 of file secplcy.h.

Class Members
void * ciphers
long index
PRBool onlyAllowed
void * policy

Define Documentation

Definition at line 51 of file secplcy.h.

Definition at line 50 of file secplcy.h.

2 /* cipher is allowed in limited cases 
                               e.g. step-up */

Definition at line 52 of file secplcy.h.

Definition at line 56 of file secplcy.h.

Definition at line 83 of file secplcy.h.

#define SEC_POLICY_PKCS12_TAIL   "\x1c\xf8\xa4\x85\x4a\xc6\x8a\xfe\xe6\xca\x03\x72\x50\x1c\xe2\xc8"

Definition at line 69 of file secplcy.h.

Definition at line 80 of file secplcy.h.

#define SEC_POLICY_SMIME_TAIL   "\xdf\xd4\xe7\x2a\xeb\xc4\x1b\xb5\xd8\xe5\xe0\x2a\x16\x9f\xc4\xb9"

Definition at line 67 of file secplcy.h.

Definition at line 77 of file secplcy.h.

#define SEC_POLICY_SSL_TAIL   "\x70\x16\x25\xc0\x2a\xb2\x4a\xca\xb6\x67\xb1\x89\x20\xdf\x87\xca"

Definition at line 65 of file secplcy.h.

#define SEC_POLICY_STRING_FOR_THE   "\x97\x15\xe2\x70\xd2\x8a\xde\xa9\xe7\xa7\x6a\xe2\x83\xe5\xb1\xf6"

Definition at line 63 of file secplcy.h.

#define SEC_POLICY_THIS_IS_THE   "\x2a\x3a\x51\xbf\x2f\x71\xb7\x73\xaa\xca\x6b\x57\x70\xcd\xc8\x9f"

Definition at line 61 of file secplcy.h.

Definition at line 59 of file secplcy.h.

Typedef Documentation

typedef struct SECCipherFindStr

Definition at line 118 of file secplcy.h.

typedef struct _sec_cp_struct secCPStruct

Function Documentation

void sec_CipherFindEnd ( SECCipherFind *  find)

Definition at line 114 of file secplcy.c.

SEC_BEGIN_PROTOS SECCipherFind* sec_CipherFindInit ( PRBool  onlyAllowed,
secCPStruct policy,
long ciphers 

Definition at line 40 of file secplcy.c.

  SECCipherFind *find = PR_NEWZAP(SECCipherFind);
  if (find)
      find->policy = policy;
      find->ciphers = ciphers;
      find->onlyAllowed = onlyAllowed;
      find->index = -1;
  return find;
long sec_CipherFindNext ( SECCipherFind *  find)

Definition at line 55 of file secplcy.c.

  char *policy;
  long rv = -1;
  secCPStruct *policies = (secCPStruct *) find->policy;
  long *ciphers = (long *) find->ciphers;
  long numCiphers = policies->num_ciphers;

  while((find->index < numCiphers) && (rv == -1))
      /* Translate index to cipher. */
      rv = ciphers[find->index];

      /* If we're only looking for allowed ciphers, and if this
        cipher isn't allowed, loop around.*/
      if (find->onlyAllowed)
         /* Find the appropriate policy flag. */
         policy = (&(policies->begin_ciphers)) + find->index + 1;

         /* If this cipher isn't allowed by policy, continue. */
         if (! (*policy))
             rv = -1;

  return rv;
char sec_IsCipherAllowed ( long  cipher,
secCPStruct policies,
long ciphers 

Definition at line 88 of file secplcy.c.

  char result = SEC_CIPHER_NOT_ALLOWED; /* our default answer */
  long numCiphers = policies->num_ciphers;
  char *policy;
  int i;
  /* Convert the cipher number into a policy flag location. */
  for (i=0, policy=(&(policies->begin_ciphers) + 1);
       i++, policy++)
      if (cipher == ciphers[i])

  if (i < numCiphers)
      /* Found the cipher, get the policy value. */
      result = *policy;

  return result;