Pārlūkot izejas kodu

The first packet (ClientHello Handshake) can be constructed and is accepted

by SSL servers. Framework.c allows me to test the library against a given
https server.
tags/v0.9.3
Derek Pryor 18 gadus atpakaļ
vecāks
revīzija
e71098a652
4 mainītis faili ar 345 papildinājumiem un 83 dzēšanām
  1. 82
    0
      src/crypto/framework.c
  2. 133
    0
      src/crypto/ssl.c
  3. 19
    0
      src/crypto/ssl.h
  4. 111
    83
      src/crypto/ssl_constructs.h

+ 82
- 0
src/crypto/framework.c Parādīt failu

@@ -0,0 +1,82 @@
1
+#include <stdio.h>
2
+#include <stdlib.h>
3
+#include <sys/types.h>
4
+#include <sys/socket.h>
5
+#include <netinet/in.h>
6
+#include <netdb.h>
7
+#include "ssl.h"
8
+
9
+int main(int argc, char *argv[])
10
+{
11
+  SSL_t ssl;
12
+  int sockfd, portno, rc;
13
+  struct sockaddr_in serv_addr;
14
+  struct hostent *server;
15
+
16
+  portno = 443;
17
+  sockfd = socket(AF_INET,SOCK_STREAM,0);
18
+  if(sockfd<0){
19
+    fprintf(stderr,"Error creating socket\n");
20
+    exit(sockfd);
21
+  }
22
+
23
+  server = gethostbyname(argv[1]);
24
+  if(server==NULL){
25
+    fprintf(stderr,"Error looking up host %s\n",argv[1]);
26
+    exit(1);
27
+  }
28
+
29
+  /**
30
+   *matrixSslOpen()
31
+   *matrixSslReadKeys()
32
+   **/
33
+  printf("Calling CreateSSLHello()\n");
34
+  rc = CreateSSLHello(&ssl);
35
+  printf("Finished calling CreateSSLHello()\n");
36
+
37
+  bzero((char *) &serv_addr, sizeof(serv_addr));
38
+  serv_addr.sin_family = AF_INET;
39
+  bcopy((char *)server->h_addr,(char *)&serv_addr.sin_addr.s_addr,server->h_length);
40
+  serv_addr.sin_port = htons(portno);
41
+  if(connect(sockfd,(struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0){
42
+    fprintf(stderr,"ERROR connecting to server\n");
43
+    exit(1);
44
+  }
45
+
46
+  PrintSSLPacket(&ssl);
47
+
48
+  printf("Write ssl.buffer\n");
49
+  write(sockfd,ssl.buffer,ssl.length);
50
+  printf("Finished writing\n");
51
+  ssl.length = read(sockfd,ssl.buffer,ssl.max_size);
52
+  ReadSSLHello(&ssl);
53
+
54
+  /**
55
+   *matrixSslNewSession()
56
+   *matrixSslSetCetValidator()
57
+   *encodeSslHandshake()
58
+
59
+   *write handshake buffer
60
+
61
+   *readSslResponse() <-+
62
+                        |
63
+   *read return code    |-- similar/same function??
64
+                        |
65
+   *sslEncode()         |
66
+   *sslDecode() <-------+
67
+   
68
+   *encodeSslCloseAlert()
69
+   
70
+   *write close alert buffer
71
+   **/
72
+   close(sockfd);
73
+
74
+  /**
75
+   *sslClose()
76
+   * -free connection
77
+   * -free keys
78
+   * -close pki interface
79
+   **/
80
+
81
+  return 0;
82
+}

+ 133
- 0
src/crypto/ssl.c Parādīt failu

@@ -0,0 +1,133 @@
1
+#include "ssl.h"
2
+#include "ssl_constructs.h"
3
+#include <string.h> // for bcopy()
4
+#include <time.h> // for time()
5
+#include <stdlib.h> // for rand(), htons?, htonl?
6
+// note net byte order is big-endian
7
+// Need to set error codes
8
+
9
+int CreateSSLHello(SSL_t *ssl)
10
+{
11
+  printf("In CreateSSLHello()\n",ssl);
12
+
13
+  // Initalize the structure
14
+  bzero(ssl,sizeof(SSL_t));
15
+  //ssl->max_size = sizeof(ssl->buffer);
16
+  ssl->max_size = 18456;
17
+
18
+  // Declare variables
19
+  int i; void *ptr;
20
+
21
+  // Set pointers into buffer
22
+  SSLPlaintext *record = (SSLPlaintext *)ssl->buffer;
23
+  Handshake *handshake = (Handshake *)record->fragment;
24
+  // the body starts right after the handshake
25
+  printf("sizeof(Handshake) = %d\n",sizeof(Handshake));
26
+  ClientHello *hello = (ClientHello *)(handshake + 1);
27
+
28
+  printf("record->%#x, handshake->%#x, hello->%#x\n",record,handshake,hello);
29
+
30
+  // Construct ClientHello Message
31
+  hello->client_version = version;
32
+  i = htonl(time(NULL));
33
+  bcopy(&i,hello->random.gmt_unix_time,4);
34
+  for(i=0;i<28;i++){ hello->random.random_bytes[i] = (uint8)rand(); }
35
+  hello->session_id_length = 0;
36
+  hello->session_id = &hello->session_id_length;
37
+  hello->session_id_end = hello->session_id;
38
+  hello->cipher_suites_length = (CipherSuiteLength *)(hello->session_id_end + 1);
39
+  hello->cipher_suites = (hello->cipher_suites_length + 1);
40
+  hello->cipher_suites_end = hello->cipher_suites;
41
+  i = htons(2*5); // 2 bytes per Suite * 5 Suites
42
+  bcopy(&i,hello->cipher_suites_length,2);
43
+  bcopy(SSL_NULL_WITH_NULL_NULL,hello->cipher_suites_end,sizeof(CipherSuite));
44
+  *hello->cipher_suites_end++;
45
+  bcopy(SSL_DH_DSS_EXPORT_WITH_DES40_CBC_SHA,hello->cipher_suites_end,sizeof(CipherSuite));
46
+  *hello->cipher_suites_end++;
47
+  bcopy(SSL_DH_DSS_WITH_DES_CBC_SHA,hello->cipher_suites_end,sizeof(CipherSuite));
48
+  *hello->cipher_suites_end++;
49
+  bcopy(SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA,hello->cipher_suites_end,sizeof(CipherSuite));
50
+  *hello->cipher_suites_end++;
51
+  bcopy(SSL_DH_anon_WITH_RC4_128_MD5,hello->cipher_suites_end,sizeof(CipherSuite));
52
+  hello->compression_methods_length = (CompressionMethodLength *)(hello->cipher_suites_end + 1);
53
+  hello->compression_methods = (hello->compression_methods_length + 1);
54
+  hello->compression_methods_end = hello->compression_methods;
55
+  *hello->compression_methods_length = 1;
56
+  *hello->compression_methods_end = compression_method_null;
57
+
58
+  // Construct Handshake Message
59
+  handshake->msg_type = handshake_type_client_hello;
60
+  i = (void *)(hello->compression_methods_end + 1) - (void *)hello;
61
+  printf("Handshake.length = %d\n", i);
62
+  handshake->length[0] = (char)*(&i+8);
63
+  handshake->length[1] = (char)*(&i+8);
64
+  handshake->length[2] = (char)i;
65
+  //bcopy((&i+1),handshake->length,3); // +1 so we copy 3 bytes
66
+
67
+  // Construct SSL Record
68
+  printf("sizeof(ContentType)=%d\n",sizeof(ContentType));
69
+  printf("sizeof(uint8)=%d\n",sizeof(uint8));
70
+  record->type = content_type_handshake;
71
+  record->version = version;
72
+  i += sizeof(Handshake);
73
+  printf("SSLPlaintext.length = %d\n",i);
74
+  record->length[0] = (char)*(&i+8);
75
+  record->length[1] = (char)i;
76
+  //bcopy(&i,record->length,4); // length of handshake
77
+
78
+  // Set total size of message
79
+  i += sizeof(ContentType) + sizeof(ProtocolVersion) + sizeof(uint16);
80
+  ssl->length = i;
81
+  printf("End of CreateSSLHello\n");
82
+  return 0;
83
+}
84
+
85
+void PrintSSLPacket(SSL_t *ssl)
86
+{
87
+  printf("Printing packet with length:%d\n", ssl->length);
88
+  char *ptr = ssl->buffer;
89
+  char *begin = ptr;
90
+  char *tmp;
91
+  char *end = ssl->buffer + ssl->length;
92
+  printf("Record Layer:\n");
93
+  printf("\tContentType: %2hhX\n",(char)*ptr++);
94
+  printf("\tVersion: %2hhX %2hhX\n", (char)*ptr++, (char)*ptr++);
95
+  printf("\tLength: %2hhX %2hhX\n", (char)*ptr++, (char)*ptr++);
96
+
97
+  printf("Handshake:\n");
98
+  printf("\tType: %2hhX\n", (char)*ptr++);
99
+  printf("\tLength: %2hhX %2hhX %2hhX\n", (char)*ptr++, (char)*ptr++, (char)*ptr++);
100
+  printf("\tVersion: %2hhX %2hhX\n", (char)*ptr++, (char)*ptr++);
101
+  printf("\tgmt_unix_time: %2hhX %2hhX %2hhX %2hhX\n", (char)*ptr++, (char)*ptr++, (char)*ptr++, (char)*ptr++);
102
+  printf("\trandom: ");
103
+  tmp = ptr + 28;
104
+  for(;ptr<tmp;ptr++){printf("%2hhX ", (char)*ptr);}
105
+
106
+  printf("\n\nHexDump:\n");
107
+
108
+  int ctr = 0;
109
+  for(;begin<end;begin++){printf("%2hhX ",(char)*begin);if(++ctr%10==0){printf("\n");}}
110
+  printf("\n\n");
111
+}
112
+
113
+int ReadSSLHello(SSL_t *ssl)
114
+{
115
+  SSLCiphertext *ct = (SSLCiphertext *)ssl->buffer;
116
+
117
+  if(ct->type == content_type_alert){
118
+    // assuming text is still plaintext
119
+    Alert *a = (Alert *)&ct->fragment;
120
+    if(a->level == alert_level_fatal){
121
+      printf("Fatal Alert %d, connection terminated\n",a->description);
122
+      return (1);
123
+    }else if(a->level == alert_level_warning){
124
+      printf("Warning Alert %d\n", a->description);
125
+    }else{
126
+      printf("Unknown alert level %d\n", a->level);
127
+    }
128
+  }else{
129
+    printf("SSL type %d\n",ct->type);
130
+  }
131
+  return (0);
132
+}
133
+

+ 19
- 0
src/crypto/ssl.h Parādīt failu

@@ -0,0 +1,19 @@
1
+// At the moment I have hard coded one buffer. The size
2
+//  is the max size of SSLCiphertext.length (so, actually it should
3
+//  be increased to include the other information in the struct)
4
+// I might need to make a new, or split the current, buffer because
5
+//  I have to have space to read in and write out, as well as keep
6
+//  any data that has not been translated.
7
+// It works for now.
8
+typedef struct _ssl_t{
9
+  char buffer[18456];
10
+  int length;
11
+  int max_size; // can't define const here
12
+  // Current CipherSuite 
13
+  // Client random / Server random ???
14
+  // pointers to different crypto functions
15
+} SSL_t;
16
+
17
+int CreateSSLHello(SSL_t *ssl);
18
+int ReadSSLHello(SSL_t *ssl);
19
+void PrintSSLPacket(SSL_t *ssl);

+ 111
- 83
src/crypto/ssl_constructs.h Parādīt failu

@@ -1,4 +1,6 @@
1 1
 // Note: This file still needs some work.
2
+// Note: I had to redefine the enums to a set of const values,
3
+//   so that the size of the variable would be correct.
2 4
 
3 5
 // Typedefs
4 6
 // (As defined by the SSL v3.0 RFC Draft)
@@ -14,15 +16,13 @@ typedef struct _ProtocolVersion{
14 16
   uint8 major, minor;
15 17
 } ProtocolVersion;
16 18
 
17
-ProtocolVersion version = { 3, 0 };
19
+const ProtocolVersion version = { 3, 0 };
18 20
 
19
-typedef enum _ContentType{
20
-  content_type_change_cipher_spec_type=20,
21
-  content_type_alert=21,
22
-  content_type_handshake=22,
23
-  content_type_application_data=23,
24
-  content_type_size=255 // to force size
25
-} ContentType;
21
+typedef uint8 ContentType;
22
+const ContentType content_type_change_cipher_spec_type = 20;
23
+const ContentType content_type_alert = 21;
24
+const ContentType content_type_handshake = 22;
25
+const ContentType content_type_application_data = 23;
26 26
 
27 27
 typedef struct _SSLPlaintext{
28 28
   ContentType type;
@@ -38,6 +38,14 @@ typedef struct _SSLCompressed{
38 38
   uint8 fragment[17408]; // SSLCompressed.length
39 39
 } SSLCompressed;
40 40
 
41
+typedef struct _SSLCiphertext{
42
+  ContentType type;
43
+  ProtocolVersion version;
44
+  uint16 length;
45
+  uint8 fragment; // so we have a pointer to the data, and don't have to do math
46
+  // fragment; type GenericStreamCipher or GenericBlockCipher
47
+} SSLCiphertext; // recast to get fragment
48
+
41 49
 typedef struct _GenericStreamCipher{
42 50
   uint8 content[17408]; // SSLCompressed.length
43 51
   uint8 MAC[]; // CipherSpec.hash_size
@@ -72,27 +80,23 @@ typedef struct _ChangeCipherSpec{
72 80
 } ChangeCipherSpec;
73 81
 
74 82
 // Alert messages
75
-typedef enum _AlertLevel{
76
-  alert_level_warning=1,
77
-  alert_level_fatal=2,
78
-  alert_level_size=255 
79
-} AlertLevel;
80
-
81
-typedef enum _AlertDescription{
82
-  alert_description_close_notify=0,
83
-  alert_description_unexpected_message=10,
84
-  alert_description_bad_record_mac=20,
85
-  alert_description_decompression_failure=30,
86
-  alert_description_handshake_failure=40,
87
-  alert_description_no_certificate=41,
88
-  alert_description_bad_certificate=42,
89
-  alert_description_unsupported_certificate=43,
90
-  alert_description_certificate_revoked=44,
91
-  alert_description_certificate_expired=45,
92
-  alert_description_certificate_unknown=46,
93
-  alert_description_illegal_parameter=47,
94
-  alert_description_size=255
95
-} AlertDescription;
83
+typedef uint8 AlertLevel;
84
+const AlertLevel alert_level_warning = 1;
85
+const AlertLevel alert_level_fatal=2;
86
+
87
+typedef uint8 AlertDescription;
88
+const AlertDescription alert_description_close_notify = 0;
89
+const AlertDescription alert_description_unexpected_message = 10;
90
+const AlertDescription alert_description_bad_record_mac = 20;
91
+const AlertDescription alert_description_decompression_failure = 30;
92
+const AlertDescription alert_description_handshake_failure = 40;
93
+const AlertDescription alert_description_no_certificate = 41;
94
+const AlertDescription alert_description_bad_certificate = 42;
95
+const AlertDescription alert_description_unsupported_certificate = 43;
96
+const AlertDescription alert_description_certificate_revoked = 44;
97
+const AlertDescription alert_description_certificate_expired = 45;
98
+const AlertDescription alert_description_certificate_unknown = 46;
99
+const AlertDescription alert_description_illegal_parameter = 47;
96 100
 
97 101
 typedef struct _Alert{
98 102
   AlertLevel level;
@@ -101,23 +105,22 @@ typedef struct _Alert{
101 105
 
102 106
 // Handshake protocol
103 107
 // What is the best way to have a generic pointer to the body struct??
104
-typedef enum _HandshakeType{
105
-  handshake_type_hello_request=0,
106
-  handshake_type_client_hello=1,
107
-  handshake_type_server_hello=2,
108
-  handshake_type_certificate=11,
109
-  handshake_type_server_key_exchange=12,
110
-  handshake_type_certificate_request=13,
111
-  handshake_type_server_done=14,
112
-  handshake_type_certificate_verify=15,
113
-  handshake_type_client_key_exchange=16,
114
-  handshake_type_finished=20,
115
-  handshake_type_size=255
116
-} HandshakeType;
108
+typedef uint8 HandshakeType;
109
+const HandshakeType handshake_type_hello_request = 0;
110
+const HandshakeType handshake_type_client_hello = 1;
111
+const HandshakeType handshake_type_server_hello = 2;
112
+const HandshakeType handshake_type_certificate = 11;
113
+const HandshakeType handshake_type_server_key_exchange = 12;
114
+const HandshakeType handshake_type_certificate_request = 13;
115
+const HandshakeType handshake_type_server_done = 14;
116
+const HandshakeType handshake_type_certificate_verify = 15;
117
+const HandshakeType handshake_type_client_key_exchange = 16;
118
+const HandshakeType handshake_type_finished = 20;
117 119
 
118 120
 typedef struct _Handshake{
119 121
   HandshakeType msg_type;
120 122
   uint24 length;
123
+  // body; // one of HandshakeType structs
121 124
 } Handshake; // generic Handshake, need to recast to get body
122 125
 
123 126
 // Hello messages
@@ -134,21 +137,38 @@ typedef struct _Random{
134 137
   uint8 random_bytes[28];
135 138
 } Random;
136 139
 
137
-typedef uint8 SessionID[32]; // <0..32>
140
+//typedef uint8 SessionID[32]; // <0..32>
141
+typedef uint8 SessionIDLength;
142
+typedef uint8 SessionID;
143
+
144
+typedef uint16 CipherSuiteLength;
138 145
 typedef uint8 CipherSuite[2];
139 146
 
140
-typedef enum _CompressionMethod{ compression_method_null=0, compression_method_size=255 } CompressionMethod;
147
+typedef uint8 CompressionMethodLength;
148
+typedef uint8 CompressionMethod;
149
+const CompressionMethod compression_method_null = 0;
150
+
141 151
 
142 152
 typedef struct _ClientHello{
143 153
   ProtocolVersion client_version;
144 154
   Random random;
145
-  SessionID session_id;
146
-  CipherSuite cipher_suites[32768]; // <2..2^16-1> = 65,536 bytes and CipherSuite is 2 bytes
147
-  CompressionMethod compression_methods[256]; // <0..2^8-1> = 256 bytes and CompressionMethod is 1 byte
155
+  SessionIDLength session_id_length;
156
+  SessionID *session_id;
157
+  SessionID *session_id_end;
158
+  CipherSuiteLength *cipher_suites_length;
159
+  CipherSuite *cipher_suites; // min size is one entry
160
+  CipherSuite *cipher_suites_end;
161
+  //CipherSuite cipher_suites[32768]; // <2..2^16-1> = 65,536 bytes and CipherSuite is 2 bytes
162
+  CompressionMethodLength *compression_methods_length;
163
+  CompressionMethod *compression_methods;
164
+  CompressionMethod *compression_methods_end;
165
+  //CompressionMethod *compression_methods; // min size is zero
166
+  //CompressionMethod compression_methods[256]; // <0..2^8-1> = 256 bytes and CompressionMethod is 1 byte
148 167
 } ClientHello;
149 168
 
150 169
 typedef struct _ClientHelloHandshake{
151
-  HandshakeType msg_type;
170
+  //HandshakeType msg_type;
171
+  uint8 msg_type;
152 172
   uint24 length;
153 173
   ClientHello body;
154 174
 } ClientHelloHandshake;
@@ -175,11 +195,10 @@ typedef struct _Certificate{
175 195
   // for some reason the size of certificate_list and ASN1Cert is the same, so only one certificate in the list
176 196
 } Certificate;
177 197
 
178
-typedef enum _KeyExchangeAlgorithm{
179
-  key_exchange_algorithm_rsa,
180
-  key_exchange_algorithm_diffie_hellman,
181
-  key_exchange_algorithm_fortezza_kea 
182
-} KeyExchangeAlgorithm;
198
+typedef uint8 KeyExchangeAlgorithm;
199
+const KeyExchangeAlgorithm key_exchange_algorithm_rsa = 0;
200
+const KeyExchangeAlgorithm key_exchange_algorithm_diffie_hellman = 1;
201
+const KeyExchangeAlgorithm key_exchange_algorithm_fortezza_kea = 2;
183 202
 
184 203
 typedef struct _AnonSignature{
185 204
   struct {};
@@ -218,22 +237,19 @@ typedef struct _ServerRSAKeyExchange{
218 237
   Signature signed_params;
219 238
 } ServerRSAKeyExchange;
220 239
 
221
-typedef enum _SignatureAlgorithm{
222
-  signature_algorithm_anonymous,
223
-  signature_algorithm_rsa,
224
-  signature_algorithm_dsa 
225
-} SignatureAlgorithm;
226
-
227
-typedef enum _CertificateType{
228
-  certificate_type_RSA_sign=1,
229
-  certificate_type_DSS_sign=2,
230
-  certificate_type_RSA_fixed_DH=3,
231
-  certificate_type_DSS_fixed_DH=4,
232
-  certificate_type_RSA_ephemeral_DH=5,
233
-  certificate_type_DSS_ephemeral_DH=6,
234
-  certificate_type_FORTEZZA_MISSI=20,
235
-  certificate_type_size=255
236
-} CertificateType;
240
+typedef uint8 SignatureAlgorithm;
241
+const SignatureAlgorithm signature_algorithm_anonymous = 0;
242
+const SignatureAlgorithm signature_algorithm_rsa = 1;
243
+const SignatureAlgorithm signature_algorithm_dsa = 2;
244
+
245
+typedef uint8 CertificateType;
246
+const CertificateType certificate_type_RSA_sign = 1;
247
+const CertificateType certificate_type_DSS_sign = 2;
248
+const CertificateType certificate_type_RSA_fixed_DH = 3;
249
+const CertificateType certificate_type_DSS_fixed_DH = 4;
250
+const CertificateType certificate_type_RSA_ephemeral_DH = 5;
251
+const CertificateType certificate_type_DSS_ephemeral_DH = 6;
252
+const CertificateType certificate_type_FORTEZZA_MISSI = 20;
237 253
 
238 254
 typedef uint8 DistinguishedName[65536]; // <1..2^16-1> = 65,536
239 255
 
@@ -259,7 +275,9 @@ typedef struct _RSAClientKeyExchange{
259 275
   EncryptedPreMasterSecret exchange_keys;
260 276
 } RSAClientKeyExchange;
261 277
 
262
-typedef enum _PublicValueEncoding{ public_value_encoding_implicit, public_value_encoding_explicit } PublicValueEncoding;
278
+typedef uint8 PublicValueEncoding;
279
+const PublicValueEncoding public_value_encoding_implicit = 0;
280
+const PublicValueEncoding public_value_encoding_explicit = 1;
263 281
 
264 282
 typedef struct _ClientDiffieHellmanPublic{
265 283
   // This is a select on PublicValueEncoding,  and I chose the larger size
@@ -281,25 +299,35 @@ typedef struct _Finished{
281 299
 } Finished;
282 300
 
283 301
 // The CipherSuite
284
-CipherSuite SSL_NULL_WITH_NULL_NULL                     = { 0x00, 0x00 };
302
+CipherSuite SSL_NULL_WITH_NULL_NULL                     = { 0x00, 0x13 };
285 303
 CipherSuite SSL_DH_DSS_EXPORT_WITH_DES40_CBC_SHA        = { 0x00, 0x0B };
286 304
 CipherSuite SSL_DH_DSS_WITH_DES_CBC_SHA                 = { 0x00, 0x0C };
305
+CipherSuite SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA       = { 0x00, 0x11 };
287 306
 CipherSuite SSL_DH_anon_EXPORT_WITH_RC4_40_MD5          = { 0x00, 0x17 };
288 307
 CipherSuite SSL_DH_anon_WITH_RC4_128_MD5                = { 0x00, 0x18 };
289 308
 
290 309
 // The CipherSpec
291
-typedef enum _CipherType{ cipher_type_stream, cipher_type_block } CipherType;
292
-typedef enum _IsExportable{ is_exportable_true, is_exportable_false } IsExportable;
293
-typedef enum _BulkCipherAlgorithm{
294
-  bulk_cipher_algorithm_null,
295
-  bulk_cipher_algorithm_rc4,
296
-  bulk_cipher_algorithm_rc2,
297
-  bulk_cipher_algorithm_des,
298
-  bulk_cipher_algorithm_3des,
299
-  bulk_cipher_algorithm_des40,
300
-  bulk_cipher_algorithm_fortezza 
301
-} BulkCipherAlgorithm;
302
-typedef enum _MACAlgorithm{ mac_algorithm_null, mac_algorithm_md5, mac_algorithm_sha } MACAlgorithm;
310
+typedef uint8 CipherType;
311
+const CipherType cipher_type_stream = 0;
312
+const CipherType cipher_type_block = 1;
313
+
314
+typedef uint8 IsExportable;
315
+const IsExportable is_exportable_true = 0;
316
+const IsExportable is_exportable_false = 1;
317
+
318
+typedef uint8 BulkCipherAlgorithm;
319
+const BulkCipherAlgorithm bulk_cipher_algorithm_null = 0;
320
+const BulkCipherAlgorithm bulk_cipher_algorithm_rc4 = 1;
321
+const BulkCipherAlgorithm bulk_cipher_algorithm_rc2 = 2;
322
+const BulkCipherAlgorithm bulk_cipher_algorithm_des = 3;
323
+const BulkCipherAlgorithm bulk_cipher_algorithm_3des = 4;
324
+const BulkCipherAlgorithm bulk_cipher_algorithm_des40 = 5;
325
+const BulkCipherAlgorithm bulk_cipher_algorithm_fortezza = 6;
326
+
327
+typedef uint8 MACAlgorithm;
328
+const MACAlgorithm mac_algorithm_null = 0;
329
+const MACAlgorithm mac_algorithm_md5 = 1;
330
+const MACAlgorithm mac_algorithm_sha = 2;
303 331
 
304 332
 typedef struct _CipherSpec{
305 333
   BulkCipherAlgorithm bulk_cipher_algorithm;

Notiek ielāde…
Atcelt
Saglabāt