Applied changes from M14 branch

This commit is contained in:
mwelch%netscape.com 2000-03-21 23:31:45 +00:00
Родитель 93f0f0a87a
Коммит 534aa5a1b7
5 изменённых файлов: 137 добавлений и 302 удалений

Просмотреть файл

@ -63,5 +63,7 @@ CSRCS = cmtinit.c \
cmtrng.c \
$(NULL)
EXTRA_DSO_LDOPTS += -L$(DIST)/bin -lprotocol
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -395,11 +395,6 @@ PCMT_CONTROL CMT_ControlConnect(CMT_MUTEX *mutex, CMT_SocketFuncs *sockFuncs)
#endif
LOG("Connected to Cartman\n");
/* Set up the protocol obfuscation */
if (!(obscureObj = InitClientObscureObject(sockFuncs, sock))) {
goto loser;
}
/* fill in the CMTControl struct */
control = (PCMT_CONTROL)calloc(sizeof(CMT_CONTROL), 1);

Просмотреть файл

@ -319,12 +319,6 @@ CMTStatus CMT_TransmitMessage(PCMT_CONTROL control, CMTItem * message)
header.type = htonl(message->type);
header.len = htonl(message->len);
/* Obscure the message header */
rv = SSMObscure_Send(control->obscureObj, &header, sizeof(CMTMessageHeader));
if (rv != 0) {
goto loser;
}
/* Send the message header */
sent = CMT_WriteThisMany(control, control->sock,
(void *)&header, sizeof(CMTMessageHeader));
@ -332,12 +326,6 @@ CMTStatus CMT_TransmitMessage(PCMT_CONTROL control, CMTItem * message)
goto loser;
}
/* Obscure the message body */
rv = SSMObscure_Send(control->obscureObj, message->data, message->len);
if (rv != 0) {
goto loser;
}
/* Send the message body */
sent = CMT_WriteThisMany(control, control->sock, (void *)message->data,
message->len);
@ -366,12 +354,6 @@ CMTStatus CMT_ReceiveMessage(PCMT_CONTROL control, CMTItem * response)
goto loser;
}
/* Unobscure the message header */
rv = SSMObscure_Recv(control->obscureObj, &header, sizeof(CMTMessageHeader));
if (rv != 0) {
goto loser;
}
response->type = ntohl(header.type);
response->len = ntohl(header.len);
response->data = (unsigned char *) malloc(response->len);
@ -385,12 +367,6 @@ CMTStatus CMT_ReceiveMessage(PCMT_CONTROL control, CMTItem * response)
goto loser;
}
/* Unobscure the message body */
rv = SSMObscure_Recv(control->obscureObj, response->data, response->len);
if (rv != 0) {
goto loser;
}
#ifdef PRINT_RECEIVE_MESSAGES
LOG("About to print message received from PSM.\n");
prettyPrintMessage(response);

Просмотреть файл

@ -1,102 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Netscape security libraries.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1994-2000 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License Version 2 or later (the
* "GPL"), in which case the provisions of the GPL are applicable
* instead of those above. If you wish to allow use of your
* version of this file only under the terms of the GPL and not to
* allow others to use your version of this file under the MPL,
* indicate your decision by deleting the provisions above and
* replace them with the notice and other provisions required by
* the GPL. If you do not delete the provisions above, a recipient
* may use your version of this file under either the MPL or the
* GPL.
*/
#ifndef __NEWPROTO_H__
#define __NEWPROTO_H__
#include <stdlib.h>
#include "ssmdefs.h"
typedef enum CMTDataType {
CMT_DT_END,
CMT_DT_RID,
CMT_DT_INT,
CMT_DT_BOOL,
CMT_DT_STRING,
CMT_DT_ITEM,
CMT_DT_LIST,
CMT_DT_CHOICE,
CMT_DT_END_CHOICE,
CMT_DT_STRUCT_LIST,
CMT_DT_END_STRUCT_LIST,
CMT_DT_STRUCT_PTR,
} CMTDataType;
typedef struct CMTMessageTemplate {
CMTDataType type;
CMUint32 offset;
CMInt32 validator;
CMInt32 choiceID;
} CMTMessageTemplate;
typedef struct CMTMessageHeader {
CMInt32 type;
CMInt32 len;
} CMTMessageHeader;
typedef void *(* CMT_Alloc_fn) (size_t size);
typedef void (* CMT_Free_fn)(void * ptr);
extern CMT_Alloc_fn cmt_alloc;
extern CMT_Free_fn cmt_free;
/*************************************************************
*
* CMT_Init
*
*
************************************************************/
void
CMT_Init(CMT_Alloc_fn allocfn, CMT_Free_fn freefn);
/*************************************************************
* CMT_DecodeMessage
*
* Decode msg into dest as specified by tmpl.
*
************************************************************/
CMTStatus
CMT_DecodeMessage(CMTMessageTemplate *tmpl, void *dest, CMTItem *msg);
/*************************************************************
* CMT_EncodeMessage
*
* Encode src into msg as specified by tmpl.
*
************************************************************/
CMTStatus
CMT_EncodeMessage(CMTMessageTemplate *tmpl, CMTItem *msg, void *src);
#endif /* __NEWPROTO_H__ */

Просмотреть файл

@ -82,192 +82,140 @@ typedef struct _SSMString SSMString;
#define SSM_SESSION_RESOURCE 0x00000002
/* Message category flags */
typedef enum
{
SSM_REQUEST_MESSAGE = 0x10000000,
SSM_REPLY_OK_MESSAGE = 0x20000000,
SSM_REPLY_ERR_MESSAGE = 0x30000000,
SSM_EVENT_MESSAGE = 0x40000000
} SSMMessageCategory;
#define SSM_REQUEST_MESSAGE 0x10000000
#define SSM_REPLY_OK_MESSAGE 0x20000000
#define SSM_REPLY_ERR_MESSAGE 0x30000000
#define SSM_EVENT_MESSAGE 0x40000000
/* Message types */
typedef enum
{
SSM_DATA_CONNECTION = 0x00001000,
SSM_OBJECT_SIGNING = 0x00002000,
SSM_RESOURCE_ACTION = 0x00003000,
SSM_CERT_ACTION = 0x00004000,
SSM_PKCS11_ACTION = 0x00005000,
SSM_CRMF_ACTION = 0x00006000,
SSM_FORMSIGN_ACTION = 0x00007000,
SSM_LOCALIZED_TEXT = 0x00008000,
SSM_HELLO_MESSAGE = 0x00009000,
SSM_SECURITY_ADVISOR = 0x0000a000,
SSM_SEC_CFG_ACTION = 0x0000b000,
SSM_KEYGEN_TAG = 0x0000c000,
SSM_PREF_ACTION = 0x0000d000,
SSM_MISC_ACTION = 0x0000f000
} SSMMessageType;
#define SSM_DATA_CONNECTION 0x00001000
#define SSM_OBJECT_SIGNING 0x00002000
#define SSM_RESOURCE_ACTION 0x00003000
#define SSM_CERT_ACTION 0x00004000
#define SSM_PKCS11_ACTION 0x00005000
#define SSM_CRMF_ACTION 0x00006000
#define SSM_FORMSIGN_ACTION 0x00007000
#define SSM_LOCALIZED_TEXT 0x00008000
#define SSM_HELLO_MESSAGE 0x00009000
#define SSM_SECURITY_ADVISOR 0x0000a000
#define SSM_SEC_CFG_ACTION 0x0000b000
#define SSM_KEYGEN_TAG 0x0000c000
#define SSM_PREF_ACTION 0x0000d000
#define SSM_MISC_ACTION 0x0000f000
/* Data connection messages subtypes */
typedef enum
{
SSM_SSL_CONNECTION = 0x00000100,
SSM_PKCS7DECODE_STREAM = 0x00000200,
SSM_PKCS7ENCODE_STREAM = 0x00000300,
SSM_HASH_STREAM = 0x00000400,
SSM_TLS_CONNECTION = 0x00000500,
SSM_PROXY_CONNECTION = 0x00000600
} SSMDataConnectionSType;
#define SSM_SSL_CONNECTION 0x00000100
#define SSM_PKCS7DECODE_STREAM 0x00000200
#define SSM_PKCS7ENCODE_STREAM 0x00000300
#define SSM_HASH_STREAM 0x00000400
#define SSM_TLS_CONNECTION 0x00000500
#define SSM_PROXY_CONNECTION 0x00000600
/* Object signing message subtypes */
typedef enum
{
SSM_VERIFY_RAW_SIG = 0x00000100,
SSM_VERIFY_DETACHED_SIG= 0x00000200,
SSM_CREATE_SIGNED = 0x00000300,
SSM_CREATE_ENCRYPTED = 0x00000400
} SSMObjSignSType;
#define SSM_VERIFY_RAW_SIG 0x00000100
#define SSM_VERIFY_DETACHED_SIG 0x00000200
#define SSM_CREATE_SIGNED 0x00000300
#define SSM_CREATE_ENCRYPTED 0x00000400
/* Resource access messages subtypes */
typedef enum
{
SSM_CREATE_RESOURCE = 0x00000100,
SSM_DESTROY_RESOURCE = 0x00000200,
SSM_GET_ATTRIBUTE = 0x00000300,
SSM_CONSERVE_RESOURCE = 0x00000400,
SSM_DUPLICATE_RESOURCE = 0x00000500,
SSM_SET_ATTRIBUTE = 0x00000600,
SSM_TLS_STEPUP = 0x00000700,
SSM_PROXY_STEPUP = 0x00000800
} SSMResourceAccessSType;
#define SSM_CREATE_RESOURCE 0x00000100
#define SSM_DESTROY_RESOURCE 0x00000200
#define SSM_GET_ATTRIBUTE 0x00000300
#define SSM_CONSERVE_RESOURCE 0x00000400
#define SSM_DUPLICATE_RESOURCE 0x00000500
#define SSM_SET_ATTRIBUTE 0x00000600
#define SSM_TLS_STEPUP 0x00000700
#define SSM_PROXY_STEPUP 0x00000800
/* Further specification for resource access messages */
typedef enum {
SSM_SSLSocket_Status = 0x00000010
} SSMCreateResource;
#define SSM_SSLSocket_Status 0x00000010
typedef enum {
SSM_NO_ATTRIBUTE = 0x00000000,
SSM_NUMERIC_ATTRIBUTE = 0x00000010,
SSM_STRING_ATTRIBUTE = 0x00000020,
SSM_RID_ATTRIBUTE = 0x00000030
} SSMResourceAttrType;
#define SSM_NO_ATTRIBUTE 0x00000000
#define SSM_NUMERIC_ATTRIBUTE 0x00000010
#define SSM_STRING_ATTRIBUTE 0x00000020
#define SSM_RID_ATTRIBUTE 0x00000030
typedef enum {
SSM_PICKLE_RESOURCE = 0x00000010,
SSM_UNPICKLE_RESOURCE = 0x00000020,
SSM_PICKLE_SECURITY_STATUS = 0x00000030
} SSMResourceConsv;
#define SSM_PICKLE_RESOURCE 0x00000010
#define SSM_UNPICKLE_RESOURCE 0x00000020
#define SSM_PICKLE_SECURITY_STATUS 0x00000030
/* Certificate access message subtypes */
typedef enum
{
SSM_IMPORT_CERT = 0x00000100,
SSM_VERIFY_CERT = 0x00000200,
SSM_FIND_BY_NICKNAME = 0x00000300,
SSM_FIND_BY_KEY = 0x00000400,
SSM_FIND_BY_EMAILADDR = 0x00000500,
SSM_ADD_TO_DB = 0x00000600,
SSM_DECODE_CERT = 0x00000700,
SSM_MATCH_USER_CERT = 0x00000800,
SSM_DESTROY_CERT = 0x00000900,
SSM_DECODE_TEMP_CERT = 0x00000a00,
SSM_REDIRECT_COMPARE = 0x00000b00,
SSM_DECODE_CRL = 0x00000c00,
SSM_EXTENSION_VALUE = 0x00000d00,
SSM_HTML_INFO = 0x00000e00
} SSMCertAccessSType;
#define SSM_IMPORT_CERT 0x00000100
#define SSM_VERIFY_CERT 0x00000200
#define SSM_FIND_BY_NICKNAME 0x00000300
#define SSM_FIND_BY_KEY 0x00000400
#define SSM_FIND_BY_EMAILADDR 0x00000500
#define SSM_ADD_TO_DB 0x00000600
#define SSM_DECODE_CERT 0x00000700
#define SSM_MATCH_USER_CERT 0x00000800
#define SSM_DESTROY_CERT 0x00000900
#define SSM_DECODE_TEMP_CERT 0x00000a00
#define SSM_REDIRECT_COMPARE 0x00000b00
#define SSM_DECODE_CRL 0x00000c00
#define SSM_EXTENSION_VALUE 0x00000d00
#define SSM_HTML_INFO 0x00000e00
/* message subtypes used for KEYGEN form tag */
typedef enum
{
#define SSM_GET_KEY_CHOICE 0x00000100
#define SSM_KEYGEN_START 0x00000200
#define SSM_KEYGEN_TOKEN 0x00000300
#define SSM_KEYGEN_PASSWORD 0x00000400
#define SSM_KEYGEN_DONE 0x00000500
SSM_GET_KEY_CHOICE = 0x00000100,
SSM_KEYGEN_START = 0x00000200,
SSM_KEYGEN_TOKEN = 0x00000300,
SSM_KEYGEN_PASSWORD = 0x00000400,
SSM_KEYGEN_DONE = 0x00000500
} SSMKeyGenTagProcessType;
#define SSM_CREATE_KEY_PAIR 0x00000100
#define SSM_FINISH_KEY_GEN 0x00000200
#define SSM_ADD_NEW_MODULE 0x00000300
#define SSM_DEL_MODULE 0x00000400
#define SSM_LOGOUT_ALL 0x00000500
#define SSM_ENABLED_CIPHERS 0x00000600
typedef enum
{
SSM_CREATE_KEY_PAIR = 0x00000100,
SSM_FINISH_KEY_GEN = 0x00000200,
SSM_ADD_NEW_MODULE = 0x00000300,
SSM_DEL_MODULE = 0x00000400,
SSM_LOGOUT_ALL = 0x00000500,
SSM_ENABLED_CIPHERS = 0x00000600
} SSMPKCS11Actions;
#define SSM_CREATE_CRMF_REQ 0x00000100
#define SSM_DER_ENCODE_REQ 0x00000200
#define SSM_PROCESS_CMMF_RESP 0x00000300
#define SSM_CHALLENGE 0x00000400
typedef enum
{
SSM_CREATE_CRMF_REQ = 0x00000100,
SSM_DER_ENCODE_REQ = 0x00000200,
SSM_PROCESS_CMMF_RESP = 0x00000300,
SSM_CHALLENGE = 0x00000400
} SSMCRMFAction;
typedef enum
{
SSM_SIGN_TEXT = 0x00000100
} SSMFormSignAction;
#define SSM_SIGN_TEXT 0x00000100
/* Security Config subtypes */
typedef enum
{
SSM_ADD_CERT_TO_TEMP_DB = 0x00000100,
SSM_ADD_TEMP_CERT_TO_DB = 0x00000200,
SSM_DELETE_PERM_CERTS = 0x00000300,
SSM_FIND_CERT_KEY = 0x00000400,
SSM_GET_CERT_PROP_BY_KEY = 0x00000500,
SSM_CERT_INDEX_ENUM = 0x00000600
} SSMSecCfgAction;
#define SSM_ADD_CERT_TO_TEMP_DB 0x00000100
#define SSM_ADD_TEMP_CERT_TO_DB 0x00000200
#define SSM_DELETE_PERM_CERTS 0x00000300
#define SSM_FIND_CERT_KEY 0x00000400
#define SSM_GET_CERT_PROP_BY_KEY 0x00000500
#define SSM_CERT_INDEX_ENUM 0x00000600
/* subcategories for SSM_FIND_CERT_KEY and SSM_CERT_INDEX_ENUM */
typedef enum
{
SSM_FIND_KEY_BY_NICKNAME = 0x00000010,
SSM_FIND_KEY_BY_EMAIL_ADDR = 0x00000020,
SSM_FIND_KEY_BY_DN = 0x00000030
} SSMSecCfgFindByType;
#define SSM_FIND_KEY_BY_NICKNAME 0x00000010
#define SSM_FIND_KEY_BY_EMAIL_ADDR 0x00000020
#define SSM_FIND_KEY_BY_DN 0x00000030
/* subcategories for SSM_GET_CERT_PROP_BY_KEY */
typedef enum
{
SSM_SECCFG_GET_NICKNAME = 0x00000010,
SSM_SECCFG_GET_EMAIL_ADDR = 0x00000020,
SSM_SECCFG_GET_DN = 0x00000030,
SSM_SECCFG_GET_TRUST = 0x00000040,
SSM_SECCFG_CERT_IS_PERM = 0x00000050,
SSM_SECCFG_GET_NOT_BEFORE = 0x00000060,
SSM_SECCFG_GET_NOT_AFTER = 0x00000070,
SSM_SECCFG_GET_SERIAL_NO = 0x00000080,
SSM_SECCFG_GET_ISSUER = 0x00000090,
SSM_SECCFG_GET_ISSUER_KEY = 0x000000a0,
SSM_SECCFG_GET_SUBJECT_NEXT = 0x000000b0,
SSM_SECCFG_GET_SUBJECT_PREV = 0x000000c0
} SSMSecCfgGetCertPropType;
#define SSM_SECCFG_GET_NICKNAME 0x00000010
#define SSM_SECCFG_GET_EMAIL_ADDR 0x00000020
#define SSM_SECCFG_GET_DN 0x00000030
#define SSM_SECCFG_GET_TRUST 0x00000040
#define SSM_SECCFG_CERT_IS_PERM 0x00000050
#define SSM_SECCFG_GET_NOT_BEFORE 0x00000060
#define SSM_SECCFG_GET_NOT_AFTER 0x00000070
#define SSM_SECCFG_GET_SERIAL_NO 0x00000080
#define SSM_SECCFG_GET_ISSUER 0x00000090
#define SSM_SECCFG_GET_ISSUER_KEY 0x000000a0
#define SSM_SECCFG_GET_SUBJECT_NEXT 0x000000b0
#define SSM_SECCFG_GET_SUBJECT_PREV 0x000000c0
/* Misc requests */
typedef enum
{
SSM_MISC_GET_RNG_DATA = 0x00000100,
SSM_MISC_PUT_RNG_DATA = 0x00000200
} SSMMiscRequestType;
#define SSM_MISC_GET_RNG_DATA 0x00000100
#define SSM_MISC_PUT_RNG_DATA 0x00000200
/* Type masks for message types */
typedef enum
{
SSM_CATEGORY_MASK = 0xF0000000,
SSM_TYPE_MASK = 0x0000F000,
SSM_SUBTYPE_MASK = 0x00000F00,
SSM_SPECIFIC_MASK = 0x000000F0
} SSMMessageMaskType;
#define SSM_CATEGORY_MASK 0xF0000000
#define SSM_TYPE_MASK 0x0000F000
#define SSM_SUBTYPE_MASK 0x00000F00
#define SSM_SPECIFIC_MASK 0x000000F0
typedef struct SSMAttributeValue {
SSMResourceAttrType type;
CMUint32 type;
union {
SSMResourceID rid;
CMTItem string;
@ -281,7 +229,7 @@ typedef enum {
} SSMKeyGenType;
typedef enum {
ssmUnknownPolicy=-1,ssmDomestic=0, ssmExport=1, ssmFrance=2
ssmUnknownPolicy= -1,ssmDomestic=0, ssmExport=1, ssmFrance=2
} SSMPolicyType;
/* These are the localized strings that PSM can feed back to
@ -314,24 +262,40 @@ typedef enum {
} SSMLocalizedString;
/* Event types */
typedef enum
{
SSM_UI_EVENT = 0x00001000,
SSM_TASK_COMPLETED_EVENT = 0x00002000,
SSM_FILE_PATH_EVENT = 0x00003000,
SSM_PROMPT_EVENT = 0x00004000,
SSM_AUTH_EVENT = 0x00007000,
SSM_SAVE_PREF_EVENT = 0x00008000,
SSM_MISC_EVENT = 0x0000f000
} SSMEventType;
#define SSM_UI_EVENT 0x00001000
#define SSM_TASK_COMPLETED_EVENT 0x00002000
#define SSM_FILE_PATH_EVENT 0x00003000
#define SSM_PROMPT_EVENT 0x00004000
#define SSM_AUTH_EVENT 0x00007000
#define SSM_SAVE_PREF_EVENT 0x00008000
#define SSM_MISC_EVENT 0x0000f000
/* Flags used in Create SSL Data request */
typedef enum
{
SSM_REQUEST_SSL_DATA_SSL = 0x00000001,
SSM_REQUEST_SSL_DATA_PROXY = 0x00000002,
SSM_REQUEST_SSL_CONNECTION_MASK = 0x00000003
} SSMSSLConnectionRequestType;
#define SSM_REQUEST_SSL_DATA_SSL 0x00000001
#define SSM_REQUEST_SSL_DATA_PROXY 0x00000002
#define SSM_REQUEST_SSL_CONNECTION_MASK 0x00000003
/* Create typedefs for the various #defines */
typedef CMUint32 SSMMessageCategory;
typedef CMUint32 SSMMessageType;
typedef CMUint32 SSMDataConnectionSType;
typedef CMUint32 SSMObjSignSType;
typedef CMUint32 SSMResourceAccessSType;
typedef CMUint32 SSMCreateResource;
typedef CMUint32 SSMResourceAttrType;
typedef CMUint32 SSMResourceConsv;
typedef CMUint32 SSMCertAccessSType;
typedef CMUint32 SSMKeyGenTagProcessType;
typedef CMUint32 SSMPKCS11Actions;
typedef CMUint32 SSMCRMFAction;
typedef CMUint32 SSMFormSignAction;
typedef CMUint32 SSMSecCfgAction;
typedef CMUint32 SSMSecCfgFindByType;
typedef CMUint32 SSMSecCfgGetCertPropType;
typedef CMUint32 SSMMiscRequestType;
typedef CMUint32 SSMMessageMaskType;
typedef CMUint32 SSMEventType;
typedef CMUint32 SSMSSLConnectionRequestType;
/*
* This string is version that can be used to assemble any