Revert "Merged all Chromoting Host code into remoting_core.dll (Windows)."
[chromium-blink-merge.git] / net / third_party / nss / ssl / preenc.h
blobd20d4a066f51ce3c27c936e3df467159a2b91efb
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
3 /*
4 * Fortezza support is removed.
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 /* $Id: preenc.h,v 1.7 2012/04/25 14:50:12 gerv%gerv.net Exp $ */
11 /* Fortezza support is removed.
12 * This file remains so that old programs will continue to compile,
13 * But this functionality is no longer supported or implemented.
16 #include "seccomon.h"
17 #include "prio.h"
19 typedef struct PEHeaderStr PEHeader;
21 #define PE_MIME_TYPE "application/pre-encrypted"
23 typedef struct PEFortezzaHeaderStr PEFortezzaHeader;
24 typedef struct PEFortezzaGeneratedHeaderStr PEFortezzaGeneratedHeader;
25 typedef struct PEFixedKeyHeaderStr PEFixedKeyHeader;
26 typedef struct PERSAKeyHeaderStr PERSAKeyHeader;
28 struct PEFortezzaHeaderStr {
29 unsigned char key[12];
30 unsigned char iv[24];
31 unsigned char hash[20];
32 unsigned char serial[8];
35 struct PEFortezzaGeneratedHeaderStr {
36 unsigned char key[12];
37 unsigned char iv[24];
38 unsigned char hash[20];
39 unsigned char Ra[128];
40 unsigned char Y[128];
43 struct PEFixedKeyHeaderStr {
44 unsigned char pkcs11Mech[4];
45 unsigned char labelLen[2];
46 unsigned char keyIDLen[2];
47 unsigned char ivLen[2];
48 unsigned char keyLen[2];
49 unsigned char data[1];
52 struct PERSAKeyHeaderStr {
53 unsigned char pkcs11Mech[4];
54 unsigned char issuerLen[2];
55 unsigned char serialLen[2];
56 unsigned char ivLen[2];
57 unsigned char keyLen[2];
58 unsigned char data[1];
61 #define PEFIXED_Label(header) (header->data)
62 #define PEFIXED_KeyID(header) (&header->data[GetInt2(header->labelLen)])
63 #define PEFIXED_IV(header) (&header->data[GetInt2(header->labelLen)\
64 +GetInt2(header->keyIDLen)])
65 #define PEFIXED_Key(header) (&header->data[GetInt2(header->labelLen)\
66 +GetInt2(header->keyIDLen)+GetInt2(header->keyLen)])
67 #define PERSA_Issuer(header) (header->data)
68 #define PERSA_Serial(header) (&header->data[GetInt2(header->issuerLen)])
69 #define PERSA_IV(header) (&header->data[GetInt2(header->issuerLen)\
70 +GetInt2(header->serialLen)])
71 #define PERSA_Key(header) (&header->data[GetInt2(header->issuerLen)\
72 +GetInt2(header->serialLen)+GetInt2(header->keyLen)])
73 struct PEHeaderStr {
74 unsigned char magic [2];
75 unsigned char len [2];
76 unsigned char type [2];
77 unsigned char version[2];
78 union {
79 PEFortezzaHeader fortezza;
80 PEFortezzaGeneratedHeader g_fortezza;
81 PEFixedKeyHeader fixed;
82 PERSAKeyHeader rsa;
83 } u;
86 #define PE_CRYPT_INTRO_LEN 8
87 #define PE_INTRO_LEN 4
88 #define PE_BASE_HEADER_LEN 8
90 #define PRE_BLOCK_SIZE 8
93 #define GetInt2(c) ((c[0] << 8) | c[1])
94 #define GetInt4(c) (((unsigned long)c[0] << 24)|((unsigned long)c[1] << 16)\
95 |((unsigned long)c[2] << 8)| ((unsigned long)c[3]))
96 #define PutInt2(c,i) ((c[1] = (i) & 0xff), (c[0] = ((i) >> 8) & 0xff))
97 #define PutInt4(c,i) ((c[0]=((i) >> 24) & 0xff),(c[1]=((i) >> 16) & 0xff),\
98 (c[2] = ((i) >> 8) & 0xff), (c[3] = (i) & 0xff))
100 #define PRE_MAGIC 0xc0de
101 #define PRE_VERSION 0x1010
102 #define PRE_FORTEZZA_FILE 0x00ff
103 #define PRE_FORTEZZA_STREAM 0x00f5
104 #define PRE_FORTEZZA_GEN_STREAM 0x00f6
105 #define PRE_FIXED_FILE 0x000f
106 #define PRE_RSA_FILE 0x001f
107 #define PRE_FIXED_STREAM 0x0005
109 PEHeader *SSL_PreencryptedStreamToFile(PRFileDesc *fd, PEHeader *,
110 int *headerSize);
112 PEHeader *SSL_PreencryptedFileToStream(PRFileDesc *fd, PEHeader *,
113 int *headerSize);