svn rev #22074: tools/gssmonger/trunk/ gssmaggot/ gssmaster/ include/
raeburn@MIT.EDU
raeburn at MIT.EDU
Tue Mar 10 19:42:42 EDT 2009
http://src.mit.edu/fisheye/changelog/krb5/?cs=22074
Commit By: raeburn
Log Message:
Add new protocol commands for wrap/unwrap_iov testing. Currently
unconditional, and doesn't support downgrading to be compatible with
the older master/maggot code that doesn't have this support. No SSPI
support yet.
Changed Files:
U tools/gssmonger/trunk/gssmaggot/gssapi.c
U tools/gssmonger/trunk/gssmaggot/handlers.c
U tools/gssmonger/trunk/gssmaster/clientapis.c
U tools/gssmonger/trunk/gssmaster/clientlib.h
U tools/gssmonger/trunk/gssmaster/interfere.c
U tools/gssmonger/trunk/include/helpers.h
U tools/gssmonger/trunk/include/messages.h
Modified: tools/gssmonger/trunk/gssmaggot/gssapi.c
===================================================================
--- tools/gssmonger/trunk/gssmaggot/gssapi.c 2009-03-10 20:26:24 UTC (rev 22073)
+++ tools/gssmonger/trunk/gssmaggot/gssapi.c 2009-03-10 23:42:41 UTC (rev 22074)
@@ -68,6 +68,12 @@
DeleteCredentialResource
--*/
+
+/* BUG: Don't call MapApiReturnVal(...,gss_foo(&minor,...), minor)
+ because 'minor' may be read for the MapApiReturnVal call before
+ gss_foo has a chance to set it. (Depends on the compiler and
+ options.) */
+
#include "messages.h"
#include "everything.h"
#include "netutil.h"
@@ -982,7 +988,137 @@
}
+#if 1
+ULONG
+DoWrapEx( IN PPROTOCOL_CALLBACK_ARGS pArgs,
+ IN PHCTXT phContext,
+ IN ULONG Flags,
+ IN ULONG SeqNo,
+ IN PVOID Message1,
+ IN ULONG cbMessage1,
+ IN PVOID Message2,
+ IN ULONG cbMessage2,
+ OUT PVOID *ppvHeader,
+ OUT PULONG pcbHeader,
+ OUT PVOID *ppvCrypt,
+ OUT PULONG pcbCrypt,
+ OUT PVOID *ppvPad,
+ OUT PULONG pcbPad,
+ OUT PVOID *ppvTrailer,
+ OUT PULONG pcbTrailer ) {
+
+ GSSERRTYPE minor = 0;
+ ULONG ulRet = GSMERR_TEST_ISSUE;
+ gss_iov_buffer_desc Buffers[5] = { { 0 } };
+ int conf = 1;
+
+ UNUSED_PARAMETER( Flags );
+ UNUSED_PARAMETER( SeqNo );
+
+ Buffers[0].type = GSS_IOV_BUFFER_TYPE_HEADER | GSS_IOV_BUFFER_FLAG_ALLOCATE;
+
+ Buffers[1].type = GSS_IOV_BUFFER_TYPE_DATA;
+ Buffers[1].buffer.value = Message1;
+ Buffers[1].buffer.length = cbMessage1;
+
+ Buffers[2].type = GSS_IOV_BUFFER_TYPE_SIGN_ONLY;
+ Buffers[2].buffer.value = Message2;
+ Buffers[2].buffer.length = cbMessage2;
+
+ Buffers[3].type = GSS_IOV_BUFFER_TYPE_PADDING | GSS_IOV_BUFFER_FLAG_ALLOCATE;
+ Buffers[4].type = GSS_IOV_BUFFER_TYPE_TRAILER | GSS_IOV_BUFFER_FLAG_ALLOCATE;
+
+ /*
+ * Possible desirable variations:
+ * no confidentiality; no trailer; more than two messages; STREAM mode
+ */
+ ulRet = gss_wrap_iov ( &minor,
+ *phContext,
+ 1, /* conf */
+ GSS_C_QOP_DEFAULT,
+ &conf,
+ Buffers,
+ 5 );
+ ulRet = MapApiReturnVal( pArgs,
+ "gss_wrapex",
+ FILE_AND_LINE,
+ ulRet,
+ minor );
+
+ /* Outputs: header, wrapped-data, padding, trailer. */
+
+ *ppvHeader = Buffers[0].buffer.value;
+ *pcbHeader = Buffers[0].buffer.length;
+ *ppvCrypt = Buffers[1].buffer.value;
+ *pcbCrypt = Buffers[1].buffer.length;
+ *ppvPad = Buffers[3].buffer.value;
+ *pcbPad = Buffers[3].buffer.length;
+ *ppvTrailer = Buffers[4].buffer.value;
+ *pcbTrailer = Buffers[4].buffer.length;
+
+ return ulRet;
+}
+
+ULONG
+DoUnwrapEx( IN PPROTOCOL_CALLBACK_ARGS pArgs,
+ IN PHCTXT phContext,
+ IN ULONG Flags,
+ IN ULONG SeqNo,
+
+ IN PVOID pvHeader,
+ IN ULONG cbHeader,
+ IN PVOID pvCrypt,
+ IN ULONG cbCrypt,
+ IN PVOID pvSign,
+ IN ULONG cbSign,
+ IN PVOID pvPad,
+ IN ULONG cbPad,
+ IN PVOID pvTrailer,
+ IN ULONG cbTrailer,
+
+ OUT PVOID *ppvClear,
+ OUT PULONG pcbClear ) {
+ gss_iov_buffer_desc Buffers[5] = { { 0 } };
+ GSSERRTYPE minor = 0;
+ ULONG ulRet = GSMERR_TEST_ISSUE;
+ int conf = 1;
+ gss_qop_t qop = GSS_C_QOP_DEFAULT;
+
+ UNUSED_PARAMETER( Flags );
+ UNUSED_PARAMETER( SeqNo );
+
+ Buffers[0].type = GSS_IOV_BUFFER_TYPE_HEADER;
+ Buffers[0].buffer.value = pvHeader;
+ Buffers[0].buffer.length = cbHeader;
+ Buffers[1].type = GSS_IOV_BUFFER_TYPE_DATA;
+ Buffers[1].buffer.value = pvCrypt;
+ Buffers[1].buffer.length = cbCrypt;
+ Buffers[2].type = GSS_IOV_BUFFER_TYPE_SIGN_ONLY;
+ Buffers[2].buffer.value = pvSign;
+ Buffers[2].buffer.length = cbSign;
+ Buffers[3].type = GSS_IOV_BUFFER_TYPE_PADDING;
+ Buffers[3].buffer.value = pvPad;
+ Buffers[3].buffer.length = cbPad;
+ Buffers[4].type = GSS_IOV_BUFFER_TYPE_TRAILER;
+ Buffers[4].buffer.value = pvTrailer;
+ Buffers[4].buffer.length = cbTrailer;
+
+ ulRet = gss_unwrap_iov( &minor, *phContext,
+ &conf, &qop,
+ Buffers, 5 );
+
+ ulRet = MapApiReturnVal( pArgs, "gss_unwrapex", FILE_AND_LINE,
+ ulRet, minor );
+ /* Output: cleartext. */
+ /* XXX Ignoring conf and qop for now. */
+ *ppvClear = Buffers[1].buffer.value;
+ *pcbClear = Buffers[1].buffer.length;
+
+ return ulRet;
+}
+#endif
+
VOID
FreeMessageOutput( IN ULONG cbData,
IN PVOID pvData ) {
Modified: tools/gssmonger/trunk/gssmaggot/handlers.c
===================================================================
--- tools/gssmonger/trunk/gssmaggot/handlers.c 2009-03-10 20:26:24 UTC (rev 22073)
+++ tools/gssmonger/trunk/gssmaggot/handlers.c 2009-03-10 23:42:41 UTC (rev 22074)
@@ -1339,8 +1339,290 @@
}
+#if 1
+/*++**************************************************************
+ NAME: HandleWrapEx
+ handles a call to gss_wrapex
+
+ CREATED: Mar 2, 2009 from HandleEncryptOrSign
+ LOCKING: none
+ CALLED BY: the server engine
+ FREE WITH: n/a -- no resources are allocated
+
+ **************************************************************--*/
+
+
+BOOL
+HandleWrapEx( IN PPROTOCOL_CALLBACK_ARGS pArgs ) {
+
+ ULONG ulRet = GSMERR_OK;
+ ULONG ulContextId, Flags, SeqNo;
+ LPSTR PlainText1, PlainText2;
+ PVOID pvCipher = NULL, pvHeader = NULL, pvPad = NULL, pvTrailer = NULL;
+ ULONG cbCipher = 0, cbString1 = 0, cbString2 = 0, cbPad = 0, cbHeader = 0, cbTrailer = 0;
+ PHCTXT phContext;
+ BOOL ret;
+ NETARGENTRY InputEntries[] = {
+
+ { "ContextId", sizeof( ulContextId ), &ulContextId, NETARG_NUMBER },
+ { "Flags", sizeof( Flags ), &Flags, NETARG_NUMBER },
+ { "SeqNo", sizeof( SeqNo ), &SeqNo, NETARG_NUMBER },
+ { "Plaintext1",
+
+ 0, NULL, /* unknown size */
+
+ NETARG_GENERIC |
+ NETARG_LENGTH_ENCODE |
+ NETARG_ALLOCFORME,
+
+ (PVOID *) &PlainText1,
+ &cbString1 },
+ { "Plaintext2",
+
+ 0, NULL, /* unknown size */
+
+ NETARG_GENERIC |
+ NETARG_LENGTH_ENCODE |
+ NETARG_ALLOCFORME,
+
+ (PVOID *) &PlainText2,
+ &cbString2 },
+
+ };
+
+ if ( !NetReadArgArray( pArgs->sock,
+ ARRAY_ENTRIES( InputEntries ),
+ InputEntries ) ) {
+
+ /* not worth continuing. */
+
+ return FALSE;
+
+ }
+
+ ulRet = GetContextForId( pArgs->pResourceTable,
+ FILE_AND_LINE,
+ &ulContextId,
+ &phContext );
+
+ if ( GSM_SUCCESS( ulRet ) ) {
+
+ ulRet = DoWrapEx ( pArgs,
+ phContext,
+ Flags,
+ SeqNo,
+ PlainText1,
+ cbString1,
+ PlainText2,
+ cbString2,
+ &pvHeader,
+ &cbHeader,
+ &pvCipher,
+ &cbCipher,
+ &pvPad,
+ &cbPad,
+ &pvTrailer,
+ &cbTrailer );
+
+ }
+
+ {
+
+ NETARGENTRY
+ OutputEntries[] = {
+
+ { "Return",
+ sizeof( ulRet ),
+ &ulRet,
+ NETARG_NUMBER },
+
+ /* for wrapex: header, ciphertext, padding?, trailer? */
+ { "Header",
+ cbHeader,
+ pvHeader,
+ NETARG_LENGTH_ENCODE |
+ NETARG_GENERIC
+ },
+ { "Ciphertext",
+ cbCipher,
+ pvCipher,
+ NETARG_LENGTH_ENCODE |
+ NETARG_GENERIC
+ },
+ { "Padding",
+ cbPad,
+ pvPad,
+ NETARG_LENGTH_ENCODE |
+ NETARG_GENERIC
+ },
+ { "Trailer",
+ cbTrailer,
+ pvTrailer,
+ NETARG_LENGTH_ENCODE |
+ NETARG_GENERIC
+ }
+
+ };
+
+ ret = NetWriteArgArray( pArgs->sock,
+ ARRAY_ENTRIES( OutputEntries ),
+ OutputEntries );
+
+ }
+
+ FreeNetArgArray( ARRAY_ENTRIES( InputEntries ),
+ InputEntries );
+
+ return ret;
+
+}
+
/*++**************************************************************
+ NAME: HandleUnwrapEx
+
+ handles a call to gss_unwrapex
+
+ CREATED: Mar 6, 2009 from HandleWrapEx
+ LOCKING: none
+ CALLED BY: the server engine
+ FREE WITH: n/a -- no resources are allocated
+
+ **************************************************************--*/
+
+
+BOOL
+HandleUnwrapEx( IN PPROTOCOL_CALLBACK_ARGS pArgs ) {
+
+ ULONG ulRet = GSMERR_OK;
+ ULONG ulContextId, Flags, SeqNo;
+ PVOID pvCipher = NULL, pvHeader = NULL, pvPad = NULL, pvTrailer = NULL, pvSign = NULL, pvPlain = NULL;
+ ULONG cbCipher = 0, cbHeader = 0, cbPad = 0, cbTrailer = 0, cbSign = 0, cbPlain = 0;
+ PHCTXT phContext;
+ BOOL ret;
+ NETARGENTRY InputEntries[] = {
+
+ { "ContextId", sizeof( ulContextId ), &ulContextId, NETARG_NUMBER },
+ { "Flags", sizeof( Flags ), &Flags, NETARG_NUMBER },
+ { "SeqNo", sizeof( SeqNo ), &SeqNo, NETARG_NUMBER },
+ { "Header",
+
+ 0, NULL, /* unknown size */
+
+ NETARG_GENERIC |
+ NETARG_LENGTH_ENCODE |
+ NETARG_ALLOCFORME,
+
+ (PVOID *) &pvHeader,
+ &cbHeader },
+ { "Ciphertext",
+
+ 0, NULL, /* unknown size */
+
+ NETARG_GENERIC |
+ NETARG_LENGTH_ENCODE |
+ NETARG_ALLOCFORME,
+
+ (PVOID *) &pvCipher,
+ &cbCipher },
+ { "Sign-only",
+
+ 0, NULL, /* unknown size */
+
+ NETARG_GENERIC |
+ NETARG_LENGTH_ENCODE |
+ NETARG_ALLOCFORME,
+
+ (PVOID *) &pvSign,
+ &cbSign },
+ { "Pad",
+
+ 0, NULL, /* unknown size */
+
+ NETARG_GENERIC |
+ NETARG_LENGTH_ENCODE |
+ NETARG_ALLOCFORME,
+
+ (PVOID *) &pvPad,
+ &cbPad },
+ { "Trailer",
+
+ 0, NULL, /* unknown size */
+
+ NETARG_GENERIC |
+ NETARG_LENGTH_ENCODE |
+ NETARG_ALLOCFORME,
+
+ (PVOID *) &pvTrailer,
+ &cbTrailer },
+
+ };
+
+ if ( !NetReadArgArray( pArgs->sock,
+ ARRAY_ENTRIES( InputEntries ),
+ InputEntries ) ) {
+
+ /* not worth continuing. */
+
+ return FALSE;
+
+ }
+
+ ulRet = GetContextForId( pArgs->pResourceTable,
+ FILE_AND_LINE,
+ &ulContextId,
+ &phContext );
+
+ if ( GSM_SUCCESS( ulRet ) ) {
+
+ ulRet = DoUnwrapEx ( pArgs,
+ phContext,
+ Flags,
+ SeqNo,
+ pvHeader, cbHeader,
+ pvCipher, cbCipher,
+ pvSign, cbSign,
+ pvPad, cbPad,
+ pvTrailer, cbTrailer,
+ &pvPlain, &cbPlain );
+
+ }
+
+ {
+
+ NETARGENTRY
+ OutputEntries[] = {
+
+ { "Return",
+ sizeof( ulRet ),
+ &ulRet,
+ NETARG_NUMBER },
+
+ /* for unwrapex: plaintext */
+ { "Plaintext",
+ cbPlain,
+ pvPlain,
+ NETARG_LENGTH_ENCODE |
+ NETARG_GENERIC
+ }
+
+ };
+
+ ret = NetWriteArgArray( pArgs->sock,
+ ARRAY_ENTRIES( OutputEntries ),
+ OutputEntries );
+
+ }
+
+ FreeNetArgArray( ARRAY_ENTRIES( InputEntries ),
+ InputEntries );
+
+ return ret;
+
+}
+#endif
+
+/*++**************************************************************
NAME: HandleVerify
callout into VerifySignature or gss_verify_mic
@@ -1824,6 +2106,9 @@
{ eUnwrap, "Unwrap", HandleDecryptOrUnwrap,
(PVOID) DoUnwrap },
+ { eWrapEx, "WrapEx", HandleWrapEx },
+ { eUnwrapEx, "UnwrapEx", HandleUnwrapEx },
+
{ eVerify, "Verify", HandleVerify },
{ eChangePassword, "ChangePassword", HandleChangePassword,
@@ -1852,7 +2137,7 @@
{ eAcquirePKInitCreds, "AcquirePKINIT", HandleAcquirePKInit },
-#if PROTOCOL_VERSION != 14
+#if PROTOCOL_VERSION != 16
/* If you add more messages in messages.h, the server
must be able to handle them here. */
Modified: tools/gssmonger/trunk/gssmaster/clientapis.c
===================================================================
--- tools/gssmonger/trunk/gssmaster/clientapis.c 2009-03-10 20:26:24 UTC (rev 22073)
+++ tools/gssmonger/trunk/gssmaster/clientapis.c 2009-03-10 23:42:41 UTC (rev 22074)
@@ -895,6 +895,159 @@
}
+ULONG
+ServerWrapEx( IN HSERVER hServer,
+ IN ULONG ulContextId,
+ IN ULONG Flags,
+ IN ULONG SeqNo,
+ IN PVOID pvPlain,
+ IN ULONG cbPlain,
+ IN PVOID pvSign,
+ IN ULONG cbSign,
+
+ OUT PVOID *ppvHeader,
+ OUT PULONG pcbHeader,
+ OUT PVOID *ppvWrappedText,
+ OUT PULONG pcbWrappedText,
+ OUT PVOID *ppvPad,
+ OUT PULONG pcbPad,
+ OUT PVOID *ppvTrailer,
+ OUT PULONG pcbTrailer ) {
+
+ ULONG ret = GSMERR_OK;
+ NETARGENTRY InputEntries[] = {
+
+ { "ContextId", sizeof( ulContextId ), &ulContextId, NETARG_NUMBER },
+ { "Flags", sizeof( Flags ), &Flags, NETARG_NUMBER },
+ { "SeqNo", sizeof( SeqNo ), &SeqNo, NETARG_NUMBER },
+ { "Plaintext", cbPlain, pvPlain, ( NETARG_GENERIC |
+ NETARG_LENGTH_ENCODE ) },
+ { "Sign-only", cbSign, pvSign, ( NETARG_GENERIC |
+ NETARG_LENGTH_ENCODE ) },
+
+ }, OutputEntries[] = {
+
+ { "Return", sizeof( ret ), &ret, NETARG_NUMBER },
+
+ { "Header",
+ 0, NULL, /* Unknown size, alloc buffer for us */
+ NETARG_GENERIC |
+ NETARG_ALLOCFORME |
+ NETARG_LENGTH_ENCODE,
+
+ ppvHeader,
+ pcbHeader },
+ { "Wrapped text",
+ 0, NULL, /* Unknown size, alloc buffer for us */
+ NETARG_GENERIC |
+ NETARG_ALLOCFORME |
+ NETARG_LENGTH_ENCODE,
+
+ ppvWrappedText,
+ pcbWrappedText },
+ { "Padding",
+ 0, NULL, /* Unknown size, alloc buffer for us */
+ NETARG_GENERIC |
+ NETARG_ALLOCFORME |
+ NETARG_LENGTH_ENCODE,
+
+ ppvPad,
+ pcbPad },
+ { "Trailer",
+ 0, NULL, /* Unknown size, alloc buffer for us */
+ NETARG_GENERIC |
+ NETARG_ALLOCFORME |
+ NETARG_LENGTH_ENCODE,
+
+ ppvTrailer,
+ pcbTrailer },
+
+ };
+
+ if ( !ClientSendReceiveData( hServer,
+ eWrapEx,
+ "WrapEx Message",
+ ARRAY_ENTRIES( InputEntries ),
+ InputEntries,
+ ARRAY_ENTRIES( OutputEntries ),
+ OutputEntries ) ) {
+
+ ret = GSMERR_TEST_ISSUE;
+
+ }
+
+ return ret;
+
+
+}
+
+ULONG
+ServerUnwrapEx( IN HSERVER hServer,
+ IN ULONG ulContextId,
+ IN ULONG Flags,
+ IN ULONG SeqNo,
+ IN PVOID pvHeader,
+ IN ULONG cbHeader,
+ IN PVOID pvCipher,
+ IN ULONG cbCipher,
+ IN PVOID pvSign,
+ IN ULONG cbSign,
+ IN PVOID pvPad,
+ IN ULONG cbPad,
+ IN PVOID pvTrailer,
+ IN ULONG cbTrailer,
+
+ OUT PVOID *ppvPlaintext,
+ OUT PULONG pcbPlaintext ) {
+
+ ULONG ret = GSMERR_OK;
+ NETARGENTRY InputEntries[] = {
+
+ { "ContextId", sizeof( ulContextId ), &ulContextId, NETARG_NUMBER },
+ { "Flags", sizeof( Flags ), &Flags, NETARG_NUMBER },
+ { "SeqNo", sizeof( SeqNo ), &SeqNo, NETARG_NUMBER },
+ { "Header", cbHeader, pvHeader, ( NETARG_GENERIC |
+ NETARG_LENGTH_ENCODE ) } ,
+ { "Ciphertext", cbCipher, pvCipher, ( NETARG_GENERIC |
+ NETARG_LENGTH_ENCODE ) },
+ { "Sign-only", cbSign, pvSign, ( NETARG_GENERIC |
+ NETARG_LENGTH_ENCODE ) },
+ { "Padding", cbPad, pvPad, ( NETARG_GENERIC |
+ NETARG_LENGTH_ENCODE ) },
+ { "Trailer", cbTrailer, pvTrailer, ( NETARG_GENERIC |
+ NETARG_LENGTH_ENCODE ) },
+
+ }, OutputEntries[] = {
+
+ { "Return", sizeof( ret ), &ret, NETARG_NUMBER },
+
+ { "Plaintext",
+ 0, NULL, /* Unknown size, alloc buffer for us */
+ NETARG_GENERIC |
+ NETARG_ALLOCFORME |
+ NETARG_LENGTH_ENCODE,
+
+ ppvPlaintext,
+ pcbPlaintext },
+ };
+
+ if ( !ClientSendReceiveData( hServer,
+ eUnwrapEx,
+ "UnwrapEx Message",
+ ARRAY_ENTRIES( InputEntries ),
+ InputEntries,
+ ARRAY_ENTRIES( OutputEntries ),
+ OutputEntries ) ) {
+
+ ret = GSMERR_TEST_ISSUE;
+
+ }
+
+ return ret;
+
+
+}
+
BOOL
GetVersionInfoAndCapFlags( IN HSERVER hServer,
OUT PULONG pulVersion,
Modified: tools/gssmonger/trunk/gssmaster/clientlib.h
===================================================================
--- tools/gssmonger/trunk/gssmaster/clientlib.h 2009-03-10 20:26:24 UTC (rev 22073)
+++ tools/gssmonger/trunk/gssmaster/clientlib.h 2009-03-10 23:42:41 UTC (rev 22074)
@@ -160,8 +160,46 @@
DECODE_FN ServerDecrypt, ServerUnwrap;
+typedef ULONG ENCODE_IOV_FN( IN HSERVER hServer,
+ IN ULONG ulContextId,
+ IN ULONG Flags,
+ IN ULONG SeqNo,
+ IN PVOID pvPlain,
+ IN ULONG cbPlain,
+ IN PVOID pvSign,
+ IN ULONG cbSign,
+ OUT PVOID *ppvHeader,
+ OUT PULONG pcbHeader,
+ OUT PVOID *ppvWrappedText,
+ OUT PULONG pcbWrappedText,
+ OUT PVOID *ppvPad,
+ OUT PULONG pcbPad,
+ OUT PVOID *ppvTrailer,
+ OUT PULONG pcbTrailer );
+ENCODE_IOV_FN ServerWrapEx;
+
+typedef ULONG DECODE_IOV_FN( IN HSERVER hServer,
+ IN ULONG ulContextId,
+ IN ULONG Flags,
+ IN ULONG SeqNo,
+ IN PVOID pvHeader,
+ IN ULONG cbHeader,
+ IN PVOID pvCipher,
+ IN ULONG cbCipher,
+ IN PVOID pvSign,
+ IN ULONG cbSign,
+ IN PVOID pvPad,
+ IN ULONG cbPad,
+ IN PVOID pvTrailer,
+ IN ULONG cbTrailer,
+
+ OUT PVOID *ppvPlaintext,
+ OUT PULONG pcbPlaintext );
+
+DECODE_IOV_FN ServerUnwrapEx;
+
ULONG
ServerSignBinary( IN HSERVER hServer,
IN ULONG ulContextId,
Modified: tools/gssmonger/trunk/gssmaster/interfere.c
===================================================================
--- tools/gssmonger/trunk/gssmaster/interfere.c 2009-03-10 20:26:24 UTC (rev 22073)
+++ tools/gssmonger/trunk/gssmaster/interfere.c 2009-03-10 23:42:41 UTC (rev 22074)
@@ -96,7 +96,8 @@
#define MESSAGETEST_ENCRYPT 0x1
#define MESSAGETEST_SIGNED 0x2
#define MESSAGETEST_WRAPPED 0x4
-#define LAST_MESSAGETEST MESSAGETEST_WRAPPED // update if more are added
+#define MESSAGETEST_WRAPEX 0x8
+#define LAST_MESSAGETEST MESSAGETEST_WRAPEX // update if more are added
ULONG iWhichMessages = ( MESSAGETEST_ENCRYPT |
MESSAGETEST_WRAPPED |
@@ -116,8 +117,9 @@
MSGTST( "Encrypt", ENCRYPT, "Exchanges encrypted messages" ),
MSGTST( "Signed", SIGNED, "Exchanges messages with an unwrapped sig" ),
MSGTST( "Wrapped", WRAPPED, "Exchanges clearsigned wrapped messages" ),
+ MSGTST( "WrapEx", WRAPEX, "Exchanges encrypted messages with additional signed data" ),
-#if LAST_MESSAGETEST != MESSAGETEST_WRAPPED
+#if LAST_MESSAGETEST != MESSAGETEST_WRAPEX
#error "New MessageTests? Update this array or they won't be on the command line"
#endif
@@ -228,6 +230,10 @@
ULONG SeqNo;
BOOL bAlreadyFreed;
+ // iov tests only
+ ULONG cbHeader, cbPad, cbTrailer;
+ PVOID pvHeader, pvPad, pvTrailer;
+
} MESSAGEDATA, *PMESSAGEDATA;
struct __messagefuncargs;
@@ -313,7 +319,55 @@
&pData->pvPlain ) );
}
+#define SIGN_ONLY_DATA "sign-me-please"
+BOOL
+EncodeIOVMessage( IN PMESSAGEFUNCARGS pArgs,
+ IN OUT PMESSAGEDATA pData ) {
+
+ ENCODE_IOV_FN *f = (ENCODE_IOV_FN *) pArgs->Glue.pEncode;
+
+ return GSM_SUCCESS( f( pArgs->pEncoder->hConn,
+ pArgs->pEncoder->ContextId,
+ 0, // no flags
+ pData->SeqNo,
+ pData->OriginalMessage->pvMessage,
+ pData->OriginalMessage->cbMessage,
+ SIGN_ONLY_DATA, sizeof(SIGN_ONLY_DATA),
+ &pData->pvHeader,
+ &pData->cbHeader,
+ &pData->pvData,
+ &pData->cbData,
+ &pData->pvPad,
+ &pData->cbPad,
+ &pData->pvTrailer,
+ &pData->cbTrailer ) );
+
+}
+
+BOOL
+DecodeIOVMessage( IN PMESSAGEFUNCARGS pArgs,
+ IN OUT PMESSAGEDATA pData ) {
+
+ DECODE_IOV_FN *f = (DECODE_IOV_FN *)pArgs->Glue.pDecode;
+
+ return GSM_SUCCESS( f( pArgs->pDecoder->hConn,
+ pArgs->pDecoder->ContextId,
+ 0, // no flags
+ pData->SeqNo,
+ pData->pvHeader,
+ pData->cbHeader,
+ pData->pvData,
+ pData->cbData,
+ SIGN_ONLY_DATA, sizeof(SIGN_ONLY_DATA),
+ pData->pvPad,
+ pData->cbPad,
+ pData->pvTrailer,
+ pData->cbTrailer,
+ &pData->pvPlain,
+ &pData->cbPlain ) );
+}
+
VOID
FreeMessageBurst( IN ULONG cMessages,
IN PMESSAGEDATA pData ) {
@@ -698,9 +752,18 @@
"signing",
ServerSignBinary
},
+ { "WrapEx",
+ GSMFLAG_CONFIDENTIALITY,
+ MESSAGETEST_ENCRYPT,
+ EncodeIOVMessage,
+ DecodeIOVMessage,
+ "encrypting",
+ (ENCODE_FN *) ServerWrapEx,
+ (DECODE_FN *) ServerUnwrapEx
+ },
-#if LAST_MESSAGETEST != MESSAGETEST_WRAPPED
+#if LAST_MESSAGETEST != MESSAGETEST_WRAPEX
#error "New Message Test type? Update this array and #defines at top"
#endif
Modified: tools/gssmonger/trunk/include/helpers.h
===================================================================
--- tools/gssmonger/trunk/include/helpers.h 2009-03-10 20:26:24 UTC (rev 22073)
+++ tools/gssmonger/trunk/include/helpers.h 2009-03-10 23:42:41 UTC (rev 22074)
@@ -182,7 +182,43 @@
FreeMessageOutput( IN ULONG cbData,
IN PVOID pvData );
+ULONG
+DoWrapEx( IN PPROTOCOL_CALLBACK_ARGS pArgs,
+ IN PHCTXT phContext,
+ IN ULONG Flags,
+ IN ULONG SeqNo,
+ IN PVOID Message1,
+ IN ULONG cbMessage1,
+ IN PVOID Message2,
+ IN ULONG cbMessage2,
+ OUT PVOID *ppvHeader,
+ OUT PULONG pcbHeader,
+ OUT PVOID *ppvCrypt,
+ OUT PULONG pcbCrypt,
+ OUT PVOID *ppvPad,
+ OUT PULONG pcbPad,
+ OUT PVOID *ppvTrailer,
+ OUT PULONG pcbTrailer );
+ULONG
+DoWrapEx( IN PPROTOCOL_CALLBACK_ARGS pArgs,
+ IN PHCTXT phContext,
+ IN ULONG Flags,
+ IN ULONG SeqNo,
+ IN PVOID Message1,
+ IN ULONG cbMessage1,
+ IN PVOID Message2,
+ IN ULONG cbMessage2,
+
+ OUT PVOID *ppvHeader,
+ OUT PULONG pcbHeader,
+ OUT PVOID *ppvCrypt,
+ OUT PULONG pcbCrypt,
+ OUT PVOID *ppvPad,
+ OUT PULONG pcbPad,
+ OUT PVOID *ppvTrailer,
+ OUT PULONG pcbTrailer );
+
typedef ULONG (CHPWD_FUNCTION)( IN PPROTOCOL_CALLBACK_ARGS, /* pArgs */
IN LPSTR, /* Principal */
IN LPSTR, /* Old Password */
Modified: tools/gssmonger/trunk/include/messages.h
===================================================================
--- tools/gssmonger/trunk/include/messages.h 2009-03-10 20:26:24 UTC (rev 22073)
+++ tools/gssmonger/trunk/include/messages.h 2009-03-10 23:42:41 UTC (rev 22074)
@@ -161,9 +161,12 @@
credential resource as eAcquireCreds,
free with eToastResource (as eAcquireCreds) */
+ eWrapEx,
+ eUnwrapEx,
+
/* Add new protocol messages here */
-#define PROTOCOL_VERSION 14 /* update this if you add more--
+#define PROTOCOL_VERSION 16 /* update this if you add more--
we use it to make sure that the
new entries show up in other areas
of the code that depend on it. */
More information about the cvs-krb5
mailing list