Internet DRAFT - draft-baldwin-bsafe-test

draft-baldwin-bsafe-test



HTTP/1.1 200 OK
Date: Mon, 08 Apr 2002 22:40:41 GMT
Server: Apache/1.3.20 (Unix)
Last-Modified: Fri, 25 Jun 1999 12:38:00 GMT
ETag: "2e7d6d-500a98-37737828"
Accept-Ranges: bytes
Content-Length: 5245592
Connection: close
Content-Type: text/plain

  RSA Working Group                             Robert W. Baldwin
   Internet Draft                                RSA Data Security
   Expiration Date: December 25, 1999                June 25, 1999
   Category: Informational

             TESTING THE BSAFE CRYPTOGRAPHIC SECURITY COMPONENTS
                     <draft-baldwin-bsafe-test-00.txt>


Status of This Memo
   This document is an Internet-Draft and is in full conformance with
   all provisions of Section 10 of RFC2026 except that the right to
   produce derivative works is not granted.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF), its areas, and its working groups. Note that
   other groups may also distribute working documents as Internet-
   Drafts.

   Internet-Drafts are draft documents valid for a maximum of six
   months and may be updated, replaced, or obsoleted by other documents
   at any time. It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."
   The list of current Internet-Drafts can be accessed at
   http://www.ietf.org/1id-abstracts.html.

   The list of Internet-Draft Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html.

   This memo provides information for the Internet community. This memo
   does not specify an Internet standard of any kind. Distribution of
   this memo is unlimited.

Abstract
   This Internet-Draft describes how to test the correct operation of a
   cryptographic module that conforms to the API described in draft-
   baldwin-bsafe-00.txt. It covers test vectors, functional tests, and
   error case tests. Performance and stress testing is not included. In
   each test the expected results are described.

Copyright Notice


   Copyright (C) The Internet Society (1999). All Rights Reserved










Baldwin         Informational, Expires 12/25/1999          1


draft-baldwin-bsafe-test-00.txt   TESTING BSAFE    June 1999



Table of Contents


1. Introduction

2. Understanding the Test Descriptions

3. Security Considerations

4. Reference Section

5. Author's Address

6. Trademark and Patent Issues

7. Copyright Section

8. Test Cases



1  Introduction


   This Internet-Draft is being distributed to members of the Internet
   community in order to solicit their reactions to the proposals
   contained in it. While the issues discussed may not be directly
   relevant to the research problems of the Internet, they may be
   interesting to a number of researchers and implementers.


   This is the companion document for draft-baldwin-bsafe-00.txt.
   Whereas that document described an application programming interface
   (API) for a general purpose cryptographic security module, this
   document describes a collection of test cases to confirm that an
   implementation of the API is correct. These test cases are not
   complete, but they form a good basis for accepting the correctness
   of an implementation.

1.1 Organization


   The next section presents information to help the reader understand
   the test case descriptions. Test case descriptions are in the last
   section of this document.

2  Understanding the Test Descriptions


   This section provides background information to help understand the
   test case descriptions. It covers the general concepts that are
   found in most calls to the API and topics such as memory allocation,
   and expected values that are specific to the testing system.


2.1 Status and Error Codes


   All API calls return a status code that is non-zero when an unusual
   event or error happens.  The test cases are described in terms of a
   symbol called "_Status" that is set to the API return value, and a
   symbol called "_ExpectedStatus" that is set to the expected return
   code.  The expected value is either set to zero or to one of the



Baldwin         Informational, Expires 12/25/1999          2


draft-baldwin-bsafe-test-00.txt   TESTING BSAFE    June 1999

   error symbols, such as BE_KEY_LEN, that are defined in the API
   specification.


2.2 The Chooser


   When an algorithm object is initialized by calling a function such
   as B_EncryptInit, a list of algorithm methods, called the chooser,
   is passed to that function.  The initialization routine searches the
   chooser list for low-level functions used to implement the
   algorithm.  For example, the algorithm object for DES-based password
   encryption, called AI_MD5WithDES_CBCPad, is implemented by methods
   called AM_DES_ENCRYPT and AM_MD5.  The AMs are listed in the
   chooser.

   The test descriptions use the symbol "_Chooser" to represent the
   list of AMs set up for calls to the initialize routines.  The list
   is terminated by the symbol "NULL_PTR", which is a value defined in
   the API specification. For example,


   Set "_Chooser" to "AM_MD5", "AM_DES_ENCRYPT", "NULL_PTR".

   The default Chooser includes all AMs and is called
   DEMO_ALGORITHM_CHOOSER.  It is referenced in the test cases by a
   phrase such as:

   Set "_Chooser" to DEMO_ALGORITHM_CHOOSER.

2.3 The Surrender Context


   Some cryptographic operations can take a long time to complete, so
   BSAFE includes a mechanism, the surrender context, that allows the
   user to abort such operations.  The surrender context contains a
   function pointer and a data pointer.  During a long operation, the
   API routine calls the surrender context function and the data
   pointer is passed to it.  If the function returns a non-zero value,
   the operation aborts.

   The test cases in this document describe this mechanism in terms of
   the symbol "_SurrenderContext".  Most cases set this symbol to
   NULL_PTR, which in an acceptable value to pass to the API routines.
   When the surrender function is being tested, the cases contain a
   phrase such as:

   Set "_SurrenderContext" to track calls.

   This means that "_SurrenderContext" should point to a surrender
   context structure as defined in the API specification, and the
   function must track of the number of times it is called.  That count
   is referred to by the phrase:

   "_counter" for "_SurrenderContext"



Baldwin         Informational, Expires 12/25/1999          3


draft-baldwin-bsafe-test-00.txt   TESTING BSAFE    June 1999


   To simulate a user abort after five calls, a phrase such as the
   following is used:

   Set "_counter" for "_SurrenderContext" to decimal value "0".
   Set "_SurrenderContext" to return error when counter reaches decimal
   value "5".


2.4 Info Structures


   When algorithm and key objects are initialized, they can be given
   parameters that control their behavior.  These parameters are passed
   via "info structures" that are defined in the API specification.
   For example, when an algorithm of type AI_RC5_CBC is initialized by
   calling B_SetAlgorithmInfo, a pointer to an info structure is passed
   that contains the RC5 parameters, such as number of rounds, and word
   size.

   The test case descriptions use a phrase such as:
   info structure for "AI_RC5_CBC"

   to mean the appropriate structure from the API specification.  In
   this case, it is a structure called A_RC5_CBC_PARAMS.  To simplify
   the test description, the initialization of that structure is
   described as a list initialization.  For example, the follow code
   fills in structure.  Note that the first and fourth parameters are
   parsed as hexadecimal values, and the others are parsed as decimals.

   Set "_InfoPointer" to address of info structure for "AI_RC5_CBC"
   initialized from "10", "12", "32", "8899AABBCCDDEEFF".

   To check the value of information returned by B_GetAlgorithmInfo and
   B_GetKeyInfo, the test cases require a way to express the expected
   value; this is done using the phrase like:

   expected info structure for "AI_RC5_CBC"

   Later a statement checks the equality of the two structures.  This
   means that the test environment assumes that there are two copies of
   each info structure.  One is for setting and getting parameters, and
   the other for holding the expected value for later comparison.

   When no parameters are passed, the test is described by a sentence
   like:

   Set "_InfoPointer" to address of info structure for "AI_MD5"
   initialized from "NULL_PTR".

   What this means is that the "_InfoPointer" should be set to NULL_PTR
   before being passed to the initialization routine.




Baldwin         Informational, Expires 12/25/1999          4


draft-baldwin-bsafe-test-00.txt   TESTING BSAFE    June 1999

2.5 Loading Buffers from Info Structures


   Some test cases attempt to manipulate and display information
   returned by the B_Get*Info API routines as data buffers.  This is
   expressed by a sentence that begins with the word "Load," for
   example,

   Load buffer "infoBuf" from info structure for "AI_RC5_CBC".

   This is equivalent to saying:

   Set buffer "infoBuf" to hex value
   "100000000c000000200000008899AABBCCDDEEFF".

   When the info structure is a pointer to a byte array such as the
   initialization vector of a CBC cipher, the meaning of a load is
   straightforward.  For complicated structures such as private keys,
   the resulting buffer is the concatenation of the bytes that make up
   the fields of the structure.  Values that are integers use four
   bytes, and byte arrays such as public key exponents are copied with
   the least significant byte first.

2.6 Data Buffers


   To simplify handling data passed to the API calls, the test cases
   use the concept of named buffers.  Buffer are created with a maximum
   size, for example:

   Create buffer "input" of decimal value "100" bytes.

   Buffers can be initialized from hexadecimal constants or ascii
   strings as, follows:

   Set buffer "input" to hex value "6665".
   Set buffer "input" to string value "BA".


   For hexadecimal values, pairs of characters become an eight-bit
   value, which is stored in successive memory locations.  It is also
   possible to initialize one buffer from another, as follows.

   Set buffer "expected" to contents of buffer "input".

   These buffers keep track of the number of bytes that are initialized
   and the number that are free.  Normally bytes are appended to output
   buffers and read from the beginning of input buffers.

   The special sentence:

   Finalize buffer "input".






Baldwin         Informational, Expires 12/25/1999          5


draft-baldwin-bsafe-test-00.txt   TESTING BSAFE    June 1999

   means that the number of initialized bytes will be set to zero when
   it is next used as an output buffer, but until then an operation
   like:

   Display buffer "input".

   will display all the initialized bytes even though the buffer has
   been finalized.

   The amount of initialized data in a buffer can be directly
   manipulated by a sentence like:

   Set length of buffer "input" to decimal value "10".

   This changes the initialized length of the buffer without changing
   the contents, which is particularly convenient for tests that are
   trying different input sizes.


2.7 Data Append and Extract


   Buffers can be manipulated by concatenation like:

   Append buffer "input" with hex value "6768".

   Sub-ranges of bytes in a buffer can be extracted.  For example, the
   following sentence means that "toBuf" should be set to the first
   five bytes of "fromBuf".

   Set buffer "toBuf" to bytes extracted from buffer "fromBuf"
   starting at offset decimal value "0" extending for decimal
   value "5" bytes.


2.8 Incrementing and Decrementing Buffers


   In order to iterate over a range of values, such as key size, the
   test cases use a phrase such as:

   Increment buffer "keySize" by decimal value "8".

   The decimal value is converted to a 16-bit integer that is added to
   the first two bytes of the value in the buffer "keySize".

   Buffer values can be converted into integers that are passed as
   parameters to API calls or as part of the initialization of info
   structures.  The bytes in the buffer are converted to unsigned
   integers treating them as least significant byte first.  Thus, a two
   byte buffer containing the hexadecimal value "01" becomes the
   integer one, and "FF01" becomes five hundred and eleven.





Baldwin         Informational, Expires 12/25/1999          6


draft-baldwin-bsafe-test-00.txt   TESTING BSAFE    June 1999

2.9 The ITEM structure


   The API specification includes a data structure called "ITEM" that
   expresses the location and length of an array of bytes.  The
   routines, B_EncodeDigestInfo and B_DecodeDigestInfo, have parameters
   that are pointers to ITEM structures.  This is expressed by the
   following phrase:

   address of ITEM describing buffer "digest"

   The ITEM structure would identify the start of the buffer and the
   number of initialized bytes.


2.10 Displaying and Checking Results


   The test case descriptions include expected results using sentences
   such as:

   Check equality of "_Status" with "_ExpectedStatus".

   Check equality of info structure for "infoType" with expected
   info structure for "infoType".

   Check equality of buffer "dataObject" with hex value "09aa".

   The equality checks can be over integer values like "_Status",
   buffers (expressed as hex or string values or the contents of a
   named buffer), or info structures.  If any check fails the test case
   does not pass, though it may be worth continuing with the rest of
   the test case to get more information about the nature of the
   failure.

   To help with manual debugging of the test cases, there is often a
   sentence about displaying a value before checking it against an
   expected value.  If everything is working, these could be ignored,
   but during testing they may be helpful.  The following are examples
   of such sentences.

   Display "_counter" for "_SurrenderContext".

   Display "_Chooser".

   Display info structure for "infoType".

   Display buffer "digest".

   Display buffer "digest" as ascii string.


2.11 Loops




Baldwin         Informational, Expires 12/25/1999          7


draft-baldwin-bsafe-test-00.txt   TESTING BSAFE    June 1999

   To help test a range of parameters for the API calls, the test case
   descriptions include loops that can be nested.  The number of times
   that a loop is iterated is specified and when the loop is done, it
   is helpful to display performance data such as execution times.
   Please refer to the following example:

   Begin a loop of decimal value "32" iterations.
   Set "_InfoPointer" to address of info structure for
   "AI_RSAKeyGen" initialized from contents of buffer "keySize",
   "010001".
   Call B_SetAlgorithmInfo passing "generateAlg" and
   "AI_RSAKeyGen" and "_InfoPointer".
   Set "_Status" to return value.
   Check equality of "_Status" with "_ExpectedStatus".
   Set "_ExpectedStatus" to zero.
   Increment buffer "keySize" by decimal value "8".
   End the loop and display execution times.

   The preceding example tests initializing a key generator algorithm
   using different key sizes.


2.12 Memory Allocation Errors


   Several test cases confirm that the implementation behaves
   reasonably when the platform runs out of memory.  Memory is
   allocated via a user supplied routine called "T_malloc" which
   returns zero if the allocation succeeded.  To simulate memory errors
   the tests call for that routine to return an error or return its
   normal value.  See the following example.

   Set "_T_malloc" to return errors.
   Set "_ExpectedStatus" to "BE_ALLOC".
   Call B_SetAlgorithmInfo passing "des" and "AI_DES_CBC_IV8" and
   "1122334455667788".
   Set "_Status" to return value.
   Check equality of "_Status" with "_ExpectedStatus".
   Set "_ExpectedStatus" to zero.
   Set "_T_malloc" to return normal.

   The preceding confirms that one API routine detects and reports
   memory allocation errors.

3  Security Considerations

   This document provides test cases that help ensure that an
   implementation of the cryptographic API described in draft-baldwin-
   bsafe-00.txt is behaving as expected.  The security of applications
   built on top of that API will depend on its correctness, so testing
   is very important.  In addition good software development practices
   should be followed such as code review, especially for new code
   introduced to fix bugs.  The test cases are not exhaustive, so they
   cannot in themselves ensure correctness.


Baldwin         Informational, Expires 12/25/1999          8


draft-baldwin-bsafe-test-00.txt   TESTING BSAFE    June 1999


   Other features of a well-written cryptographic module cannot be
   tested via its API.  For example, all sensitive data such as keys
   should be zeroed as soon as possible to reduce the chances of
   leaking them inadvertently.  Issues like these are beyond the scope
   of this document.


4  References


   Consult the following references for a better understanding of the
   algorithms and processes exercised by the test cases described in
   this document.

   draft-baldwin-bsafe-00.txt
   Baldwin, et al., BSAFE Cryptographic Security
   Components, May 1999.

   FIPS PUB 46-1
   National Bureau of Standards. FIPS Publication
   46-1: Data Encryption Standard, January 1988.

   FIPS PUB 81
   National Bureau of Standards. FIPS Publication
   81: DES Modes of Operation, December 1980.

   FIPS PUB 180-1
   National Institute of Standards and Technology.
   FIPS Publication 180-1: Secure Hash, May 1993.

   FIPS PUB 186
   National Institute of Standards and Technology.
   FIPS Publication 186: Digital Signature
   Standard, May 1994.

   P1363 Draft D1
   IEEE. Standard Specifications for Public Key
   Cryptography, December 1997.

   RFC 1113
   J. Linn. RFC 1113: Privacy Enhancement for
   Internet Electronic Mail: Part I, Message
   Encipherment and Authentication Procedures,
   August 1989.

   RFC 1319
   B. Kaliski. The MD2 Message-Digest Algorithm,
   April 1992.

   RFC 1321
   R. Rivest. The MD5 Message-Digest Algorithm,
   April 1992.

   RFC 1423


Baldwin         Informational, Expires 12/25/1999          9


draft-baldwin-bsafe-test-00.txt   TESTING BSAFE    June 1999

   D. Balenson. RFC 1423: Privacy Enhancement for
   Internet Electronic Mail: Part III Algorithms,
   Modes, and Identifiers, February 1993.

   X.208
   CCITT. Recommendation X.208: Specification of
   Basic Encoding Rules for Abstract Syntax
   Notation One (ASN.1), 1988.

   X.209
   CCITT. Recommendation X.209: Specification of
   Abstract Syntax Notation One (ASN.1), 1988.

   X.509
   CCITT. Recommendation X.509: The Directory
   Authentication Framework, 1988.

   X9.31
   Draft Digital signatures Using Reversible Public
   Key Cryptography for the Financial Services
   Industry. December 1997.

   X9.44
   Draft Key management using reversible public key
   cryptography for the financial services
   industry, January 1998.

   X9.52
   Draft Triple Data Encryption Algorithm Modes of
   Operation, December 1997.

   X9.57
   Draft ANSI. Certificate Management, N5-95,
   June 15, 1995.

   X9.62
   Draft ANSI. The Elliptic Curve Digital Signature
   Algorithm (ECDSA), August 29, 1997.

   X9.63
   Draft Public Key Cryptography for the Financial
   Services Industry: Elliptic Curve Key Agreement
   and Transport Protocol, December 1997.

   [NIST91]
   NIST. Special Publication 500-202: Stable
   Implementation Agreements for Open Systems
   Interconnection Protocols. Version 5, Edition 1,
   Part 1,. December 1991.

   PKCS Suite
   The following references are from the RSA Data Security
   Public-Key Cryptography Standards (PKCS) suite.


Baldwin         Informational, Expires 12/25/1999         10


draft-baldwin-bsafe-test-00.txt   TESTING BSAFE    June 1999

   PKCS documents are available by anonymous FTP from the host
   ftp.rsa.com in the files pub/pkcs/pkcs*.ps, or by sending
   electronic mail to pkcs@rsa.com.

   PKCS 1
   RSA Data Security PKCS 1: RSA
   Encryption Standard, Version 1.5, November 1993.

   PKCS 3
   RSA Data Security PKCS 3: Diffie-Hellman
   Key Agreement Standard, Version 1.4, November
   1993.

   PKCS 5
   RSA Data Security PKCS 5: Password-Based
   Encryption Standard, Version 1.5, November 1993.

   PKCS 7
   RSA Data Security PKCS 7: Cryptographic
   Message Syntax Standard, Version 1.5, November
   1993.

   PKCS 8
   RSA Data Security PKCS 8: Private-Key
   Information Syntax Standard, Version 1.2,
   November 1993.


5  Author Information

   Robert W. Baldwin
   Plus Five Consulting, Inc.
   990 Amarillo Avenue
   Palo Alto, CA 94303
   Voice: +1 650-852-9675
   Fax: +1 650-852-9675
   Email: baldwin@plusfive.com, baldwin@lcs.mit.edu



6  Trademarks and Patents


   RC2, RC4, and RC5 are registered trademarks, and BCERT, BSAFE, MD2,
   MD4, MD5, PKCS, RC5, RC6, RSA Public Key Cryptosystem, S/MAIL and
   TIPEM are trademarks of RSA Data Security.

   The RSA Public Key Cryptosystem@ is protected by U.S. Patent
   4,405,829.


   The RC5@ algorithm is protected by U.S. Patents 5,724,428, and
   5,835,600.


7  Copyright




Baldwin         Informational, Expires 12/25/1999         11


draft-baldwin-bsafe-test-00.txt   TESTING BSAFE    June 1999

   Copyright The Internet Society June 1999.
   All Rights Reserved.

   This document and translations of it may be copied and furnished
   to others, and derivative works that comment on or otherwise
   explain it or assist in its implementation may be prepared, copied,
   published and distributed, in whole or in part, without
   restriction of any kind, provided that the above copyright notice
   and this paragraph are included on all such copies and derivative
   works. However, this document itself may not be modified in any
   way, such as by removing the copyright notice or references to the
   Internet Society or other Internet organizations, except as needed
   for the purpose of developing Internet standards in which case the
   procedures for copyrights defined in the Internet Standards process
   must be followed, or as required to translate it into languages
   other than English.  The limited permissions granted above are
   perpetual and will not be revoked by the Internet Society or its
   successors or assigns.  This document and the information contained
   herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND
   THE INTERNETENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS
   OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE
   OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY
   IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
   PURPOSE.  The IETF takes no position regarding the validity or scope
   of any intellectual property or other rights that might be claimed
   to  pertain to the implementation or use of the technology described
   in this document or the extent to which any license under such
   rights might or might not be available; neither does it represent
   that it has made any effort to identify any such rights. Information
   on the IETF's procedures with respect to rights in standards-track
   and standards-related documentation can be found in BCP-11. Copies
   of claims of rights mad available for publication and any assurances
   of licenses to be made available, or the result of an attempt made
   to obtain a general license or permission for the use of such
   proprietary rights by implementers or users of this
   specification can be obtained from the IETF Secretariat.


8  Test Cases

   There are 179 test case descriptions. Each description begins with a
   phrase like:

   This is the start of test case "TVDES00".

   and ends with the phrase like:

   This is the end of test case "TVDES00".

   These phrases can be used to find and separate the cases.






Baldwin         Informational, Expires 12/25/1999         12


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

This is the start of test case "TV111300".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: RFC 1113 vectors test

Note: -------------------------------------------------------
Create algorithm object "rfc1113".
Call B_CreateAlgorithmObject passing "rfc1113".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "inputData" of decimal value "100" bytes.
Create buffer "encodedData" of decimal value "100" bytes.
Create buffer "decodedData" of decimal value "100" bytes.
Create buffer "expectedResult" of decimal value "100" bytes.


Note: Initialize, set up expected and input data

Set "_InfoPointer" to address of info structure for 
"AI_RFC1113Recode" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "rfc1113" and 
"AI_RFC1113Recode" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set buffer "expectedResult" with string value 
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+
/".

Set buffer "inputData" to hex value "00108310518720928b30d38f411
49351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf
3dfbf".

Call Call B_EncodeInit passing "rfc1113".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncodeUpdate passing "rfc1113" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData" and address of 
first initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Call B_EncodeFinal passing "rfc1113" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 

Baldwin         Informational, Expires 12/25/1999          13


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

length of free bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Finalize buffer "encodedData".

Check equality of buffer "expectedResult" with contents of 
buffer "encodedData".

Call Call B_DecodeInit passing "rfc1113".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecodeUpdate passing "rfc1113" and address of next free 
byte in buffer "decodedData" and address of "_OutputLen" and 
length of free bytes in buffer "decodedData" and address of 
first initialized byte in buffer "expectedResult" and length of 
initialized bytes in buffer "expectedResult"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Call B_DecodeFinal passing "rfc1113" and address of next free 
byte in buffer "decodedData" and address of "_OutputLen" and 
length of free bytes in buffer "decodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Finalize buffer "decodedData".

Check equality of buffer "decodedData" with contents of buffer 
"inputData".



This is the end of test case "TV111300".
This is the start of test case "TVDHKA01".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Test Diffie-Hellman Key Agreement using 1024 bit prime

Note: A test vector consisting of a fixed prime and a fixed 
Note: base are
Note: passed to both parties to generate 1020 bit private 
Note: exponents.
Note: This information is provided in the form of a BER encoded 
Note: string.
Note: The first party uses AI_MD5Random with a predetermined 

Baldwin         Informational, Expires 12/25/1999          14


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: initialization
Note: vector to generate its private key.
Note: The second party uses AI_MD2Random with it own given 
Note: initialization vector 
Note: to generate its private key.
Note: Both parties then exchange their public keys to compute 
Note: the shared
Note: secret key. The generated secret keys are compared to 
Note: each other as well
Note: the validated test vector.

Note: Summary
Note: Given 1024 bit prime and base, and two different 
Note: initialization vectors,
Note: generate key pairs using MD5Random for first party and 
Note: MD2Random for 
Note: second party. Compare computed secret key to expected 
Note: test vector.


Note: -------------------------------------------------------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_DH_KEY_AGREE", "NULL_PTR".

Set "_Chooser" to "AM_MD2_RANDOM", "AM_MD5_RANDOM", "NULL_PTR".


Note: Setup data objects

Create algorithm object "DHAlgorithmA".
Call B_CreateAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "DHAlgorithmB".
Call B_CreateAlgorithmObject passing "DHAlgorithmB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "MD5RandIV" of decimal value "200" bytes.
Create buffer "MD2RandIV" of decimal value "200" bytes.
Create buffer "outputA" of decimal value "500" bytes.
Create buffer "outputB" of decimal value "500" bytes.
Create buffer "BERString" of decimal value "700" bytes.
Create buffer "publicKey1" of decimal value "500" bytes.
Create buffer "publicKey2" of decimal value "500" bytes.
Create buffer "sharedKey" of decimal value "500" bytes.

Note: Input Test Vectors
Set buffer "BERString" to hex value "3082011a06092a864886f70d010
3013082010b02818100dbcd42df86e82fb68043278858d367129f6c7bb36c90c
0732104ba84a39609d0e29ea6eb0ea5eb8627e0b158220fc142bb41e7c6043d6

Baldwin         Informational, Expires 12/25/1999          15


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

977313265a979fb6704253010a166a94c2f31106bfe2fa0ff1c8a2b6f8bb61ed
59748c5a163df75c13a86922e7a0ee61cb9bd362fd356dcbbdf007f4b05bdce0
266547f884236c0f4130281802a88dee01f73b9d1ebaac980dd63da367413f7e
87eb53d1d676ec33c2aeec8178079e0a90af6e2915f8da4fb2a25473968010f0
2f0fa775fd71eac415f8e243e1ed54b6f594509130a9c1714d64e681660b353f
392a3f17d90a31665a7ddc7e4a33dc24ad0879414e7409213ea7cf841d872508
f387d9e1a3f9b9b124d9ee583020203fc".

Set buffer "MD5RandIV" to hex value "23d986c764b8b77a2394f7a32f9
678a2395f8c4768d7c235".

Set buffer "MD2RandIV" to hex value "1a9576d61839a56c71b68bb0960
e01f7e6a62d3083e31448a98d03e7".

Note: Expected Output Test Vectors
Set buffer "publicKey1" to hex value "5ac14c93fe7426b9e354b02756
b430aadc9a219bc37aa477293b0478e8ee96ac619009f3f3b509cb6cf8b3f053
a0362d607acf3c210746f91d62164b1cd16050ba7790129edd96d25da7057fb2
81a29724a4d9efb4a8c80e78ea50fd62fd8f2eb1a3267fcab766c7f33b7ff9aa
a6d501b266421644ac8931a5dcd6fb22b56259".

Set buffer "publicKey2" to hex value "cb7ce208f7df9e030948ae3b7e
4d3ca8a9b1b8ce7ea6347e52ba7236786a79c481d77d8851bb99ef0af0a8ee85
e1e1c1c85361258e7505f9a972c183086d011649df80b0cbbe017d2b4c509b02
610b8d733e235f86e3552c15eba074108a5b64d620e3e9f9effd93a1eecf56dc
898ed5d60fb78e31d334a033a83c76851d5246".

Set buffer "sharedKey" to hex value "d2eade2c91679262c1ded50d9cd
bc01a009527df57bad5c7f8349f9214cbe4576fdd8ab4480fef6ab54d32fd88e
d1ab5e57fc0e1177632818f99bab51756e9138c403301e369af1be611095a5a5
b5b84e1c89353b300cec8ecd26c7297674b6aa9d9e6eae900d0a33a930ceda95
6541de57a0b7198df4999ba137ecfe5cc6d32".

Note: Initialize an AI_MD5Random Algorithm for first party

Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD5Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 

Baldwin         Informational, Expires 12/25/1999          16


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

first initialized byte in "MD5RandIV" and length of initialized 
bytes in "MD5RandIV" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Initialize an AI_MD2Random Algorithm for second party

Create algorithm object "diffRandomAlgorithm".
Call B_CreateAlgorithmObject passing "diffRandomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "diffRandomAlgorithm" and 
"AI_MD2Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "diffRandomAlgorithm" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "diffRandomAlgorithm" and address 
of first initialized byte in "MD2RandIV" and length of 
initialized bytes in "MD2RandIV" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Setup key generator for first party.


Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmA" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: echo data from BER encoded string.

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgree".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"DHAlgorithmA" and "AI_DHKeyAgree".
Display info structure for "AI_DHKeyAgree".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999          17


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.

Note: Setup key generator for second party.

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmB" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate private and public keys for first party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmA" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".
Check equality of buffer "outputA" with contents of buffer 
"publicKey1".

Note: Generate private and public keys for second party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmB" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and 
"diffRandomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".
Check equality of buffer "outputB" with contents of buffer 
"publicKey2".


Baldwin         Informational, Expires 12/25/1999          18


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: First party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and address of 
first initialized byte in buffer "outputB" and length of 
initialized bytes in buffer "outputB" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".

Note: test if first party has produced the correct shared 
Note: secret key

Check equality of buffer "outputA" with contents of buffer 
"sharedKey".

Note: Second party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and address of 
first initialized byte in buffer "publicKey1" and length of 
initialized bytes in buffer "publicKey1" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Note: test if second party has produced the correct shared 
Note: secret key
Note: DataEquals (outputA, @outputB)



This is the end of test case "TVDHKA01".
This is the start of test case "TVDHKA02".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Test Diffie-Hellman Key Agreement using 256 bit prime

Note: A test vector consisting of a fixed prime and a fixed 
Note: base are
Note: passed to both parties to generate 255 bit private 
Note: exponents.
Note: This information is provided in the form of a BER encoded 
Note: string.
Note: Both parties use the same AI_MD2Random stream to generate 
Note: their
Note: private keys. This stream is first initialized with 

Baldwin         Informational, Expires 12/25/1999          19


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: default vector, used
Note: by the first party and then reused by the second party.
Note: Both parties then exchange their public keys in order to 
Note: compute their shared
Note: secret key. The generated secret keys are compared to 
Note: each other as well
Note: the expected test vector.

Note: Summary
Note: Given 256 bit prime and base, both parties, using a 
Note: single MD2Random stream,
Note: generate key pairs. The computed secret key are compared 
Note: to an expected 
Note: test output vector.


Note: -------------------------------------------------------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_DH_KEY_AGREE", "AM_MD2_RANDOM", 
"NULL_PTR".


Note: Setup data objects

Create algorithm object "DHAlgorithmA".
Call B_CreateAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "DHAlgorithmB".
Call B_CreateAlgorithmObject passing "DHAlgorithmB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "MD2RandIV" of decimal value "100" bytes.
Create buffer "outputA" of decimal value "100" bytes.
Create buffer "outputB" of decimal value "100" bytes.
Create buffer "BERString" of decimal value "400" bytes.
Create buffer "publicKey1" of decimal value "100" bytes.
Create buffer "publicKey2" of decimal value "100" bytes.
Create buffer "sharedKey" of decimal value "100" bytes.

Note: Input Test Vectors
Set buffer "BERString" to hex value "305606092a864886f70d0103013
049022100e258c44a865a04f557e37d29434d78483e007d1ff291650b88f2673
b37f9d73702200848be4dd9cb89f026f154f4cbf7647e889f5470cc32b203024
4ea155b4f7312020200ff".

Set buffer "MD2RandIV" to hex value "".

Note: Expected Output Test Vectors
Set buffer "publicKey1" to hex value "2256491874c200af37d9a4f143

Baldwin         Informational, Expires 12/25/1999          20


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

7b66b9404dfea12d6a4b8ae86cd922b38ea6a6".

Set buffer "publicKey2" to hex value "2bd79041f043c06d015c8ea70b
5a0bc63aec6364cffbb1b3fa83bbd14111ba37".

Set buffer "sharedKey" to hex value "7517dddd0748b77d6975ddf611e
eb0b01839183947be7c1d9216ce41582b907c".

Note: Initialize an AI_MD2Random Algorithm 

Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD2Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "MD2RandIV" and length of initialized 
bytes in "MD2RandIV" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: Setup key generator for first party.


Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmA" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: echo data from BER encoded string.
Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgree".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"DHAlgorithmA" and "AI_DHKeyAgree".
Display info structure for "AI_DHKeyAgree".

Baldwin         Informational, Expires 12/25/1999          21


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Setup key generator for second party.

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmB" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate private and public keys for first party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmA" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".
Check equality of buffer "outputA" with contents of buffer 
"publicKey1".

Note: Generate private and public keys for second party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmB" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".
Check equality of buffer "outputB" with contents of buffer 

Baldwin         Informational, Expires 12/25/1999          22


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"publicKey2".

Note: First party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and address of 
first initialized byte in buffer "outputB" and length of 
initialized bytes in buffer "outputB" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".

Note: test if first party has produced the correct shared 
Note: secret key

Check equality of buffer "outputA" with contents of buffer 
"sharedKey".

Note: Second party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and address of 
first initialized byte in buffer "publicKey1" and length of 
initialized bytes in buffer "publicKey1" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Note: test if second party has produced the correct shared 
Note: secret key
Note: DataEquals (outputA, @outputB)



This is the end of test case "TVDHKA02".
This is the start of test case "TVDHKA03".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Test Diffie-Hellman Key Agreement using 256 bit prime

Note: A test vector consisting of a fixed prime and a fixed 
Note: base are
Note: passed to both parties to generate 255 bit private 
Note: exponents.
Note: This information is provided in the form of a BER encoded 
Note: string.
Note: Both parties use the same AI_MD2Random stream to generate 

Baldwin         Informational, Expires 12/25/1999          23


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: their
Note: private keys. This stream is first initialized with a 
Note: zero vector, used
Note: by the first party and then reused by the second party.
Note: Both parties then exchange their public keys in order to 
Note: compute their shared
Note: secret key. The generated secret keys are compared to 
Note: each other as well
Note: the expected test vector.

Note: Summary
Note: Given 256 bit prime and base, both parties, using a 
Note: single MD2Random stream
Note: generate key pairs. The computed secret key are compared 
Note: to an expected 
Note: test output vector.


Note: -------------------------------------------------------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_DH_KEY_AGREE", "AM_MD2_RANDOM", 
"NULL_PTR".


Note: Setup data objects

Create algorithm object "DHAlgorithmA".
Call B_CreateAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "DHAlgorithmB".
Call B_CreateAlgorithmObject passing "DHAlgorithmB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "MD2RandIV" of decimal value "256" bytes.
Create buffer "outputA" of decimal value "500" bytes.
Create buffer "outputB" of decimal value "500" bytes.
Create buffer "BERString" of decimal value "700" bytes.
Create buffer "publicKey1" of decimal value "500" bytes.
Create buffer "publicKey2" of decimal value "500" bytes.
Create buffer "sharedKey" of decimal value "500" bytes.

Note: Input Test Vectors
Set buffer "BERString" to hex value "305606092a864886f70d0103013
049022100e258c44a865a04f557e37d29434d78483e007d1ff291650b88f2673
b37f9d73702200848be4dd9cb89f026f154f4cbf7647e889f5470cc32b203024
4ea155b4f7312020200ff".

Set buffer "MD2RandIV" to hex value "000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000

Baldwin         Informational, Expires 12/25/1999          24


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000".

Note: Expected Output Test Vectors
Set buffer "publicKey1" to hex value "258df51efcb0eb0e91c4faadc1
611c52338a8669fc3968422c086a99007e183b".

Set buffer "publicKey2" to hex value "4370b03dc70378a4f758b46e11
2afd6182bd87ac1d958ca10af4232bcc2d4b46".

Set buffer "sharedKey" to hex value "52726473d2435e45ee4177da4aa
4dfbbec2fcdb58e8496396b9547cd891e7849".

Note: Initialize an AI_MD2Random Algorithm 

Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD2Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "MD2RandIV" and length of initialized 
bytes in "MD2RandIV" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: Setup key generator for first party.


Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmA" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".

Baldwin         Informational, Expires 12/25/1999          25


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Echo data from BER encoded string.
Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgree".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"DHAlgorithmA" and "AI_DHKeyAgree".
Display info structure for "AI_DHKeyAgree".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Setup key generator for second party.

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmB" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate private and public keys for first party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmA" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".
Check equality of buffer "outputA" with contents of buffer 
"publicKey1".

Note: Generate private and public keys for second party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmB" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999          26


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".
Check equality of buffer "outputB" with contents of buffer 
"publicKey2".

Note: First party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and address of 
first initialized byte in buffer "outputB" and length of 
initialized bytes in buffer "outputB" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".

Note: test if first party has produced the correct shared 
Note: secret key

Check equality of buffer "outputA" with contents of buffer 
"sharedKey".

Note: Second party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and address of 
first initialized byte in buffer "publicKey1" and length of 
initialized bytes in buffer "publicKey1" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Note: test if second party has produced the correct shared 
Note: secret key
Note: DataEquals (outputA, @outputB)



This is the end of test case "TVDHKA03".
This is the start of test case "TVDHKA04".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Baldwin         Informational, Expires 12/25/1999          27


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Test Diffie-Hellman Key Agreement using 256 bit prime

Note: A test vector consisting of a fixed prime and a fixed 
Note: base are
Note: passed to both parties to generate 255 bit private 
Note: exponents.
Note: This information is provided in the form of a BER encoded 
Note: string.
Note: Both parties use the same AI_MD2Random object to generate 
Note: their
Note: private keys. This object is first initialized with a 
Note: given vector, used
Note: by the first party and then reused by the second party.
Note: Both parties then exchange their public keys to compute 
Note: their shared
Note: secret key. The generated secret keys are compared to 
Note: each other as well
Note: the expected test vector.

Note: Summary
Note: Given 256 bit prime and base, both parties, using a 
Note: single MD2Random stream
Note: generate key pairs. The computed secret key are compared 
Note: to an expected 
Note: test output vector.


Note: -------------------------------------------------------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_DH_KEY_AGREE", "AM_MD2_RANDOM", 
"NULL_PTR".


Note: Setup data objects

Create algorithm object "DHAlgorithmA".
Call B_CreateAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "DHAlgorithmB".
Call B_CreateAlgorithmObject passing "DHAlgorithmB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "MD2RandIV" of decimal value "100" bytes.
Create buffer "outputA" of decimal value "100" bytes.
Create buffer "outputB" of decimal value "100" bytes.
Create buffer "BERString" of decimal value "400" bytes.
Create buffer "publicKey1" of decimal value "100" bytes.
Create buffer "publicKey2" of decimal value "100" bytes.

Baldwin         Informational, Expires 12/25/1999          28


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create buffer "sharedKey" of decimal value "100" bytes.

Note: Input Test Vectors
Set buffer "BERString" to hex value "305606092a864886f70d0103013
049022100e258c44a865a04f557e37d29434d78483e007d1ff291650b88f2673
b37f9d73702200848be4dd9cb89f026f154f4cbf7647e889f5470cc32b203024
4ea155b4f7312020200ff".

Set buffer "MD2RandIV" to hex value "1111111111111111".

Note: Expected Output Test Vectors
Set buffer "publicKey1" to hex value "5b8b3dbadf868513443a77e26e
78611ed94bdbde5a8dda55fd80b6ee9fd65b62".

Set buffer "publicKey2" to hex value "0704b308d65333b4c8374036a2
192a6c340b73a05b7766b605944c922f599e25".

Set buffer "sharedKey" to hex value "77fa3337e3ea610b61a2d4d9fd3
b75e406dae13a089f684f628f2a1e7ee2b2d6".

Note: Initialize an AI_MD2Random Algorithm 

Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD2Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "MD2RandIV" and length of initialized 
bytes in "MD2RandIV" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: Setup key generator for first party.


Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".

Baldwin         Informational, Expires 12/25/1999          29


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_SetAlgorithmInfo passing "DHAlgorithmA" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Echo data from BER encoded string.
Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgree".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"DHAlgorithmA" and "AI_DHKeyAgree".
Display info structure for "AI_DHKeyAgree".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: Setup key generator for second party.

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmB" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate private and public keys for first party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmA" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".
Check equality of buffer "outputA" with contents of buffer 
"publicKey1".

Note: Generate private and public keys for second party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmB" and "NULL_PTR" 

Baldwin         Informational, Expires 12/25/1999          30


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".
Check equality of buffer "outputB" with contents of buffer 
"publicKey2".

Note: First party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and address of 
first initialized byte in buffer "outputB" and length of 
initialized bytes in buffer "outputB" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".

Note: test if first party has produced the correct shared 
Note: secret key

Check equality of buffer "outputA" with contents of buffer 
"sharedKey".

Note: Second party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and address of 
first initialized byte in buffer "publicKey1" and length of 
initialized bytes in buffer "publicKey1" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Note: test if second party has produced the correct shared 
Note: secret key
Note: DataEquals (outputA, @outputB)



This is the end of test case "TVDHKA04".
This is the start of test case "TVDHKA05".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999          31


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Test Diffie-Hellman Key Agreement using 256 bit prime

Note: A test vector consisting of a fixed prime and a fixed 
Note: base are
Note: passed to both parties to generate 255 bit private 
Note: exponents.
Note: This information is provided in the form of a BER encoded 
Note: string.
Note: The first party uses AI_MD2Random with a given 
Note: initialization
Note: vector to generate its private key. The second party uses 
Note: AI_MD5Random 
Note: with a given initialization vector to generate its 
Note: private key.
Note: Both parties then exchange their public keys in order to 
Note: compute their shared
Note: secret key. The generated secret keys are compared to 
Note: each other as well
Note: the expected test vector.

Note: Summary
Note: Given 256 bit prime and base, and two different 
Note: initialization vectors,
Note: generate key pairs using MD2Random for first party and 
Note: MD5Random for 
Note: second party. Compare computed secret key to expected 
Note: test vector.


Note: -------------------------------------------------------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_DH_KEY_AGREE", "AM_MD2_RANDOM", 
"AM_MD5_RANDOM", "NULL_PTR".


Note: Setup data objects

Create algorithm object "DHAlgorithmA".
Call B_CreateAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "DHAlgorithmB".
Call B_CreateAlgorithmObject passing "DHAlgorithmB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "MD5RandIV" of decimal value "200" bytes.

Baldwin         Informational, Expires 12/25/1999          32


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create buffer "MD2RandIV" of decimal value "200" bytes.
Create buffer "outputA" of decimal value "100" bytes.
Create buffer "outputB" of decimal value "100" bytes.
Create buffer "BERString" of decimal value "400" bytes.
Create buffer "publicKey1" of decimal value "100" bytes.
Create buffer "publicKey2" of decimal value "100" bytes.
Create buffer "sharedKey" of decimal value "100" bytes.

Note: Input Test Vectors
Set buffer "BERString" to hex value "305606092a864886f70d0103013
049022100e258c44a865a04f557e37d29434d78483e007d1ff291650b88f2673
b37f9d73702200848be4dd9cb89f026f154f4cbf7647e889f5470cc32b203024
4ea155b4f7312020200ff".

Set buffer "MD2RandIV" to hex value "1111111111111111".

Set buffer "MD5RandIV" to hex value "2222222222222222".

Note: Expected Output Test Vectors
Set buffer "publicKey1" to hex value "5b8b3dbadf868513443a77e26e
78611ed94bdbde5a8dda55fd80b6ee9fd65b62".

Set buffer "publicKey2" to hex value "54f1f6c5701e4301e806252fa2
1ad748b65e625fd763017b60ff560e32e9aa83".

Set buffer "sharedKey" to hex value "1073ea0d67069431757a09c202a
d224372b41d5eb38b07f436dd2b0228e8add4".

Note: Initialize an AI_MD2Random Algorithm for first party

Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD2Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "MD2RandIV" and length of initialized 
bytes in "MD2RandIV" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999          33


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Initialize an AI_MD5Random Algorithm for second party

Create algorithm object "diffRandomAlgorithm".
Call B_CreateAlgorithmObject passing "diffRandomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "diffRandomAlgorithm" and 
"AI_MD5Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "diffRandomAlgorithm" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "diffRandomAlgorithm" and address 
of first initialized byte in "MD5RandIV" and length of 
initialized bytes in "MD5RandIV" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Setup key generator for first party.


Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmA" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Echo data from BER encoded string.
Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgree".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"DHAlgorithmA" and "AI_DHKeyAgree".
Display info structure for "AI_DHKeyAgree".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Setup key generator for second party.

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 

Baldwin         Informational, Expires 12/25/1999          34


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmB" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate private and public keys for first party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmA" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".
Check equality of buffer "outputA" with contents of buffer 
"publicKey1".

Note: Generate private and public keys for second party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmB" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and 
"diffRandomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".
Check equality of buffer "outputB" with contents of buffer 
"publicKey2".

Note: First party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and address of 
first initialized byte in buffer "outputB" and length of 
initialized bytes in buffer "outputB" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999          35


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".

Note: test if first party has produced the correct shared 
Note: secret key

Check equality of buffer "outputA" with contents of buffer 
"sharedKey".

Note: Second party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and address of 
first initialized byte in buffer "publicKey1" and length of 
initialized bytes in buffer "publicKey1" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Note: test if second party has produced the correct shared 
Note: secret key
Note: DataEquals (outputA, @outputB)



This is the end of test case "TVDHKA05".
This is the start of test case "TVDHKA06".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Test Diffie-Hellman Key Agreement using 256 bit prime

Note: A test vector consisting of a fixed prime and a fixed 
Note: base are
Note: passed to both parties to generate 250 bit private 
Note: exponents.
Note: This information is provided in the form of a BER encoded 
Note: string. Using 
Note: distinct AI_MD5Random streams, each party generates its 
Note: own private key. 
Note: Both parties then exchange their public keys in order to 
Note: compute their shared
Note: secret key. The generated secret keys are compared to 
Note: each other as well
Note: the expected test vector.

Note: Summary

Baldwin         Informational, Expires 12/25/1999          36


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Given 256 bit prime and base, and two different 
Note: initialization vectors,
Note: generate key pairs using MD5Random for both parties. 
Note: Compare computed secret key to expected test vector.


Note: -------------------------------------------------------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_DH_KEY_AGREE", "AM_MD5_RANDOM", 
"NULL_PTR".


Note: Setup data objects

Create algorithm object "DHAlgorithmA".
Call B_CreateAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "DHAlgorithmB".
Call B_CreateAlgorithmObject passing "DHAlgorithmB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "MD5RandIV1" of decimal value "200" bytes.
Create buffer "MD5RandIV2" of decimal value "200" bytes.
Create buffer "outputA" of decimal value "100" bytes.
Create buffer "outputB" of decimal value "100" bytes.
Create buffer "BERString" of decimal value "400" bytes.
Create buffer "publicKey1" of decimal value "100" bytes.
Create buffer "publicKey2" of decimal value "100" bytes.
Create buffer "sharedKey" of decimal value "100" bytes.

Note: Input Test Vectors
Set buffer "BERString" to hex value "305706092a864886f70d0103013
04a022100fb3c81d44a514f036074162330e5930dfb8bc1362b340f79f10a56b
dc9e0cb9f0221008b2075349fef00f168614cf5c50d3268ff3c939824ad85c2a
8237f196ba889c3020200fa".

Set buffer "MD5RandIV1" to hex value "1415161718191a1b868788898a
8b8c8d".

Set buffer "MD5RandIV2" to hex value "1c1d1e1f202122238e8f909192
939495".

Note: Expected Output Test Vectors
Set buffer "publicKey1" to hex value "c37aa9bfca38ef8c393afa8694
144198b8c315abfbb8c4f8fdff2305ffc39ee0".

Set buffer "publicKey2" to hex value "6fb23248ecd17e729d45ea7cb5
e18f3e629d3cabde0730376b6686e5f9cac2f8".


Baldwin         Informational, Expires 12/25/1999          37


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set buffer "sharedKey" to hex value "e67b0aa166e697339d2ab922242
c9c71b3524943673d9a59fffeb6be337c409b".

Note: Initialize an AI_MD5Random Algorithm for first party

Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD5Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "MD5RandIV1" and length of 
initialized bytes in "MD5RandIV1" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Initialize an AI_MD5Random Algorithm for second party

Create algorithm object "diffRandomAlgorithm".
Call B_CreateAlgorithmObject passing "diffRandomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "diffRandomAlgorithm" and 
"AI_MD5Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "diffRandomAlgorithm" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "diffRandomAlgorithm" and address 
of first initialized byte in "MD5RandIV2" and length of 
initialized bytes in "MD5RandIV2" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999          38


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.

Note: Setup key generator for first party.


Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmA" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Echo data from BER encoded string.

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgree".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"DHAlgorithmA" and "AI_DHKeyAgree".
Display info structure for "AI_DHKeyAgree".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Setup key generator for second party.

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmB" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate private and public keys for first party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmA" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999          39


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of buffer "outputA" with contents of buffer 
"publicKey1".

Note: Generate private and public keys for second party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmB" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and 
"diffRandomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".
Check equality of buffer "outputB" with contents of buffer 
"publicKey2".

Note: First party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and address of 
first initialized byte in buffer "outputB" and length of 
initialized bytes in buffer "outputB" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".

Note: test if first party has produced the correct shared 
Note: secret key

Check equality of buffer "outputA" with contents of buffer 
"sharedKey".

Note: Second party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and address of 
first initialized byte in buffer "publicKey1" and length of 
initialized bytes in buffer "publicKey1" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Note: test if second party has produced the correct shared 

Baldwin         Informational, Expires 12/25/1999          40


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: secret key
Note: DataEquals (outputA, @outputB)



This is the end of test case "TVDHKA06".
This is the start of test case "TVDHKA07".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Test Diffie-Hellman Key Agreement using 256 bit prime

Note: A test vector consisting of a fixed prime and a fixed 
Note: base are
Note: passed to both parties to generate 246 bit private 
Note: exponents.
Note: This information is provided in the form of a BER encoded 
Note: string.
Note: The first party uses AI_MD5Random with a given 
Note: initialization vector to 
Note: generate its private key. The second party uses 
Note: AI_MD2Random with a 
Note: given initialization vector to generate its private key.
Note: Both parties then exchange their public keys in order to 
Note: compute their shared
Note: secret key. The generated secret keys are compared to 
Note: each other as well
Note: the expected test vector.

Note: Summary
Note: Given 256 bit prime and base, and two different 
Note: initialization vectors,
Note: generate key pairs using distinct MD5Random streams for 
Note: each party.
Note: Compare computed secret key to expected test vector.


Note: -------------------------------------------------------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_DH_KEY_AGREE", "AM_MD2_RANDOM", 
"AM_MD5_RANDOM", "NULL_PTR".


Note: Setup data objects

Create algorithm object "DHAlgorithmA".
Call B_CreateAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999          41


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create algorithm object "DHAlgorithmB".
Call B_CreateAlgorithmObject passing "DHAlgorithmB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "MD2RandIV" of decimal value "200" bytes.
Create buffer "MD5RandIV" of decimal value "200" bytes.
Create buffer "outputA" of decimal value "100" bytes.
Create buffer "outputB" of decimal value "100" bytes.
Create buffer "BERString" of decimal value "400" bytes.
Create buffer "publicKey1" of decimal value "100" bytes.
Create buffer "publicKey2" of decimal value "100" bytes.
Create buffer "sharedKey" of decimal value "100" bytes.

Note: Input Test Vectors
Set buffer "BERString" to hex value "305606092a864886f70d0103013
049022100e7a16d36abadc1d0a635ede9b09409dafd40833bed2de7df617fce4
0424de9b90220043ddbaf7de9d0b663b9c726599362332123aa3f3056eca33cb
ebc5602f160aa020200f6".

Set buffer "MD5RandIV" to hex value "71263a457a26571d23657f6f35e
67f129a85e472d18b56".

Set buffer "MD2RandIV" to hex value "3c285c6c583d27a549bbb23859a
1f2816345a51236f3ef2a542d1b56".

Note: Expected Output Test Vectors
Set buffer "publicKey1" to hex value "c8a1e5d14ce2ab219685e0d085
a8ab78e161dd18958d27ff2977b5727516c073".

Set buffer "publicKey2" to hex value "2f2b40c49f13577ef90fbd8906
01ea7c282c8329c7e17e0221183211b62d77c0".

Set buffer "sharedKey" to hex value "30509f5a6175d22c8c0ea766fe4
e72508be661d37809464e829f152467c3dc9d".

Note: Initialize an AI_MD5Random Algorithm for first party

Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD5Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999          42


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "MD5RandIV" and length of initialized 
bytes in "MD5RandIV" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Initialize an AI_MD2Random Algorithm for second party

Create algorithm object "diffRandomAlgorithm".
Call B_CreateAlgorithmObject passing "diffRandomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "diffRandomAlgorithm" and 
"AI_MD2Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "diffRandomAlgorithm" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "diffRandomAlgorithm" and address 
of first initialized byte in "MD2RandIV" and length of 
initialized bytes in "MD2RandIV" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Setup key generator for first party.


Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmA" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Echo data from BER encoded string.

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgree".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"DHAlgorithmA" and "AI_DHKeyAgree".

Baldwin         Informational, Expires 12/25/1999          43


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Display info structure for "AI_DHKeyAgree".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Setup key generator for second party.

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmB" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate private and public keys for first party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmA" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".
Check equality of buffer "outputA" with contents of buffer 
"publicKey1".

Note: Generate private and public keys for second party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmB" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and 
"diffRandomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999          44


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of buffer "outputB" with contents of buffer 
"publicKey2".

Note: First party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and address of 
first initialized byte in buffer "outputB" and length of 
initialized bytes in buffer "outputB" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".

Note: test if first party has produced the correct shared 
Note: secret key

Check equality of buffer "outputA" with contents of buffer 
"sharedKey".

Note: Second party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and address of 
first initialized byte in buffer "publicKey1" and length of 
initialized bytes in buffer "publicKey1" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Note: test if second party has produced the correct shared 
Note: secret key
Note: DataEquals (outputA, @outputB)



This is the end of test case "TVDHKA07".
This is the start of test case "TVDHKA08".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Test Diffie-Hellman Key Agreement using 300 bit prime

Note: A test vector consisting of a fixed prime and a fixed 
Note: base are
Note: passed to both parties to generate 290 bit private 
Note: exponents.
Note: This information is provided in the form of a BER encoded 
Note: string.

Baldwin         Informational, Expires 12/25/1999          45


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Both parties use the same AI_MD2Random object to generate 
Note: their
Note: private keys. This object is initialized with the default 
Note: vector, used
Note: by the first party and then reused by the second party.
Note: Both parties then exchange their public keys to compute 
Note: their shared
Note: secret key. The generated secret keys are compared to 
Note: each other as well
Note: the expected test vector.

Note: Summary
Note: Given 300 bit prime and base, both parties, using a 
Note: single MD2Random stream
Note: generate key pairs. The computed secret key are compared 
Note: to an expected 
Note: test output vector.


Note: -------------------------------------------------------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_DH_KEY_AGREE", "AM_MD2_RANDOM", 
"NULL_PTR".


Note: Setup data objects

Create algorithm object "DHAlgorithmA".
Call B_CreateAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "DHAlgorithmB".
Call B_CreateAlgorithmObject passing "DHAlgorithmB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "MD2RandIV" of decimal value "100" bytes.
Create buffer "outputA" of decimal value "100" bytes.
Create buffer "outputB" of decimal value "100" bytes.
Create buffer "BERString" of decimal value "400" bytes.
Create buffer "publicKey1" of decimal value "100" bytes.
Create buffer "publicKey2" of decimal value "100" bytes.
Create buffer "sharedKey" of decimal value "100" bytes.

Note: Input Test Vectors
Set buffer "BERString" to hex value "306106092a864886f70d0103013
05402260c7fdfb89ef76a1e3c795febb4fa73dd5d0756c30ff5be5ef9e4ff056
cf122e343721a554767022603ab528e75b353e8935d9f5454ef3204747ea8b00
c97f8d0277516d5fcbef1a3c2ba8d90180e02020122".

Set buffer "MD2RandIV" to hex value "".

Baldwin         Informational, Expires 12/25/1999          46


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Expected Output Test Vectors
Set buffer "publicKey1" to hex value "01f4b285e206ffd9e2626f4b14
1cbccf4c37ca504d7a849d425adce0bb08d7c09660dbee9a64".

Set buffer "publicKey2" to hex value "02d04256a5fcf8bab73ac22df8
688edb557e84ebb43b7bce26451c7d9fbbe7306d0cd502a631".

Set buffer "sharedKey" to hex value "00db3b3072f1e90b6bba1197dc0
e73b37674a4b7cbbe8ec3095fcc93c8ef15dbd5ba5d93e066".

Note: Initialize an AI_MD2Random Algorithm 

Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD2Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "MD2RandIV" and length of initialized 
bytes in "MD2RandIV" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: Setup key generator for first party.


Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmA" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Echo data from BER encoded string.
Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgree".

Baldwin         Informational, Expires 12/25/1999          47


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"DHAlgorithmA" and "AI_DHKeyAgree".
Display info structure for "AI_DHKeyAgree".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Setup key generator for second party.

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmB" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate private and public keys for first party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmA" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".
Check equality of buffer "outputA" with contents of buffer 
"publicKey1".

Note: Generate private and public keys for second party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmB" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999          48


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".
Check equality of buffer "outputB" with contents of buffer 
"publicKey2".

Note: First party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and address of 
first initialized byte in buffer "outputB" and length of 
initialized bytes in buffer "outputB" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".

Note: test if first party has produced the correct shared 
Note: secret key

Check equality of buffer "outputA" with contents of buffer 
"sharedKey".

Note: Second party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and address of 
first initialized byte in buffer "publicKey1" and length of 
initialized bytes in buffer "publicKey1" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Note: test if second party has produced the correct shared 
Note: secret key
Note: DataEquals (outputA, @outputB)



This is the end of test case "TVDHKA08".
This is the start of test case "TVDHKA09".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Test Diffie-Hellman Key Agreement using 300 bit prime

Note: A test vector consisting of a fixed prime and a fixed 
Note: base are
Note: passed to both parties to generate 290 bit private 
Note: exponents.

Baldwin         Informational, Expires 12/25/1999          49


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: This information is provided in the form of a BER encoded 
Note: string.
Note: Both parties use the same AI_MD2Random object to generate 
Note: their
Note: private keys. This object is initialized with a zero 
Note: vector, used
Note: by the first party and then reused by the second party.
Note: Both parties then exchange their public keys in order to 
Note: compute their shared
Note: secret key. The generated secret keys are compared to 
Note: each other as well
Note: the expected test vector.

Note: Summary
Note: Given 300 bit prime and base, both parties, using a 
Note: single MD2Random stream
Note: generate key pairs. The computed secret key are compared 
Note: to an expected 
Note: test output vector.


Note: -------------------------------------------------------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_DH_KEY_AGREE", "AM_MD2_RANDOM", 
"NULL_PTR".


Note: Setup data objects

Create algorithm object "DHAlgorithmA".
Call B_CreateAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "DHAlgorithmB".
Call B_CreateAlgorithmObject passing "DHAlgorithmB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "MD2RandIV" of decimal value "256" bytes.
Create buffer "outputA" of decimal value "100" bytes.
Create buffer "outputB" of decimal value "100" bytes.
Create buffer "BERString" of decimal value "400" bytes.
Create buffer "publicKey1" of decimal value "100" bytes.
Create buffer "publicKey2" of decimal value "100" bytes.
Create buffer "sharedKey" of decimal value "100" bytes.

Note: Input Test Vectors
Set buffer "BERString" to hex value "306106092a864886f70d0103013
05402260c7fdfb89ef76a1e3c795febb4fa73dd5d0756c30ff5be5ef9e4ff056
cf122e343721a554767022603ab528e75b353e8935d9f5454ef3204747ea8b00
c97f8d0277516d5fcbef1a3c2ba8d90180e02020122".

Baldwin         Informational, Expires 12/25/1999          50


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Set buffer "MD2RandIV" to hex value "000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000".

Note: Expected Output Test Vectors
Set buffer "publicKey1" to hex value "01685726135d90b1724e7c7e13
23e1e3ae7554b848ed82bb26eddf65540bdc84d46ec64b5aa9".

Set buffer "publicKey2" to hex value "0aa7ae5ae28d98d2ca7d817671
202caa2edf76c8ebc9f1f7b60c01fd40ccac7f53b4fd0b569a".

Set buffer "sharedKey" to hex value "09494f96a9641fd6be6142d8443
c6bd5391ca6f4c7e5b93816f102cc412e8c1476f5269240d8".

Note: Initialize an AI_MD2Random Algorithm 

Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD2Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "MD2RandIV" and length of initialized 
bytes in "MD2RandIV" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: Setup key generator for first party.


Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 

Baldwin         Informational, Expires 12/25/1999          51


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmA" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Echo data from BER encoded string.
Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgree".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"DHAlgorithmA" and "AI_DHKeyAgree".
Display info structure for "AI_DHKeyAgree".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: Setup key generator for second party.

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmB" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate private and public keys for first party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmA" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".
Check equality of buffer "outputA" with contents of buffer 
"publicKey1".

Note: Generate private and public keys for second party, and 
Note: test public key
Note: against test vector.


Baldwin         Informational, Expires 12/25/1999          52


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_KeyAgreeInit passing "DHAlgorithmB" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".
Check equality of buffer "outputB" with contents of buffer 
"publicKey2".

Note: First party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and address of 
first initialized byte in buffer "outputB" and length of 
initialized bytes in buffer "outputB" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".

Note: test if first party has produced the correct shared 
Note: secret key

Check equality of buffer "outputA" with contents of buffer 
"sharedKey".

Note: Second party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and address of 
first initialized byte in buffer "publicKey1" and length of 
initialized bytes in buffer "publicKey1" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Note: test if second party has produced the correct shared 
Note: secret key
Note: DataEquals (outputA, @outputB)



This is the end of test case "TVDHKA09".
This is the start of test case "TVDHKA10".

Baldwin         Informational, Expires 12/25/1999          53


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Test Diffie-Hellman Key Agreement using 300 bit prime

Note: A test vector consisting of a fixed prime and a fixed 
Note: base are
Note: passed to both parties to generate 290 bit private 
Note: exponents.
Note: This information is provided in the form of a BER encoded 
Note: string.
Note: Both parties use the same AI_MD2Random object to generate 
Note: their
Note: private keys. This object is initialized with a given 
Note: test vector, used
Note: by the first party and then reused by the second party.
Note: Both parties then exchange their public keys in order to 
Note: compute their shared
Note: secret key. The generated secret keys are compared to 
Note: each other as well
Note: the expected test vector.

Note: Summary
Note: Given 300 bit prime and base, both parties, using a 
Note: single MD2Random stream
Note: generate key pairs. The computed secret key are compared 
Note: to an expected 
Note: test output vector.


Note: -------------------------------------------------------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_DH_KEY_AGREE", "AM_MD2_RANDOM", 
"NULL_PTR".


Note: Setup data objects

Create algorithm object "DHAlgorithmA".
Call B_CreateAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "DHAlgorithmB".
Call B_CreateAlgorithmObject passing "DHAlgorithmB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "MD2RandIV" of decimal value "100" bytes.
Create buffer "outputA" of decimal value "100" bytes.

Baldwin         Informational, Expires 12/25/1999          54


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create buffer "outputB" of decimal value "100" bytes.
Create buffer "BERString" of decimal value "400" bytes.
Create buffer "publicKey1" of decimal value "100" bytes.
Create buffer "publicKey2" of decimal value "100" bytes.
Create buffer "sharedKey" of decimal value "100" bytes.

Note: Input Test Vectors
Set buffer "BERString" to hex value "306106092a864886f70d0103013
05402260c7fdfb89ef76a1e3c795febb4fa73dd5d0756c30ff5be5ef9e4ff056
cf122e343721a554767022603ab528e75b353e8935d9f5454ef3204747ea8b00
c97f8d0277516d5fcbef1a3c2ba8d90180e02020122".

Set buffer "MD2RandIV" to hex value "123456789abcdef0".

Note: Expected Output Test Vectors
Set buffer "publicKey1" to hex value "0a4cf11676a3a91ff33cd1f727
62ee3aef1b64bb3acf7bd82b47e5323a9457084f58a06bdace".

Set buffer "publicKey2" to hex value "070f06c116dec187fe28c82000
9629510279a5bebd18760d5f8cda6e3edbca9560760e311066".

Set buffer "sharedKey" to hex value "05ab11f65f73d8fbe909c5f6b9a
90aaca01a9e168191dab2148d2ff0645256680dd0148eea6d".

Note: Initialize an AI_MD2Random Algorithm 

Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD2Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "MD2RandIV" and length of initialized 
bytes in "MD2RandIV" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: Setup key generator for first party.


Baldwin         Informational, Expires 12/25/1999          55


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmA" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Echo data from BER encoded string.
Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgree".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"DHAlgorithmA" and "AI_DHKeyAgree".
Display info structure for "AI_DHKeyAgree".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: Setup key generator for second party.

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmB" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate private and public keys for first party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmA" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".
Check equality of buffer "outputA" with contents of buffer 
"publicKey1".

Note: Generate private and public keys for second party, and 

Baldwin         Informational, Expires 12/25/1999          56


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmB" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".
Check equality of buffer "outputB" with contents of buffer 
"publicKey2".

Note: First party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and address of 
first initialized byte in buffer "outputB" and length of 
initialized bytes in buffer "outputB" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".

Note: test if first party has produced the correct shared 
Note: secret key

Check equality of buffer "outputA" with contents of buffer 
"sharedKey".

Note: Second party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and address of 
first initialized byte in buffer "publicKey1" and length of 
initialized bytes in buffer "publicKey1" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Note: test if second party has produced the correct shared 
Note: secret key
Note: DataEquals (outputA, @outputB)



Baldwin         Informational, Expires 12/25/1999          57


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


This is the end of test case "TVDHKA10".
This is the start of test case "TVDHKA11".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Test Diffie-Hellman Key Agreement using 479 bit prime

Note: A test vector consisting of a fixed prime and a fixed 
Note: base are
Note: passed to both parties to generate 470 bit private 
Note: exponents.
Note: This information is provided in the form of a BER encoded 
Note: string.
Note: The first party uses AI_MD5Random with a given 
Note: initialization
Note: vector to generate its private key. The second party uses 
Note: AI_MD2Random 
Note: with the same initialization vector to generate its 
Note: private key.
Note: Both parties then exchange their public keys to compute 
Note: their shared
Note: secret key. The generated secret keys are compared to 
Note: each other as well
Note: the expected test vector.

Note: Summary
Note: Given 479 bit prime and base, and an initialization 
Note: vector,
Note: generate key pairs using MD5Random for first party and 
Note: MD2Random for 
Note: second party. Compare computed secret key to expected 
Note: test vector.


Note: -------------------------------------------------------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_DH_KEY_AGREE", "AM_MD2_RANDOM", 
"AM_MD5_RANDOM", "NULL_PTR".


Note: Setup data objects

Create algorithm object "DHAlgorithmA".
Call B_CreateAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "DHAlgorithmB".
Call B_CreateAlgorithmObject passing "DHAlgorithmB".

Baldwin         Informational, Expires 12/25/1999          58


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "randIV" of decimal value "200" bytes.
Create buffer "outputA" of decimal value "100" bytes.
Create buffer "outputB" of decimal value "100" bytes.
Create buffer "BERString" of decimal value "400" bytes.
Create buffer "publicKey1" of decimal value "100" bytes.
Create buffer "publicKey2" of decimal value "100" bytes.
Create buffer "sharedKey" of decimal value "100" bytes.

Note: Input Test Vectors
Set buffer "BERString" to hex value "30818e06092a864886f70d01030
1308180023c6d861a736462e5f2628eefbf4c9913522a4dfde5b655b02ef2519
3616bd3f5ddd36d6321ec01a8f0c4fd4e44d9e02fb019e45e19b42f469d434e6
70d023c1785465a832ac028ad4ee07b8dc73b0b59612c2747b3e26e3f8589796
87df06da851a17d2eca9c05e06d3da832092fd7d816566c80151cc95c6409720
20201d6".

Set buffer "randIV" to hex value "23f974e01b90f6104c664e960f3e95
8b1f9571c26c38b2".

Note: Expected Output Test Vectors
Set buffer "publicKey1" to hex value "44e5ae0ba8d11d23f3187f42c1
55da508394ff569b7d3640da5e16eea192979a3c71fd729b086b10baef83b8c0
9457f754f5589ca38ff188348edce2".

Set buffer "publicKey2" to hex value "20b46b27bc1baaa4a3e4e58d90
690e1a6cc070013040aa551aac3642212aeb8d4c915adce34aef1fcf57682b94
9f733cf82e740c1d276d42fdde5df0".

Set buffer "sharedKey" to hex value "43f90fd12d83934f2a65ab08ed5
fb107053c6646a8b47d78c6306b87a719808105b9c2f4d650523e37a71eccc97
d12de962ad25ee68c3bdb99795ab4".

Note: Initialize an AI_MD5Random Algorithm for first party

Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD5Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999          59


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "randIV" and length of initialized 
bytes in "randIV" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Initialize an AI_MD2Random Algorithm for second party

Create algorithm object "diffRandomAlgorithm".
Call B_CreateAlgorithmObject passing "diffRandomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "diffRandomAlgorithm" and 
"AI_MD2Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "diffRandomAlgorithm" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "diffRandomAlgorithm" and address 
of first initialized byte in "randIV" and length of initialized 
bytes in "randIV" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Setup key generator for first party.


Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmA" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Echo data from BER encoded string.

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgree".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"DHAlgorithmA" and "AI_DHKeyAgree".
Display info structure for "AI_DHKeyAgree".

Baldwin         Informational, Expires 12/25/1999          60


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Setup key generator for second party.

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmB" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate private and public keys for first party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmA" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".
Check equality of buffer "outputA" with contents of buffer 
"publicKey1".

Note: Generate private and public keys for second party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmB" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and 
"diffRandomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".
Check equality of buffer "outputB" with contents of buffer 

Baldwin         Informational, Expires 12/25/1999          61


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"publicKey2".

Note: First party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and address of 
first initialized byte in buffer "outputB" and length of 
initialized bytes in buffer "outputB" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".

Note: test if first party has produced the correct shared 
Note: secret key

Check equality of buffer "outputA" with contents of buffer 
"sharedKey".

Note: Second party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and address of 
first initialized byte in buffer "publicKey1" and length of 
initialized bytes in buffer "publicKey1" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Note: test if second party has produced the correct shared 
Note: secret key
Note: DataEquals (outputA, @outputB)



This is the end of test case "TVDHKA11".
This is the start of test case "TVDHKA12".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Test Diffie-Hellman Key Agreement using 512 bit prime

Note: A test vector consisting of a fixed prime and a fixed 
Note: base are
Note: passed to both parties to generate 511 bit private 
Note: exponents.
Note: This information is provided in the form of a BER encoded 
Note: string.
Note: Using distinct AI_MD5Random streams, each party generates 

Baldwin         Informational, Expires 12/25/1999          62


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: its own private
Note: key. Both parties then exchange their public keys to in 
Note: order to compute 
Note: their shared secret key. The generated secret keys are 
Note: compared to each 
Note: other as well the expected test vector.

Note: Summary
Note: Given 512 bit prime and base, and two different 
Note: initialization vectors,
Note: generate key pairs using MD5Random for both parties. 
Note: Compare computed shared secret key to expected test 
Note: vector.


Note: -------------------------------------------------------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_DH_KEY_AGREE", "AM_MD5_RANDOM", 
"NULL_PTR".


Note: Setup data objects

Create algorithm object "DHAlgorithmA".
Call B_CreateAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "DHAlgorithmB".
Call B_CreateAlgorithmObject passing "DHAlgorithmB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "MD5RandIV1" of decimal value "200" bytes.
Create buffer "MD5RandIV2" of decimal value "200" bytes.
Create buffer "outputA" of decimal value "200" bytes.
Create buffer "outputB" of decimal value "200" bytes.
Create buffer "BERString" of decimal value "400" bytes.
Create buffer "publicKey1" of decimal value "200" bytes.
Create buffer "publicKey2" of decimal value "200" bytes.
Create buffer "sharedKey" of decimal value "200" bytes.

Note: Input Test Vectors
Set buffer "BERString" to hex value "30819706092a864886f70d01030
1308189024100e6d2dfe4e920d8ef148e748d6c950001cb5876fac1ac581f7a1
9cf734ce38b6f861d984bbc03662a759c9b345be8ea7d7b4a616ff6f7f13a9cd
cd0c125aff23302402a597600fb7e925757c6765cb36d29e1f6848a0e93a79ec
8734bfd71678e12e46aefa61126f704f548349140cef758cfb587e8d76448876
4e680b7063f52322e020201ff".

Set buffer "MD5RandIV1" to hex value "a6d23d4f974e01b90f6010a49c
76c64e9610f03e89a58b14".

Baldwin         Informational, Expires 12/25/1999          63


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Set buffer "MD5RandIV2" to hex value "d928f5693b271c906a82d175d9
20a019b465e72f19c210".

Note: Expected Output Test Vectors
Set buffer "publicKey1" to hex value "465407b618285cbf54b3bf1d3e
f3db175480cf25b3609abb2ef76fe4a5c5c7426fe01404b39d2acc2fa399d65e
f4b6638f75f808bd10f84b7b73389d578ebe67".

Set buffer "publicKey2" to hex value "7eece1b6fcfd45856668fc9f17
91f003edea3897280a689f53589b0a3d45c3d266e02950b4de1e9cc386403be2
db588cdb184d275b964a44a43035cd60a55b4c".

Set buffer "sharedKey" to hex value "c23efa13121622463c226c2d1bd
9e37b6d7798ef14b489de5c544de540bb6fcb6ef052b28188739b1eafaa71b92
7a8d94be259451c375f41f0d47b2f3f2a2ae4".

Note: Initialize an AI_MD5Random Algorithm for first party

Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD5Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "MD5RandIV1" and length of 
initialized bytes in "MD5RandIV1" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Initialize an AI_MD5Random Algorithm for second party

Create algorithm object "diffRandomAlgorithm".
Call B_CreateAlgorithmObject passing "diffRandomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "diffRandomAlgorithm" and 

Baldwin         Informational, Expires 12/25/1999          64


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_MD5Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "diffRandomAlgorithm" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "diffRandomAlgorithm" and address 
of first initialized byte in "MD5RandIV2" and length of 
initialized bytes in "MD5RandIV2" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Setup key generator for first party.


Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmA" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Echo data from BER encoded string.

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgree".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"DHAlgorithmA" and "AI_DHKeyAgree".
Display info structure for "AI_DHKeyAgree".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Setup key generator for second party.

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmB" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate private and public keys for first party, and 
Note: test public key
Note: against test vector.

Baldwin         Informational, Expires 12/25/1999          65


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Call Call B_KeyAgreeInit passing "DHAlgorithmA" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".
Check equality of buffer "outputA" with contents of buffer 
"publicKey1".

Note: Generate private and public keys for second party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmB" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and 
"diffRandomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".
Check equality of buffer "outputB" with contents of buffer 
"publicKey2".

Note: First party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and address of 
first initialized byte in buffer "outputB" and length of 
initialized bytes in buffer "outputB" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".

Note: test if first party has produced the correct shared 
Note: secret key

Check equality of buffer "outputA" with contents of buffer 
"sharedKey".

Baldwin         Informational, Expires 12/25/1999          66


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Second party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and address of 
first initialized byte in buffer "publicKey1" and length of 
initialized bytes in buffer "publicKey1" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Note: test if second party has produced the correct shared 
Note: secret key
Note: DataEquals (outputA, @outputB)



This is the end of test case "TVDHKA12".
This is the start of test case "TVDHKA13".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Test Diffie-Hellman Key Agreement using 705 bit prime

Note: A test vector consisting of a fixed prime and a fixed 
Note: base are
Note: passed to both parties to generate 701 bit private 
Note: exponents.
Note: This information is provided in the form of a BER encoded 
Note: string.
Note: Using distinct AI_MD2Random streams, each party generates 
Note: its own private
Note: key. Both parties then exchange their public keys in 
Note: order to compute their 
Note: shared secret key. The generated secret keys are compared 
Note: to each other as 
Note: well the expected test vector.

Note: Summary
Note: Given 705 bit prime and base, and two different 
Note: initialization vectors,
Note: generate key pairs using MD2Random for both parties. 
Note: Compare computed shared secret key to expected test 
Note: vector.


Note: -------------------------------------------------------

Note: Start with the GlobalInit

Baldwin         Informational, Expires 12/25/1999          67


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Chooser" to "AM_DH_KEY_AGREE", "AM_MD2_RANDOM", 
"NULL_PTR".


Note: Setup data objects

Create algorithm object "DHAlgorithmA".
Call B_CreateAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "DHAlgorithmB".
Call B_CreateAlgorithmObject passing "DHAlgorithmB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "MD2RandIV1" of decimal value "200" bytes.
Create buffer "MD2RandIV2" of decimal value "200" bytes.
Create buffer "outputA" of decimal value "200" bytes.
Create buffer "outputB" of decimal value "200" bytes.
Create buffer "BERString" of decimal value "600" bytes.
Create buffer "publicKey1" of decimal value "200" bytes.
Create buffer "publicKey2" of decimal value "200" bytes.
Create buffer "sharedKey" of decimal value "200" bytes.

Note: Input Test Vectors
Set buffer "BERString" to hex value "3081c806092a864886f70d01030
13081ba025901ec9b7e86e486a2ba7916b7e23b0cd2f0f1ad3c73ca74728081c
b2b2723ec413b6fccf5a1d95ac3b4d46048bca1adef04c33a05453a3a4df1f37
fd0db4a2640969704adc5886bffebbcf11e537224715dbddab00300c2480d025
9008c2e4cc68ccf22470201bdedbabe7a1ded8d05a1a9ece2d23c51245aafd3d
4892ff04b8095952b92ced6e23b9eb723df2227362631dfa6aec48095d8a2150
dc37da9228c67315e27a38d708aa1ebe711bc217f374889281d020202bd".

Set buffer "MD2RandIV1" to hex value "0102030405060708090a0b0c0d
0e0f".

Set buffer "MD2RandIV2" to hex value "6b8107278d84858f8c81838a8d
5cb7ba13d82c6f".

Note: Expected Output Test Vectors
Set buffer "publicKey1" to hex value "000ee00218ab5f5688eb741853
e81b882c9d043e41115018847e748291ce651dee73c66c8300802f67d4d3def9
5850f152811c72db7affd82f8331975ad694ccea61d8512ad4e60810870471b3
cf767b137ebb54610c305b9a".

Set buffer "publicKey2" to hex value "006abb11ff2e618a9119ee9b2c
5d865fd472a8e1681d52edc2754d051ff6e855be96b79712f14ff11a6beea880
3155b6934de8e3ea8c8dc5e0ff031e3ab49c065f5f71fe8db9f4e7b85811bfde
6526f9b3f0fd134f546c947f".


Set buffer "sharedKey" to hex value "00945b88af739157b2ed3e4042d

Baldwin         Informational, Expires 12/25/1999          68


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

ff2228db8bc29c50f7f01a0a13b240fc4af309ea360951fcda19a84e77629335
6b3046e27e81f241cc691555efe629089a1420fb22c62f6c254aa018faf46021
7457847c64ceca7fe860f33".

Note: Initialize an AI_MD2Random Algorithm for first party

Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD2Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "MD2RandIV1" and length of 
initialized bytes in "MD2RandIV1" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Initialize an AI_MD2Random Algorithm for second party

Create algorithm object "diffRandomAlgorithm".
Call B_CreateAlgorithmObject passing "diffRandomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "diffRandomAlgorithm" and 
"AI_MD2Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "diffRandomAlgorithm" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "diffRandomAlgorithm" and address 
of first initialized byte in "MD2RandIV2" and length of 
initialized bytes in "MD2RandIV2" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999          69


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Setup key generator for first party.


Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmA" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Echo data from BER encoded string.

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgree".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"DHAlgorithmA" and "AI_DHKeyAgree".
Display info structure for "AI_DHKeyAgree".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Setup key generator for second party.

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer 
"BERString".
Call B_SetAlgorithmInfo passing "DHAlgorithmB" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate private and public keys for first party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmA" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999          70


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Increment length of buffer "outputA" by "_OutputLen".
Check equality of buffer "outputA" with contents of buffer 
"publicKey1".

Note: Generate private and public keys for second party, and 
Note: test public key
Note: against test vector.

Call Call B_KeyAgreeInit passing "DHAlgorithmB" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and 
"diffRandomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".
Check equality of buffer "outputB" with contents of buffer 
"publicKey2".

Note: First party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and address of 
first initialized byte in buffer "outputB" and length of 
initialized bytes in buffer "outputB" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".

Note: test if first party has produced the correct shared 
Note: secret key

Check equality of buffer "outputA" with contents of buffer 
"sharedKey".

Note: Second party is computing shared secret key.
Call B_KeyAgreePhase2 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and address of 
first initialized byte in buffer "publicKey1" and length of 
initialized bytes in buffer "publicKey1" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".


Baldwin         Informational, Expires 12/25/1999          71


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: test if second party has produced the correct shared 
Note: secret key
Note: DataEquals (outputA, @outputB)



This is the end of test case "TVDHKA13".
This is the start of test case "TVHMCMD5".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Generate 24 byte key and use it to perform HMAC and test 
Note: it against
Note: test vector generated by running SET based code


Create buffer "keytext" of decimal value "24" bytes.
Set buffer "keytext" to hex value "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0
b0b".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate an HMAC code.


Create algorithm object "HMAC_Digester".
Call B_CreateAlgorithmObject passing "HMAC_Digester".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Set "_InfoPointer" to address of info structure for "AI_HMAC" 
initialized from "AI_MD5", "NULL_PTR".
Call B_SetAlgorithmInfo passing "HMAC_Digester" and "AI_HMAC" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Baldwin         Informational, Expires 12/25/1999          72


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Create buffer "dataToDigest" of decimal value "32" bytes.
Create buffer "HMACdigest" of decimal value "64" bytes.
Set buffer "dataToDigest" to hex value "4869205468657265".

Note: Use the private key to sign.

Call Call B_DigestInit passing "HMAC_Digester" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "HMAC_Digester" and address of 
first initialized byte in buffer "dataToDigest" and length of 
initialized bytes in buffer "dataToDigest" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "HMAC_Digester" and address of next 
free byte in buffer "HMACdigest" and address of "_OutputLen" 
and length of free bytes in buffer "HMACdigest" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "HMACdigest" by "_OutputLen".
Finalize buffer "HMACdigest".
Check equality of buffer "HMACdigest" with hex value 
"9294727a3638bb1c13f48ef8158bfc9d".
Display buffer "HMACdigest".



Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "HMAC_Digester".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.







This is the end of test case "TVHMCMD5".
This is the start of test case "TVMD2R00".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".

Baldwin         Informational, Expires 12/25/1999          73


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_SurrenderContext" to "NULL_PTR".


Note: Test vectors for AI_MD2Random using BSafe 3.0 behavior.

Note: Note there are different expected results for BSafe 3.0
Note: and BSafe 2.x.  This file has the expected results for
Note: BSafe 3.0.

Note: Depends on:
Note: AI_MD2
Note: AI_MD2Random

Note: Test cases:
Note: - For a given one byte seed check the result against the
Note: expected MD2 operations.  Generate 16, 12, 32 bytes. 
Note: - For a given 100 byte seed check the result against the
Note: expected MD2 operations.  Generate 16, 12, 32 bytes.
Note: - Check the result for a two bytes seed passed as two
Note: calls to RandomUpdate matches one call.  Generate 
Note: 48 bytes to check state incrementing.
Note: - Check adding new seed bytes after GenerateBytes call.
Note: Call RandomUpdate twice and generate 32 bytes.

Note: ----------------------------------------------------------
Note: -------

Note: Choose the BSafe 3.0 AM

Set "_Chooser" to "AM_MD2", "AM_MD2_RANDOM", "NULL_PTR".

Note: Start with the GlobalInit
Set "_Chooser" to "AM_MD2", "AM_MD2_RANDOM", "NULL_PTR".


Note: Setup Data Objects

Create buffer "oneByte" of decimal value "1" bytes.
Create buffer "twoBytes" of decimal value "2" bytes.
Create buffer "bigSeed" of decimal value "256" bytes.
Create buffer "randomOutput" of decimal value "1000" bytes.
Create buffer "digestOutput" of decimal value "1000" bytes.
Note: ----------------------------------------------------------
Note: -------
Note: Setup Algorithm Objects

Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2Random" initialized from "NULL_PTR".

Baldwin         Informational, Expires 12/25/1999          74


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD2Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "digestAlgorithm".
Call B_CreateAlgorithmObject passing "digestAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "AI_MD2" 
initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "digestAlgorithm" and "AI_MD2" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: -------
Note: - For a given one byte seed check the result against the
Note: expected MD2 operations. 

Note: Seed the generator

Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "oneByte" to hex value "12".
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Compute expected result

Call Call B_DigestInit passing "digestAlgorithm" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "oneByte" and length of 
initialized bytes in buffer "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 

Baldwin         Informational, Expires 12/25/1999          75


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"3238a25051baa87ca3455dc022feae65".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"f68063d0de9ca6be78f7e5a9a0f8e81d".

Note: Generate random values

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with contents of buffer 
"digestOutput".

Note: Check buffering of available output bytes.

Set "_OutputLen" to decimal value "12".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999          76


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"bb6e5d9c97a90efe660477ea".
Set "_OutputLen" to decimal value "32".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"fdd7d3084a708d50bf142042f6c999b231bc8c66a8429d4afd93179c1d10c31
0".

Note: Compute expected result for subsequent values

Set buffer "digestOutput" to hex value "3238a25051baa87ca3455dc0
22feae66".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"bb6e5d9c97a90efe660477eafdd7d308".
Set buffer "digestOutput" to hex value "3238a25051baa87ca3455dc0
22feae67".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 

Baldwin         Informational, Expires 12/25/1999          77


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"4a708d50bf142042f6c999b231bc8c66".
Set buffer "digestOutput" to hex value "3238a25051baa87ca3455dc0
22feae68".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"a8429d4afd93179c1d10c31056ec9606".

Note: ----------------------------------------------------------
Note: -------
Note: - For a given 100 byte seed check the result against the
Note: expected MD2 operations.  Generate 16, 12, 32 bytes.

Note: Seed the generator

Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "bigSeed" to hex value "01020304050607080910010203040
5060708091001020304050607080910010203040506070809100102030405060
7080910010203040506070809100102030405060708091001020304050607080
9100102030405060708091001020304050607080910".
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "bigSeed" and length of initialized 
bytes in "bigSeed" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999          78


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Compute expected result

Call Call B_DigestInit passing "digestAlgorithm" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "bigSeed" and length of 
initialized bytes in buffer "bigSeed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"ea04d524b856cf388246997ea7946295".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"0d2dc33854380f4d3c7f79896fecdc7e".

Note: Generate random values

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999          79


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with contents of buffer 
"digestOutput".

Note: Check buffering of available output bytes.

Set "_OutputLen" to decimal value "12".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"b265099d7511e8d82b831d61".
Set "_OutputLen" to decimal value "32".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"6ee6449da723bac4922a13ec71a984d5d596cbc189433d94b3f0f12fd6dd530
5".

Note: Compute expected result for subsequent values

Set buffer "digestOutput" to hex value "ea04d524b856cf388246997e
a7946296".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999          80


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"b265099d7511e8d82b831d616ee6449d".
Set buffer "digestOutput" to hex value "ea04d524b856cf388246997e
a7946297".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"a723bac4922a13ec71a984d5d596cbc1".
Set buffer "digestOutput" to hex value "ea04d524b856cf388246997e
a7946298".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"89433d94b3f0f12fd6dd53059cc78c96".

Note: ----------------------------------------------------------
Note: -------

Baldwin         Informational, Expires 12/25/1999          81


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: - Check the result for a two bytes seed passed as two
Note: calls to RandomUpdate matches one call.  Generate 48 
Note: bytes.

Note: Seed the generator

Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "oneByte" to hex value "12".
Set buffer "twoBytes" to hex value "1212".
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Compute expected result

Call Call B_DigestInit passing "digestAlgorithm" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "twoBytes" and length of 
initialized bytes in buffer "twoBytes" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999          82


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".

Note: Generate random values

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"eccf29fc41d08258138218a46f3eb070".

Note: Check incrementing state.

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"fd953e253b75afbf0dad460bb5e654ed".

Note: Check incrementing state.

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999          83


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"72d9a38e80e63dd1b62b889b61972301".

Note: ----------------------------------------------------------
Note: -------
Note: - Check adding new seed bytes after GenerateBytes call.
Note: Call RandomUpdate twice and generate 32 bytes.
Note: NOTE this in continued from the previous test.

Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate random values

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"15b0a1c7931ca323304ca81b9080df47".

Note: Check incrementing state.

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 

Baldwin         Informational, Expires 12/25/1999          84


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"c3c9320871f47a7d6408cce64fad29f7".

Note: ----------------------------------------------------------
Note: -------
Note: Cleanup. 
Call Call B_DestroyAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
This is the end of test case "TVMD2R00".
This is the start of test case "TVMD2RX0".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Test vectors for AI_MD2Random.

Note: Note there are different expected results for BSafe 3.0
Note: and BSafe 2.x.  This file has the expected results for
Note: BSafe 2.x.

Note: Depends on:
Note: AI_MD2
Note: AI_MD2Random

Note: Test cases:
Note: - For a given one byte seed check the result against the
Note: expected MD2 operations.  Generate 16, 12, 32 bytes. 
Note: - For a given 100 byte seed check the result against the
Note: expected MD2 operations.  Generate 16, 12, 32 bytes.
Note: - Check the result for a two bytes seed passed as two
Note: calls to RandomUpdate matches one call.  Generate 
Note: 48 bytes to check state incrementing.
Note: - Check adding new seed bytes after GenerateBytes call.
Note: Call RandomUpdate twice and generate 32 bytes.

Note: ----------------------------------------------------------
Note: -------

Note: Choose the BSafe 2.x AM

Set "_Chooser" to "AM_MD2", "AM_MD2_RANDOM_2X", "NULL_PTR".

Note: Start with the GlobalInit
Set "_Chooser" to "AM_MD2", "AM_MD2_RANDOM_2X", "NULL_PTR".


Note: Setup Data Objects

Create buffer "oneByte" of decimal value "1" bytes.
Create buffer "twoBytes" of decimal value "2" bytes.
Create buffer "bigSeed" of decimal value "256" bytes.

Baldwin         Informational, Expires 12/25/1999          85


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create buffer "randomOutput" of decimal value "1000" bytes.
Create buffer "digestOutput" of decimal value "1000" bytes.
Note: ----------------------------------------------------------
Note: -------
Note: Setup Algorithm Objects

Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD2Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "digestAlgorithm".
Call B_CreateAlgorithmObject passing "digestAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "AI_MD2" 
initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "digestAlgorithm" and "AI_MD2" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: -------
Note: - For a given one byte seed check the result against the
Note: expected MD2 operations. 

Note: Seed the generator

Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "oneByte" to hex value "12".
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Compute expected result


Baldwin         Informational, Expires 12/25/1999          86


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_DigestInit passing "digestAlgorithm" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "oneByte" and length of 
initialized bytes in buffer "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"3238a25051baa87ca3455dc022feae65".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"f68063d0de9ca6be78f7e5a9a0f8e81d".

Note: Generate random values

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999          87


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with contents of buffer 
"digestOutput".

Note: Check buffering of available output bytes.

Set "_OutputLen" to decimal value "12".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"bb6e5d9c97a90efe660477ea".
Set "_OutputLen" to decimal value "32".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"fdd7d3084a708d50bf142042f6c999b231bc8c66a8429d4afd93179c1d10c31
0".

Note: Compute expected result for subsequent values

Set buffer "digestOutput" to hex value "3238a25051baa87ca3455dc0
22feae66".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".

Baldwin         Informational, Expires 12/25/1999          88


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"bb6e5d9c97a90efe660477eafdd7d308".
Set buffer "digestOutput" to hex value "3238a25051baa87ca3455dc0
22feae67".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"4a708d50bf142042f6c999b231bc8c66".
Set buffer "digestOutput" to hex value "3238a25051baa87ca3455dc0
22feae68".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"a8429d4afd93179c1d10c31056ec9606".

Note: ----------------------------------------------------------
Note: -------
Note: - For a given 100 byte seed check the result against the
Note: expected MD2 operations.  Generate 16, 12, 32 bytes.

Note: Seed the generator


Baldwin         Informational, Expires 12/25/1999          89


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "bigSeed" to hex value "01020304050607080910010203040
5060708091001020304050607080910010203040506070809100102030405060
7080910010203040506070809100102030405060708091001020304050607080
9100102030405060708091001020304050607080910".
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "bigSeed" and length of initialized 
bytes in "bigSeed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Compute expected result

Call Call B_DigestInit passing "digestAlgorithm" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "bigSeed" and length of 
initialized bytes in buffer "bigSeed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"ea04d524b856cf388246997ea7946295".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999          90


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"0d2dc33854380f4d3c7f79896fecdc7e".

Note: Generate random values

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with contents of buffer 
"digestOutput".

Note: Check buffering of available output bytes.

Set "_OutputLen" to decimal value "12".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"b265099d7511e8d82b831d61".
Set "_OutputLen" to decimal value "32".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"6ee6449da723bac4922a13ec71a984d5d596cbc189433d94b3f0f12fd6dd530
5".

Note: Compute expected result for subsequent values


Baldwin         Informational, Expires 12/25/1999          91


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set buffer "digestOutput" to hex value "ea04d524b856cf388246997e
a7946296".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"b265099d7511e8d82b831d616ee6449d".
Set buffer "digestOutput" to hex value "ea04d524b856cf388246997e
a7946297".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"a723bac4922a13ec71a984d5d596cbc1".
Set buffer "digestOutput" to hex value "ea04d524b856cf388246997e
a7946298".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 

Baldwin         Informational, Expires 12/25/1999          92


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"89433d94b3f0f12fd6dd53059cc78c96".

Note: ----------------------------------------------------------
Note: -------
Note: - Check the result for a two bytes seed passed as two
Note: calls to RandomUpdate matches one call.  Generate 48 
Note: bytes.

Note: Seed the generator

Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "oneByte" to hex value "12".
Set buffer "twoBytes" to hex value "1212".
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Compute expected result

Call Call B_DigestInit passing "digestAlgorithm" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "twoBytes" and length of 
initialized bytes in buffer "twoBytes" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 

Baldwin         Informational, Expires 12/25/1999          93


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".

Note: Generate random values

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"f90fb28bd2b947ab518f36b9d1a29e15".

Note: Check incrementing state.

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".

Baldwin         Informational, Expires 12/25/1999          94


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"20d30acb63c3b8a99bae95aba6eeaa79".

Note: Check incrementing state.

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"e7999274a64f621fb8e1afbd3dec379e".

Note: ----------------------------------------------------------
Note: -------
Note: - Check adding new seed bytes after GenerateBytes call.
Note: Call RandomUpdate twice and generate 32 bytes.
Note: NOTE this in continued from the previous test.

Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate random values

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"3e0c8de693c53a7f9172ec2b3f54c2fc".


Baldwin         Informational, Expires 12/25/1999          95


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Check incrementing state.

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"0503fe51bb2c2c30e72f29bbe92857d0".

Note: ----------------------------------------------------------
Note: -------
Note: Cleanup. 
Call Call B_DestroyAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
This is the end of test case "TVMD2RX0".
This is the start of test case "TVMD5R00".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Test vectors for AI_MD5Random.

Note: Note there are different expected results for BSafe 3.0
Note: and BSafe 2.x.  This file has the expected results for
Note: BSafe 3.0.

Note: Depends on:
Note: AI_MD5
Note: AI_MD5Random

Note: Test cases:
Note: - For a given one byte seed check the result against the
Note: expected MD5 operations.  Generate 16, 12, 32 bytes. 
Note: - For a given 100 byte seed check the result against the
Note: expected MD5 operations.  Generate 16, 12, 32 bytes.
Note: - Check the result for a two bytes seed passed as two
Note: calls to RandomUpdate matches one call.  Generate 
Note: 48 bytes to check state incrementing.
Note: - Check adding new seed bytes after GenerateBytes call.
Note: Call RandomUpdate twice and generate 32 bytes.

Note: ----------------------------------------------------------
Note: -------


Baldwin         Informational, Expires 12/25/1999          96


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Start with the GlobalInit
Set "_Chooser" to "AM_MD5", "AM_MD5_RANDOM", "NULL_PTR".


Note: Setup Data Objects

Create buffer "oneByte" of decimal value "1" bytes.
Create buffer "twoBytes" of decimal value "2" bytes.
Create buffer "bigSeed" of decimal value "256" bytes.
Create buffer "randomOutput" of decimal value "1000" bytes.
Create buffer "digestOutput" of decimal value "1000" bytes.
Note: ----------------------------------------------------------
Note: -------
Note: Setup Algorithm Objects

Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD5Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "digestAlgorithm".
Call B_CreateAlgorithmObject passing "digestAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "AI_MD5" 
initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "digestAlgorithm" and "AI_MD5" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: -------
Note: - For a given one byte seed check the result against the
Note: expected MD5 operations. 

Note: Seed the generator

Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "oneByte" to hex value "12".

Baldwin         Informational, Expires 12/25/1999          97


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Compute expected result

Call Call B_DigestInit passing "digestAlgorithm" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "oneByte" and length of 
initialized bytes in buffer "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"a8445619abd08f3ba0ebfcb31183f7f9".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"8acde574aef013204fe182aa51ec69b5".

Note: Generate random values

Baldwin         Informational, Expires 12/25/1999          98


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with contents of buffer 
"digestOutput".

Note: Check buffering of available output bytes.

Set "_OutputLen" to decimal value "12".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"d726cd43c4f84ebc77113a7a".
Set "_OutputLen" to decimal value "32".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"c2274a2696bb57fcd2c25a05d496b22a7f24fa640fd54d23d487d412d277588
2".

Note: Compute expected result for subsequent values

Set buffer "digestOutput" to hex value "a8445619abd08f3ba0ebfcb3
1183f7fa".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999          99


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"d726cd43c4f84ebc77113a7ac2274a26".
Set buffer "digestOutput" to hex value "a8445619abd08f3ba0ebfcb3
1183f7fb".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"96bb57fcd2c25a05d496b22a7f24fa64".
Set buffer "digestOutput" to hex value "a8445619abd08f3ba0ebfcb3
1183f7fc".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 

Baldwin         Informational, Expires 12/25/1999         100


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"0fd54d23d487d412d27758823b728ee9".

Note: ----------------------------------------------------------
Note: -------
Note: - For a given 100 byte seed check the result against the
Note: expected MD5 operations.  Generate 16, 12, 32 bytes.

Note: Seed the generator

Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "bigSeed" to hex value "01020304050607080910010203040
5060708091001020304050607080910010203040506070809100102030405060
7080910010203040506070809100102030405060708091001020304050607080
9100102030405060708091001020304050607080910".
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "bigSeed" and length of initialized 
bytes in "bigSeed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Compute expected result

Call Call B_DigestInit passing "digestAlgorithm" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "bigSeed" and length of 
initialized bytes in buffer "bigSeed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"524a61a4d4483b31ac7870fe608fe67f".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 

Baldwin         Informational, Expires 12/25/1999         101


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"5163b51d0d5e0b49ce2cc153249d2e98".

Note: Generate random values

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with contents of buffer 
"digestOutput".

Note: Check buffering of available output bytes.

Set "_OutputLen" to decimal value "12".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"611a19becad1de78b09ce0ee".
Set "_OutputLen" to decimal value "32".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         102


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"dc0eeda18cc2db2329db2fd6f8b518d506892872e5e3f0b3fcc06f8f6d29b35
e".

Note: Compute expected result for subsequent values

Set buffer "digestOutput" to hex value "524a61a4d4483b31ac7870fe
608fe680".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"611a19becad1de78b09ce0eedc0eeda1".
Set buffer "digestOutput" to hex value "524a61a4d4483b31ac7870fe
608fe681".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"8cc2db2329db2fd6f8b518d506892872".
Set buffer "digestOutput" to hex value "524a61a4d4483b31ac7870fe
608fe682".

Baldwin         Informational, Expires 12/25/1999         103


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"e5e3f0b3fcc06f8f6d29b35e3d9d652a".

Note: ----------------------------------------------------------
Note: -------
Note: - Check the result for a two bytes seed passed as two
Note: calls to RandomUpdate matches one call.  Generate 48 
Note: bytes.

Note: Seed the generator

Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "oneByte" to hex value "12".
Set buffer "twoBytes" to hex value "1212".
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Compute expected result

Call Call B_DigestInit passing "digestAlgorithm" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         104


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "twoBytes" and length of 
initialized bytes in buffer "twoBytes" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".

Note: Generate random values

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with contents of buffer 
"digestOutput".

Note: Check incrementing state.


Baldwin         Informational, Expires 12/25/1999         105


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"8d7e8ea536685ec32e5935167b53fe2d".

Note: Check incrementing state.

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"838d1fb10127c5d82578763633362e9e".

Note: ----------------------------------------------------------
Note: -------
Note: - Check adding new seed bytes after GenerateBytes call.
Note: Call RandomUpdate twice and generate 32 bytes.
Note: NOTE this in continued from the previous test.

Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate random values

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         106


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"575f1385fd30489fe3b8bd31d3cc033d".

Note: Check incrementing state.

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"1c4165877827f7b37b388046740fe7c2".

Note: ----------------------------------------------------------
Note: -------
Note: Cleanup. 
Call Call B_DestroyAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
This is the end of test case "TVMD5R00".
This is the start of test case "TVMD5RX0".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Test vectors for AI_MD5Random.

Note: Note there are different expected results for BSafe 3.0
Note: and BSafe 2.x.  This file has the expected results for
Note: BSafe 2.x.

Note: Depends on:
Note: AI_MD5
Note: AI_MD5Random

Note: Test cases:
Note: - For a given one byte seed check the result against the
Note: expected MD5 operations.  Generate 16, 12, 32 bytes. 
Note: - For a given 100 byte seed check the result against the
Note: expected MD5 operations.  Generate 16, 12, 32 bytes.

Baldwin         Informational, Expires 12/25/1999         107


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: - Check the result for a two bytes seed passed as two
Note: calls to RandomUpdate matches one call.  Generate 
Note: 48 bytes to check state incrementing.
Note: - Check adding new seed bytes after GenerateBytes call.
Note: Call RandomUpdate twice and generate 32 bytes.

Note: ----------------------------------------------------------
Note: -------

Note: Choose the BSafe 2.x AM

Set "_Chooser" to "AM_MD5", "AM_MD5_RANDOM_2X", "NULL_PTR".

Note: Start with the GlobalInit
Set "_Chooser" to "AM_MD5", "AM_MD5_RANDOM_2X", "NULL_PTR".


Note: Setup Data Objects

Create buffer "oneByte" of decimal value "1" bytes.
Create buffer "twoBytes" of decimal value "2" bytes.
Create buffer "bigSeed" of decimal value "256" bytes.
Create buffer "randomOutput" of decimal value "1000" bytes.
Create buffer "digestOutput" of decimal value "1000" bytes.
Note: ----------------------------------------------------------
Note: -------
Note: Setup Algorithm Objects

Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD5Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "digestAlgorithm".
Call B_CreateAlgorithmObject passing "digestAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "AI_MD5" 
initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "digestAlgorithm" and "AI_MD5" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Baldwin         Informational, Expires 12/25/1999         108


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: ----------------------------------------------------------
Note: -------
Note: - For a given one byte seed check the result against the
Note: expected MD5 operations. 

Note: Seed the generator

Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "oneByte" to hex value "12".
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Compute expected result

Call Call B_DigestInit passing "digestAlgorithm" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "oneByte" and length of 
initialized bytes in buffer "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"a8445619abd08f3ba0ebfcb31183f7f9".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 

Baldwin         Informational, Expires 12/25/1999         109


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"8acde574aef013204fe182aa51ec69b5".

Note: Generate random values

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with contents of buffer 
"digestOutput".

Note: Check buffering of available output bytes.

Set "_OutputLen" to decimal value "12".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"d726cd43c4f84ebc77113a7a".
Set "_OutputLen" to decimal value "32".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"c2274a2696bb57fcd2c25a05d496b22a7f24fa640fd54d23d487d412d277588

Baldwin         Informational, Expires 12/25/1999         110


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

2".

Note: Compute expected result for subsequent values

Set buffer "digestOutput" to hex value "a8445619abd08f3ba0ebfcb3
1183f7fa".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"d726cd43c4f84ebc77113a7ac2274a26".
Set buffer "digestOutput" to hex value "a8445619abd08f3ba0ebfcb3
1183f7fb".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"96bb57fcd2c25a05d496b22a7f24fa64".
Set buffer "digestOutput" to hex value "a8445619abd08f3ba0ebfcb3
1183f7fc".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         111


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"0fd54d23d487d412d27758823b728ee9".

Note: ----------------------------------------------------------
Note: -------
Note: - For a given 100 byte seed check the result against the
Note: expected MD5 operations.  Generate 16, 12, 32 bytes.

Note: Seed the generator

Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "bigSeed" to hex value "01020304050607080910010203040
5060708091001020304050607080910010203040506070809100102030405060
7080910010203040506070809100102030405060708091001020304050607080
9100102030405060708091001020304050607080910".
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "bigSeed" and length of initialized 
bytes in "bigSeed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Compute expected result

Call Call B_DigestInit passing "digestAlgorithm" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "bigSeed" and length of 
initialized bytes in buffer "bigSeed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 

Baldwin         Informational, Expires 12/25/1999         112


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"524a61a4d4483b31ac7870fe608fe67f".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"5163b51d0d5e0b49ce2cc153249d2e98".

Note: Generate random values

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with contents of buffer 
"digestOutput".

Note: Check buffering of available output bytes.

Set "_OutputLen" to decimal value "12".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         113


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"611a19becad1de78b09ce0ee".
Set "_OutputLen" to decimal value "32".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"dc0eeda18cc2db2329db2fd6f8b518d506892872e5e3f0b3fcc06f8f6d29b35
e".

Note: Compute expected result for subsequent values

Set buffer "digestOutput" to hex value "524a61a4d4483b31ac7870fe
608fe680".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"611a19becad1de78b09ce0eedc0eeda1".
Set buffer "digestOutput" to hex value "524a61a4d4483b31ac7870fe
608fe681".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 

Baldwin         Informational, Expires 12/25/1999         114


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"8cc2db2329db2fd6f8b518d506892872".
Set buffer "digestOutput" to hex value "524a61a4d4483b31ac7870fe
608fe682".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Check equality of buffer "digestOutput" with hex value 
"e5e3f0b3fcc06f8f6d29b35e3d9d652a".

Note: ----------------------------------------------------------
Note: -------
Note: - Check the result for a two bytes seed passed as two
Note: calls to RandomUpdate matches one call.  Generate 48 
Note: bytes.

Note: Seed the generator

Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "oneByte" to hex value "12".
Set buffer "twoBytes" to hex value "1212".
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         115


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Compute expected result

Call Call B_DigestInit passing "digestAlgorithm" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "twoBytes" and length of 
initialized bytes in buffer "twoBytes" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".
Call B_DigestUpdate passing "digestAlgorithm" and address of 
first initialized byte in buffer "digestOutput" and length of 
initialized bytes in buffer "digestOutput" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlgorithm" and address of 
next free byte in buffer "digestOutput" and address of 
"_OutputLen" and length of free bytes in buffer "digestOutput" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digestOutput" by "_OutputLen".
Finalize buffer "digestOutput".
Display buffer "digestOutput".

Note: Generate random values

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 

Baldwin         Informational, Expires 12/25/1999         116


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"8a4ffc0a687886737471aaf56e4cf00e".

Note: Check incrementing state.

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"9dbc89de920b3b25ac76d4bbac0d07c2".

Note: Check incrementing state.

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"4ba70d8b917eba2a773221f05d9ba801".

Note: ----------------------------------------------------------
Note: -------
Note: - Check adding new seed bytes after GenerateBytes call.
Note: Call RandomUpdate twice and generate 32 bytes.
Note: NOTE this in continued from the previous test.

Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         117


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "oneByte" and length of initialized 
bytes in "oneByte" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate random values

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"1149e830ebd0bc369c93972546848056".

Note: Check incrementing state.

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "randomOutput" and "_OutputLen" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randomOutput" by "_OutputLen".
Finalize "randomOutput".
Display buffer "randomOutput".
Check equality of buffer "randomOutput" with hex value 
"e750dd1984707fc77eca05341abab605".

Note: ----------------------------------------------------------
Note: -------
Note: Cleanup. 
Call Call B_DestroyAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
This is the end of test case "TVMD5RX0".
This is the start of test case "TVOAEP01".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: OAEP Encode/Decode vectors test


Baldwin         Informational, Expires 12/25/1999         118


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: This script pads the message in "inputData" to the size 
Note: of "expected result"
Note: using PKCS #1 V2.0 encryption padding.

Note: -------------------------------------------------------

Create algorithm object "pkcsoaep".
Call B_CreateAlgorithmObject passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seedValue" of decimal value "20" bytes.
Create buffer "encodedData" of decimal value "700" bytes.
Create buffer "decodedData" of decimal value "700" bytes.
Create buffer "expectedResult" of decimal value "700" bytes.
Create buffer "inputData" of decimal value "700" bytes.

Set buffer "inputData" with string value "Copyright (c) 
1991-1998 RSA Data Security, a Security Dynamics Company. 
License to copy this document is not granted to anyone unless 
the proper authority at RSA or Security Dynamics says so; and 
then you are not allowed to do anything with this document that 
the aforementioned authority person says that you can do. So 
there. Like you would really want to rip off a Btest script 
anyway, eh? Hey!  Go get your own test data.".

Set buffer "seedValue" to hex value "919191919191919191919191919
1919191919191".

Set buffer "expectedResult" to hex value "005a4c67ca990e9d2ab09a
d19cae81261a8ab8ce05daaf717b3ec7d6db71e719c1040afb8921b64552629a
df68eb9ad1fcd6ab2e394e98594c6844180ab6b0bf726e1ac1e93394ae600ac9
8c33328d08bfb086fad41add244e861608056dfa36894ac70bffa7441ed48f59
9ccc0b255cdeb353b162e1c4b26748e9476f0f4e883b85437473aff1c0396ae8
dd960841dda166655ba8aa684097c783fdadf7b39c4bb464094b7d8b356e6846
1243d74e2f5c3046bbac5fb1f60edb1c82472309390e28458723c404065e4972
e6568c3f6ac98bfa05f9829d0fff337bcca1841db95a5af3e42c761fd94e1f2a
157f85622c9e9c534c7b57d46c8d3d4ce839ad9a0773925ad9566f3da79a593a
bba40379818df05cbbf39fd4a44c35cba3139d6474f908170249b9f29ebc3d40
9d22e9a3dfec8a170645fff1ef94e58b986593b629d367f9e2c1152142f7c770
b7f307228b45b2c46cccdcf9d2989c1706b032359e01d296f122280c65287f3f
cfd4c2bebca09b4a137e6d05c9264f8ee13548ddf4c1e3a47d185ec6d9e0b65a
c7f523b126d4c29a83d4a41bc7740ba7b0b225172702faab8922bc7e0f09f756
38fbd9eb29f2d52255cefe30394f7fde37b6f911f7959da6d866123fe2af4e79
f486af65839f9f9d9f8920dd0ad7fac72357abbf64aaa34cd8b02b513a54451a
6590178185179dbf3c961d5106ea7cd088900aa61362df91eb70e9b8f0987a7c
34f7a89bc2d842ae7438449599a1cbe3e762b437a07fe8b422f76a202f4519d0
7524374ac395d44a01b81c40dc97166299e1a8c95f7f1cf330b1a99d43a7bf54
873a23ea140b7d7a5d6bf1bf4b57adbf86b594d59e91a9a9dcb99d64df64a7af
9704a51680739a1e8944ab0167b9f9601b0425ed1675c30808fcd634122cca4c
87b080331aa149cc10864f4f47fb6ac51ff941cc940bd1280def33652d7528b9
01ecd2cb752f43339bc2cf2f191330b817".


Baldwin         Informational, Expires 12/25/1999         119


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Test a single encode and decode cycle against
Note: a test vector and for functional reciprocity.

Set "_InfoPointer" to address of info structure for 
"AI_PKCS_OAEPRecode" initialized from "sha1", "mgf1", "sha1", 
"specifiedParameters",.
Call B_SetAlgorithmInfo passing "pkcsoaep" and 
"AI_PKCS_OAEPRecode" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncodeInit passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData" and address of "_OutputLen" and 
length of free bytes in buffer "inputData" and address of first 
initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "seedValue" and address of "_OutputLen" and 
length of free bytes in buffer "seedValue" and address of first 
initialized byte in buffer "seedValue" and length of 
initialized bytes in buffer "seedValue"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "seedValue" by "_OutputLen".
Call B_EncodeFinal passing "pkcsoaep" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Finalize buffer "encodedData".

Check equality of buffer "expectedResult" with contents of 
buffer "encodedData".

Call Call B_DecodeInit passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData" and address of 

Baldwin         Informational, Expires 12/25/1999         120


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Call B_DecodeFinal passing "pkcsoaep" and address of next free 
byte in buffer "decodedData" and address of "_OutputLen" and 
length of free bytes in buffer "decodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Finalize buffer "decodedData".

Check equality of buffer "inputData" with contents of buffer 
"decodedData".

Call Call B_DestroyAlgorithmObject passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.








Note: Test a encode and decode with multiple updates against
Note: a test vector and for functional reciprocity.

Create algorithm object "pkcsoaep".
Call B_CreateAlgorithmObject passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seedValue" of decimal value "20" bytes.
Create buffer "encodedData" of decimal value "700" bytes.
Create buffer "decodedData" of decimal value "700" bytes.

Create buffer "inputData1" of decimal value "100" bytes.
Create buffer "inputData2" of decimal value "100" bytes.
Create buffer "inputData3" of decimal value "100" bytes.
Create buffer "inputData4" of decimal value "100" bytes.
Create buffer "inputData5" of decimal value "100" bytes.
Create buffer "inputData6" of decimal value "100" bytes.
Create buffer "inputData7" of decimal value "100" bytes.
Create buffer "inputData8" of decimal value "100" bytes.

Set buffer "inputData1" with string value "Copyright (c) 
1991-1998 RSA Data Secur".

Baldwin         Informational, Expires 12/25/1999         121


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set buffer "inputData2" with string value "ity, a Security 
Dynamics Company. License to copy this document ".
Set buffer "inputData3" with string value "is not granted to 
anyone unless the proper authority at RSA or S".
Set buffer "inputData4" with string value "ecurity Dynamics 
says so; and then you are not allowed to do any".
Set buffer "inputData5" with string value "thing with this 
document that the aforementioned authority perso".
Set buffer "inputData6" with string value "n says that you can 
do. So there. Like you would really want to ".
Set buffer "inputData7" with string value "rip off a Btest 
script anyway, eh? Hey!  Go get your own test da".
Set buffer "inputData8" with string value "ta.".

Set buffer "seedValue" to hex value "919191919191919191919191919
1919191919191".

Create buffer "expectedResult1" of decimal value "20" bytes.
Create buffer "expectedResult2" of decimal value "700" bytes.


Note: Initialize, set up expected and input data

Set "_InfoPointer" to address of info structure for 
"AI_PKCS_OAEPRecode" initialized from "sha1", "mgf1", "sha1", 
"specifiedParameters",.
Call B_SetAlgorithmInfo passing "pkcsoaep" and 
"AI_PKCS_OAEPRecode" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncodeInit passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData1" and address of "_OutputLen" and 
length of free bytes in buffer "inputData1" and address of 
first initialized byte in buffer "inputData1" and length of 
initialized bytes in buffer "inputData1"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData1" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData2" and address of "_OutputLen" and 
length of free bytes in buffer "inputData2" and address of 
first initialized byte in buffer "inputData2" and length of 
initialized bytes in buffer "inputData2"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         122


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Increment length of buffer "inputData2" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData3" and address of "_OutputLen" and 
length of free bytes in buffer "inputData3" and address of 
first initialized byte in buffer "inputData3" and length of 
initialized bytes in buffer "inputData3"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData3" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData4" and address of "_OutputLen" and 
length of free bytes in buffer "inputData4" and address of 
first initialized byte in buffer "inputData4" and length of 
initialized bytes in buffer "inputData4"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData4" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData5" and address of "_OutputLen" and 
length of free bytes in buffer "inputData5" and address of 
first initialized byte in buffer "inputData5" and length of 
initialized bytes in buffer "inputData5"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData5" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData6" and address of "_OutputLen" and 
length of free bytes in buffer "inputData6" and address of 
first initialized byte in buffer "inputData6" and length of 
initialized bytes in buffer "inputData6"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData6" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData7" and address of "_OutputLen" and 
length of free bytes in buffer "inputData7" and address of 
first initialized byte in buffer "inputData7" and length of 
initialized bytes in buffer "inputData7"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData7" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData8" and address of "_OutputLen" and 
length of free bytes in buffer "inputData8" and address of 
first initialized byte in buffer "inputData8" and length of 
initialized bytes in buffer "inputData8"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         123


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData8" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "seedValue" and address of "_OutputLen" and 
length of free bytes in buffer "seedValue" and address of first 
initialized byte in buffer "seedValue" and length of 
initialized bytes in buffer "seedValue"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "seedValue" by "_OutputLen".

Call B_EncodeFinal passing "pkcsoaep" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Finalize buffer "encodedData".

Call Call B_DecodeInit passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Call B_DecodeFinal passing "pkcsoaep" and address of next free 
byte in buffer "decodedData" and address of "_OutputLen" and 
length of free bytes in buffer "decodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Finalize buffer "decodedData".

Check equality of buffer "inputData" with contents of buffer 
"decodedData".



This is the end of test case "TVOAEP01".
This is the start of test case "TVOAEP02".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".

Baldwin         Informational, Expires 12/25/1999         124


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999



Note: OAEP Encode/Decode vectors test with BER initialization.

Note: This script pads the message in "inputData" to the size 
Note: of "expected result"
Note: using PKCS #1 V2.0 encryption padding.

Note: -------------------------------------------------------

Create algorithm object "pkcsoaep".
Call B_CreateAlgorithmObject passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seedValue" of decimal value "20" bytes.
Create buffer "encodedData" of decimal value "700" bytes.
Create buffer "decodedData" of decimal value "700" bytes.
Create buffer "expectedResult" of decimal value "700" bytes.
Create buffer "inputData" of decimal value "700" bytes.

Set buffer "inputData" with string value "Copyright (c) 
1991-1998 RSA Data Security, a Security Dynamics Company. 
License to copy this document is not granted to anyone unless 
the proper authority at RSA or Security Dynamics says so; and 
then you are not allowed to do anything with this document that 
the aforementioned authority person says that you can do. So 
there. Like you would really want to rip off a Btest script 
anyway, eh? Hey!  Go get your own test data.".

Set buffer "seedValue" to hex value "919191919191919191919191919
1919191919191".

Set buffer "expectedResult" to hex value "005a4c67ca990e9d2ab09a
d19cae81261a8ab8ce05daaf717b3ec7d6db71e719c1040afb8921b64552629a
df68eb9ad1fcd6ab2e394e98594c6844180ab6b0bf726e1ac1e93394ae600ac9
8c33328d08bfb086fad41add244e861608056dfa36894ac70bffa7441ed48f59
9ccc0b255cdeb353b162e1c4b26748e9476f0f4e883b85437473aff1c0396ae8
dd960841dda166655ba8aa684097c783fdadf7b39c4bb464094b7d8b356e6846
1243d74e2f5c3046bbac5fb1f60edb1c82472309390e28458723c404065e4972
e6568c3f6ac98bfa05f9829d0fff337bcca1841db95a5af3e42c761fd94e1f2a
157f85622c9e9c534c7b57d46c8d3d4ce839ad9a0773925ad9566f3da79a593a
bba40379818df05cbbf39fd4a44c35cba3139d6474f908170249b9f29ebc3d40
9d22e9a3dfec8a170645fff1ef94e58b986593b629d367f9e2c1152142f7c770
b7f307228b45b2c46cccdcf9d2989c1706b032359e01d296f122280c65287f3f
cfd4c2bebca09b4a137e6d05c9264f8ee13548ddf4c1e3a47d185ec6d9e0b65a
c7f523b126d4c29a83d4a41bc7740ba7b0b225172702faab8922bc7e0f09f756
38fbd9eb29f2d52255cefe30394f7fde37b6f911f7959da6d866123fe2af4e79
f486af65839f9f9d9f8920dd0ad7fac72357abbf64aaa34cd8b02b513a54451a
6590178185179dbf3c961d5106ea7cd088900aa61362df91eb70e9b8f0987a7c
34f7a89bc2d842ae7438449599a1cbe3e762b437a07fe8b422f76a202f4519d0
7524374ac395d44a01b81c40dc97166299e1a8c95f7f1cf330b1a99d43a7bf54
873a23ea140b7d7a5d6bf1bf4b57adbf86b594d59e91a9a9dcb99d64df64a7af

Baldwin         Informational, Expires 12/25/1999         125


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

9704a51680739a1e8944ab0167b9f9601b0425ed1675c30808fcd634122cca4c
87b080331aa149cc10864f4f47fb6ac51ff941cc940bd1280def33652d7528b9
01ecd2cb752f43339bc2cf2f191330b817".

Note: Test a single encode and decode cycle against
Note: a test vector and for functional reciprocity.

Set "_InfoPointer" to address of info structure for 
"AI_PKCS_OAEPRecodeBER" initialized from "304506092a864886f70d01
01073038a00b300906052b0e03021a0500a118301606092a864886f70d010108
300906052b0e03021a0500a20f300d06092a864886f70d0101090400".
Call B_SetAlgorithmInfo passing "pkcsoaep" and 
"AI_PKCS_OAEPRecodeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_InfoPointer" to address of info structure for 
"AI_PKCS_OAEPRecode".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "pkcsoaep" 
and "AI_PKCS_OAEPRecode".
Display info structure for "AI_PKCS_OAEPRecode".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncodeInit passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData" and address of "_OutputLen" and 
length of free bytes in buffer "inputData" and address of first 
initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "seedValue" and address of "_OutputLen" and 
length of free bytes in buffer "seedValue" and address of first 
initialized byte in buffer "seedValue" and length of 
initialized bytes in buffer "seedValue"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "seedValue" by "_OutputLen".
Call B_EncodeFinal passing "pkcsoaep" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         126


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Finalize buffer "encodedData".

Check equality of buffer "expectedResult" with contents of 
buffer "encodedData".

Call Call B_DecodeInit passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Call B_DecodeFinal passing "pkcsoaep" and address of next free 
byte in buffer "decodedData" and address of "_OutputLen" and 
length of free bytes in buffer "decodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Finalize buffer "decodedData".

Check equality of buffer "inputData" with contents of buffer 
"decodedData".

Call Call B_DestroyAlgorithmObject passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.








Note: Test a encode and decode with multiple updates against
Note: a test vector and for functional reciprocity.

Create algorithm object "pkcsoaep".
Call B_CreateAlgorithmObject passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seedValue" of decimal value "20" bytes.

Baldwin         Informational, Expires 12/25/1999         127


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create buffer "encodedData" of decimal value "700" bytes.
Create buffer "decodedData" of decimal value "700" bytes.

Create buffer "inputData1" of decimal value "100" bytes.
Create buffer "inputData2" of decimal value "100" bytes.
Create buffer "inputData3" of decimal value "100" bytes.
Create buffer "inputData4" of decimal value "100" bytes.
Create buffer "inputData5" of decimal value "100" bytes.
Create buffer "inputData6" of decimal value "100" bytes.
Create buffer "inputData7" of decimal value "100" bytes.
Create buffer "inputData8" of decimal value "100" bytes.

Set buffer "inputData1" with string value "Copyright (c) 
1991-1998 RSA Data Secur".
Set buffer "inputData2" with string value "ity, a Security 
Dynamics Company. License to copy this document ".
Set buffer "inputData3" with string value "is not granted to 
anyone unless the proper authority at RSA or S".
Set buffer "inputData4" with string value "ecurity Dynamics 
says so; and then you are not allowed to do any".
Set buffer "inputData5" with string value "thing with this 
document that the aforementioned authority perso".
Set buffer "inputData6" with string value "n says that you can 
do. So there. Like you would really want to ".
Set buffer "inputData7" with string value "rip off a Btest 
script anyway, eh? Hey!  Go get your own test da".
Set buffer "inputData8" with string value "ta.".

Set buffer "seedValue" to hex value "919191919191919191919191919
1919191919191".

Create buffer "expectedResult1" of decimal value "20" bytes.
Create buffer "expectedResult2" of decimal value "700" bytes.


Note: Initialize, set up expected and input data

Set "_InfoPointer" to address of info structure for 
"AI_PKCS_OAEPRecode" initialized from "sha1", "mgf1", "sha1", 
"specifiedParameters",.
Call B_SetAlgorithmInfo passing "pkcsoaep" and 
"AI_PKCS_OAEPRecode" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncodeInit passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData1" and address of "_OutputLen" and 
length of free bytes in buffer "inputData1" and address of 

Baldwin         Informational, Expires 12/25/1999         128


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

first initialized byte in buffer "inputData1" and length of 
initialized bytes in buffer "inputData1"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData1" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData2" and address of "_OutputLen" and 
length of free bytes in buffer "inputData2" and address of 
first initialized byte in buffer "inputData2" and length of 
initialized bytes in buffer "inputData2"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData2" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData3" and address of "_OutputLen" and 
length of free bytes in buffer "inputData3" and address of 
first initialized byte in buffer "inputData3" and length of 
initialized bytes in buffer "inputData3"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData3" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData4" and address of "_OutputLen" and 
length of free bytes in buffer "inputData4" and address of 
first initialized byte in buffer "inputData4" and length of 
initialized bytes in buffer "inputData4"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData4" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData5" and address of "_OutputLen" and 
length of free bytes in buffer "inputData5" and address of 
first initialized byte in buffer "inputData5" and length of 
initialized bytes in buffer "inputData5"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData5" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData6" and address of "_OutputLen" and 
length of free bytes in buffer "inputData6" and address of 
first initialized byte in buffer "inputData6" and length of 
initialized bytes in buffer "inputData6"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData6" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData7" and address of "_OutputLen" and 

Baldwin         Informational, Expires 12/25/1999         129


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

length of free bytes in buffer "inputData7" and address of 
first initialized byte in buffer "inputData7" and length of 
initialized bytes in buffer "inputData7"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData7" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData8" and address of "_OutputLen" and 
length of free bytes in buffer "inputData8" and address of 
first initialized byte in buffer "inputData8" and length of 
initialized bytes in buffer "inputData8"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData8" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "seedValue" and address of "_OutputLen" and 
length of free bytes in buffer "seedValue" and address of first 
initialized byte in buffer "seedValue" and length of 
initialized bytes in buffer "seedValue"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "seedValue" by "_OutputLen".

Call B_EncodeFinal passing "pkcsoaep" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Finalize buffer "encodedData".

Call Call B_DecodeInit passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Call B_DecodeFinal passing "pkcsoaep" and address of next free 
byte in buffer "decodedData" and address of "_OutputLen" and 
length of free bytes in buffer "decodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         130


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Finalize buffer "decodedData".

Check equality of buffer "inputData" with contents of buffer 
"decodedData".




This is the end of test case "TVOAEP02".
This is the start of test case "TVOAEP03".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: OAEP Encode/Decode vectors test with BER initialization.

Note: This script pads the message in "inputData" to the size 
Note: of "expected result"
Note: using PKCS #1 V2.0 encryption padding.

Note: -------------------------------------------------------

Create algorithm object "pkcsoaep".
Call B_CreateAlgorithmObject passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seedValue" of decimal value "20" bytes.
Create buffer "encodedData" of decimal value "700" bytes.
Create buffer "decodedData" of decimal value "700" bytes.
Create buffer "expectedResult" of decimal value "700" bytes.
Create buffer "inputData" of decimal value "700" bytes.
Create buffer "parmData" of decimal value "16" bytes.

Set buffer "inputData" with string value "Copyright (c) 
1991-1998 RSA Data Security, a Security Dynamics Company. 
License to copy this document is not granted to anyone unless 
the proper authority at RSA or Security Dynamics says so; and 
then you are not allowed to do anything with this document that 
the aforementioned authority person says that you can do. So 
there. Like you would really want to rip off a Btest script 
anyway, eh? Hey!  Go get your own test data.".

Set buffer "seedValue" to hex value "919191919191919191919191919
1919191919191".

Set buffer "parmData" to hex value "0123456789abcdeffedcba987654
3210".

Set buffer "expectedResult" to hex value "00f2d028637058956033ed

Baldwin         Informational, Expires 12/25/1999         131


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

15003f97692010379a9fecf612681074b7a1c6446f8ebcd4f5eb6a65511f629a
df68eb9ad1fcd6ab2e394e98594c6844180ab6b0bf726e1ac1e93394ae600ac9
8c33328d08bfb086fad41add244e861608056dfa36894ac70bffa7441ed48f59
9ccc0b255cdeb353b162e1c4b26748e9476f0f4e883b85437473aff1c0396ae8
dd960841dda166655ba8aa684097c783fdadf7b39c4bb464094b7d8b356e6846
1243d74e2f5c3046bbac5fb1f60edb1c82472309390e28458723c404065e4972
e6568c3f6ac98bfa05f9829d0fff337bcca1841db95a5af3e42c761fd94e1f2a
157f85622c9e9c534c7b57d46c8d3d4ce839ad9a0773925ad9566f3da79a593a
bba40379818df05cbbf39fd4a44c35cba3139d6474f908170249b9f29ebc3d40
9d22e9a3dfec8a170645fff1ef94e58b986593b629d367f9e2c1152142f7c770
b7f307228b45b2c46cccdcf9d2989c1706b032359e01d296f122280c65287f3f
cfd4c2bebca09b4a137e6d05c9264f8ee13548ddf4c1e3a47d185ec6d9e0b65a
c7f523b126d4c29a83d4a41bc7740ba7b0b225172702faab8922bc7e0f09f756
38fbd9eb29f2d52255cefe30394f7fde37b6f911f7959da6d866123fe2af4e79
f486af65839f9f9d9f8920dd0ad7fac72357abbf64aaa34cd8b02b513a54451a
6590178185179dbf3c961d5106ea7cd088900aa61362df91eb70e9b8f0987a7c
34f7a89bc2d842ae7438449599a1cbe3e762b437a07fe8b422f76a202f4519d0
7524374ac395d44a01b81c40dc97166299e1a8c95f7f1cf330b1a99d43a7bf54
873a23ea140b7d7a5d6bf1bf4b57adbf86b594d59e91a9a9dcb99d64df64a7af
9704a51680739a1e8944ab0167b9f9601b0425ed1675c30808fcd634122cca4c
87b080331aa149cc10864f4f47fb6ac51ff941cc940bd1280def33652d7528b9
01ecd2cb752f43339bc2cf2f191330b817".

Note: Test a single encode and decode cycle against
Note: a test vector and for functional reciprocity.

Set "_InfoPointer" to address of info structure for 
"AI_PKCS_OAEPRecodeBER" initialized from "304806092a864886f70d01
0107303ba00b300906052b0e03021a0500a118301606092a864886f70d010108
300906052b0e03021a0500a212301006092a864886f70d0101090403012345".
Call B_SetAlgorithmInfo passing "pkcsoaep" and 
"AI_PKCS_OAEPRecodeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_InfoPointer" to address of info structure for 
"AI_PKCS_OAEPRecode".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "pkcsoaep" 
and "AI_PKCS_OAEPRecode".
Display info structure for "AI_PKCS_OAEPRecode".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncodeInit passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData" and address of "_OutputLen" and 
length of free bytes in buffer "inputData" and address of first 
initialized byte in buffer "inputData" and length of 

Baldwin         Informational, Expires 12/25/1999         132


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized bytes in buffer "inputData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "seedValue" and address of "_OutputLen" and 
length of free bytes in buffer "seedValue" and address of first 
initialized byte in buffer "seedValue" and length of 
initialized bytes in buffer "seedValue"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "seedValue" by "_OutputLen".
Call B_EncodeFinal passing "pkcsoaep" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Finalize buffer "encodedData".

Check equality of buffer "expectedResult" with contents of 
buffer "encodedData".

Call Call B_DecodeInit passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Call B_DecodeFinal passing "pkcsoaep" and address of next free 
byte in buffer "decodedData" and address of "_OutputLen" and 
length of free bytes in buffer "decodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Finalize buffer "decodedData".

Check equality of buffer "inputData" with contents of buffer 
"decodedData".

Call Call B_DestroyAlgorithmObject passing "pkcsoaep".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         133


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.








Note: Test a encode and decode with multiple updates against
Note: a test vector and for functional reciprocity.

Create algorithm object "pkcsoaep".
Call B_CreateAlgorithmObject passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seedValue" of decimal value "20" bytes.
Create buffer "encodedData" of decimal value "700" bytes.
Create buffer "decodedData" of decimal value "700" bytes.

Create buffer "inputData1" of decimal value "100" bytes.
Create buffer "inputData2" of decimal value "100" bytes.
Create buffer "inputData3" of decimal value "100" bytes.
Create buffer "inputData4" of decimal value "100" bytes.
Create buffer "inputData5" of decimal value "100" bytes.
Create buffer "inputData6" of decimal value "100" bytes.
Create buffer "inputData7" of decimal value "100" bytes.
Create buffer "inputData8" of decimal value "100" bytes.

Set buffer "inputData1" with string value "Copyright (c) 
1991-1998 RSA Data Secur".
Set buffer "inputData2" with string value "ity, a Security 
Dynamics Company. License to copy this document ".
Set buffer "inputData3" with string value "is not granted to 
anyone unless the proper authority at RSA or S".
Set buffer "inputData4" with string value "ecurity Dynamics 
says so; and then you are not allowed to do any".
Set buffer "inputData5" with string value "thing with this 
document that the aforementioned authority perso".
Set buffer "inputData6" with string value "n says that you can 
do. So there. Like you would really want to ".
Set buffer "inputData7" with string value "rip off a Btest 
script anyway, eh? Hey!  Go get your own test da".
Set buffer "inputData8" with string value "ta.".

Set buffer "seedValue" to hex value "919191919191919191919191919
1919191919191".

Create buffer "expectedResult1" of decimal value "20" bytes.
Create buffer "expectedResult2" of decimal value "700" bytes.


Baldwin         Informational, Expires 12/25/1999         134


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Initialize, set up expected and input data
Note: Should be able to decode properly without P-params

Set "_InfoPointer" to address of info structure for 
"AI_PKCS_OAEPRecode" initialized from "sha1", "mgf1", "sha1", 
"specifiedParameters",.
Call B_SetAlgorithmInfo passing "pkcsoaep" and 
"AI_PKCS_OAEPRecode" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_PKCS_OAEPRecodeBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "pkcsoaep" 
and "AI_PKCS_OAEPRecodeBER".
Display info structure for "AI_PKCS_OAEPRecodeBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncodeInit passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData1" and address of "_OutputLen" and 
length of free bytes in buffer "inputData1" and address of 
first initialized byte in buffer "inputData1" and length of 
initialized bytes in buffer "inputData1"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData1" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData2" and address of "_OutputLen" and 
length of free bytes in buffer "inputData2" and address of 
first initialized byte in buffer "inputData2" and length of 
initialized bytes in buffer "inputData2"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData2" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData3" and address of "_OutputLen" and 
length of free bytes in buffer "inputData3" and address of 
first initialized byte in buffer "inputData3" and length of 
initialized bytes in buffer "inputData3"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData3" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 

Baldwin         Informational, Expires 12/25/1999         135


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

byte in buffer "inputData4" and address of "_OutputLen" and 
length of free bytes in buffer "inputData4" and address of 
first initialized byte in buffer "inputData4" and length of 
initialized bytes in buffer "inputData4"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData4" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData5" and address of "_OutputLen" and 
length of free bytes in buffer "inputData5" and address of 
first initialized byte in buffer "inputData5" and length of 
initialized bytes in buffer "inputData5"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData5" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData6" and address of "_OutputLen" and 
length of free bytes in buffer "inputData6" and address of 
first initialized byte in buffer "inputData6" and length of 
initialized bytes in buffer "inputData6"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData6" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData7" and address of "_OutputLen" and 
length of free bytes in buffer "inputData7" and address of 
first initialized byte in buffer "inputData7" and length of 
initialized bytes in buffer "inputData7"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData7" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "inputData8" and address of "_OutputLen" and 
length of free bytes in buffer "inputData8" and address of 
first initialized byte in buffer "inputData8" and length of 
initialized bytes in buffer "inputData8"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "inputData8" by "_OutputLen".
Call B_EncodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "seedValue" and address of "_OutputLen" and 
length of free bytes in buffer "seedValue" and address of first 
initialized byte in buffer "seedValue" and length of 
initialized bytes in buffer "seedValue"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "seedValue" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         136


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Call B_EncodeFinal passing "pkcsoaep" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Finalize buffer "encodedData".

Call Call B_DecodeInit passing "pkcsoaep".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecodeUpdate passing "pkcsoaep" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Call B_DecodeFinal passing "pkcsoaep" and address of next free 
byte in buffer "decodedData" and address of "_OutputLen" and 
length of free bytes in buffer "decodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Finalize buffer "decodedData".

Check equality of buffer "inputData" with contents of buffer 
"decodedData".




This is the end of test case "TVOAEP03".
This is the start of test case "TVRC4MAC".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: RC4 with MAC vectors test

Note: -------------------------------------------------------

Note: Start with the GlobalInit

Set "_Chooser" to "AM_RC4_ENCRYPT", "AM_RC4_DECRYPT", "AM_MAC", 
"AM_RC4_WITH_MAC_ENCRYPT", "AM_RC4_WITH_MAC_DECRYPT", 

Baldwin         Informational, Expires 12/25/1999         137


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"NULL_PTR".


Create algorithm object "macAlg".
Call B_CreateAlgorithmObject passing "macAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "rc4EncAlg".
Call B_CreateAlgorithmObject passing "rc4EncAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "rc4MACEncAlg".
Call B_CreateAlgorithmObject passing "rc4MACEncAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "rc4MACDecAlg".
Call B_CreateAlgorithmObject passing "rc4MACDecAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "inputData" of decimal value "100" bytes.
Create buffer "cypherText" of decimal value "100" bytes.
Create buffer "expected" of decimal value "100" bytes.
Create buffer "plainText" of decimal value "100" bytes.
Create key object "rc4Key".
Call B_CreateKeyObject passing "rc4Key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "rc4MacKey".
Call B_CreateKeyObject passing "rc4MacKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "key8" of decimal value "8" bytes.
Create buffer "key4" of decimal value "4" bytes.
Create buffer "temp" of decimal value "16" bytes.

Note: Case 1: Mac len = 4

Note: Initialize, set up expected and input data
Note: The first 4 bytes of the key is the key for RC4WithMAC 
Note: algorithm.
Note: The last 4 bytes is the salt for RC4WithMAC algorithm.

Set buffer "key8" to hex value "fedcba9876543210".
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "key8".
Call B_SetKeyInfo passing "rc4Key" and "KI_Item" and 
"_InfoPointer".

Baldwin         Informational, Expires 12/25/1999         138


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "AI_RC4" 
initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "rc4EncAlg" and "AI_RC4" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "AI_MAC" 
initialized from "4".
Call B_SetAlgorithmInfo passing "macAlg" and "AI_MAC" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set buffer "inputData" to hex value "0123456789abcdeffedcba98765
43210".

Note: Simulate RC4 With MAC algorithm by first encrypt using 
Note: RC4 algorithm and
Note: then MAC algorithm.

Call Call B_EncryptInit passing "rc4EncAlg" and "rc4Key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "rc4EncAlg" and address of next 
free byte in buffer "expected" and address of "_OutputLen" and 
length of free bytes in buffer "expected" and address of first 
initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expected" by "_OutputLen".

Call Call B_DigestInit passing "macAlg" and "rc4Key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "macAlg" and address of first 
initialized byte in buffer "key8" and length of initialized 
bytes in buffer "key8" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "macAlg" and address of first 

Baldwin         Informational, Expires 12/25/1999         139


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "temp" to hex value "00000000".
Call B_DigestUpdate passing "macAlg" and address of first 
initialized byte in buffer "temp" and length of initialized 
bytes in buffer "temp" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "macAlg" and address of next free 
byte in buffer "temp" and address of "_OutputLen" and length of 
free bytes in buffer "temp" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "temp" by "_OutputLen".
Finalize buffer "temp".

Call B_EncryptUpdate passing "rc4EncAlg" and address of next 
free byte in buffer "expected" and address of "_OutputLen" and 
length of free bytes in buffer "expected" and address of first 
initialized byte in buffer "temp" and length of initialized 
bytes in buffer "temp" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expected" by "_OutputLen".

Call B_EncryptFinal passing "rc4EncAlg" and address of next 
free byte in buffer "expected" and address of "_OutputLen" and 
length of free bytes in buffer "expected" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expected" by "_OutputLen".
Finalize buffer "expected".

Note: Now encrypt the inputData using RC4 with MAC algorithm

Set buffer "key4" to hex value "fedcba98".
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "key4".
Call B_SetKeyInfo passing "rc4MacKey" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_InfoPointer" to address of info structure for 

Baldwin         Informational, Expires 12/25/1999         140


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_RC4WithMAC" initialized from "76543210", "4".
Call B_SetAlgorithmInfo passing "rc4MACEncAlg" and 
"AI_RC4WithMAC" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC4WithMAC" initialized from "76543210", "4".
Call B_SetAlgorithmInfo passing "rc4MACDecAlg" and 
"AI_RC4WithMAC" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "rc4MACEncAlg" and "rc4MacKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "rc4MACEncAlg" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and address of 
first initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "rc4MACEncAlg" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".

Check equality of buffer "cypherText" with contents of buffer 
"expected".
Check equality of buffer "cypherText" with hex value 
"dae10fb4e886c6671003cb322806393d929f6334".

Note: Decryption

Call Call B_DecryptInit passing "rc4MACDecAlg" and "rc4MacKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "rc4MACDecAlg" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 

Baldwin         Informational, Expires 12/25/1999         141


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

length of free bytes in buffer "plainText" and address of first 
initialized byte in buffer "cypherText" and length of 
initialized bytes in buffer "cypherText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "rc4MACDecAlg" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".

Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 2: Mac len = 2

Note: Initialize, set up expected and input data
Note: The first 4 bytes of the key is the key for RC4WithMAC 
Note: algorithm.
Note: The last 4 bytes is the salt for RC4WithMAC algorithm.

Call Call B_DestroyAlgorithmObject passing "macAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "rc4MACEncAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "rc4MACDecAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create algorithm object "macAlg".
Call B_CreateAlgorithmObject passing "macAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "rc4MACEncAlg".
Call B_CreateAlgorithmObject passing "rc4MACEncAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "rc4MACDecAlg".
Call B_CreateAlgorithmObject passing "rc4MACDecAlg".

Baldwin         Informational, Expires 12/25/1999         142


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_InfoPointer" to address of info structure for 
"AI_RC4WithMAC" initialized from "76543210", "2".
Call B_SetAlgorithmInfo passing "rc4MACEncAlg" and 
"AI_RC4WithMAC" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC4WithMAC" initialized from "76543210", "2".
Call B_SetAlgorithmInfo passing "rc4MACDecAlg" and 
"AI_RC4WithMAC" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "AI_MAC" 
initialized from "2".
Call B_SetAlgorithmInfo passing "macAlg" and "AI_MAC" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "plainText" to decimal value "0".
Set length of buffer "cypherText" to decimal value "0".

Note: Simulate RC4 With MAC algorithm by first encrypt using 
Note: RC4 algorithm and
Note: then MAC algorithm.

Call Call B_EncryptInit passing "rc4EncAlg" and "rc4Key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "rc4EncAlg" and address of next 
free byte in buffer "expected" and address of "_OutputLen" and 
length of free bytes in buffer "expected" and address of first 
initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expected" by "_OutputLen".

Call Call B_DigestInit passing "macAlg" and "rc4Key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         143


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "macAlg" and address of first 
initialized byte in buffer "key8" and length of initialized 
bytes in buffer "key8" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "macAlg" and address of first 
initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "temp" to hex value "0000".
Call B_DigestUpdate passing "macAlg" and address of first 
initialized byte in buffer "temp" and length of initialized 
bytes in buffer "temp" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "macAlg" and address of next free 
byte in buffer "temp" and address of "_OutputLen" and length of 
free bytes in buffer "temp" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "temp" by "_OutputLen".
Finalize buffer "temp".

Call B_EncryptUpdate passing "rc4EncAlg" and address of next 
free byte in buffer "expected" and address of "_OutputLen" and 
length of free bytes in buffer "expected" and address of first 
initialized byte in buffer "temp" and length of initialized 
bytes in buffer "temp" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expected" by "_OutputLen".

Call B_EncryptFinal passing "rc4EncAlg" and address of next 
free byte in buffer "expected" and address of "_OutputLen" and 
length of free bytes in buffer "expected" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expected" by "_OutputLen".
Finalize buffer "expected".

Note: Now encrypt the inputData using RC4 with MAC algorithm

Call Call B_EncryptInit passing "rc4MACEncAlg" and "rc4MacKey" 
and "_Chooser" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         144


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "rc4MACEncAlg" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and address of 
first initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "rc4MACEncAlg" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".

Check equality of buffer "cypherText" with contents of buffer 
"expected".
Check equality of buffer "cypherText" with hex value 
"dae10fb4e886c6671003cb322806393d6476".

Note: Decryption

Call Call B_DecryptInit passing "rc4MACDecAlg" and "rc4MacKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "rc4MACDecAlg" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and address of first 
initialized byte in buffer "cypherText" and length of 
initialized bytes in buffer "cypherText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "rc4MACDecAlg" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         145


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Finalize buffer "plainText".

Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 3: Mac len = 8

Note: Initialize, set up expected and input data
Note: The first 4 bytes of the key is the key for RC4WithMAC 
Note: algorithm.
Note: The last 4 bytes is the salt for RC4WithMAC algorithm.

Call Call B_DestroyAlgorithmObject passing "macAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "rc4MACEncAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "rc4MACDecAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create algorithm object "macAlg".
Call B_CreateAlgorithmObject passing "macAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "rc4MACEncAlg".
Call B_CreateAlgorithmObject passing "rc4MACEncAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "rc4MACDecAlg".
Call B_CreateAlgorithmObject passing "rc4MACDecAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_InfoPointer" to address of info structure for 
"AI_RC4WithMAC" initialized from "76543210", "8".
Call B_SetAlgorithmInfo passing "rc4MACEncAlg" and 
"AI_RC4WithMAC" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC4WithMAC" initialized from "76543210", "8".
Call B_SetAlgorithmInfo passing "rc4MACDecAlg" and 
"AI_RC4WithMAC" and "_InfoPointer".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         146


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "AI_MAC" 
initialized from "8".
Call B_SetAlgorithmInfo passing "macAlg" and "AI_MAC" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "plainText" to decimal value "0".
Set length of buffer "cypherText" to decimal value "0".

Note: Simulate RC4 With MAC algorithm by first encrypt using 
Note: RC4 algorithm and
Note: then MAC algorithm.

Call Call B_EncryptInit passing "rc4EncAlg" and "rc4Key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "rc4EncAlg" and address of next 
free byte in buffer "expected" and address of "_OutputLen" and 
length of free bytes in buffer "expected" and address of first 
initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expected" by "_OutputLen".

Call Call B_DigestInit passing "macAlg" and "rc4Key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "macAlg" and address of first 
initialized byte in buffer "key8" and length of initialized 
bytes in buffer "key8" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "macAlg" and address of first 
initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "temp" to hex value "0000000000000000".
Call B_DigestUpdate passing "macAlg" and address of first 
initialized byte in buffer "temp" and length of initialized 

Baldwin         Informational, Expires 12/25/1999         147


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

bytes in buffer "temp" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "macAlg" and address of next free 
byte in buffer "temp" and address of "_OutputLen" and length of 
free bytes in buffer "temp" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "temp" by "_OutputLen".
Finalize buffer "temp".

Call B_EncryptUpdate passing "rc4EncAlg" and address of next 
free byte in buffer "expected" and address of "_OutputLen" and 
length of free bytes in buffer "expected" and address of first 
initialized byte in buffer "temp" and length of initialized 
bytes in buffer "temp" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expected" by "_OutputLen".

Call B_EncryptFinal passing "rc4EncAlg" and address of next 
free byte in buffer "expected" and address of "_OutputLen" and 
length of free bytes in buffer "expected" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expected" by "_OutputLen".
Finalize buffer "expected".

Note: Now encrypt the inputData using RC4 with MAC algorithm

Call Call B_EncryptInit passing "rc4MACEncAlg" and "rc4MacKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "rc4MACEncAlg" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and address of 
first initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "rc4MACEncAlg" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 

Baldwin         Informational, Expires 12/25/1999         148


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".

Check equality of buffer "cypherText" with contents of buffer 
"expected".
Check equality of buffer "cypherText" with hex value 
"dae10fb4e886c6671003cb322806393d7110b2ab11b2db55".

Note: Decryption

Call Call B_DecryptInit passing "rc4MACDecAlg" and "rc4MacKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "rc4MACDecAlg" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and address of first 
initialized byte in buffer "cypherText" and length of 
initialized bytes in buffer "cypherText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "rc4MACDecAlg" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".

Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 4: Mac len = 16

Note: Initialize, set up expected and input data
Note: The first 4 bytes of the key is the key for RC4WithMAC 
Note: algorithm.
Note: The last 4 bytes is the salt for RC4WithMAC algorithm.

Call Call B_DestroyAlgorithmObject passing "macAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         149


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_DestroyAlgorithmObject passing "rc4MACEncAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "rc4MACDecAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create algorithm object "macAlg".
Call B_CreateAlgorithmObject passing "macAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "rc4MACEncAlg".
Call B_CreateAlgorithmObject passing "rc4MACEncAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "rc4MACDecAlg".
Call B_CreateAlgorithmObject passing "rc4MACDecAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_InfoPointer" to address of info structure for 
"AI_RC4WithMAC" initialized from "76543210", "16".
Call B_SetAlgorithmInfo passing "rc4MACEncAlg" and 
"AI_RC4WithMAC" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC4WithMAC" initialized from "76543210", "16".
Call B_SetAlgorithmInfo passing "rc4MACDecAlg" and 
"AI_RC4WithMAC" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "AI_MAC" 
initialized from "16".
Call B_SetAlgorithmInfo passing "macAlg" and "AI_MAC" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "plainText" to decimal value "0".
Set length of buffer "cypherText" to decimal value "0".

Note: Simulate RC4 With MAC algorithm by first encrypt using 
Note: RC4 algorithm and
Note: then MAC algorithm.

Baldwin         Informational, Expires 12/25/1999         150


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Call Call B_EncryptInit passing "rc4EncAlg" and "rc4Key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "rc4EncAlg" and address of next 
free byte in buffer "expected" and address of "_OutputLen" and 
length of free bytes in buffer "expected" and address of first 
initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expected" by "_OutputLen".

Call Call B_DigestInit passing "macAlg" and "rc4Key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "macAlg" and address of first 
initialized byte in buffer "key8" and length of initialized 
bytes in buffer "key8" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "macAlg" and address of first 
initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "temp" to hex value "00000000000000000000000000000000
".
Call B_DigestUpdate passing "macAlg" and address of first 
initialized byte in buffer "temp" and length of initialized 
bytes in buffer "temp" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "macAlg" and address of next free 
byte in buffer "temp" and address of "_OutputLen" and length of 
free bytes in buffer "temp" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "temp" by "_OutputLen".
Finalize buffer "temp".

Call B_EncryptUpdate passing "rc4EncAlg" and address of next 
free byte in buffer "expected" and address of "_OutputLen" and 

Baldwin         Informational, Expires 12/25/1999         151


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

length of free bytes in buffer "expected" and address of first 
initialized byte in buffer "temp" and length of initialized 
bytes in buffer "temp" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expected" by "_OutputLen".

Call B_EncryptFinal passing "rc4EncAlg" and address of next 
free byte in buffer "expected" and address of "_OutputLen" and 
length of free bytes in buffer "expected" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expected" by "_OutputLen".
Finalize buffer "expected".

Note: Now encrypt the inputData using RC4 with MAC algorithm

Call Call B_EncryptInit passing "rc4MACEncAlg" and "rc4MacKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "rc4MACEncAlg" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and address of 
first initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "rc4MACEncAlg" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".

Check equality of buffer "cypherText" with contents of buffer 
"expected".
Check equality of buffer "cypherText" with hex value 
"dae10fb4e886c6671003cb322806393dc339816703b3f0525fb5023177faa91
3".

Note: Decryption


Baldwin         Informational, Expires 12/25/1999         152


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_DecryptInit passing "rc4MACDecAlg" and "rc4MacKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "rc4MACDecAlg" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and address of first 
initialized byte in buffer "cypherText" and length of 
initialized bytes in buffer "cypherText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "rc4MACDecAlg" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".

Check equality of buffer "plainText" with contents of buffer 
"inputData".



This is the end of test case "TVRC4MAC".
This is the start of test case "TVRKG931".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: 1024 bit key vector test based on X9.31 example 4.1 for 
Note: AI_RSAStrongKeyGen, 
Note: KI_RSAPublic, KI_RSAPrivate
Note: AI_FormatX931, AI_SignVerify

Note: Depending on AI_DummyRandom algorithm


Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_DUMMY_RANDOM_MULT", "AM_FORMAT_X931", 
"AM_EXTRACT_X931", "AM_RSA_CRT_X931_ENCRYPT", 
"AM_RSA_X931_DECRYPT", "AM_RSA_STRONG_KEY_GEN", "NULL_PTR".


Note: Set up random object for param and key generation

Baldwin         Informational, Expires 12/25/1999         153


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DummyRandomMult" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and 
"AI_DummyRandomMult" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "512" bytes.
Set buffer "seed" to hex value "1A1916DDB29B4EB7EB6732E128192E8A
AC41C576C822D93EA433D8CD81F035EC57EFE822955149D3BFF70C53520D769D
6D76646C7A792E16EBD89FE6FC5B605A649339DFC925A86A4C6D150B71B9EEA0
2D68885F5009B98BD9841A5CF72EE770DE50CB09ACCEA9134E4CAA16D2350A21
D775C404CC1092495D867E64065DEE3E7955F2EBC7D47A2D7C9953388F97DDDC
3E1CA19C35CA659EDC2FC3256D29C2627479C086A699A49C4C9CEE7EF7BD1B34
321DE34A".

Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate RSA Keypair

Create algorithm object "rsaKeyGen".
Call B_CreateAlgorithmObject passing "rsaKeyGen".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RSAStrongKeyGen" initialized from "1024", "3".
Call B_SetAlgorithmInfo passing "rsaKeyGen" and 
"AI_RSAStrongKeyGen" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "publicKey".
Call B_CreateKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         154


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create key object "privateKey".
Call B_CreateKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_GenerateInit passing "rsaKeyGen" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_GenerateKeypair passing "rsaKeyGen" and "publicKey" 
and "privateKey" and "random" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Check the RSA public

Set "_ExpectedInfoPointer" to address of expected info 
structure for "KI_RSAPublic" initialized from 
"acd1cc46dfe54fe8f9786672664ca2690d0ad7e5003bc6427954d939eee8b27
152e6a947450d7fa980172de064d6569a28a83fe70fa840f5e9802cb8984ab34
bd5c1e6399ec21e4d3a3a69be4e676f395aafef7c4925fd4faee9f9e5e48af43
15df0ec2db9ad7a350b3df2f4d15dc0039846d1aca3527b1a75049e3fe34f43b
d", "03".
Set "_InfoPointer" to address of info structure for 
"KI_RSAPublic".
Call B_GetKeyInfo passing "_InfoPointer" and "publicKey" and 
"KI_RSAPublic".
Check equality of info structure for "KI_RSAPublic" with 
expected info structure for "KI_RSAPublic".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Check the DSA private

Set "_ExpectedInfoPointer" to address of expected info 
structure for "KI_RSAPrivate" initialized from 
"acd1cc46dfe54fe8f9786672664ca2690d0ad7e5003bc6427954d939eee8b27
152e6a947450d7fa980172de064d6569a28a83fe70fa840f5e9802cb8984ab34
bd5c1e6399ec21e4d3a3a69be4e676f395aafef7c4925fd4faee9f9e5e48af43
15df0ec2db9ad7a350b3df2f4d15dc0039846d1aca3527b1a75049e3fe34f43b
d", "1ccda20bcffb8d517ee9666866621b11822c7950d55f4bb5bee37989a7d
17312e326718be0d79546eaae87a56623b919b1715ffbd7f16028fc400774196
1c88c5d7b4daaac8d36a98c9efbb26c8a4a0e6bc15b358e528a1ac9d0f042beb
93bca16b541b33f80c933a3b769285c462ed5677bfe89df07bed5c127fd13241
d3c4b".
Set "_InfoPointer" to address of info structure for 
"KI_RSAPrivate".
Call B_GetKeyInfo passing "_InfoPointer" and "privateKey" and 
"KI_RSAPrivate".
Check equality of info structure for "KI_RSAPrivate" with 

Baldwin         Informational, Expires 12/25/1999         155


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

expected info structure for "KI_RSAPrivate".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Now use the generated key in signing and verifying

Create buffer "signature" of decimal value "1024" bytes.
Create algorithm object "x931RSASigner".
Call B_CreateAlgorithmObject passing "x931RSASigner".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SignVerify" initialized from "rsaSignX931", "0", "sha1", 
"0", "formatX931", "128", "3".
Call B_SetAlgorithmInfo passing "x931RSASigner" and 
"AI_SignVerify" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Create algorithm object "x931RSAVerifier".
Call B_CreateAlgorithmObject passing "x931RSAVerifier".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SignVerify" initialized from "rsaVerifyX931", "0", "sha1", 
"0", "formatX931", "128", "3".
Call B_SetAlgorithmInfo passing "x931RSAVerifier" and 
"AI_SignVerify" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: Sign 3 bytes

Set buffer "seed" to hex value "616263".
Call Call B_SignInit passing "x931RSASigner" and "privateKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignUpdate passing "x931RSASigner" and address of first 
initialized byte in buffer "seed" and length of initialized 
bytes in buffer "seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "x931RSASigner" and address of next 

Baldwin         Informational, Expires 12/25/1999         156


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

free byte in buffer "signature" and address of "_OutputLen" and 
length of free bytes in buffer "signature" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "signature" by "_OutputLen".
Finalize buffer "signature".
Check equality of buffer "signature" with hex value 
"061D355237E2A05866867110D32F1D8D3C5193F5CB7AC3892B7FBE89D0D85DB
544E136A549DFCF75297EA9ECE21F0855893BBF23099884E5EDAC82EDFAE44AF
0453AB631CCBA5C76EDD13CBD3D51F37FE40B9A5DD6483513386F5C70401687D
FC27D1DDAF6EDBD18CEFAD5CF817504C08F482D262AD3577AA2705AAF0905657
8".

Note: Verify the signature of the seed


Call Call B_VerifyInit passing "x931RSAVerifier" and 
"publicKey" and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyUpdate passing "x931RSAVerifier" and address of 
first initialized byte in buffer "seed" and length of 
initialized bytes in buffer "seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "x931RSAVerifier" and address of 
first initialized byte in buffer "signature" and length of 
initialized bytes in buffer "signature" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



This is the end of test case "TVRKG931".
This is the start of test case "TVRKG932".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: 1536 bit key vector test based on X9.31 example 4.2 for 
Note: AI_RSAStrongKeyGen, 
Note: KI_RSAPublic, KI_RSAPrivate
Note: AI_FormatX931, AI_SignVerify

Note: Depending on AI_DummyRandom algorithm


Baldwin         Informational, Expires 12/25/1999         157


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_DUMMY_RANDOM_MULT", "AM_FORMAT_X931", 
"AM_EXTRACT_X931", "AM_RSA_CRT_X931_ENCRYPT", 
"AM_RSA_X931_DECRYPT", "AM_RSA_STRONG_KEY_GEN", "NULL_PTR".


Note: Set up random object for param and key generation

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DummyRandomMult" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and 
"AI_DummyRandomMult" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "512" bytes.
Set buffer "seed" to hex value "1A1916DDB29B4EB7EB6732E128192E8A
AC41C576C822D93EA433D8CD81F035EC57EFE822955149D3BFF70C53520D769D
6D76646C7A792E16EBD89FE6FC5B605A649339DFC925A86A4C6D150B71B9EEA0
2D68885F5009B98BD9841A5CF72EE770DE50CB09ACCEA9134E4CAA16D2350A21
D775C404CC1092495D867E64065DEE3E7955F2EBC7D47A2D7C9953388F97DDDC
3E1CA19C35CA659EDC2FC3256D29C2627479C086A699A49C4C9CEE7EF7BD1B34
321DE34A".


Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate RSA Keypair

Create algorithm object "rsaKeyGen".
Call B_CreateAlgorithmObject passing "rsaKeyGen".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RSAStrongKeyGen" initialized from "1536", "3".

Baldwin         Informational, Expires 12/25/1999         158


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_SetAlgorithmInfo passing "rsaKeyGen" and 
"AI_RSAStrongKeyGen" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "publicKey".
Call B_CreateKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "privateKey".
Call B_CreateKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_GenerateInit passing "rsaKeyGen" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_GenerateKeypair passing "rsaKeyGen" and "publicKey" 
and "privateKey" and "random" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Set "_InfoPointer" to address of info structure for 
"KI_RSAPrivate".
Call B_GetKeyInfo passing "_InfoPointer" and "privateKey" and 
"KI_RSAPrivate".
Display info structure for "KI_RSAPrivate".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "KI_RSAPrivate" initialized from 
"99f4b516fb3dacdb0e8f2c208c7c4271d1a51c040d0934014370ae59132f2fa
ef9ff6fb3a89fb0b5f36b36121641c2f9582f3dd80a2f0a5807609c3ce2c5ec4
bf46977b85e0bb4394705bc3108b3b6813ad0e86577a460b65b95bb013295218
e4125ab763388f354a22528daf643c179ddf787dce34a5486e2870d1cf17166c
f847ef3cdcd9c00a4938a3782e6fe7a5f3872c1d35a602f741403dccb1f704d0
3b612dd472a89f353cf085a641b1ab8fd5e5aefb9fadf0426aaf32cd0e2dc436
1", "066a32364a77e733cb45f72c05da82c4be118bd5808b0cd562cf5c990b7
74ca74a6aa4a77c5bfcb23f79cceb6b9812ca63aca293ab174b19004eb12d341
d94832a2f0fa7ae95d22d0da03d2cb5b2279ab7c8b4598fa6d95cee7b9275621
b8c10877092d44c0f33ad4dde5e0c4cff980a81cb1b622155ffb0baee8fa4a60
d30fc886ff4063271988e6498227a80efcaa44fa19071717be1b3344f5cd4d42
a2d3b78283fea3c92c5c421f2258cff1cf86f1a08211c2ffa20f53d467d4d231
bc8b3".
Set "_InfoPointer" to address of info structure for 
"KI_RSAPrivate".
Call B_GetKeyInfo passing "_InfoPointer" and "privateKey" and 

Baldwin         Informational, Expires 12/25/1999         159


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"KI_RSAPrivate".
Check equality of info structure for "KI_RSAPrivate" with 
expected info structure for "KI_RSAPrivate".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Note: Check the DSA private


Set "_InfoPointer" to address of info structure for 
"KI_RSAPublic".
Call B_GetKeyInfo passing "_InfoPointer" and "publicKey" and 
"KI_RSAPublic".
Display info structure for "KI_RSAPublic".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "KI_RSAPublic" initialized from 
"99f4b516fb3dacdb0e8f2c208c7c4271d1a51c040d0934014370ae59132f2fa
ef9ff6fb3a89fb0b5f36b36121641c2f9582f3dd80a2f0a5807609c3ce2c5ec4
bf46977b85e0bb4394705bc3108b3b6813ad0e86577a460b65b95bb013295218
e4125ab763388f354a22528daf643c179ddf787dce34a5486e2870d1cf17166c
f847ef3cdcd9c00a4938a3782e6fe7a5f3872c1d35a602f741403dccb1f704d0
3b612dd472a89f353cf085a641b1ab8fd5e5aefb9fadf0426aaf32cd0e2dc436
1", "03".
Set "_InfoPointer" to address of info structure for 
"KI_RSAPublic".
Call B_GetKeyInfo passing "_InfoPointer" and "publicKey" and 
"KI_RSAPublic".
Check equality of info structure for "KI_RSAPublic" with 
expected info structure for "KI_RSAPublic".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Now use the generated key in signing and verifying

Create buffer "signature" of decimal value "1024" bytes.
Create algorithm object "x931RSASigner".
Call B_CreateAlgorithmObject passing "x931RSASigner".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SignVerify" initialized from "rsaSignX931", "0", "sha1", 
"0", "formatX931", "192", "3".
Call B_SetAlgorithmInfo passing "x931RSASigner" and 
"AI_SignVerify" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Baldwin         Informational, Expires 12/25/1999         160


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999



Create algorithm object "x931RSAVerifier".
Call B_CreateAlgorithmObject passing "x931RSAVerifier".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SignVerify" initialized from "rsaVerifyX931", "0", "sha1", 
"0", "formatX931", "192", "3".
Call B_SetAlgorithmInfo passing "x931RSAVerifier" and 
"AI_SignVerify" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: Sign 3 bytes

Set buffer "seed" to hex value "616263".
Call Call B_SignInit passing "x931RSASigner" and "privateKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignUpdate passing "x931RSASigner" and address of first 
initialized byte in buffer "seed" and length of initialized 
bytes in buffer "seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "x931RSASigner" and address of next 
free byte in buffer "signature" and address of "_OutputLen" and 
length of free bytes in buffer "signature" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "signature" by "_OutputLen".
Finalize buffer "signature".
Check equality of buffer "signature" with hex value 
"2bd1aedbe89a4da184ed40155c8b2f2980b98158ac6eab6df6c440f6af07f5f
88e00f3682b5e74a01929727bb6464f31b9b5b9343e1b4d75bf317211e274db9
0b11105720d363c0506c2803723f121d68c94ba70bf2e8cfbc379f4ecb7754b6
19e524f9fc336d70a597d0d89a0a314b25191040425c0f7740755b8e51cb6201
786c14fb910dc6193bb65790c002b38d1ce05e473bcfb670496c2c51d236410c
7129bf0ac3e29519e42eb3aed76f75f8233a91e87f566ebdfbb5fef46987da4a
7".

Note: Verify the signature of the seed


Call Call B_VerifyInit passing "x931RSAVerifier" and 
"publicKey" and "_Chooser" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         161


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyUpdate passing "x931RSAVerifier" and address of 
first initialized byte in buffer "seed" and length of 
initialized bytes in buffer "seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "x931RSAVerifier" and address of 
first initialized byte in buffer "signature" and length of 
initialized bytes in buffer "signature" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



This is the end of test case "TVRKG932".
This is the start of test case "TVRKG933".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: 2024 bit key vector test based on X9.31 example 4.2 for 
Note: AI_RSAStrongKeyGen, 
Note: KI_RSAPublic, KI_RSAPrivate
Note: AI_FormatX931, AI_SignVerify

Note: Depending on AI_DummyRandom algorithm


Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_DUMMY_RANDOM_MULT", "AM_FORMAT_X931", 
"AM_EXTRACT_X931", "AM_RSA_CRT_X931_ENCRYPT", 
"AM_RSA_X931_DECRYPT", "AM_RSA_STRONG_KEY_GEN", "NULL_PTR".


Note: Set up random object for param and key generation

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DummyRandomMult" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and 
"AI_DummyRandomMult" and "_InfoPointer".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         162


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "700" bytes.
Set buffer "seed" to hex value "1a1916ddb29b4eb7eb6732e128192e8a
ac41c576c822d93ea433e532cf6e17e192b694e1313a3ce043534cd24e264e77
3f7bde8d9a190ef1a5ab841c4d3932a85b48d428875dd710176489e6973dcbb9
dc379432c26b33aa6fb3b19b03e06bd8afdfd0452aa293a77fee18a6a41aed3a
daecc8d8f4f25c2dd7b13fcdf8b6c0b4c92673bf924b50d498da2a16e373dd40
5ad110bea0137317b3081f2654ce23e5f7770f8728670c1d867e64065dee3e79
55f2ebc7D2DDB9275760C8AACFC46AD6C3D78F0788D18733D6B024043E04AE70
E71794C0231ACBAD28FC0FC137D8CFA848747594F6EE8D5D318C6962A70AB471
BA439B1227EEEAFDEAB75AC119D72178BAF4685B931DF1C87E230F33EB120CDF
E7A618A48C63B2069E62610152752C113990A21A551FE17F6F711CE812197E1C
9CE5DEA6".

Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate RSA Keypair

Create algorithm object "rsaKeyGen".
Call B_CreateAlgorithmObject passing "rsaKeyGen".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RSAStrongKeyGen" initialized from "2048", "3".
Call B_SetAlgorithmInfo passing "rsaKeyGen" and 
"AI_RSAStrongKeyGen" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "publicKey".
Call B_CreateKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "privateKey".
Call B_CreateKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_GenerateInit passing "rsaKeyGen" and "_Chooser" and 
"_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         163


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_GenerateKeypair passing "rsaKeyGen" and "publicKey" 
and "privateKey" and "random" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Check the RSA public

Set "_ExpectedInfoPointer" to address of expected info 
structure for "KI_RSAPublic" initialized from 
"bcca30ca5280bc51e758dbaffedfe46a5d2a78d83969e154780f9b27ad4e76e
63e8fa96029c04de3f2c4b01fecbebb44fc2f5f8ac69bd0e3278ff0658a6f9ac
23bcfb2c9aaaf1ac4d5571a55d3b1ec3550cf34d8f789235dd3b5c4e2f3df176
119d918f2d35e805b62fc35fee5fd07854824b9846dc1665e35a31873bf6a24f
e50842d0aa0305c35d0f45b0d7c2f1e9432d850d67956d383bbef52fc2acbf7a
e6f7ca21488a56456bdf6672696ee037c3caa2199904e37aa40134e10155fc81
393a225bd129c4b3bc91ad3a5fc958a6abcabe3550390b67787625d78f8d3172
b673c4482ce354b8951d7e8c4ddce5d4cdfa6790c6ce8c02c8d807ae26f27fe3
3", "03".
Set "_InfoPointer" to address of info structure for 
"KI_RSAPublic".
Call B_GetKeyInfo passing "_InfoPointer" and "publicKey" and 
"KI_RSAPublic".
Check equality of info structure for "KI_RSAPublic" with 
expected info structure for "KI_RSAPublic".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: Check the RSA private


Set "_ExpectedInfoPointer" to address of expected info 
structure for "KI_PKCS_RSAPrivate" initialized from 
"bcca30ca5280bc51e758dbaffedfe46a5d2a78d83969e154780f9b27ad4e76e
63e8fa96029c04de3f2c4b01fecbebb44fc2f5f8ac69bd0e3278ff0658a6f9ac
23bcfb2c9aaaf1ac4d5571a55d3b1ec3550cf34d8f789235dd3b5c4e2f3df176
119d918f2d35e805b62fc35fee5fd07854824b9846dc1665e35a31873bf6a24f
e50842d0aa0305c35d0f45b0d7c2f1e9432d850d67956d383bbef52fc2acbf7a
e6f7ca21488a56456bdf6672696ee037c3caa2199904e37aa40134e10155fc81
393a225bd129c4b3bc91ad3a5fc958a6abcabe3550390b67787625d78f8d3172
b673c4482ce354b8951d7e8c4ddce5d4cdfa6790c6ce8c02c8d807ae26f27fe3
3", "03", "1f770821b86aca0da68ecf47ffcffb670f8714240991a58e14029
9dbf237be7bb517f19006f56250a8761d5aa7751f362a07e541cbc4a2d08697f
d6641bd4475b4a29dcc471d2f20ce392f0e4df2fcb38d77de24294185e4f89e4
b7b28a52e902ef98428788fc00f3b2a08ffd0ff8140e15b7440bcf5910fb39b2
ebdf53c5b7f6ebdf0be32d25578bcb7ca7f69e9375ee4de1494b8b292ab453a2
c685e2074e076b64187b22ad43772fe2d5abe9193c074a37f7fc32bfdad5623a
3dddbe84a379f0409251f576019cfd516971cfef05ad8268ce844087763cde93

Baldwin         Informational, Expires 12/25/1999         164


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

9f11e2a8678ef2c6ef63d2aa48c997c7c75548d9d4eb23043583c3eac1cd990e
6a4178b18eb", "e532cf6e17e192b694e1313a3ce043534cd24e264e773f7bd
e8d9a190ef1a5ab841c4d3932a85b48d428875dd710176489e6973dcbb9dc379
432c26b33aa6fb3b19b03e06bd8afdfd0452aa293a77fee18a6a41aed3adaecc
8d8f4f25c2dd7b13fcdf8b6c0c8a33e72998487de550e0d7188aa87b2cf20d5c
7f83eb0c95ed0c1", "d2ddb9275760c8aacfc46ad6c3d78f0788d18733d6b02
4043e04ae70e71794c0231acbad28fc0fc137d8cfa848747594f6ee8d5d318c6
962a70ab471ba439b1227eeeafdeab75ac119d72178baf4685b931df1c87e230
f33eb120cdfe7a618a48c63b2069e6cccff4653797d04279f6740fc3a7350a19
6a9ac22d459188697f3", "98cc8a4965410c79b89620d17dead78cdde1896ed
efa2a52945e66bb5f4bc3c7ad68337b771ae785e2c5af93e4b564edb14464d3d
d2692cfb821d6f222719fcd211202959d3b1fea8ad8c7170d1a554965c46d674
8d1e74885e5f8a192c93a762a895079d5db177ef71103053ee35eb3a105c7052
1df6b392ffad475db948b2b", "8c93d0c4e4eb3071dfd84739d7e50a0505e10
4cd39cac2ad7eadc9a09a0fb8801767327370a80a80cfe5dfc585a2f90df9f45
e3e21084641c4b1cda126d7bcb6c549f1fe9c7a3c80bbe4c0fb274d9ae7b7694
bdafec20a229cb6b33fefc4106db2ed2159bef33354d98cfba8ad6fbf9a2b52d
1a235c10f1bc817383b65af0ff7", "ba91456e8aafa0451a3f564d6580a1d89
79f85f33a9c46c8f904328b5f2743d65e98563d158fb4d289efc8b39fd79e969
dae6152c8cc3b1f2bce9f5cb7f593eed9e50169edecf82b0361828852c7b700c
a3655d434916fc5a13eef4ffa4136f41e3ef11aa76a67294480d8eb6973bafd7
7c2d8ca6c33ad71c079d3d65e30352a".
Set "_InfoPointer" to address of info structure for 
"KI_PKCS_RSAPrivate".
Call B_GetKeyInfo passing "_InfoPointer" and "privateKey" and 
"KI_PKCS_RSAPrivate".
Check equality of info structure for "KI_PKCS_RSAPrivate" with 
expected info structure for "KI_PKCS_RSAPrivate".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Now use the generated key in signing and verifying

Create buffer "signature" of decimal value "1024" bytes.
Create algorithm object "x931RSASigner".
Call B_CreateAlgorithmObject passing "x931RSASigner".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SignVerify" initialized from "rsaSignX931", "0", "sha1", 
"0", "formatX931", "256", "3".
Call B_SetAlgorithmInfo passing "x931RSASigner" and 
"AI_SignVerify" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Create algorithm object "x931RSAVerifier".
Call B_CreateAlgorithmObject passing "x931RSAVerifier".

Baldwin         Informational, Expires 12/25/1999         165


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SignVerify" initialized from "rsaVerifyX931", "0", "sha1", 
"0", "formatX931", "256", "3".
Call B_SetAlgorithmInfo passing "x931RSAVerifier" and 
"AI_SignVerify" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: Sign 3 bytes

Set buffer "seed" to hex value "616263".
Call Call B_SignInit passing "x931RSASigner" and "privateKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignUpdate passing "x931RSASigner" and address of first 
initialized byte in buffer "seed" and length of initialized 
bytes in buffer "seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "x931RSASigner" and address of next 
free byte in buffer "signature" and address of "_OutputLen" and 
length of free bytes in buffer "signature" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "signature" by "_OutputLen".
Finalize buffer "signature".


Display buffer "signature".
Check equality of buffer "signature" with contents of buffer 
"signature".


Check equality of buffer "signature" with hex value 
"2b6557434af5230b2693648c2c797a47e197da08d4aef6f3d49edfa22e7332a
227366f2bc597e0d54863c84e9139aeadc9d174604119fad959b2bf8eddfb15c
a6b06c3efd7f6a740719e541d289833845f5ae3888003711ecb1027cf8600c20
a3719903592c63533ab7258eba709f5f45b8e9df33532cc70d9165be2aa7bce2
99c951d585f74c3fc25685788abc3325714fdf5933ca6ac528ebbead99e02dc7
9c1151156bc59dbb8f32bdfab92f7b28fb35c646a281cdd75460f07436a140bc
b47a971cf157d0773888b9c07723e774922fcdfd204cd4bc317b4d5f6ef6f4cb
4e6840bb56e2ddef88c349e8fd9cba049d1df2329848a7f4227e44021813b7f8
d".


Baldwin         Informational, Expires 12/25/1999         166


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Verify the signature of the seed


Call Call B_VerifyInit passing "x931RSAVerifier" and 
"publicKey" and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyUpdate passing "x931RSAVerifier" and address of 
first initialized byte in buffer "seed" and length of 
initialized bytes in buffer "seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "x931RSAVerifier" and address of 
first initialized byte in buffer "signature" and length of 
initialized bytes in buffer "signature" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



This is the end of test case "TVRKG933".
This is the start of test case "TVRKG935".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: 1024 bit key vector test based on X9.31 example 4.5 for 
Note: AI_RSAStrongKeyGen, 
Note: KI_RSAPublic, KI_RSAPrivate
Note: AI_FormatX931, AI_SignVerify

Note: Depending on AI_DummyRandom algorithm


Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_DUMMY_RANDOM_MULT", "AM_FORMAT_X931", 
"AM_EXTRACT_X931", "AM_RSA_CRT_X931_ENCRYPT", 
"AM_RSA_X931_DECRYPT", "AM_RSA_STRONG_KEY_GEN", "NULL_PTR".


Note: Set up random object for param and key generation

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         167


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DummyRandomMult" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and 
"AI_DummyRandomMult" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "512" bytes.
Set buffer "seed" to hex value "1857FA8D9D0B0E4E033B68CE401A416A
5C0DAB5E4CEB97EB9EECDBB3CB4C375C0ECD2FD300DB4F08547293CA004CEDD2
019CE79CA08A15EEFB25DD3BAF981823961F4148FF03C6E96930B78C7A758D69
BC5070137900403807A4198C4AD4DBA81A560183DD19BA1A5A797EB98BEFF431
2D0C9EF7EEAA4A5347999FE76FB7876064BBEC66CB409A7739EF5A5906613DC3
7225D41D2BEB1F9F5EBF4CC95B6BF916A47C5EF2146BE00ECD4A1C5D88B3E85A
9569BE97".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate RSA Keypair

Create algorithm object "rsaKeyGen".
Call B_CreateAlgorithmObject passing "rsaKeyGen".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RSAStrongKeyGen" initialized from "1024", "2".
Call B_SetAlgorithmInfo passing "rsaKeyGen" and 
"AI_RSAStrongKeyGen" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "publicKey".
Call B_CreateKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "privateKey".
Call B_CreateKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_GenerateInit passing "rsaKeyGen" and "_Chooser" and 

Baldwin         Informational, Expires 12/25/1999         168


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_GenerateKeypair passing "rsaKeyGen" and "publicKey" 
and "privateKey" and "random" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Check the RSA public

Set "_ExpectedInfoPointer" to address of expected info 
structure for "KI_RSAPublic" initialized from 
"ccd34c2f4d95ffad1420e666c07e39d1450a13304c3f5891ede57595c772a36
91ab51d2bece1476b8f22ae223365f183bc3ee2d4cacdba3ad0c4d4781c523a1
0efe6203d6f3bc226bf9a459727b8f122c482d8c86019f9a869329187096430a
6c67cb103742bcbc66906ad23836ebabb511d5d80ab8cb59974e9aac62d785c4
5", "02".
Set "_InfoPointer" to address of info structure for 
"KI_RSAPublic".
Call B_GetKeyInfo passing "_InfoPointer" and "publicKey" and 
"KI_RSAPublic".
Check equality of info structure for "KI_RSAPublic" with 
expected info structure for "KI_RSAPublic".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: Check the RSA private

Set "_ExpectedInfoPointer" to address of expected info 
structure for "KI_RSAPrivate" initialized from 
"ccd34c2f4d95ffad1420e666c07e39d1450a13304c3f5891ede57595c772a36
91ab51d2bece1476b8f22ae223365f183bc3ee2d4cacdba3ad0c4d4781c523a1
0efe6203d6f3bc226bf9a459727b8f122c482d8c86019f9a869329187096430a
6c67cb103742bcbc66906ad23836ebabb511d5d80ab8cb59974e9aac62d785c4
5", "199a6985e9b2bff5a2841cccd80fc73a28a142660987eb123dbcaeb2b8e
e546d2356a3a57d9c28ed71e455c4466cbe307787dc5a9959b7475a189a8f038
a4741e4b10153be08c26e4401f7ab6e7e96092caf07c0870b13b64f669667302
9ec2c77aabc397fa528a245d7073ce69cc9bdcd7bef91599dca484000c0bd8ab
0814e".
Set "_InfoPointer" to address of info structure for 
"KI_RSAPrivate".
Call B_GetKeyInfo passing "_InfoPointer" and "privateKey" and 
"KI_RSAPrivate".
Check equality of info structure for "KI_RSAPrivate" with 
expected info structure for "KI_RSAPrivate".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Baldwin         Informational, Expires 12/25/1999         169


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999



Note: Now use the generated key in signing and verifying

Create buffer "signature" of decimal value "1024" bytes.
Create algorithm object "x931RSASigner".
Call B_CreateAlgorithmObject passing "x931RSASigner".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SignVerify" initialized from "rsaSignX931", "0", "sha1", 
"0", "formatX931", "128", "3".
Call B_SetAlgorithmInfo passing "x931RSASigner" and 
"AI_SignVerify" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Create algorithm object "x931RSAVerifier".
Call B_CreateAlgorithmObject passing "x931RSAVerifier".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SignVerify" initialized from "rsaVerifyX931", "0", "sha1", 
"0", "formatX931", "128", "3".
Call B_SetAlgorithmInfo passing "x931RSAVerifier" and 
"AI_SignVerify" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: Sign 3 bytes

Set buffer "seed" to hex value "616263".
Call Call B_SignInit passing "x931RSASigner" and "privateKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignUpdate passing "x931RSASigner" and address of first 
initialized byte in buffer "seed" and length of initialized 
bytes in buffer "seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "x931RSASigner" and address of next 
free byte in buffer "signature" and address of "_OutputLen" and 
length of free bytes in buffer "signature" and "random" and 
"_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         170


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "signature" by "_OutputLen".
Finalize buffer "signature".
Check equality of buffer "signature" with hex value 
"232F0E08EB9A23957646697FC7884796D39A04FD0EFF5B72B60813D4E691917
891C96603876D08793AAD86DAF2E6187FF62C226E81BD6B993B27091E0864895
AF10F222AEB022961B444D312EA3DB7891D4550B280CF24693D4465B957E53CB
DB0F8C29D2B5EE1545D6C91A45EAAACEC0096D8A5E4CFE06A2CD320BDF853D81
7".




Note: Verify the signature of the seed

Call Call B_VerifyInit passing "x931RSAVerifier" and 
"publicKey" and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyUpdate passing "x931RSAVerifier" and address of 
first initialized byte in buffer "seed" and length of 
initialized bytes in buffer "seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "x931RSAVerifier" and address of 
first initialized byte in buffer "signature" and length of 
initialized bytes in buffer "signature" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



This is the end of test case "TVRKG935".
This is the start of test case "TVRSAP01".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector tests, PKCS RSA encryption and decryption

Note: ----------------------------------------------------------
Note: ----------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_RSA_ENCRYPT", "AM_RSA_CRT_ENCRYPT", 
"AM_MD2_RANDOM", "NULL_PTR".

Baldwin         Informational, Expires 12/25/1999         171


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999



Note: Use the following random algorithm object througout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD2Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "2" bytes.
Set buffer "seed" to hex value "0000".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Input the value given and check the result against the 
Note: result
Note: produced by BSAFE 2.1.2

Note: Use an the following 777-bit keypair

Create key object "publicKey".
Call B_CreateKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_RSAPublic" initialized from "01aff1bfa898e4656dc06f97f5cda85
345e4813a92e57c39a72f277a4dfeaad685507241f61b0c5e744a2bf12ee2b16
2d7674c8de231bedbf3af349bf92199d2e97c735033c39e109fac775d12ebdae
d0132ee1e9125816f8099c84b93f946379cb7", "010001".
Call B_SetKeyInfo passing "publicKey" and "KI_RSAPublic" and 
"_InfoPointer".

Baldwin         Informational, Expires 12/25/1999         172


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create key object "privateKey".
Call B_CreateKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_PKCS_RSAPrivate" initialized from "01aff1bfa898e4656dc06f97f
5cda85345e4813a92e57c39a72f277a4dfeaad685507241f61b0c5e744a2bf12
ee2b162d7674c8de231bedbf3af349bf92199d2e97c735033c39e109fac775d1
2ebdaed0132ee1e9125816f8099c84b93f946379cb7", "010001", 
"cb58ef16ab2bd3085130f80433168c657a06d0917951fb3e56b7aa1f6fc5f38
9fd6e5cd944b09503002c21b625e8c69476687355240df3c2177d7564c2780bb
baa855b70103cf7a540c5d7e7136cbcb6aa8d5518b3ae9032f7468b7d81ee616
d89", "1fb6d010eab6f59a4421a6778f911a33148eb2a70513d9b5648a30d8b
27874bfea18ee6a869ad6d5236b538a62a46f1325", "0d9eb46fbf1a16db07b
10030fed4d1ce687b613520575a33c48502801c4ba475d46dac29e667d89af03
2b64e103d5f97ab", "1145d240c4756d82ddc4ae13c43fb55348c907886bfd8
9bf7fc8bc1de9e62d403151eed85a038f2a7aa603d40531a5c579", 
"0d0596d85c6b123d19ee7613622191f2f9dc34c579856afda1bfd5f32c9a79c
41a753d2cd658a53505c046a2fe4ddf8e7f", "0382dd6cc2d80db494cc60908
1b56d37e4dcbc592ffedaa02a225ee8a09204a4b094ab514f69d668b8423499d
ae135ffac".
Call B_SetKeyInfo passing "privateKey" and "KI_PKCS_RSAPrivate" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt and decrypt the following data.

Create buffer "input" of decimal value "32" bytes.
Set buffer "input" to hex value "10cae34ddaf234b5feedd98ac544e02
79ae2c5c14d1ec835feb6f48aeb26414b".
Create buffer "output" of decimal value "98" bytes.

Note: Public key encryption.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_PKCS_RSAPublic" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_PKCS_RSAPublic" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         173


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_EncryptInit passing "encryptObj" and "publicKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "random" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"0192bb944584995809f6414d0ec12d8a64356cbdc7a21ccccd3c09f3a0c49da
ed0f2731c6b16368346f5dd46f065292461aaca8cf1f5d862d43e97c05024984
78be39a44e512698e3b0cf7db816914d328dec9d5728a63ae906514e8fd493b0
8f219".
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Private key encryption.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_PKCS_RSAPrivate" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_PKCS_RSAPrivate" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "privateKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 

Baldwin         Informational, Expires 12/25/1999         174


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "random" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"010851a47f356b9d3487c1e0625802e0ff87f48ac4df12b2efa2baacab9f99b
e7d379ee8d9408c4e981f3c058bd7bc66df6a3cb57371adf08ef9d02a15c0439
2064b6dbac3d154b86ca59384df6c7ede557460ef95415b4eed56325d5982a90
5efb7".

Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TVRSAP01".
This is the start of test case "TVRSAP02".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector tests, PKCS RSA encryption and decryption

Note: ----------------------------------------------------------
Note: ----------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_RSA_ENCRYPT", "AM_RSA_CRT_ENCRYPT", 
"AM_MD5_RANDOM", "NULL_PTR".


Note: Use the following random algorithm object througout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         175


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "2" bytes.
Set buffer "seed" to hex value "0000".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 02-1

Note: Input the value given and check the result against the 
Note: result
Note: produced by BSAFE 2.1.2

Note: Use an the following 1994-bit keypair

Create key object "publicKey".
Call B_CreateKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_RSAPublic" initialized from "03a886ca1029bb5ee2e8e455b2dd4a3
632315cf58e0c5ad9a5422bff4dbe7a0cec258ae7932e49c58986c56f932ca88
501187e8e92aa4a28fb2e83ed107a2b4b1c63bd6ba18e00d0bd6b359fe01f7b5
66895f943c40f5d012149ea4c4a7337e1fe5498b40728616509219ba54323bb6
e78a84ab7b74fb3b195afab14aa9ad0061cb813693a6de691c42164385ca6b9d
8173aba42180aa3d2fadd63118adcdc23be6e30921ff4a23460ec413f9ee3a17
d516359cbcd6d411aab16db5d697c388cfd4e3f295e4a7413b7fa06032fc6700
fb6a64be8b8400040282938a1dbfe550f3e3bb9b1807dd67474dee187307f0fe
088437c44e19ecd9e50e9", "010001".
Call B_SetKeyInfo passing "publicKey" and "KI_RSAPublic" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Baldwin         Informational, Expires 12/25/1999         176


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create key object "privateKey".
Call B_CreateKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_PKCS_RSAPrivate" initialized from "03a886ca1029bb5ee2e8e455b
2dd4a3632315cf58e0c5ad9a5422bff4dbe7a0cec258ae7932e49c58986c56f9
32ca88501187e8e92aa4a28fb2e83ed107a2b4b1c63bd6ba18e00d0bd6b359fe
01f7b566895f943c40f5d012149ea4c4a7337e1fe5498b40728616509219ba54
323bb6e78a84ab7b74fb3b195afab14aa9ad0061cb813693a6de691c42164385
ca6b9d8173aba42180aa3d2fadd63118adcdc23be6e30921ff4a23460ec413f9
ee3a17d516359cbcd6d411aab16db5d697c388cfd4e3f295e4a7413b7fa06032
fc6700fb6a64be8b8400040282938a1dbfe550f3e3bb9b1807dd67474dee1873
07f0fe088437c44e19ecd9e50e9", "010001", "024b1b3cff86f9f4d131893
b84672007fbcd60667c479888cb0641c8ca7737d2741451113dfe8db6edb1748
2aef4172d5273859b61aca9d3292c8efe060f60a6b4c47e5244345ea47dab013
219f20283380b94f97ba6d9fa44612f25e6a2768d11c0fcfe1762a4340fd666d
9e2ce3ac95590c34e8af7c741f401edb185e02af243897e26dca7e106731f97e
263d9afbb8e488c4bfad7e3a26f28855a456f377a897c208301ee5bddfaa58e7
f43a0fdd206bfa53bf11e7ef0aab81e2424f29ee71833c21eaabdfe8550dd145
c361f224d9a45cf77fa71fd87bb60685557b1aabfdda51263bd6b07e02893e2a
85f6bda02a2f7554494e6edb62311", "1ead516e9ba0f918d62db10280e1518
50820e6e56179a4ad05d63c3cc7af0c15924d21e62974fa7260c9dfd579da1f0
5039b5e6830cd793cad1361501bc67eac1bdd5af6beedf8135e06cb53060a8ab
633c9e6246de5398183aa4e4f22f0b28342a573361a6d1615e0549f2d0805e84
355ac3f155e1e102423a7bb36e5", "1e87522f167933e0f9055fab0a16ce84a
5b276781a33588a34a5d8797695ea1c98abb89b2505f88dfbf0ed9642b291268
b512dd7d23f9593d5121b78792f600370654dc8b4ad173784218b11d913555dd
491fb5bcd7440273d4ad62b98bf9247cc1a1333ff20d91abaaf5e34249353cae
ef8944d347670583e394d6db5", "1822cf3e122e5dae3fdd2536ce05f9288cd
3ae36ed3152f25af44ae29b4d4b59b1890451dd6e4f1a2cb2c86c6279ce0c18e
1662eddaedc6373dd1aa477a5fdc6160a5be665244019a4d1fda92dc89f88694
8c1cd09b5df3fda42e567f81a9ea90d87b514ed47c4a7a39f90b95265ab6f46f
9c58c5f4791f58d240bf54d", "11929b3ff793b4c51f1274cb23779550cd803
8a9518b94bf99268dc0fcfdb650d7a0a116cceceef1ebbff742b309ce7b7d5e3
1213628db94c8e52f62dd7ee3a9971cf8f53aeb179e21349db49c5b809c0e2c2
99fe257b445e2061dd9e2870350c8af89b6387953ff0acebf4f0c6eb1a0f285a
bf7f4e6e82c234520c8b1", "020086ab73e7b4cd307f963c0f50d6468c6a589
a8ae5ef82211d58600569c9e3ecc5839543131cad2880fff40289fff44cafa4a
1eb56e5211a48e8193b10c9320f5d5d66966aaa7bd5eac0d5d04d78621267b2c
9cbb1dcda49b94f1a88ffc4bc4b949e4c28baa9a4e310de344db17b974aa2e16
41cfd727ad46d16ec96".
Call B_SetKeyInfo passing "privateKey" and "KI_PKCS_RSAPrivate" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt and decrypt the following data.

Create buffer "input" of decimal value "32" bytes.
Set buffer "input" to hex value "2b98bf9247cc1a1333ff2f894422cf3

Baldwin         Informational, Expires 12/25/1999         177


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

536c36ed3152f25af446ecb2c2eddaedc".
Create buffer "output" of decimal value "251" bytes.

Note: Public key encryption.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_PKCS_RSAPublic" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_PKCS_RSAPublic" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "publicKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "random" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"0016c2127c2b9168f3a05c206f6b916184f55bdc94937f0e0751234be72dc91
a70827014583dd56096544c527e3d183ff9eaf634ec1d1515c58031c782fc367
ba1f5a94ed3ef5d7be7024dfd71766fa1f1cc6fa6107e782d554e0012c8c4591
d8717f81f850cfc56b4696ff8cc46d04021ba26c2dd40e2a82cbdd54a2c07cc9
b2412fe5a584f6a10d051c5ca8d38882e0b1c1f1d21e171fb2b7d3c5f614d9aa
0b5bfee22ce6afced8096590e34545467a80a2ace4f53577b1da62bfe38516c8
760c509406b1037908f648739aa0c52a2c4ace9364eb9ee645270466f64f8338
4b16403bc5610adf98296e7c4e0da75344fb811ad8bdfcd2a7899".
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         178


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Private key encryption.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_PKCS_RSAPrivate" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_PKCS_RSAPrivate" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "privateKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "random" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"018a5aeb53a816ed677c0d3240807025dfed44ac0c8a92a2461bd847a2aa257
f437ea8977666b09f07ea83dbe6dbed5e7c0f28723decf099a3dfd569825a457
0f96bdbec49e2b8f7d8a67d5e01e13469661403debc70bff9fcba6dbd226c80a
27e25b4f9eb01b53fe904a11ec46cdf2447df4512b7dc2fb4f4f2050f99f7e8d
a526122d352b55ee3db2cea7deecb3e7611de03ca8a350c83217449d2a3c87a0
d80c587b92937f83e16d6f42e69761981f5d64148861dd1a5790b58cd702ee21
e18abd310d5d2604a4adeeaaf2274a0c0caf43c1a48d0ffe8264e756fa223f1b
51b6741dd7d21e8b52224dc2cf86c1c030b2a323c69122980a85d".

Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------

Baldwin         Informational, Expires 12/25/1999         179


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: ----------
This is the end of test case "TVRSAP02".
This is the start of test case "TVRSAPK1".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector tests, PKCS 1 V2 OAEP RSA encryption and 
Note: decryption

Note: ----------------------------------------------------------
Note: ----------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_RSA_ENCRYPT", "AM_RSA_CRT_ENCRYPT", 
"AM_MD2_RANDOM", "NULL_PTR".


Note: Use the following random algorithm object througout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "2" bytes.
Set buffer "seed" to hex value "0000".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Input the value given and check the result.

Baldwin         Informational, Expires 12/25/1999         180


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Use the following 777-bit keypair

Create key object "publicKey".
Call B_CreateKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_RSAPublic" initialized from "01aff1bfa898e4656dc06f97f5cda85
345e4813a92e57c39a72f277a4dfeaad685507241f61b0c5e744a2bf12ee2b16
2d7674c8de231bedbf3af349bf92199d2e97c735033c39e109fac775d12ebdae
d0132ee1e9125816f8099c84b93f946379cb7", "010001".
Call B_SetKeyInfo passing "publicKey" and "KI_RSAPublic" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create key object "privateKey".
Call B_CreateKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_PKCS_RSAPrivate" initialized from "01aff1bfa898e4656dc06f97f
5cda85345e4813a92e57c39a72f277a4dfeaad685507241f61b0c5e744a2bf12
ee2b162d7674c8de231bedbf3af349bf92199d2e97c735033c39e109fac775d1
2ebdaed0132ee1e9125816f8099c84b93f946379cb7", "010001", 
"cb58ef16ab2bd3085130f80433168c657a06d0917951fb3e56b7aa1f6fc5f38
9fd6e5cd944b09503002c21b625e8c69476687355240df3c2177d7564c2780bb
baa855b70103cf7a540c5d7e7136cbcb6aa8d5518b3ae9032f7468b7d81ee616
d89", "1fb6d010eab6f59a4421a6778f911a33148eb2a70513d9b5648a30d8b
27874bfea18ee6a869ad6d5236b538a62a46f1325", "0d9eb46fbf1a16db07b
10030fed4d1ce687b613520575a33c48502801c4ba475d46dac29e667d89af03
2b64e103d5f97ab", "1145d240c4756d82ddc4ae13c43fb55348c907886bfd8
9bf7fc8bc1de9e62d403151eed85a038f2a7aa603d40531a5c579", 
"0d0596d85c6b123d19ee7613622191f2f9dc34c579856afda1bfd5f32c9a79c
41a753d2cd658a53505c046a2fe4ddf8e7f", "0382dd6cc2d80db494cc60908
1b56d37e4dcbc592ffedaa02a225ee8a09204a4b094ab514f69d668b8423499d
ae135ffac".
Call B_SetKeyInfo passing "privateKey" and "KI_PKCS_RSAPrivate" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt and decrypt the following data.

Create buffer "input" of decimal value "32" bytes.
Set buffer "input" with string value "RSA Data Security Bsafe 
Toolkit".


Baldwin         Informational, Expires 12/25/1999         181


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create buffer "encryptedResult" of decimal value "400" bytes.
Set buffer "encryptedResult" to hex value "0118f15daa7e60ec2a8b7
6c3e3c94c6e1c684b98461d6986f442f695e5568472b30f8bb304d039a1ef705
c29c59f50e6c9b5066aa3d5af6e29f2a2608c9f4016eb7195d230274334631e5
8925129b36b3be655adbdbbeac5f7319ce1104fe39d1786".

Create buffer "output" of decimal value "200" bytes.

Note: Public key encryption.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_PKCS_OAEP_RSAPublic" initialized from "sha1", "mgf1", 
"sha1", "specifiedParameters",.
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_PKCS_OAEP_RSAPublic" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "publicKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "random" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "encryptedResult" with contents of 
buffer "output".

Set "_InfoPointer" to address of info structure for 
"AI_PKCS_OAEP_RSAPublic".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "encryptObj" 
and "AI_PKCS_OAEP_RSAPublic".

Baldwin         Informational, Expires 12/25/1999         182


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Display info structure for "AI_PKCS_OAEP_RSAPublic".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Create buffer "output" of decimal value "200" bytes.


Note: Private key decryption.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_PKCS_OAEP_RSAPrivate" initialized from "sha1", "mgf1", 
"sha1", "specifiedParameters",.
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_PKCS_OAEP_RSAPrivate" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "privateKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "encryptedResult" and length of 
initialized bytes in buffer "encryptedResult" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "input" with contents of buffer 
"output".

Set "_InfoPointer" to address of info structure for 
"AI_PKCS_OAEP_RSAPrivate".

Baldwin         Informational, Expires 12/25/1999         183


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_GetAlgorithmInfo passing "_InfoPointer" and "decryptObj" 
and "AI_PKCS_OAEP_RSAPrivate".
Display info structure for "AI_PKCS_OAEP_RSAPrivate".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TVRSAPK1".
This is the start of test case "TVRSAPK2".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector tests, PKCS 1 V2 OAEP RSA encryption and 
Note: decryption

Note: ----------------------------------------------------------
Note: ----------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_RSA_ENCRYPT", "AM_RSA_CRT_ENCRYPT", 
"AM_MD2_RANDOM", "NULL_PTR".


Note: Use the following random algorithm object througout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "2" bytes.
Set buffer "seed" to hex value "0000".

Baldwin         Informational, Expires 12/25/1999         184


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Input the value given and check the result.

Note: Use the following 777-bit keypair

Create key object "publicKey".
Call B_CreateKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_RSAPublic" initialized from "01aff1bfa898e4656dc06f97f5cda85
345e4813a92e57c39a72f277a4dfeaad685507241f61b0c5e744a2bf12ee2b16
2d7674c8de231bedbf3af349bf92199d2e97c735033c39e109fac775d12ebdae
d0132ee1e9125816f8099c84b93f946379cb7", "010001".
Call B_SetKeyInfo passing "publicKey" and "KI_RSAPublic" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create key object "privateKey".
Call B_CreateKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_PKCS_RSAPrivate" initialized from "01aff1bfa898e4656dc06f97f
5cda85345e4813a92e57c39a72f277a4dfeaad685507241f61b0c5e744a2bf12
ee2b162d7674c8de231bedbf3af349bf92199d2e97c735033c39e109fac775d1
2ebdaed0132ee1e9125816f8099c84b93f946379cb7", "010001", 
"cb58ef16ab2bd3085130f80433168c657a06d0917951fb3e56b7aa1f6fc5f38
9fd6e5cd944b09503002c21b625e8c69476687355240df3c2177d7564c2780bb
baa855b70103cf7a540c5d7e7136cbcb6aa8d5518b3ae9032f7468b7d81ee616
d89", "1fb6d010eab6f59a4421a6778f911a33148eb2a70513d9b5648a30d8b
27874bfea18ee6a869ad6d5236b538a62a46f1325", "0d9eb46fbf1a16db07b
10030fed4d1ce687b613520575a33c48502801c4ba475d46dac29e667d89af03
2b64e103d5f97ab", "1145d240c4756d82ddc4ae13c43fb55348c907886bfd8
9bf7fc8bc1de9e62d403151eed85a038f2a7aa603d40531a5c579", 
"0d0596d85c6b123d19ee7613622191f2f9dc34c579856afda1bfd5f32c9a79c
41a753d2cd658a53505c046a2fe4ddf8e7f", "0382dd6cc2d80db494cc60908
1b56d37e4dcbc592ffedaa02a225ee8a09204a4b094ab514f69d668b8423499d

Baldwin         Informational, Expires 12/25/1999         185


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

ae135ffac".
Call B_SetKeyInfo passing "privateKey" and "KI_PKCS_RSAPrivate" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt and decrypt the following data.

Create buffer "input" of decimal value "32" bytes.
Set buffer "input" with string value "RSA Data Security Bsafe 
Toolkit".

Create buffer "encryptedResult" of decimal value "400" bytes.
Set buffer "encryptedResult" to hex value "0118f15daa7e60ec2a8b7
6c3e3c94c6e1c684b98461d6986f442f695e5568472b30f8bb304d039a1ef705
c29c59f50e6c9b5066aa3d5af6e29f2a2608c9f4016eb7195d230274334631e5
8925129b36b3be655adbdbbeac5f7319ce1104fe39d1786".

Create buffer "output" of decimal value "200" bytes.

Note: Public key encryption.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_PKCS_OAEP_RSAPublicBER" initialized from 
"304506092a864886f70d0101073038a00b300906052b0e03021a0500a118301
606092a864886f70d010108300906052b0e03021a0500a20f300d06092a86488
6f70d0101090400".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_PKCS_OAEP_RSAPublicBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "publicKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "random" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 

Baldwin         Informational, Expires 12/25/1999         186


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "encryptedResult" with contents of 
buffer "output".

Set "_InfoPointer" to address of info structure for 
"AI_PKCS_OAEP_RSAPublic".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "encryptObj" 
and "AI_PKCS_OAEP_RSAPublic".
Display info structure for "AI_PKCS_OAEP_RSAPublic".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Create buffer "output" of decimal value "200" bytes.


Note: Private key decryption.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_PKCS_OAEP_RSAPrivateBER" initialized from 
"304506092a864886f70d0101073038a00b300906052b0e03021a0500a118301
606092a864886f70d010108300906052b0e03021a0500a20f300d06092a86488
6f70d0101090400".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_PKCS_OAEP_RSAPrivateBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "privateKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "encryptedResult" and length of 
initialized bytes in buffer "encryptedResult" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         187


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "input" with contents of buffer 
"output".

Set "_InfoPointer" to address of info structure for 
"AI_PKCS_OAEP_RSAPrivate".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "decryptObj" 
and "AI_PKCS_OAEP_RSAPrivate".
Display info structure for "AI_PKCS_OAEP_RSAPrivate".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TVRSAPK2".
This is the start of test case "TVRSAS01".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector tests, RSA Sign and Verify

Note: ----------------------------------------------------------
Note: ----------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_RSA_DECRYPT", "AM_RSA_CRT_ENCRYPT", 
"NULL_PTR".

Set "_Chooser" to "AM_MD2", "AM_MD5", "AM_SHA", "NULL_PTR".


Note: Test 01-1

Note: Create a signature, compare it to the result from 2.1.2.

Baldwin         Informational, Expires 12/25/1999         188


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Use an arbitrary public/private keypair, this one 
Note: contains a
Note: 768-bit modulus.

Create key object "publicKey".
Call B_CreateKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_RSAPublic" initialized from "cc76652b4b5d972b25c464d23b965fa
a52ca08b1012239f4aa3f8d518bf550c56dc4c684c78fe4ed492728005a7c101
2a072ecd28592a6b0f520445e41eb4884a2b801d8b579e6920fa7d25c0b02359
263af4dd4beececaa9dd59671351bb59f", "010001".
Call B_SetKeyInfo passing "publicKey" and "KI_RSAPublic" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create key object "privateKey".
Call B_CreateKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_PKCS_RSAPrivate" initialized from "cc76652b4b5d972b25c464d23
b965faa52ca08b1012239f4aa3f8d518bf550c56dc4c684c78fe4ed492728005
a7c1012a072ecd28592a6b0f520445e41eb4884a2b801d8b579e6920fa7d25c0
b02359263af4dd4beececaa9dd59671351bb59f", "010001", 
"8ce64e23bec51946bfb90ead9e28ab7669a516c63bfcc529a9253092f0bb365
547a6e213609ef5e8db8fa34e530cc9d980ea4253c6624734e57fbc5d5df7775
536ecdd195e9e7e640f4301d3d12f391d012a1e552208c1c396a49d2d561390a
9", "e5db12250f865ace6d9613df55b2bddbbf3887e061f55c9228906873216
ff0c03a146bfd3d279ef57221fed054b502fb", "e3b7eca5658d8530e3f6e5e
0806a533b0d2bd86a348339548140ddab84b27247a6235b3d563d053802d652c
671eb76ad", "b9aa07f109a643e92459aa79a6d677476e2132980b684ebafca
b10c39689be14f79511597fb16653ea3a0d82a839824b", 
"104bcf419edcdbd53ddb2364478c545c7b7ad1c7f7ee14223a05bc5753edb94
3eb5dc85fc1562893739086e7f0ab1b19", "875198f828082848eac2487c92d
6093d576382ab367eadcf059cd6a5a9062c9d6157a45631648cbffab6273361c
6ccb7".
Call B_SetKeyInfo passing "privateKey" and "KI_PKCS_RSAPrivate" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Set the data to sign

Create buffer "input" of decimal value "1" bytes.
Set buffer "input" to hex value "00".

Baldwin         Informational, Expires 12/25/1999         189


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: The signature will be the same size as the modulus.

Create buffer "output" of decimal value "96" bytes.

Note: Use AI_MD2WithRSAEncryption

Create algorithm object "signObj".
Call B_CreateAlgorithmObject passing "signObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2WithRSAEncryption" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "signObj" and 
"AI_MD2WithRSAEncryption" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_MD2WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101020500".
Set "_InfoPointer" to address of info structure for 
"AI_MD2WithRSAEncryptionBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "signObj" 
and "AI_MD2WithRSAEncryptionBER".
Check equality of info structure for "AI_MD2WithRSAEncryptionBER
" with expected info structure for "AI_MD2WithRSAEncryptionBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_SignInit passing "signObj" and "privateKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"454aba121005f84e408d3d5d9c8402028f42e8d44b112fd20ae916036edaf28

Baldwin         Informational, Expires 12/25/1999         190


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

cde5f1ca09d9447e874695ef335dcb7eef68a42bf4d936d95884764a8dd2844c
a90af3123a92798c11a778f1e1144b12ee2a7b9047ae8dc57e4218545a9e9bb9
6".

Note: Might as well verify it.

Create algorithm object "verifyObj".
Call B_CreateAlgorithmObject passing "verifyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101020500".
Call B_SetAlgorithmInfo passing "verifyObj" and 
"AI_MD2WithRSAEncryptionBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_MD2WithRSAEncryption" initialized from 
"NULL_PTR".
Set "_InfoPointer" to address of info structure for 
"AI_MD2WithRSAEncryption".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "verifyObj" 
and "AI_MD2WithRSAEncryption".
Check equality of info structure for "AI_MD2WithRSAEncryption" 
with expected info structure for "AI_MD2WithRSAEncryption".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_VerifyInit passing "verifyObj" and "publicKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-2

Baldwin         Informational, Expires 12/25/1999         191


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Perform the same test as 01-1 except use 
Note: AI_MD5WithRSAEncryption.

Call Call B_DestroyAlgorithmObject passing "signObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "verifyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create algorithm object "signObj".
Call B_CreateAlgorithmObject passing "signObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5WithRSAEncryption" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "signObj" and 
"AI_MD5WithRSAEncryption" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_MD5WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101040500".
Set "_InfoPointer" to address of info structure for 
"AI_MD5WithRSAEncryptionBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "signObj" 
and "AI_MD5WithRSAEncryptionBER".
Check equality of info structure for "AI_MD5WithRSAEncryptionBER
" with expected info structure for "AI_MD5WithRSAEncryptionBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_SignInit passing "signObj" and "privateKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         192


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"372e8ebcf4bd1b57b948ecaedc3decd9daca72a314b915f45db655978fea1ee
e90fc822cb145621cc3b5de6a431f83edb169c9a8e4affcb2db45ef097ff89cd
6f1c7595f5e39d3a781019300b11c66271931c8391664ec4e40fcdb28fe26d6f
0".

Create algorithm object "verifyObj".
Call B_CreateAlgorithmObject passing "verifyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101040500".
Call B_SetAlgorithmInfo passing "verifyObj" and 
"AI_MD5WithRSAEncryptionBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_MD5WithRSAEncryption" initialized from 
"NULL_PTR".
Set "_InfoPointer" to address of info structure for 
"AI_MD5WithRSAEncryption".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "verifyObj" 
and "AI_MD5WithRSAEncryption".
Check equality of info structure for "AI_MD5WithRSAEncryption" 
with expected info structure for "AI_MD5WithRSAEncryption".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_VerifyInit passing "verifyObj" and "publicKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Baldwin         Informational, Expires 12/25/1999         193


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: ----------------------------------------------------------
Note: ----------
Note: Test 01-3

Note: Perform the same test as 01-1 except use 
Note: AI_SHA1WithRSAEncryption.

Call Call B_DestroyAlgorithmObject passing "signObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "verifyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create algorithm object "signObj".
Call B_CreateAlgorithmObject passing "signObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryption" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "signObj" and 
"AI_SHA1WithRSAEncryption" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_SHA1WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101050500".
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryptionBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "signObj" 
and "AI_SHA1WithRSAEncryptionBER".
Check equality of info structure for "AI_SHA1WithRSAEncryptionBE
R" with expected info structure for "AI_SHA1WithRSAEncryptionBER
".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_SignInit passing "signObj" and "privateKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         194


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"7d58a091070949865161c648af0056914db6814f8795e2bbd9ae1b98040c635
15238d60abf891f60cb7794b0e641a3da81226b57caaa2634a0bafc502f7e1cb
3179884845f3087e054a69f00a4f2e7e0faecfe00592f109f342589fbc67ed14
7".

Create algorithm object "verifyObj".
Call B_CreateAlgorithmObject passing "verifyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101050500".
Call B_SetAlgorithmInfo passing "verifyObj" and 
"AI_SHA1WithRSAEncryptionBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_SHA1WithRSAEncryption" initialized from 
"NULL_PTR".
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryption".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "verifyObj" 
and "AI_SHA1WithRSAEncryption".
Check equality of info structure for "AI_SHA1WithRSAEncryption" 
with expected info structure for "AI_SHA1WithRSAEncryption".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_VerifyInit passing "verifyObj" and "publicKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 

Baldwin         Informational, Expires 12/25/1999         195


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TVRSAS01".
This is the start of test case "TVRSAS02".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector tests, RSA Sign and Verify

Note: ----------------------------------------------------------
Note: ----------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_RSA_DECRYPT", "AM_RSA_CRT_ENCRYPT", 
"NULL_PTR".

Set "_Chooser" to "AM_MD2", "AM_MD5", "AM_SHA", "NULL_PTR".


Note: Test 02-1

Note: Create a signature, compare it to the result from 2.1.2.

Note: Use an arbitrary public/private keypair, this one 
Note: contains a
Note: 1024-bit modulus.

Create key object "publicKey".
Call B_CreateKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_RSAPublic" initialized from "d1bb134b2583eb6008cfcb10943f4b5
40872876a2e3f31ffd704b99f62d005cb4eac429d625b0bd4de002d63f74e5e8
a09c3be7a269dc941739e6d8532ba5b32695350bf9659f5ea71ee8bf4102ce71
2272e12a849e4e62342c2ce6c5143327eb3007e5bf4d709e89e0181d6d603514
7a93d79ddc4175cccf2ceecf4c298fc17", "010001".
Call B_SetKeyInfo passing "publicKey" and "KI_RSAPublic" and 
"_InfoPointer".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         196


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create key object "privateKey".
Call B_CreateKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_PKCS_RSAPrivate" initialized from "d1bb134b2583eb6008cfcb109
43f4b540872876a2e3f31ffd704b99f62d005cb4eac429d625b0bd4de002d63f
74e5e8a09c3be7a269dc941739e6d8532ba5b32695350bf9659f5ea71ee8bf41
02ce712272e12a849e4e62342c2ce6c5143327eb3007e5bf4d709e89e0181d6d
6035147a93d79ddc4175cccf2ceecf4c298fc17", "010001", 
"309d3368acc67a4da55d3d0d97bf601f9761acbfd0fe77017d7eabe4250c60f
b723dfda6eb807d2a9756e52e91c989a2678706e4db84a17cd966f4adf6473a1
1f6e9f1d208cb569c8d3bc1a01625364d6db2aab90bfa0b5e3925e5c9c1a8dc8
4fdb6546b8217a657741aa7b21a7fafff9ed0d758deeb4fc3af0d416be8398f7
1", "e8fefba76de45cfaf347ce2ed30e935ff19db5e0c99f685c0ca2e42f567
a5fcbdefbba4242519491bd9f9676addac54d51ad11d78572687b9a626f999a0
579b9", "e6700efd7438554f5a1c5f07dbe07d357858dc85de049f30fbb69b7
e86d4eb793da00e44e5bfbe0dea93806b64d8a486b4c8336ac34d0688f18af79
4ddb1cc4f", "d5ea550e315cbae9443726dbe2b6bd2417671eb75525dfe0b35
152830bb8aaff38a89127884ff241a48142d98f610e48a0b66f6d1a7e21e369a
8faa161c1a931", "85ab7b068ae42298652d0ff2ff18b988cac6c124e624c83
321d04b6299d3e8c3eb7b6ccb8a7a2f44e34dacb09f4f0c2117bd0a166433ca1
6a606769764023f01", "ac6b6150f924e3d0968b3bc9031bf96ffaa3cf146ef
043545187714f3b099b1165bbd88e84f237a171ac0685b7c5b7c840d393c0fa2
d2bf4d0aa77b9791ab9c3".
Call B_SetKeyInfo passing "privateKey" and "KI_PKCS_RSAPrivate" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Set the data to sign

Create buffer "input" of decimal value "1" bytes.
Set buffer "input" to hex value "00".

Note: The signature will be the same size as the modulus.

Create buffer "output" of decimal value "128" bytes.

Note: Use AI_MD2WithRSAEncryption

Create algorithm object "signObj".
Call B_CreateAlgorithmObject passing "signObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2WithRSAEncryption" initialized from "NULL_PTR".

Baldwin         Informational, Expires 12/25/1999         197


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_SetAlgorithmInfo passing "signObj" and 
"AI_MD2WithRSAEncryption" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_MD2WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101020500".
Set "_InfoPointer" to address of info structure for 
"AI_MD2WithRSAEncryptionBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "signObj" 
and "AI_MD2WithRSAEncryptionBER".
Check equality of info structure for "AI_MD2WithRSAEncryptionBER
" with expected info structure for "AI_MD2WithRSAEncryptionBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_SignInit passing "signObj" and "privateKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"59d9fe3d1e3e73e14263da270690ed4e93ecaa4479b512962cb06f0673e1e6c
f4695651274eae7779736a344fc1159392c1b35afeff4ce168a9e85e79ba1d65
180c712aaf11532b65b088113de260414adbd1b878952adc27b01367c8427dad
9749c0f5aa42af0254c6c16388af2e27e3e3c392b22bdf82d77486d6ad60349b
8".

Note: Might as well verify it.

Create algorithm object "verifyObj".
Call B_CreateAlgorithmObject passing "verifyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2WithRSAEncryptionBER" initialized from 

Baldwin         Informational, Expires 12/25/1999         198


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"300d06092a864886f70d0101020500".
Call B_SetAlgorithmInfo passing "verifyObj" and 
"AI_MD2WithRSAEncryptionBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_MD2WithRSAEncryption" initialized from 
"NULL_PTR".
Set "_InfoPointer" to address of info structure for 
"AI_MD2WithRSAEncryption".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "verifyObj" 
and "AI_MD2WithRSAEncryption".
Check equality of info structure for "AI_MD2WithRSAEncryption" 
with expected info structure for "AI_MD2WithRSAEncryption".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_VerifyInit passing "verifyObj" and "publicKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 02-2

Note: Perform the same test as 02-1 except use 
Note: AI_MD5WithRSAEncryption.

Call Call B_DestroyAlgorithmObject passing "signObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "verifyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Baldwin         Informational, Expires 12/25/1999         199


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create algorithm object "signObj".
Call B_CreateAlgorithmObject passing "signObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5WithRSAEncryption" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "signObj" and 
"AI_MD5WithRSAEncryption" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_MD5WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101040500".
Set "_InfoPointer" to address of info structure for 
"AI_MD5WithRSAEncryptionBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "signObj" 
and "AI_MD5WithRSAEncryptionBER".
Check equality of info structure for "AI_MD5WithRSAEncryptionBER
" with expected info structure for "AI_MD5WithRSAEncryptionBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_SignInit passing "signObj" and "privateKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"aaea3e551cf5bd00d861912a93acbce0e36b1ca16871eab85430ced31071f6b
23ad99ac9387afd99203466ba53132e3e3c3f9e46d4f64bc0f5bf3f55d47b967
113ae888b6f7e084d4db8ebf7d896c3734b0d59126010621d3f1cc0ef2217f89
34c980753be98112904d3d7dfaf7ee659d553f48ebd6f115950a179436519c3c
8".

Create algorithm object "verifyObj".
Call B_CreateAlgorithmObject passing "verifyObj".

Baldwin         Informational, Expires 12/25/1999         200


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101040500".
Call B_SetAlgorithmInfo passing "verifyObj" and 
"AI_MD5WithRSAEncryptionBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_MD5WithRSAEncryption" initialized from 
"NULL_PTR".
Set "_InfoPointer" to address of info structure for 
"AI_MD5WithRSAEncryption".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "verifyObj" 
and "AI_MD5WithRSAEncryption".
Check equality of info structure for "AI_MD5WithRSAEncryption" 
with expected info structure for "AI_MD5WithRSAEncryption".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_VerifyInit passing "verifyObj" and "publicKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 02-3

Note: Perform the same test as 02-1 except use 
Note: AI_SHA1WithRSAEncryption.

Call Call B_DestroyAlgorithmObject passing "signObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         201


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_DestroyAlgorithmObject passing "verifyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create algorithm object "signObj".
Call B_CreateAlgorithmObject passing "signObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryption" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "signObj" and 
"AI_SHA1WithRSAEncryption" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_SHA1WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101050500".
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryptionBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "signObj" 
and "AI_SHA1WithRSAEncryptionBER".
Check equality of info structure for "AI_SHA1WithRSAEncryptionBE
R" with expected info structure for "AI_SHA1WithRSAEncryptionBER
".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_SignInit passing "signObj" and "privateKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"3b796db5eda47a67b86933d2fadddf87b88192e8ea690a010b0006e87e9de95
d4e0a1e8c78253001c5d1fe49078850da12feeba244b156d8085279af8fcb5f6

Baldwin         Informational, Expires 12/25/1999         202


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

746ecaf02711e361093af3bb812effab9606b64d22b63acb4fb1e68f43b0ceed
65d05506d045e1371d9c37fca2f0a764077cfd6193df02c4a9891d9f4de322cd
f".

Create algorithm object "verifyObj".
Call B_CreateAlgorithmObject passing "verifyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101050500".
Call B_SetAlgorithmInfo passing "verifyObj" and 
"AI_SHA1WithRSAEncryptionBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_SHA1WithRSAEncryption" initialized from 
"NULL_PTR".
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryption".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "verifyObj" 
and "AI_SHA1WithRSAEncryption".
Check equality of info structure for "AI_SHA1WithRSAEncryption" 
with expected info structure for "AI_SHA1WithRSAEncryption".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_VerifyInit passing "verifyObj" and "publicKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------

Baldwin         Informational, Expires 12/25/1999         203


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

This is the end of test case "TVRSAS02".
This is the start of test case "TVRSAS03".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector tests, RSA Sign and Verify

Note: ----------------------------------------------------------
Note: ----------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_RSA_DECRYPT", "AM_RSA_CRT_ENCRYPT", 
"NULL_PTR".

Set "_Chooser" to "AM_MD2", "AM_MD5", "AM_SHA", "NULL_PTR".


Note: Test 03-1

Note: Create a signature, compare it to the result from 2.1.2.

Note: Use an arbitrary public/private keypair, this one 
Note: contains a
Note: 2048-bit modulus.

Create key object "publicKey".
Call B_CreateKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_RSAPublic" initialized from "a40d55504a4a99261ac819e53536b50
a922b6f9e130899606cb3c5bc16ff61376d2538f10e13560b6c49006049b9a1e
af070feeac92313074e4a65471d510609ddbe97de1da3817a47f6d3632b9275c
ed442a308869a17a29582cc693ac2616bc90bb8c06f9ab88a0c61a08fd2e8eb7
f1b6e04910de8d5d0bd30fdc4b836e70ad992400a96d2845b2bb023a9ce81296
827732e3d68ccae2fd66849179572c7e0e4b5fbb7a92b2f222e020b413ac198b
24f3d297819e0e98f9d8e5291a4918bf4af71476c7b3cd0f7c888151bf5ca9d5
4b98297731ded8ec120920a62b9bc5bbbf9955536abe41ae6731c8ad2f43bfbb
b5648961f12d4c26408baec8e609b53bf", "010001".
Call B_SetKeyInfo passing "publicKey" and "KI_RSAPublic" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create key object "privateKey".
Call B_CreateKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         204


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_InfoPointer" to address of info structure for 
"KI_PKCS_RSAPrivate" initialized from "a40d55504a4a99261ac819e53
536b50a922b6f9e130899606cb3c5bc16ff61376d2538f10e13560b6c4900604
9b9a1eaf070feeac92313074e4a65471d510609ddbe97de1da3817a47f6d3632
b9275ced442a308869a17a29582cc693ac2616bc90bb8c06f9ab88a0c61a08fd
2e8eb7f1b6e04910de8d5d0bd30fdc4b836e70ad992400a96d2845b2bb023a9c
e81296827732e3d68ccae2fd66849179572c7e0e4b5fbb7a92b2f222e020b413
ac198b24f3d297819e0e98f9d8e5291a4918bf4af71476c7b3cd0f7c888151bf
5ca9d54b98297731ded8ec120920a62b9bc5bbbf9955536abe41ae6731c8ad2f
43bfbbb5648961f12d4c26408baec8e609b53bf", "010001", 
"75bed422e28f9448532497e1794620becb96bd70197d2c8896bc99099d00030
8c31fda34b9c38b187bca11a90a816003be3b7bdb8c2dce7489eebfae410e6c6
51c70b593c876187269c0708c5733b1b697869479841289303a5b3cd7b242dda
57d111ab393e6dad8ca762fc5cabd3e7966789a727a27497f9eaad1192696d15
043feec9ce697b51a5b9e8ef89aecee3a2285088c9213f7f00b26b9130329c0f
29cf26bfa4e8be0c8d7dffaf5b2fdb5dee6ead68af8afeeb0fdbd7f13e464832
612f2171576231d695c0406da99a411bed8f9cad077375a74854ae0dd86cb617
cc639843561e86c5ffaf9fe010736c30c237b9be05d76a9a7bdf9ff332fbc208
1", "d2359d139c5e94e1d7ced3f4dfd3a37a5d68b89196a21dd0619ec71c3dd
221ca9e571382c307aa768029d999ee1f8e24f7cf73c34c1c071495b4f7a28a3
f7aebd09f17cf3f80565f3981bfde9ff55349cbdfd42dfaeaa863a4005ca25fb
7c014a9e16fe38ec741ab07a5cf9df32854344fcf47a00124b81cfcf2ed72c6e
1c221", "c7c9be1f927787728816f008a5e4c1e06b29959c007d365830aa70f
59acdf09d04c326b40aaacc63022a29b860bd8da809a5a6594ca06f506f9f4a8
8adf88d63f704602f477789737cf593959bc3b3e47d74116bf0e3426dfd463ef
f0472909d922cb9cd61d9f2edd0878b00e720e659861c4f6bf57d8a15b7d132d
bd23e19df", "2cabb6089fd73d9e4cc52827c694ec0da9e2022ef62ad7591c1
5a8cc689aca118bda874be7742e96661ffe9d068c70218d03e9dedbc2ad0283d
9e432075cfc1b36c7484103869b543b1d468fe1c03985da2c63a3adc9c624fe8
a1125745fd112d313143af0718993f5d917a8c22e94ce5513806e1130236c0d9
8f63ac8e6dae1", "374e33a14dcc64e461a3e7e29cf9cc69b1809b77c9f2df7
e5e4a7066ace9e177b5ffc7d1033af0c55fae084a900d290fa14c07d6a48dad0
2d943814080d8535b9edfc9388d521becaa64d8ec0b688b7deef498760703023
aac682bbc30a0fe4380597d3dcb9ea7cf0970dc1beddf7fa4bca94d9b17241f7
b8f9d0bb52a682285", "acc125113028f8150feb24d14672db7f59118d349ff
7a2b0584c841e1e6bfc6033729edd2c7a44cfbe54869f0dbfe21f39f6c7f0419
172c832b83d167e0d2d474c39d1457d47ed986659d216c06edd0b16ece129801
56f5215634ae61995818057fc8bde64994d60743f89d0dbf8f6762efda3fa04c
8acdc983c60a0ad41cc0e".
Call B_SetKeyInfo passing "privateKey" and "KI_PKCS_RSAPrivate" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Set the data to sign

Create buffer "input" of decimal value "1" bytes.
Set buffer "input" to hex value "00".

Note: The signature will be the same size as the modulus.

Create buffer "output" of decimal value "256" bytes.

Baldwin         Informational, Expires 12/25/1999         205


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Use AI_MD2WithRSAEncryption

Create algorithm object "signObj".
Call B_CreateAlgorithmObject passing "signObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2WithRSAEncryption" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "signObj" and 
"AI_MD2WithRSAEncryption" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_MD2WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101020500".
Set "_InfoPointer" to address of info structure for 
"AI_MD2WithRSAEncryptionBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "signObj" 
and "AI_MD2WithRSAEncryptionBER".
Check equality of info structure for "AI_MD2WithRSAEncryptionBER
" with expected info structure for "AI_MD2WithRSAEncryptionBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_SignInit passing "signObj" and "privateKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"1b984d77e81d87fea72af09e0d8faf5e51d068cb7706f371c81a5bfb509f75a
374a7bfa5991447e734fa4d2319dac524e782d865b305db3d8523cd7f00773e4
252d6d805ceda06b6db10be44c8b5c86241efe2b9117ac5730a1ee261ee323da
998a1562ef61efb81e85e503703d1cf0e1778caccd185d49b4d608e59bcf5609
d81b2c5ad345a87004d238c5069e8c653489862311acd8dc7b66d0979c98006f

Baldwin         Informational, Expires 12/25/1999         206


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

5d7103cd9758df55d2a27ffca34ef051c12c4c68270881586155c4d4165cedb7
0b6a3286e859c59d277f2548e89410179866d932399df1373900641259eb0ebe
938d16a10507fdc2893a3692b9ed9f55e4d723884403123d5765d0c621ed1bbe
d".

Note: Might as well verify it.

Create algorithm object "verifyObj".
Call B_CreateAlgorithmObject passing "verifyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101020500".
Call B_SetAlgorithmInfo passing "verifyObj" and 
"AI_MD2WithRSAEncryptionBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_MD2WithRSAEncryption" initialized from 
"NULL_PTR".
Set "_InfoPointer" to address of info structure for 
"AI_MD2WithRSAEncryption".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "verifyObj" 
and "AI_MD2WithRSAEncryption".
Check equality of info structure for "AI_MD2WithRSAEncryption" 
with expected info structure for "AI_MD2WithRSAEncryption".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_VerifyInit passing "verifyObj" and "publicKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------


Baldwin         Informational, Expires 12/25/1999         207


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Test 03-2

Note: Perform the same test as 03-1 except use 
Note: AI_MD5WithRSAEncryption.

Call Call B_DestroyAlgorithmObject passing "signObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "verifyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create algorithm object "signObj".
Call B_CreateAlgorithmObject passing "signObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5WithRSAEncryption" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "signObj" and 
"AI_MD5WithRSAEncryption" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_MD5WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101040500".
Set "_InfoPointer" to address of info structure for 
"AI_MD5WithRSAEncryptionBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "signObj" 
and "AI_MD5WithRSAEncryptionBER".
Check equality of info structure for "AI_MD5WithRSAEncryptionBER
" with expected info structure for "AI_MD5WithRSAEncryptionBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_SignInit passing "signObj" and "privateKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         208


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"07580efc0144ea7f63dfcbf39324c143ecd679f0ffa66d035ae297d5d57fa2e
6892ccb10946bfdde89ed5eefb787c4f3c72b3a3ff5b5a21ae5b1cfe714fd112
c4ff37af4bcc6ea0de5665769ec36438d9f5882da869c380d5e23ee219aedbca
97ed8915798b38d2642fcaa7c636e4e3eb5906ada68a0094ab7ac4571f423e16
f5b2dabf03b7ef801d70e6a5b972c0d0ec39d096619b4873a0caccf17d8856f2
50318d5c583021ee3ecfc6f50f692570fd7dd01cc418a5a5c0bf96860613d166
ca7de3a62fa4f689771ca1e330b52d576bfc14faa106084f5a376b8bba005b98
661c6ef46612a74fb9de62c542baa582921b9ae4f5eec1baadfec04f4fff98c5
b".

Create algorithm object "verifyObj".
Call B_CreateAlgorithmObject passing "verifyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101040500".
Call B_SetAlgorithmInfo passing "verifyObj" and 
"AI_MD5WithRSAEncryptionBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_MD5WithRSAEncryption" initialized from 
"NULL_PTR".
Set "_InfoPointer" to address of info structure for 
"AI_MD5WithRSAEncryption".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "verifyObj" 
and "AI_MD5WithRSAEncryption".
Check equality of info structure for "AI_MD5WithRSAEncryption" 
with expected info structure for "AI_MD5WithRSAEncryption".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_VerifyInit passing "verifyObj" and "publicKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "verifyObj" and address of first 

Baldwin         Informational, Expires 12/25/1999         209


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 03-3

Note: Perform the same test as 03-1 except use 
Note: AI_SHA1WithRSAEncryption.

Call Call B_DestroyAlgorithmObject passing "signObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "verifyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create algorithm object "signObj".
Call B_CreateAlgorithmObject passing "signObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryption" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "signObj" and 
"AI_SHA1WithRSAEncryption" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_SHA1WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101050500".
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryptionBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "signObj" 
and "AI_SHA1WithRSAEncryptionBER".
Check equality of info structure for "AI_SHA1WithRSAEncryptionBE
R" with expected info structure for "AI_SHA1WithRSAEncryptionBER
".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_SignInit passing "signObj" and "privateKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         210


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"622bbc3656cce331718ac86441bd27d90db8f78399ee10789b2212e8bba8a1f
5eb35cb1c5905ab505aa50b26850234aa8badec44c4b79eeabc57a4209d5e3b1
52d05f259fcb4f9cfbcc82db130f27ba4d6079f159d25d7086d4f432ac60de8e
6cc7a9dc1d1e3f4700f153343edc68712a61f587f96bc6b67662705f531896d7
8a892f8e9e00e29e37c581edf68bc3e1f54922c604806204ffa169b2d56d6401
b7323e7de5b0ea2df961c61c8896149cb8935a564f2c0fdfe88da64bd8d020c6
a6289ecd97408b233d5110de00314ace4cefe2667cc8b6431e5dd06c89969a63
61395f1deeecaea7ec09a7aebe7e1031bc8cdb0e28c24b21de47453aa67dfe37
2".

Create algorithm object "verifyObj".
Call B_CreateAlgorithmObject passing "verifyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101050500".
Call B_SetAlgorithmInfo passing "verifyObj" and 
"AI_SHA1WithRSAEncryptionBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_SHA1WithRSAEncryption" initialized from 
"NULL_PTR".
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryption".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "verifyObj" 
and "AI_SHA1WithRSAEncryption".
Check equality of info structure for "AI_SHA1WithRSAEncryption" 
with expected info structure for "AI_SHA1WithRSAEncryption".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_VerifyInit passing "verifyObj" and "publicKey" and 
"_Chooser" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         211


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TVRSAS03".
This is the start of test case "TVSHADES".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: vectors test for AI_SHA1WithDES_CBCPad, 
Note: AI_SHA1WithDES_CBCPadBER

Note: -------------------------------------------------------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_SHA", "AM_DES_CBC_ENCRYPT", 
"AM_DES_CBC_DECRYPT", "NULL_PTR".


Note: Create global data objects

Create buffer "inputData" of decimal value "32" bytes.
Create buffer "cypherText" of decimal value "32" bytes.
Create buffer "plainText" of decimal value "32" bytes.
Create buffer "expectedCypherText" of decimal value "32" bytes.
Create buffer "expectedPlainText" of decimal value "32" bytes.
Create buffer "salt" of decimal value "8" bytes.
Create buffer "password" of decimal value "8" bytes.

Note: Initialize global data object

Set buffer "salt" to hex value "0011223344556677".
Set buffer "password" to hex value "70617373776F7264".

Baldwin         Informational, Expires 12/25/1999         212


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set buffer "inputData" to hex value "000102030405060708090A0B0C0
D0E0F101112131415161718191A".

Note: Case 1:
Note: Set up pbe encryption/decryption algorithm with 
Note: pbe salt = 0011223344556677 and iteration = 1
Note: Encrypt/Decrypt the inputData with the password

Create algorithm object "encryptionAlg".
Call B_CreateAlgorithmObject passing "encryptionAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionAlg".
Call B_CreateAlgorithmObject passing "decryptionAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithDES_CBCPad" initialized from contents of buffer 
"salt", "1".
Call B_SetAlgorithmInfo passing "encryptionAlg" and 
"AI_SHA1WithDES_CBCPad" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Check its BER encoding
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_SHA1WithDES_CBCPadBER" initialized from 
"301a06092a864886f70d01050a300d04080011223344556677020101".
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithDES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionAlg" and "AI_SHA1WithDES_CBCPadBER".
Check equality of info structure for "AI_SHA1WithDES_CBCPadBER" 
with expected info structure for "AI_SHA1WithDES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Set the decryption algorithm with the AI_SHA1WithDES_CBCPa
Note: dBER
Note: 30 1a
Note: 06 09 2a 86 48 86 f7 0d 01 05 0a
Note: 30 0d
Note: 04 08 00 11 22 33 44 55 66 77
Note: 02 01 01

Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithDES_CBCPadBER" initialized from "301a06092a864886f70
d01050a300d04080011223344556677020101".
Call B_SetAlgorithmInfo passing "decryptionAlg" and 

Baldwin         Informational, Expires 12/25/1999         213


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_SHA1WithDES_CBCPadBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Set up keyobject with 'password' key

Create key object "pbekey".
Call B_CreateKeyObject passing "pbekey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "password".
Call B_SetKeyInfo passing "pbekey" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionAlg" and "pbekey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptionAlg" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionAlg" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"1854453d8ce8083ea6be20495854aeefeca33fec2be6e92a29ba6c8983b4403
3".

Note: Password base unprotect the protected data

Call Call B_DecryptInit passing "decryptionAlg" and "pbekey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         214


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptionAlg" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionAlg" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Verify the pbe encryption by digest password || salt -> 
Note: Use the output of the digest as the input to des 
Note: algorithm and key

Create buffer "digest" of decimal value "20" bytes.
Create algorithm object "digestAlg".
Call B_CreateAlgorithmObject passing "digestAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_InfoPointer" to address of info structure for "AI_SHA1" 
initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "digestAlg" and "AI_SHA1" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DigestInit passing "digestAlg" and "NULL_PTR" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "digestAlg" and address of first 
initialized byte in buffer "password" and length of initialized 
bytes in buffer "password" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         215


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_DigestUpdate passing "digestAlg" and address of first 
initialized byte in buffer "salt" and length of initialized 
bytes in buffer "salt" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlg" and address of next free 
byte in buffer "digest" and address of "_OutputLen" and length 
of free bytes in buffer "digest" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digest" by "_OutputLen".
Finalize buffer "digest".
Check equality of buffer "digest" with hex value 
"52ede8a078f04af8f1d92c170d4492c1fada7ea8".

Note: Set up symetric key encryption

Create key object "symetricKey".
Call B_CreateKeyObject passing "symetricKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from "52ede8a078f04af8".
Call B_SetKeyInfo passing "symetricKey" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create algorithm object "symetricEncryptionAlg".
Call B_CreateAlgorithmObject passing "symetricEncryptionAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8" initialized from "f1d92c170d4492c1".
Call B_SetAlgorithmInfo passing "symetricEncryptionAlg" and 
"AI_DES_CBCPadIV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "symetricDecryptionAlg".
Call B_CreateAlgorithmObject passing "symetricDecryptionAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8" initialized from "f1d92c170d4492c1".
Call B_SetAlgorithmInfo passing "symetricDecryptionAlg" and 
"AI_DES_CBCPadIV8" and "_InfoPointer".

Baldwin         Informational, Expires 12/25/1999         216


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "symetricEncryptionAlg" and 
"symetricKey" and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "symetricEncryptionAlg" and 
address of next free byte in buffer "expectedCypherText" and 
address of "_OutputLen" and length of free bytes in buffer 
"expectedCypherText" and address of first initialized byte in 
buffer "inputData" and length of initialized bytes in buffer 
"inputData" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectedCypherText" by 
"_OutputLen".
Call B_EncryptFinal passing "symetricEncryptionAlg" and address 
of next free byte in buffer "expectedCypherText" and address of 
"_OutputLen" and length of free bytes in buffer 
"expectedCypherText" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectedCypherText" by 
"_OutputLen".
Finalize buffer "expectedCypherText".
Check equality of buffer "expectedCypherText" with contents of 
buffer "cypherText".

Call Call B_DecryptInit passing "symetricDecryptionAlg" and 
"symetricKey" and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "symetricDecryptionAlg" and 
address of next free byte in buffer "expectedPlainText" and 
address of "_OutputLen" and length of free bytes in buffer 
"expectedPlainText" and address of first initialized byte in 
buffer "expectedCypherText" and length of initialized bytes in 
buffer "expectedCypherText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectedPlainText" by "_OutputLen".
Call B_DecryptFinal passing "symetricDecryptionAlg" and address 
of next free byte in buffer "expectedPlainText" and address of 
"_OutputLen" and length of free bytes in buffer 
"expectedPlainText" and "NULL_PTR" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         217


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectedPlainText" by "_OutputLen".
Finalize buffer "expectedPlainText".
Check equality of buffer "expectedPlainText" with contents of 
buffer "inputData".

Note: Destroy algorithm objects, and symetric algorithm & key 
Note: objects

Call Call B_DestroyAlgorithmObject passing "encryptionAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "symetricEncryptionAl
g".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "symetricDecryptionAl
g".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyKeyObject passing "symetricKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 2: 
Note: Set up pbe encryption/decryption algorithm with 
Note: pbe salt = 0011223344556677 and iteration = 4
Note: Encrypt/Decrypt the inputData with the password

Create algorithm object "encryptionAlg".
Call B_CreateAlgorithmObject passing "encryptionAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionAlg".
Call B_CreateAlgorithmObject passing "decryptionAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithDES_CBCPad" initialized from contents of buffer 
"salt", "4".
Call B_SetAlgorithmInfo passing "encryptionAlg" and 

Baldwin         Informational, Expires 12/25/1999         218


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_SHA1WithDES_CBCPad" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Check its BER encoding
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_SHA1WithDES_CBCPadBER" initialized from 
"301a06092a864886f70d01050a300d04080011223344556677020104".
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithDES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionAlg" and "AI_SHA1WithDES_CBCPadBER".
Check equality of info structure for "AI_SHA1WithDES_CBCPadBER" 
with expected info structure for "AI_SHA1WithDES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Set the decryption algorithm with the AI_SHA1WithDES_CBCPa
Note: dBER
Note: 30 1a
Note: 06 09 2a 86 48 86 f7 0d 01 05 0a
Note: 30 0d
Note: 04 08 00 11 22 33 44 55 66 77
Note: 02 01 04

Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithDES_CBCPadBER" initialized from "301a06092a864886f70
d01050a300d04080011223344556677020104".
Call B_SetAlgorithmInfo passing "decryptionAlg" and 
"AI_SHA1WithDES_CBCPadBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionAlg" and "pbekey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptionAlg" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionAlg" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         219


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"be020792451b2907d01ea8c1c5826be2b1b10c31470c779726ffeef0bad8b7f
9".

Note: Password base unprotect the protected data

Call Call B_DecryptInit passing "decryptionAlg" and "pbekey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptionAlg" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionAlg" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Verify the pbe encryption by digest password || salt -> 
Note: des key
Note: Take the digest output and digest 3 more time.
Note: Use the output of the last digest as the input to des 
Note: algorithm and key

Call B_DigestUpdate passing "digestAlg" and address of first 
initialized byte in buffer "password" and length of initialized 
bytes in buffer "password" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestUpdate passing "digestAlg" and address of first 

Baldwin         Informational, Expires 12/25/1999         220


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized byte in buffer "salt" and length of initialized 
bytes in buffer "salt" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlg" and address of next free 
byte in buffer "digest" and address of "_OutputLen" and length 
of free bytes in buffer "digest" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digest" by "_OutputLen".
Finalize buffer "digest".

Note: now digest the digest output 3 more time
Begin a loop of decimal value "3" iterations.
Call B_DigestUpdate passing "digestAlg" and address of first 
initialized byte in buffer "digest" and length of initialized 
bytes in buffer "digest" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DigestFinal passing "digestAlg" and address of next free 
byte in buffer "digest" and address of "_OutputLen" and length 
of free bytes in buffer "digest" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "digest" by "_OutputLen".
Finalize buffer "digest".
End the loop and display execution times.
Check equality of buffer "digest" with hex value 
"147f42ef55c239e38a18f6121a4627693b328299".

Note: Set up symetric key encryption

Create key object "symetricKey".
Call B_CreateKeyObject passing "symetricKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from "147f42ef55c239e3".
Call B_SetKeyInfo passing "symetricKey" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create algorithm object "symetricEncryptionAlg".
Call B_CreateAlgorithmObject passing "symetricEncryptionAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         221


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8" initialized from "8a18f6121a462769".
Call B_SetAlgorithmInfo passing "symetricEncryptionAlg" and 
"AI_DES_CBCPadIV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "symetricDecryptionAlg".
Call B_CreateAlgorithmObject passing "symetricDecryptionAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8" initialized from "8a18f6121a462769".
Call B_SetAlgorithmInfo passing "symetricDecryptionAlg" and 
"AI_DES_CBCPadIV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "symetricEncryptionAlg" and 
"symetricKey" and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "symetricEncryptionAlg" and 
address of next free byte in buffer "expectedCypherText" and 
address of "_OutputLen" and length of free bytes in buffer 
"expectedCypherText" and address of first initialized byte in 
buffer "inputData" and length of initialized bytes in buffer 
"inputData" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectedCypherText" by 
"_OutputLen".
Call B_EncryptFinal passing "symetricEncryptionAlg" and address 
of next free byte in buffer "expectedCypherText" and address of 
"_OutputLen" and length of free bytes in buffer 
"expectedCypherText" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectedCypherText" by 
"_OutputLen".
Finalize buffer "expectedCypherText".
Check equality of buffer "expectedCypherText" with contents of 
buffer "cypherText".

Call Call B_DecryptInit passing "symetricDecryptionAlg" and 
"symetricKey" and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         222


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "symetricDecryptionAlg" and 
address of next free byte in buffer "expectedPlainText" and 
address of "_OutputLen" and length of free bytes in buffer 
"expectedPlainText" and address of first initialized byte in 
buffer "expectedCypherText" and length of initialized bytes in 
buffer "expectedCypherText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectedPlainText" by "_OutputLen".
Call B_DecryptFinal passing "symetricDecryptionAlg" and address 
of next free byte in buffer "expectedPlainText" and address of 
"_OutputLen" and length of free bytes in buffer 
"expectedPlainText" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectedPlainText" by "_OutputLen".
Finalize buffer "expectedPlainText".
Check equality of buffer "expectedPlainText" with contents of 
buffer "inputData".



This is the end of test case "TVSHADES".
This is the start of test case "TVSHARSA".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector tests, RSA Sign and Verify for AI_SHA1WithRSAEncryp
Note: tion

Note: ----------------------------------------------------------
Note: ----------

Note: Start with the GlobalInit
Set "_Chooser" to "AM_RSA_DECRYPT", "AM_RSA_CRT_ENCRYPT", 
"NULL_PTR".

Set "_Chooser" to "AM_SHA", "NULL_PTR".


Note: Case 1:
Note: Use an arbitrary public/private keypair, this one 
Note: contains a
Note: 768-bit modulus.

Create key object "publicKey".

Baldwin         Informational, Expires 12/25/1999         223


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_CreateKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_RSAPublic" initialized from "cc76652b4b5d972b25c464d23b965fa
a52ca08b1012239f4aa3f8d518bf550c56dc4c684c78fe4ed492728005a7c101
2a072ecd28592a6b0f520445e41eb4884a2b801d8b579e6920fa7d25c0b02359
263af4dd4beececaa9dd59671351bb59f", "010001".
Call B_SetKeyInfo passing "publicKey" and "KI_RSAPublic" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create key object "privateKey".
Call B_CreateKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_PKCS_RSAPrivate" initialized from "cc76652b4b5d972b25c464d23
b965faa52ca08b1012239f4aa3f8d518bf550c56dc4c684c78fe4ed492728005
a7c1012a072ecd28592a6b0f520445e41eb4884a2b801d8b579e6920fa7d25c0
b02359263af4dd4beececaa9dd59671351bb59f", "010001", 
"8ce64e23bec51946bfb90ead9e28ab7669a516c63bfcc529a9253092f0bb365
547a6e213609ef5e8db8fa34e530cc9d980ea4253c6624734e57fbc5d5df7775
536ecdd195e9e7e640f4301d3d12f391d012a1e552208c1c396a49d2d561390a
9", "e5db12250f865ace6d9613df55b2bddbbf3887e061f55c9228906873216
ff0c03a146bfd3d279ef57221fed054b502fb", "e3b7eca5658d8530e3f6e5e
0806a533b0d2bd86a348339548140ddab84b27247a6235b3d563d053802d652c
671eb76ad", "b9aa07f109a643e92459aa79a6d677476e2132980b684ebafca
b10c39689be14f79511597fb16653ea3a0d82a839824b", 
"104bcf419edcdbd53ddb2364478c545c7b7ad1c7f7ee14223a05bc5753edb94
3eb5dc85fc1562893739086e7f0ab1b19", "875198f828082848eac2487c92d
6093d576382ab367eadcf059cd6a5a9062c9d6157a45631648cbffab6273361c
6ccb7".
Call B_SetKeyInfo passing "privateKey" and "KI_PKCS_RSAPrivate" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Set the data to sign

Create buffer "input" of decimal value "1024" bytes.
Set buffer "input" to hex value "616263".

Note: The signature will be the same size as the modulus.

Create buffer "output" of decimal value "96" bytes.
Note: ----------------------------------------------------------
Note: ----------

Baldwin         Informational, Expires 12/25/1999         224


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Test 1-1: input is "abc"
Note: SHA1 ("abc") = a9993e364706816aba3e25717850c26c9cd0d89d

Note: Perform the test use AI_SHA1WithRSAEncryption.

Create algorithm object "signObj".
Call B_CreateAlgorithmObject passing "signObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryption" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "signObj" and 
"AI_SHA1WithRSAEncryption" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_SHA1WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101050500".
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryptionBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "signObj" 
and "AI_SHA1WithRSAEncryptionBER".
Check equality of info structure for "AI_SHA1WithRSAEncryptionBE
R" with expected info structure for "AI_SHA1WithRSAEncryptionBER
".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_SignInit passing "signObj" and "privateKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"583b2209827d3fd9a111ac19cfdccfb0974ec22633dbdf6a5d8fcaa0e98c89e
3e3f0ab5130674bc7677325b4f4b9f08926fa4a3f14cbeaba03fb74aa31a3ff1

Baldwin         Informational, Expires 12/25/1999         225


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

016c42991b5a79c2b24cb041493f50bbbc468888c9bfb6bedcc5f844f3dc18d2
0".

Create algorithm object "verifyObj".
Call B_CreateAlgorithmObject passing "verifyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101050500".
Call B_SetAlgorithmInfo passing "verifyObj" and 
"AI_SHA1WithRSAEncryptionBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_SHA1WithRSAEncryption" initialized from 
"NULL_PTR".
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryption".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "verifyObj" 
and "AI_SHA1WithRSAEncryption".
Check equality of info structure for "AI_SHA1WithRSAEncryption" 
with expected info structure for "AI_SHA1WithRSAEncryption".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_VerifyInit passing "verifyObj" and "publicKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------
Note: Test 1-2:

Note: Check the signature result of 1-1 by signing the 
Note: digestinfo with
Note: AI_PKCS_RSAPrivate

Baldwin         Informational, Expires 12/25/1999         226


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Create buffer "expectOutput" of decimal value "96" bytes.
Create buffer "digestInfo" of decimal value "36" bytes.
Create algorithm object "encrytpionObj".
Call B_CreateAlgorithmObject passing "encrytpionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set buffer "digestInfo" to hex value "3021300906052b0e03021a0500
0414a9993e364706816aba3e25717850c26c9cd0d89d".

Set "_InfoPointer" to address of info structure for 
"AI_PKCS_RSAPrivate" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "encrytpionObj" and 
"AI_PKCS_RSAPrivate" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrytpionObj" and 
"privateKey" and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrytpionObj" and address of 
next free byte in buffer "expectOutput" and address of 
"_OutputLen" and length of free bytes in buffer "expectOutput" 
and address of first initialized byte in buffer "digestInfo" 
and length of initialized bytes in buffer "digestInfo" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Call B_EncryptFinal passing "encrytpionObj" and address of next 
free byte in buffer "expectOutput" and address of "_OutputLen" 
and length of free bytes in buffer "expectOutput" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Finalize buffer "expectOutput".
Check equality of buffer "expectOutput" with contents of buffer 
"output".


Note: ----------------------------------------------------------
Note: ----------
Note: Test 2-1:input = "abcdbcdecdefdefgefghfghighijhijkijkljklm
Note: klmnlmnomnopnopq"
Note: SHA1 ("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomno
Note: pnopq") = 

Baldwin         Informational, Expires 12/25/1999         227


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: 84983e441c3bd26ebaae4aa1f95129e5e54670f1

Note: Perform the test use AI_SHA1WithRSAEncryption.

Set length of buffer "output" to decimal value "0".
Set length of buffer "expectOutput" to decimal value "0".

Set buffer "input" to hex value "6162636462636465636465666465666
765666768666768696768696a68696a6b696a6b6c6a6b6c6d6b6c6d6e6c6d6e6
f6d6e6f706e6f7071".

Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"a751f1593b23dc86d70cec4ed60f77be415c49a2da5e6f84f868c93652930c8
60171e4e084cc8eb6f1f61ee176efdf146cf71aa82f9ed16944139283b3c7642
bf99be4235ffff7d48d03409060328b9f1ff956c6c62750bb552fd718d6084d5
1".

Note: Verify the signature
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------
Note: Test 2-2:

Note: Check the signature result of 2-1 by signing the 
Note: digestinfo with
Note: AI_PKCS_RSAPrivate

Baldwin         Informational, Expires 12/25/1999         228


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Set buffer "digestInfo" to hex value "3021300906052b0e03021a0500
041484983e441c3bd26ebaae4aa1f95129e5e54670f1".

Call B_EncryptUpdate passing "encrytpionObj" and address of 
next free byte in buffer "expectOutput" and address of 
"_OutputLen" and length of free bytes in buffer "expectOutput" 
and address of first initialized byte in buffer "digestInfo" 
and length of initialized bytes in buffer "digestInfo" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Call B_EncryptFinal passing "encrytpionObj" and address of next 
free byte in buffer "expectOutput" and address of "_OutputLen" 
and length of free bytes in buffer "expectOutput" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Finalize buffer "expectOutput".
Check equality of buffer "expectOutput" with contents of buffer 
"output".

Note: ----------------------------------------------------------
Note: ----------
Note: Test 3-1:input = "abcdbcdecdefdefgefghfghighijhijkijkljklm
Note: klmnlmnomnopnopq"
Note: SHA1 ("1,000,00 repetition of a" = 34aa973cd4c4daa4f61eeb2
Note: bdbad27316534016f

Note: Perform the test use AI_SHA1WithRSAEncryption.

Set length of buffer "output" to decimal value "0".
Set length of buffer "expectOutput" to decimal value "0".

Set buffer "input" to hex value "6161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616

Baldwin         Informational, Expires 12/25/1999         229


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161".

Begin a loop of decimal value "1000" iterations.
Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
End the loop and display execution times.
Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"845f7adbacb97303c16449107f27b98ce3df09b9e840be7fcca33c6d1f51018
d59a429f18bccc37e9a4384374b440f23f26159c0297d671290586da92a3befe
a60f783bbef5e10b0a1c0f2029bcd2d74807500c5847db820f90d6cbdae36e1e
2".

Note: Verify the signature
Begin a loop of decimal value "1000" iterations.
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
End the loop and display execution times.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         230


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------
Note: Test 3-2:

Note: Check the signature result of 3-1 by signing the 
Note: digestinfo with
Note: AI_PKCS_RSAPrivate

Set buffer "digestInfo" to hex value "3021300906052b0e03021a0500
041434aa973cd4c4daa4f61eeb2bdbad27316534016f".

Call B_EncryptUpdate passing "encrytpionObj" and address of 
next free byte in buffer "expectOutput" and address of 
"_OutputLen" and length of free bytes in buffer "expectOutput" 
and address of first initialized byte in buffer "digestInfo" 
and length of initialized bytes in buffer "digestInfo" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Call B_EncryptFinal passing "encrytpionObj" and address of next 
free byte in buffer "expectOutput" and address of "_OutputLen" 
and length of free bytes in buffer "expectOutput" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Finalize buffer "expectOutput".
Check equality of buffer "expectOutput" with contents of buffer 
"output".



Note: ----------------------------------------------------------
Note: ----------



Note: Case 2:
Note: Use an arbitrary public/private keypair, this one 
Note: contains a
Note: 512-bit modulus.

Create key object "publicKey".
Call B_CreateKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         231


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_RSAPublic" initialized from "ab383940542cac9ac03740d04904ed5
10e95720251c2ad9da7ebba29aed4497953fadf016cbc69464c831bd93b59420
4990f632475a0be6f924d9da240daf849", "010001".
Call B_SetKeyInfo passing "publicKey" and "KI_RSAPublic" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create key object "privateKey".
Call B_CreateKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_PKCS_RSAPrivate" initialized from "ab383940542cac9ac03740d04
904ed510e95720251c2ad9da7ebba29aed4497953fadf016cbc69464c831bd93
b594204990f632475a0be6f924d9da240daf849", "010001", 
"4ad2e7321596f0573068f50a10def656d5e8b94a0a30e96e5c53c7a72f9fd5f
b589b1e5be86eae02aa152367aa209e82764cade195dee325662fb0ab1ce5a00
1", "d1eb51bd09267ee7128ceb5c3218d1600b49678f783c58c5b00170ee1ac
f6ee1", "d0ce21834173f6843206a8a6ad132b65278628ef0e8cca4f20c0199
5fe6c3e69", "1a499cb7ce808a9dc73dec6f643aa565a0a4359acad4cbcd1dc
8606b00e27f21", "a793d77794ef31785501dd16afaec3d4120d6d0ab6ddad7
c25e7a66127e8cd89", "0bdb907f33c51f5b4da486da77d4b31dbcc3ae0bac9
1f3384acf10b15e5ad186".
Call B_SetKeyInfo passing "privateKey" and "KI_PKCS_RSAPrivate" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Set the data to sign

Create buffer "input" of decimal value "1024" bytes.
Set buffer "input" to hex value "616263".

Note: The signature will be the same size as the modulus.

Create buffer "output" of decimal value "64" bytes.
Note: ----------------------------------------------------------
Note: ----------
Note: Test 1-1: input is "abc"
Note: SHA1 ("abc") = a9993e364706816aba3e25717850c26c9cd0d89d

Note: Perform the test use AI_SHA1WithRSAEncryption.

Create algorithm object "signObj".
Call B_CreateAlgorithmObject passing "signObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         232


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryption" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "signObj" and 
"AI_SHA1WithRSAEncryption" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_SHA1WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101050500".
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryptionBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "signObj" 
and "AI_SHA1WithRSAEncryptionBER".
Check equality of info structure for "AI_SHA1WithRSAEncryptionBE
R" with expected info structure for "AI_SHA1WithRSAEncryptionBER
".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_SignInit passing "signObj" and "privateKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"4423a0a405c767fb48f0a376acdb10a4388d9702d88ce13ed878e25099c13c4
a72439972cbeb5993a1231a7717c924759969f9f9792abd32a6ca66a1e3f696a
3".


Create algorithm object "verifyObj".
Call B_CreateAlgorithmObject passing "verifyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 

Baldwin         Informational, Expires 12/25/1999         233


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_SHA1WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101050500".
Call B_SetAlgorithmInfo passing "verifyObj" and 
"AI_SHA1WithRSAEncryptionBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_SHA1WithRSAEncryption" initialized from 
"NULL_PTR".
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryption".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "verifyObj" 
and "AI_SHA1WithRSAEncryption".
Check equality of info structure for "AI_SHA1WithRSAEncryption" 
with expected info structure for "AI_SHA1WithRSAEncryption".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_VerifyInit passing "verifyObj" and "publicKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------
Note: Test 1-2:

Note: Check the signature result of 1-1 by signing the 
Note: digestinfo with
Note: AI_PKCS_RSAPrivate

Create buffer "expectOutput" of decimal value "64" bytes.
Create buffer "digestInfo" of decimal value "36" bytes.
Create algorithm object "encrytpionObj".
Call B_CreateAlgorithmObject passing "encrytpionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Baldwin         Informational, Expires 12/25/1999         234


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set buffer "digestInfo" to hex value "3021300906052b0e03021a0500
0414a9993e364706816aba3e25717850c26c9cd0d89d".

Set "_InfoPointer" to address of info structure for 
"AI_PKCS_RSAPrivate" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "encrytpionObj" and 
"AI_PKCS_RSAPrivate" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrytpionObj" and 
"privateKey" and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrytpionObj" and address of 
next free byte in buffer "expectOutput" and address of 
"_OutputLen" and length of free bytes in buffer "expectOutput" 
and address of first initialized byte in buffer "digestInfo" 
and length of initialized bytes in buffer "digestInfo" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Call B_EncryptFinal passing "encrytpionObj" and address of next 
free byte in buffer "expectOutput" and address of "_OutputLen" 
and length of free bytes in buffer "expectOutput" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Finalize buffer "expectOutput".
Check equality of buffer "expectOutput" with contents of buffer 
"output".


Note: ----------------------------------------------------------
Note: ----------
Note: Test 2-1:input = "abcdbcdecdefdefgefghfghighijhijkijkljklm
Note: klmnlmnomnopnopq"
Note: SHA1 ("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomno
Note: pnopq") = 
Note: 84983e441c3bd26ebaae4aa1f95129e5e54670f1

Note: Perform the test use AI_SHA1WithRSAEncryption.

Set length of buffer "output" to decimal value "0".
Set length of buffer "expectOutput" to decimal value "0".

Set buffer "input" to hex value "6162636462636465636465666465666
765666768666768696768696a68696a6b696a6b6c6a6b6c6d6b6c6d6e6c6d6e6

Baldwin         Informational, Expires 12/25/1999         235


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

f6d6e6f706e6f7071".

Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"7bcc91d130057590f399ee1a1dfb7c0ecd52768f2e68795f51e474698b22739
4b9c18034e74987a7da4bbff93677b7f198df9572390e660887a9c09848fdd3c
7".

Note: Verify the signature
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------
Note: Test 2-2:

Note: Check the signature result of 2-1 by signing the 
Note: digestinfo with
Note: AI_PKCS_RSAPrivate

Set buffer "digestInfo" to hex value "3021300906052b0e03021a0500
041484983e441c3bd26ebaae4aa1f95129e5e54670f1".

Call B_EncryptUpdate passing "encrytpionObj" and address of 
next free byte in buffer "expectOutput" and address of 
"_OutputLen" and length of free bytes in buffer "expectOutput" 
and address of first initialized byte in buffer "digestInfo" 
and length of initialized bytes in buffer "digestInfo" and 
"NULL_PTR" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         236


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Call B_EncryptFinal passing "encrytpionObj" and address of next 
free byte in buffer "expectOutput" and address of "_OutputLen" 
and length of free bytes in buffer "expectOutput" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Finalize buffer "expectOutput".
Check equality of buffer "expectOutput" with contents of buffer 
"output".

Note: ----------------------------------------------------------
Note: ----------
Note: Test 3-1:input = "abcdbcdecdefdefgefghfghighijhijkijkljklm
Note: klmnlmnomnopnopq"
Note: SHA1 ("1,000,00 repetition of a" = 34aa973cd4c4daa4f61eeb2
Note: bdbad27316534016f

Note: Perform the test use AI_SHA1WithRSAEncryption.

Set length of buffer "output" to decimal value "0".
Set length of buffer "expectOutput" to decimal value "0".

Set buffer "input" to hex value "6161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616

Baldwin         Informational, Expires 12/25/1999         237


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161".

Begin a loop of decimal value "1000" iterations.
Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
End the loop and display execution times.
Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"01a744bcce93364041faebfb8c1603c612b90922e319e1c38d840d94de8f4c9
2883f3c55c3fdcc7cd7553b596be6218eb687a9d868031bf221b062b735a6b1a
d".

Note: Verify the signature
Begin a loop of decimal value "1000" iterations.
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
End the loop and display execution times.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------
Note: Test 3-2:

Note: Check the signature result of 3-1 by signing the 
Note: digestinfo with
Note: AI_PKCS_RSAPrivate

Baldwin         Informational, Expires 12/25/1999         238


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Set buffer "digestInfo" to hex value "3021300906052b0e03021a0500
041434aa973cd4c4daa4f61eeb2bdbad27316534016f".

Call B_EncryptUpdate passing "encrytpionObj" and address of 
next free byte in buffer "expectOutput" and address of 
"_OutputLen" and length of free bytes in buffer "expectOutput" 
and address of first initialized byte in buffer "digestInfo" 
and length of initialized bytes in buffer "digestInfo" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Call B_EncryptFinal passing "encrytpionObj" and address of next 
free byte in buffer "expectOutput" and address of "_OutputLen" 
and length of free bytes in buffer "expectOutput" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Finalize buffer "expectOutput".
Check equality of buffer "expectOutput" with contents of buffer 
"output".

Note: ----------------------------------------------------------
Note: ----------




Note: Case 3:
Note: Use an arbitrary public/private keypair, this one 
Note: contains a
Note: 1024-bit modulus.

Create key object "publicKey".
Call B_CreateKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_RSAPublic" initialized from "d1bb134b2583eb6008cfcb10943f4b5
40872876a2e3f31ffd704b99f62d005cb4eac429d625b0bd4de002d63f74e5e8
a09c3be7a269dc941739e6d8532ba5b32695350bf9659f5ea71ee8bf4102ce71
2272e12a849e4e62342c2ce6c5143327eb3007e5bf4d709e89e0181d6d603514
7a93d79ddc4175cccf2ceecf4c298fc17", "010001".
Call B_SetKeyInfo passing "publicKey" and "KI_RSAPublic" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         239


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Create key object "privateKey".
Call B_CreateKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_PKCS_RSAPrivate" initialized from "d1bb134b2583eb6008cfcb109
43f4b540872876a2e3f31ffd704b99f62d005cb4eac429d625b0bd4de002d63f
74e5e8a09c3be7a269dc941739e6d8532ba5b32695350bf9659f5ea71ee8bf41
02ce712272e12a849e4e62342c2ce6c5143327eb3007e5bf4d709e89e0181d6d
6035147a93d79ddc4175cccf2ceecf4c298fc17", "010001", 
"309d3368acc67a4da55d3d0d97bf601f9761acbfd0fe77017d7eabe4250c60f
b723dfda6eb807d2a9756e52e91c989a2678706e4db84a17cd966f4adf6473a1
1f6e9f1d208cb569c8d3bc1a01625364d6db2aab90bfa0b5e3925e5c9c1a8dc8
4fdb6546b8217a657741aa7b21a7fafff9ed0d758deeb4fc3af0d416be8398f7
1", "e8fefba76de45cfaf347ce2ed30e935ff19db5e0c99f685c0ca2e42f567
a5fcbdefbba4242519491bd9f9676addac54d51ad11d78572687b9a626f999a0
579b9", "e6700efd7438554f5a1c5f07dbe07d357858dc85de049f30fbb69b7
e86d4eb793da00e44e5bfbe0dea93806b64d8a486b4c8336ac34d0688f18af79
4ddb1cc4f", "d5ea550e315cbae9443726dbe2b6bd2417671eb75525dfe0b35
152830bb8aaff38a89127884ff241a48142d98f610e48a0b66f6d1a7e21e369a
8faa161c1a931", "85ab7b068ae42298652d0ff2ff18b988cac6c124e624c83
321d04b6299d3e8c3eb7b6ccb8a7a2f44e34dacb09f4f0c2117bd0a166433ca1
6a606769764023f01", "ac6b6150f924e3d0968b3bc9031bf96ffaa3cf146ef
043545187714f3b099b1165bbd88e84f237a171ac0685b7c5b7c840d393c0fa2
d2bf4d0aa77b9791ab9c3".
Call B_SetKeyInfo passing "privateKey" and "KI_PKCS_RSAPrivate" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Set the data to sign

Create buffer "input" of decimal value "1024" bytes.
Set buffer "input" to hex value "616263".

Note: The signature will be the same size as the modulus.

Create buffer "output" of decimal value "128" bytes.
Note: ----------------------------------------------------------
Note: ----------
Note: Test 1-1: input is "abc"
Note: SHA1 ("abc") = a9993e364706816aba3e25717850c26c9cd0d89d

Note: Perform the test use AI_SHA1WithRSAEncryption.

Create algorithm object "signObj".
Call B_CreateAlgorithmObject passing "signObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         240


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryption" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "signObj" and 
"AI_SHA1WithRSAEncryption" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_SHA1WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101050500".
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryptionBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "signObj" 
and "AI_SHA1WithRSAEncryptionBER".
Check equality of info structure for "AI_SHA1WithRSAEncryptionBE
R" with expected info structure for "AI_SHA1WithRSAEncryptionBER
".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_SignInit passing "signObj" and "privateKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"5c85c14a3dbe011bfb969a637a76d7a2d0ddc7ddbcbb450a121f6568020c596
e9929473332f288f4407bf71489b7c29dc9810b103a51291f8128c8ea935ba72
253b2a05de9489d64d2bcec8ba3f3ca19d318380edb8c459920ef2599f655781
e94bffb1cfc7d4ba9e567117c08378e489f939007acdc6a92918c2a2fc31bf9c
8".

Create algorithm object "verifyObj".
Call B_CreateAlgorithmObject passing "verifyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 

Baldwin         Informational, Expires 12/25/1999         241


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_SHA1WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101050500".
Call B_SetAlgorithmInfo passing "verifyObj" and 
"AI_SHA1WithRSAEncryptionBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_SHA1WithRSAEncryption" initialized from 
"NULL_PTR".
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryption".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "verifyObj" 
and "AI_SHA1WithRSAEncryption".
Check equality of info structure for "AI_SHA1WithRSAEncryption" 
with expected info structure for "AI_SHA1WithRSAEncryption".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_VerifyInit passing "verifyObj" and "publicKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------
Note: Test 1-2:

Note: Check the signature result of 1-1 by signing the 
Note: digestinfo with
Note: AI_PKCS_RSAPrivate

Create buffer "expectOutput" of decimal value "128" bytes.
Create buffer "digestInfo" of decimal value "36" bytes.
Create algorithm object "encrytpionObj".
Call B_CreateAlgorithmObject passing "encrytpionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Baldwin         Informational, Expires 12/25/1999         242


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set buffer "digestInfo" to hex value "3021300906052b0e03021a0500
0414a9993e364706816aba3e25717850c26c9cd0d89d".

Set "_InfoPointer" to address of info structure for 
"AI_PKCS_RSAPrivate" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "encrytpionObj" and 
"AI_PKCS_RSAPrivate" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrytpionObj" and 
"privateKey" and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrytpionObj" and address of 
next free byte in buffer "expectOutput" and address of 
"_OutputLen" and length of free bytes in buffer "expectOutput" 
and address of first initialized byte in buffer "digestInfo" 
and length of initialized bytes in buffer "digestInfo" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Call B_EncryptFinal passing "encrytpionObj" and address of next 
free byte in buffer "expectOutput" and address of "_OutputLen" 
and length of free bytes in buffer "expectOutput" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Finalize buffer "expectOutput".
Check equality of buffer "expectOutput" with contents of buffer 
"output".


Note: ----------------------------------------------------------
Note: ----------
Note: Test 2-1:input = "abcdbcdecdefdefgefghfghighijhijkijkljklm
Note: klmnlmnomnopnopq"
Note: SHA1 ("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomno
Note: pnopq") = 
Note: 84983e441c3bd26ebaae4aa1f95129e5e54670f1

Note: Perform the test use AI_SHA1WithRSAEncryption.

Set length of buffer "output" to decimal value "0".
Set length of buffer "expectOutput" to decimal value "0".

Set buffer "input" to hex value "6162636462636465636465666465666
765666768666768696768696a68696a6b696a6b6c6a6b6c6d6b6c6d6e6c6d6e6

Baldwin         Informational, Expires 12/25/1999         243


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

f6d6e6f706e6f7071".

Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"9b13f4e9cfc36cc2b1153360c09d3b6eb47c473ba9a127cf775fe6116a365fd
9a69532aaea721693185e1e42ce6d49608cd2de4f995d1bff5e6cc7a0bf71002
c7aca0b3edb63f67f91b4a31d69ae647dbe22fab63bf20d2b0a6ce76ab5f414f
c55ae9b86ddf8c3a97b8a6c292c7ac91495b02e6847e2c6713df12d2f2ff196f
3".

Note: Verify the signature
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------
Note: Test 2-2:

Note: Check the signature result of 2-1 by signing the 
Note: digestinfo with
Note: AI_PKCS_RSAPrivate

Set buffer "digestInfo" to hex value "3021300906052b0e03021a0500
041484983e441c3bd26ebaae4aa1f95129e5e54670f1".

Call B_EncryptUpdate passing "encrytpionObj" and address of 
next free byte in buffer "expectOutput" and address of 
"_OutputLen" and length of free bytes in buffer "expectOutput" 
and address of first initialized byte in buffer "digestInfo" 

Baldwin         Informational, Expires 12/25/1999         244


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of initialized bytes in buffer "digestInfo" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Call B_EncryptFinal passing "encrytpionObj" and address of next 
free byte in buffer "expectOutput" and address of "_OutputLen" 
and length of free bytes in buffer "expectOutput" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Finalize buffer "expectOutput".
Check equality of buffer "expectOutput" with contents of buffer 
"output".

Note: ----------------------------------------------------------
Note: ----------
Note: Test 3-1:input = "abcdbcdecdefdefgefghfghighijhijkijkljklm
Note: klmnlmnomnopnopq"
Note: SHA1 ("1,000,00 repetition of a" = 34aa973cd4c4daa4f61eeb2
Note: bdbad27316534016f

Note: Perform the test use AI_SHA1WithRSAEncryption.

Set length of buffer "output" to decimal value "0".
Set length of buffer "expectOutput" to decimal value "0".

Set buffer "input" to hex value "6161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616

Baldwin         Informational, Expires 12/25/1999         245


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161".

Begin a loop of decimal value "1000" iterations.
Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
End the loop and display execution times.
Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"5acc27d981591f576d9e9684fe57c42cdd4a3ae2fa81a2b05e28ee1aee3aab9
669b6467c8be3a34dfa71f98d88300e1f6c9ea60f700576e8bc3f6104e87b1b9
a93d6882d121f8c06e456fa9ad4b5bb06f6f6265a52714d51536dc5477b9e333
36ee56fac0a486b6e2b7eb3b5fed5c7f12f8e595c201ccb6f2b1cf41bbe152c5
1".

Note: Verify the signature
Begin a loop of decimal value "1000" iterations.
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
End the loop and display execution times.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------
Note: Test 3-2:

Baldwin         Informational, Expires 12/25/1999         246


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Check the signature result of 3-1 by signing the 
Note: digestinfo with
Note: AI_PKCS_RSAPrivate

Set buffer "digestInfo" to hex value "3021300906052b0e03021a0500
041434aa973cd4c4daa4f61eeb2bdbad27316534016f".

Call B_EncryptUpdate passing "encrytpionObj" and address of 
next free byte in buffer "expectOutput" and address of 
"_OutputLen" and length of free bytes in buffer "expectOutput" 
and address of first initialized byte in buffer "digestInfo" 
and length of initialized bytes in buffer "digestInfo" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Call B_EncryptFinal passing "encrytpionObj" and address of next 
free byte in buffer "expectOutput" and address of "_OutputLen" 
and length of free bytes in buffer "expectOutput" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Finalize buffer "expectOutput".
Check equality of buffer "expectOutput" with contents of buffer 
"output".

Note: ----------------------------------------------------------
Note: ----------



Note: Case 4:
Note: Use an arbitrary public/private keypair, this one 
Note: contains a
Note: 2048-bit modulus.

Create key object "publicKey".
Call B_CreateKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_RSAPublic" initialized from "a40d55504a4a99261ac819e53536b50
a922b6f9e130899606cb3c5bc16ff61376d2538f10e13560b6c49006049b9a1e
af070feeac92313074e4a65471d510609ddbe97de1da3817a47f6d3632b9275c
ed442a308869a17a29582cc693ac2616bc90bb8c06f9ab88a0c61a08fd2e8eb7
f1b6e04910de8d5d0bd30fdc4b836e70ad992400a96d2845b2bb023a9ce81296
827732e3d68ccae2fd66849179572c7e0e4b5fbb7a92b2f222e020b413ac198b
24f3d297819e0e98f9d8e5291a4918bf4af71476c7b3cd0f7c888151bf5ca9d5

Baldwin         Informational, Expires 12/25/1999         247


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

4b98297731ded8ec120920a62b9bc5bbbf9955536abe41ae6731c8ad2f43bfbb
b5648961f12d4c26408baec8e609b53bf", "010001".
Call B_SetKeyInfo passing "publicKey" and "KI_RSAPublic" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create key object "privateKey".
Call B_CreateKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_PKCS_RSAPrivate" initialized from "a40d55504a4a99261ac819e53
536b50a922b6f9e130899606cb3c5bc16ff61376d2538f10e13560b6c4900604
9b9a1eaf070feeac92313074e4a65471d510609ddbe97de1da3817a47f6d3632
b9275ced442a308869a17a29582cc693ac2616bc90bb8c06f9ab88a0c61a08fd
2e8eb7f1b6e04910de8d5d0bd30fdc4b836e70ad992400a96d2845b2bb023a9c
e81296827732e3d68ccae2fd66849179572c7e0e4b5fbb7a92b2f222e020b413
ac198b24f3d297819e0e98f9d8e5291a4918bf4af71476c7b3cd0f7c888151bf
5ca9d54b98297731ded8ec120920a62b9bc5bbbf9955536abe41ae6731c8ad2f
43bfbbb5648961f12d4c26408baec8e609b53bf", "010001", 
"75bed422e28f9448532497e1794620becb96bd70197d2c8896bc99099d00030
8c31fda34b9c38b187bca11a90a816003be3b7bdb8c2dce7489eebfae410e6c6
51c70b593c876187269c0708c5733b1b697869479841289303a5b3cd7b242dda
57d111ab393e6dad8ca762fc5cabd3e7966789a727a27497f9eaad1192696d15
043feec9ce697b51a5b9e8ef89aecee3a2285088c9213f7f00b26b9130329c0f
29cf26bfa4e8be0c8d7dffaf5b2fdb5dee6ead68af8afeeb0fdbd7f13e464832
612f2171576231d695c0406da99a411bed8f9cad077375a74854ae0dd86cb617
cc639843561e86c5ffaf9fe010736c30c237b9be05d76a9a7bdf9ff332fbc208
1", "d2359d139c5e94e1d7ced3f4dfd3a37a5d68b89196a21dd0619ec71c3dd
221ca9e571382c307aa768029d999ee1f8e24f7cf73c34c1c071495b4f7a28a3
f7aebd09f17cf3f80565f3981bfde9ff55349cbdfd42dfaeaa863a4005ca25fb
7c014a9e16fe38ec741ab07a5cf9df32854344fcf47a00124b81cfcf2ed72c6e
1c221", "c7c9be1f927787728816f008a5e4c1e06b29959c007d365830aa70f
59acdf09d04c326b40aaacc63022a29b860bd8da809a5a6594ca06f506f9f4a8
8adf88d63f704602f477789737cf593959bc3b3e47d74116bf0e3426dfd463ef
f0472909d922cb9cd61d9f2edd0878b00e720e659861c4f6bf57d8a15b7d132d
bd23e19df", "2cabb6089fd73d9e4cc52827c694ec0da9e2022ef62ad7591c1
5a8cc689aca118bda874be7742e96661ffe9d068c70218d03e9dedbc2ad0283d
9e432075cfc1b36c7484103869b543b1d468fe1c03985da2c63a3adc9c624fe8
a1125745fd112d313143af0718993f5d917a8c22e94ce5513806e1130236c0d9
8f63ac8e6dae1", "374e33a14dcc64e461a3e7e29cf9cc69b1809b77c9f2df7
e5e4a7066ace9e177b5ffc7d1033af0c55fae084a900d290fa14c07d6a48dad0
2d943814080d8535b9edfc9388d521becaa64d8ec0b688b7deef498760703023
aac682bbc30a0fe4380597d3dcb9ea7cf0970dc1beddf7fa4bca94d9b17241f7
b8f9d0bb52a682285", "acc125113028f8150feb24d14672db7f59118d349ff
7a2b0584c841e1e6bfc6033729edd2c7a44cfbe54869f0dbfe21f39f6c7f0419
172c832b83d167e0d2d474c39d1457d47ed986659d216c06edd0b16ece129801
56f5215634ae61995818057fc8bde64994d60743f89d0dbf8f6762efda3fa04c
8acdc983c60a0ad41cc0e".
Call B_SetKeyInfo passing "privateKey" and "KI_PKCS_RSAPrivate" 

Baldwin         Informational, Expires 12/25/1999         248


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Set the data to sign

Create buffer "input" of decimal value "1024" bytes.
Set buffer "input" to hex value "616263".

Note: The signature will be the same size as the modulus.

Create buffer "output" of decimal value "256" bytes.
Note: ----------------------------------------------------------
Note: ----------
Note: Test 1-1: input is "abc"
Note: SHA1 ("abc") = a9993e364706816aba3e25717850c26c9cd0d89d

Note: Perform the test use AI_SHA1WithRSAEncryption.

Create algorithm object "signObj".
Call B_CreateAlgorithmObject passing "signObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryption" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "signObj" and 
"AI_SHA1WithRSAEncryption" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_SHA1WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101050500".
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryptionBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "signObj" 
and "AI_SHA1WithRSAEncryptionBER".
Check equality of info structure for "AI_SHA1WithRSAEncryptionBE
R" with expected info structure for "AI_SHA1WithRSAEncryptionBER
".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_SignInit passing "signObj" and "privateKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         249


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"1ffc4b60ef0f4e7bea3ce4bda4528d96b4fb47862c5699f2686651a436b112b
297856bf8c65901dda9d0a12c61f672c60c1ea81390e15842fead1c8fc6810a5
60a629d72814eacb4c71834e26a07dc1d85864de831b1fd1ac6e08be33cc1359
7a1e3fd8abea154d0007077552941aa9c5381e2a681eb1d7f0c2be0ed50b25ed
3564f123c53136374ccf373e5f78c7114d1979fd1f8d71889e8f908e7fc6713f
10fba4ea5f0a3622ae994352114909d6ad82e97cad6548565e8d0f880d023b6c
dd09817fb907e1811dfe93974f403bbf71521c93c4142a0e1a673118f8e684ca
e6c76f9cfce6c9c142c838f94d4e5cf48ca2abd60113a54eda149044fa9bb4d1
c".


Create algorithm object "verifyObj".
Call B_CreateAlgorithmObject passing "verifyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryptionBER" initialized from 
"300d06092a864886f70d0101050500".
Call B_SetAlgorithmInfo passing "verifyObj" and 
"AI_SHA1WithRSAEncryptionBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_SHA1WithRSAEncryption" initialized from 
"NULL_PTR".
Set "_InfoPointer" to address of info structure for 
"AI_SHA1WithRSAEncryption".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "verifyObj" 
and "AI_SHA1WithRSAEncryption".
Check equality of info structure for "AI_SHA1WithRSAEncryption" 
with expected info structure for "AI_SHA1WithRSAEncryption".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_VerifyInit passing "verifyObj" and "publicKey" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         250


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------
Note: Test 1-2:

Note: Check the signature result of 1-1 by signing the 
Note: digestinfo with
Note: AI_PKCS_RSAPrivate

Create buffer "expectOutput" of decimal value "256" bytes.
Create buffer "digestInfo" of decimal value "36" bytes.
Create algorithm object "encrytpionObj".
Call B_CreateAlgorithmObject passing "encrytpionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set buffer "digestInfo" to hex value "3021300906052b0e03021a0500
0414a9993e364706816aba3e25717850c26c9cd0d89d".

Set "_InfoPointer" to address of info structure for 
"AI_PKCS_RSAPrivate" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "encrytpionObj" and 
"AI_PKCS_RSAPrivate" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrytpionObj" and 
"privateKey" and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrytpionObj" and address of 
next free byte in buffer "expectOutput" and address of 
"_OutputLen" and length of free bytes in buffer "expectOutput" 
and address of first initialized byte in buffer "digestInfo" 
and length of initialized bytes in buffer "digestInfo" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         251


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Call B_EncryptFinal passing "encrytpionObj" and address of next 
free byte in buffer "expectOutput" and address of "_OutputLen" 
and length of free bytes in buffer "expectOutput" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Finalize buffer "expectOutput".
Check equality of buffer "expectOutput" with contents of buffer 
"output".


Note: ----------------------------------------------------------
Note: ----------
Note: Test 2-1:input = "abcdbcdecdefdefgefghfghighijhijkijkljklm
Note: klmnlmnomnopnopq"
Note: SHA1 ("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomno
Note: pnopq") = 
Note: 84983e441c3bd26ebaae4aa1f95129e5e54670f1

Note: Perform the test use AI_SHA1WithRSAEncryption.

Set length of buffer "output" to decimal value "0".
Set length of buffer "expectOutput" to decimal value "0".

Set buffer "input" to hex value "6162636462636465636465666465666
765666768666768696768696a68696a6b696a6b6c6a6b6c6d6b6c6d6e6c6d6e6
f6d6e6f706e6f7071".

Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "signObj" and address of next free 
byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"850ecd588dc614bcb56d25913beaec9ed232bb8ab180f050edf7faf4b684593
241f2fc8ab20cf9981dd83089538d7f3c34f88e4e85cbaa0a96071a90db6e694
d23b7b3e6987a44b43dd9a46ac9c3f67537c57c61ea589b3a8b42ee4be7b5f0f
e71cb220804b6554456578de950e435d07e3b84276b08ec9a6159d35c96744c3
bb16a15c194f77da04406b38ab9acf3a43efd7ce05967e31202ed7dccc9e57f9

Baldwin         Informational, Expires 12/25/1999         252


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

f9354cc797ebe55bdf46f307741e6aa1fdf90da921e90aff76474fe7fe5ca881
f1e0ae5ee30ed40fab2455922e5beeea573e32e3f7a8f4fdaa8fa9d7a8fb2a6d
14ed263a8e0ad8bb8a5dce5c07cc1c2a6d4a1e6e7b78ffba6010511d31f77a82
1".

Note: Verify the signature
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------
Note: Test 2-2:

Note: Check the signature result of 2-1 by signing the 
Note: digestinfo with
Note: AI_PKCS_RSAPrivate

Set buffer "digestInfo" to hex value "3021300906052b0e03021a0500
041484983e441c3bd26ebaae4aa1f95129e5e54670f1".

Call B_EncryptUpdate passing "encrytpionObj" and address of 
next free byte in buffer "expectOutput" and address of 
"_OutputLen" and length of free bytes in buffer "expectOutput" 
and address of first initialized byte in buffer "digestInfo" 
and length of initialized bytes in buffer "digestInfo" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Call B_EncryptFinal passing "encrytpionObj" and address of next 
free byte in buffer "expectOutput" and address of "_OutputLen" 
and length of free bytes in buffer "expectOutput" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Finalize buffer "expectOutput".
Check equality of buffer "expectOutput" with contents of buffer 
"output".

Note: ----------------------------------------------------------

Baldwin         Informational, Expires 12/25/1999         253


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: ----------
Note: Test 3-1:input = "abcdbcdecdefdefgefghfghighijhijkijkljklm
Note: klmnlmnomnopnopq"
Note: SHA1 ("1,000,00 repetition of a" = 34aa973cd4c4daa4f61eeb2
Note: bdbad27316534016f

Note: Perform the test use AI_SHA1WithRSAEncryption.

Set length of buffer "output" to decimal value "0".
Set length of buffer "expectOutput" to decimal value "0".

Set buffer "input" to hex value "6161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161616161616161616
1616161616161616161616161616161616161616161616161".

Begin a loop of decimal value "1000" iterations.
Call B_SignUpdate passing "signObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
End the loop and display execution times.
Call B_SignFinal passing "signObj" and address of next free 

Baldwin         Informational, Expires 12/25/1999         254


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

byte in buffer "output" and address of "_OutputLen" and length 
of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with hex value 
"104b1d13ba23b080be0e48891feec225482a4ad8dcdf0b3893bd1d2144fa71d
15cf7c873b35cf443f30710c2db1dfa2f5f662ea3c3281d84976021120beb919
61bab6eb887bf9c5e40bf7d7b8c3f46523eb2fef9e85d6abf9d07735aefd764e
bbfd0f8f09fddb3f400f61750b8541fe2571864b5077b1014840cafd098db94b
af52373729ff6f31cd52bc73766fa7e223ada147e7cca92faf06bd41b5f99d1f
3f691f0897618cede5ab510710199f205809deb8b28e29d777e3617cef65db29
b7297213fcf0ca00225c7da8422c287aa5736b2726b63048953d5404ee94d0a3
7450b28ede032f279e0863589a3c3acc47a7f38a463258b5b8610204ee53a61e
3".

Note: Verify the signature
Begin a loop of decimal value "1000" iterations.
Call B_VerifyUpdate passing "verifyObj" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
End the loop and display execution times.
Call B_VerifyFinal passing "verifyObj" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------
Note: Test 3-2:

Note: Check the signature result of 3-1 by signing the 
Note: digestinfo with
Note: AI_PKCS_RSAPrivate

Set buffer "digestInfo" to hex value "3021300906052b0e03021a0500
041434aa973cd4c4daa4f61eeb2bdbad27316534016f".

Call B_EncryptUpdate passing "encrytpionObj" and address of 
next free byte in buffer "expectOutput" and address of 
"_OutputLen" and length of free bytes in buffer "expectOutput" 
and address of first initialized byte in buffer "digestInfo" 
and length of initialized bytes in buffer "digestInfo" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         255


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Call B_EncryptFinal passing "encrytpionObj" and address of next 
free byte in buffer "expectOutput" and address of "_OutputLen" 
and length of free bytes in buffer "expectOutput" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "expectOutput" by "_OutputLen".
Finalize buffer "expectOutput".
Check equality of buffer "expectOutput" with contents of buffer 
"output".



Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TVSHARSA".
This is the start of test case "TFSHARND".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional test for AI_SHARandom

Note: -------------------------------------------------------

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_SHA_RANDOM", "NULL_PTR".


Create buffer "input" of decimal value "256" bytes.
Set buffer "input" to hex value "99aabbcc".

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SHA1Random" initialized from "", "000102030405060708090a0b0c
0d0e0f000102030405".
Call B_SetAlgorithmInfo passing "random" and "AI_SHA1Random" 
and "_InfoPointer".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         256


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "input" and length of initialized bytes in 
"input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create buffer "initVector" of decimal value "8" bytes.

Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".
Display buffer "initVector".
Set "_OutputLen" to decimal value "253".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Display buffer "input".

Call Call B_DestroyAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


This is the end of test case "TFSHARND".
This is the start of test case "TF111300".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional test for 1113 recoding

Note: -------------------------------------------------------
Note: Start with GlobalInit for code resource

Baldwin         Informational, Expires 12/25/1999         257


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Set "_Chooser" to "NULL_PTR".


Create algorithm object "encodeAlg".
Call B_CreateAlgorithmObject passing "encodeAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decodeAlg".
Call B_CreateAlgorithmObject passing "decodeAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "inputData" of decimal value "5000" bytes.
Create buffer "encodedData" of decimal value "7000" bytes.
Create buffer "decodedData" of decimal value "5000" bytes.
Create buffer "expectedResult" of decimal value "7000" bytes.

Note: Initialize, set up expected and input data

Set "_InfoPointer" to address of info structure for 
"AI_RFC1113Recode" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "encodeAlg" and 
"AI_RFC1113Recode" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RFC1113Recode" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "decodeAlg" and 
"AI_RFC1113Recode" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncodeInit passing "encodeAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecodeInit passing "decodeAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1

Set buffer "inputData" to hex value "307c300d06092a864886f70d010
1010500036b003068026100b0b40e9a3a464e8703ffb8dbcad8af41f3c3f4131
cf6571e39a53549b42094dc92f8ee1ea1035f94212b751a3b07445dbdd6ef4d7
e2300f42cf5734790bce8ba517fa819eef75f1746dce5ffd123fe642e6894b38
1de5a40288dd6d714af84ef0203010001".


Baldwin         Informational, Expires 12/25/1999         258


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_EncodeUpdate passing "encodeAlg" and address of next 
free byte in buffer "encodedData" and address of "_OutputLen" 
and length of free bytes in buffer "encodedData" and address of 
first initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Call B_EncodeFinal passing "encodeAlg" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Finalize buffer "encodedData".

Set buffer "expectedResult" to hex value "4d4877774451594a4b6f5a
496876634e41514542425141446177417761414a68414c433044706f36526b36
48412f2b34323872597230487a772f515448505a58486a6d6c4e556d30494a54
636b766a7548714544583551684b3355614f776445586233573730312b497744
304c50567a52354338364c70526636675a377664664630626335662f52492f35
6b4c6d695573344865576b416f6a646258464b2b453777494441514142".

Check equality of buffer "expectedResult" with contents of 
buffer "encodedData".

Call B_DecodeUpdate passing "decodeAlg" and address of next 
free byte in buffer "decodedData" and address of "_OutputLen" 
and length of free bytes in buffer "decodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Call B_DecodeFinal passing "decodeAlg" and address of next free 
byte in buffer "decodedData" and address of "_OutputLen" and 
length of free bytes in buffer "decodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Finalize buffer "decodedData".
Check equality of buffer "inputData" with contents of buffer 
"decodedData".

Note: Case 2

Set length of buffer "encodedData" to decimal value "0".
Set length of buffer "decodedData" to decimal value "0".
Set buffer "inputData" to hex value "305f310b3009060355040613025

Baldwin         Informational, Expires 12/25/1999         259


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

5533120301e060355040a131752534120446174612053656375726974792c204
96e632e312e302c060355040b13254c6f77204173737572616e6365204365727
4696669636174696f6e20417574686f72697479".

Call B_EncodeUpdate passing "encodeAlg" and address of next 
free byte in buffer "encodedData" and address of "_OutputLen" 
and length of free bytes in buffer "encodedData" and address of 
first initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Call B_EncodeFinal passing "encodeAlg" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Finalize buffer "encodedData".

Set buffer "expectedResult" to hex value "4d463878437a414a42674e
5642415954416c56544d534177486759445651514b4578645355304567524746
30595342545a574e31636d6c30655377675357356a4c6a45754d437747413155
4543784d6c544739334945467a633356795957356a5a5342445a584a3061575a
7059324630615739754945463164476876636d6c3065513d3d".
Check equality of buffer "expectedResult" with contents of 
buffer "encodedData".

Call B_DecodeUpdate passing "decodeAlg" and address of next 
free byte in buffer "decodedData" and address of "_OutputLen" 
and length of free bytes in buffer "decodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Call B_DecodeFinal passing "decodeAlg" and address of next free 
byte in buffer "decodedData" and address of "_OutputLen" and 
length of free bytes in buffer "decodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Finalize buffer "decodedData".
Check equality of buffer "inputData" with contents of buffer 
"decodedData".

Note: Case 3

Set length of buffer "encodedData" to decimal value "0".

Baldwin         Informational, Expires 12/25/1999         260


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set length of buffer "decodedData" to decimal value "0".
Set buffer "inputData" to hex value "3082010330818e300d06092a864
886f70d0101020500305f310b30090603550406130255533120301e060355040
a131752534120446174612053656375726974792c20496e632e312e302c06035
5040b13254c6f77204173737572616e63652043657274696669636174696f6e2
0417574686f72697479170d3932303930393132303031385a170d39323130303
13030303030305a300d06092a864886f70d0101020500036100678de267135fb
b9d7b38725267ece9ef8bc5baa7b93fdd5128133db75a0c252b6de3401879659
ff7160d98efff55049b6b368b41a79c9d8e4332ea3039bf3169d4a3b9d9b6f7c
b7aa840d549cac49c0d4dccabdd45d06a5f171fafcc9e1e8255".
Display buffer "inputData".

Call B_EncodeUpdate passing "encodeAlg" and address of next 
free byte in buffer "encodedData" and address of "_OutputLen" 
and length of free bytes in buffer "encodedData" and address of 
first initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Call B_EncodeFinal passing "encodeAlg" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Finalize buffer "encodedData".

Set buffer "expectedResult" to hex value "4d494942417a43426a6a41
4e42676b71686b69473977304241514946414442664d51737743515944565151
4745774a56557a45674d4234474131554543684d58556c4e4249455268644745
675532566a64584a7064486b7349456c75597934784c6a417342674e56424173
544a5578766479424263334e31636d4675593255675132567964476c6d61574e
6864476c76626942426458526f62334a7064486b5844546b794d446b774f5445
794d4441784f466f5844546b794d5441774d5441774d4441774d466f77445159
4a4b6f5a496876634e41514543425141445951426e6a654a6e45312b376e5873
34636c4a6e374f6e766938573670376b2f3356456f457a32335767776c4b3233
6a514268355a5a2f3346673259372f3956424a74724e6f7442703579646a6b4d
79366a4135767a4670314b4f35326262337933716f514e564a79735363445533
4d713931463047706646782b767a4a3465676c553d".
Display buffer "expectedResult".

Call B_DecodeUpdate passing "decodeAlg" and address of next 
free byte in buffer "decodedData" and address of "_OutputLen" 
and length of free bytes in buffer "decodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         261


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_DecodeFinal passing "decodeAlg" and address of next free 
byte in buffer "decodedData" and address of "_OutputLen" and 
length of free bytes in buffer "decodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Finalize buffer "decodedData".
Check equality of buffer "inputData" with contents of buffer 
"decodedData".

Note: Case 4

Set length of buffer "encodedData" to decimal value "0".
Set length of buffer "decodedData" to decimal value "0".
Set buffer "inputData" to hex value "308201983082012202044600000
1300d06092a864886f70d0101020500305f310b3009060355040613025553312
0301e060355040a131752534120446174612053656375726974792c20496e632
e312e302c060355040b13254c6f77204173737572616e6365204365727469666
9636174696f6e20417574686f72697479301e170d39323039303931383530303
55a170d3934303930393138353030345a302c310b30090603550406130255533
11d301b060355040a13144578616d706c65204f7267616e697a6174696f6e305
c300d06092a864886f70d0101010500034b003048024100c5596591f670ac387
fbabff6c0d083e593220e0bc3a00f975b9eb7ad514c777bae14252df83058747
f177eac9c1da5394d33ebd8de9216a41c69d2d4838fa4510203010001300d060
92a864886f70d0101020500036100738e6d829230f4376aa94c20500bf153428
98014facad1d87148e72812d6f195700f1f1c42378208038cfa96d4d77baafab
2dcdc7c5a8031fc678e789a35c5cee985ece445fe8bb258bccbd92802ddecc82
6bc6ad67664c48e3cc5a26d8f7495".

Call B_EncodeUpdate passing "encodeAlg" and address of next 
free byte in buffer "encodedData" and address of "_OutputLen" 
and length of free bytes in buffer "encodedData" and address of 
first initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Call B_EncodeFinal passing "encodeAlg" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Finalize buffer "encodedData".

Set buffer "expectedResult" to hex value "4d4949426d444343415349
4342455941414145774451594a4b6f5a496876634e4151454342514177587a45
4c4d416b474131554542684d4356564d784944416542674e5642416f5446314a
54515342455958526849464e6c59335679615852354c43424a626d4d754d5334
774c4159445651514c4579564d6233636751584e7a64584a68626d4e6c49454e

Baldwin         Informational, Expires 12/25/1999         262


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

6c636e52705a6d6c6a59585270623234675158563061473979615852354d4234
5844546b794d446b774f5445344e5441774e566f5844546b304d446b774f5445
344e5441774e466f774c44454c4d416b474131554542684d4356564d78485441
6242674e5642416f5446455634595731776247556754334a6e59573570656d46
30615739754d4677774451594a4b6f5a496876634e4151454242514144537741
7753414a42414d565a5a5a4832634b77346637712f39734451672b5754496734
4c773641506c31756574363152544864377268516c4c6667775748522f463336
736e42326c4f55307a36396a656b68616b48476e5331494f5070464543417745
414154414e42676b71686b6947397730424151494641414e6841484f4f62594b
534d50513361716c4d4946414c38564e43695941552b73725232484649357967
53317647566341386648454933676767446a507157314e643771767179334e78
38576f41782f47654f654a6f317863377068657a6b5266364c736c693879396b
6f417433737943613861745a325a4d534f504d5769625939306c513d3d".
Display buffer "expectedResult".

Call B_DecodeUpdate passing "decodeAlg" and address of next 
free byte in buffer "decodedData" and address of "_OutputLen" 
and length of free bytes in buffer "decodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Call B_DecodeFinal passing "decodeAlg" and address of next free 
byte in buffer "decodedData" and address of "_OutputLen" and 
length of free bytes in buffer "decodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Finalize buffer "decodedData".
Check equality of buffer "inputData" with contents of buffer 
"decodedData".



This is the end of test case "TF111300".
This is the start of test case "TF111301".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Length-based test for 1113 recoding

Note: -------------------------------------------------------
Note: Start with GlobalInit for code resource

Set "_Chooser" to "NULL_PTR".


Create algorithm object "encodeAlg".

Baldwin         Informational, Expires 12/25/1999         263


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_CreateAlgorithmObject passing "encodeAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decodeAlg".
Call B_CreateAlgorithmObject passing "decodeAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "inputData" of decimal value "100" bytes.
Create buffer "encodedData" of decimal value "100" bytes.
Create buffer "decodedData" of decimal value "100" bytes.
Create buffer "expectedResult" of decimal value "100" bytes.
Create buffer "empty" of decimal value "2" bytes.


Note: Initialize, set up expected and input data

Set "_InfoPointer" to address of info structure for 
"AI_RFC1113Recode" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "encodeAlg" and 
"AI_RFC1113Recode" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RFC1113Recode" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "decodeAlg" and 
"AI_RFC1113Recode" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Buffer 1 byte in update, output 4 bytes in final

Set buffer "inputData" to hex value "00".

Call Call B_EncodeInit passing "encodeAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "empty" with string value "".
Call B_EncodeUpdate passing "encodeAlg" and address of next 
free byte in buffer "encodedData" and address of "_OutputLen" 
and length of free bytes in buffer "encodedData" and address of 
first initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Check equality of buffer "empty" with contents of buffer 
"encodedData".

Baldwin         Informational, Expires 12/25/1999         264


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Set buffer "expectedResult" with string value "AA==".
Call B_EncodeFinal passing "encodeAlg" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Finalize buffer "encodedData".
Check equality of buffer "expectedResult" with contents of 
buffer "encodedData".

Call Call B_DecodeInit passing "decodeAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecodeUpdate passing "decodeAlg" and address of next 
free byte in buffer "decodedData" and address of "_OutputLen" 
and length of free bytes in buffer "decodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Check equality of buffer "empty" with contents of buffer 
"decodedData".

Call B_DecodeFinal passing "decodeAlg" and address of next free 
byte in buffer "decodedData" and address of "_OutputLen" and 
length of free bytes in buffer "decodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Finalize buffer "decodedData".
Check equality of buffer "decodedData" with contents of buffer 
"inputData".

Note: Buffer 2 bytes in update, output 4 bytes in final

Set buffer "inputData" to hex value "0010".
Set length of buffer "encodedData" to decimal value "0".
Set length of buffer "decodedData" to decimal value "0".

Call B_EncodeUpdate passing "encodeAlg" and address of next 
free byte in buffer "encodedData" and address of "_OutputLen" 
and length of free bytes in buffer "encodedData" and address of 
first initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         265


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Check equality of buffer "empty" with contents of buffer 
"encodedData".

Set buffer "expectedResult" with string value "ABA=".
Call B_EncodeFinal passing "encodeAlg" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Finalize buffer "encodedData".
Check equality of buffer "expectedResult" with contents of 
buffer "encodedData".

Call B_DecodeUpdate passing "decodeAlg" and address of next 
free byte in buffer "decodedData" and address of "_OutputLen" 
and length of free bytes in buffer "decodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Check equality of buffer "empty" with contents of buffer 
"decodedData".

Call B_DecodeFinal passing "decodeAlg" and address of next free 
byte in buffer "decodedData" and address of "_OutputLen" and 
length of free bytes in buffer "decodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Finalize buffer "decodedData".
Check equality of buffer "decodedData" with contents of buffer 
"inputData".

Note: 3 bytes input in update, output 4 bytes, no thing in 
Note: final

Set buffer "inputData" to hex value "001083".
Set buffer "expectedResult" with string value "ABCD".
Set length of buffer "encodedData" to decimal value "0".
Set length of buffer "decodedData" to decimal value "0".

Call Call B_EncodeInit passing "encodeAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncodeUpdate passing "encodeAlg" and address of next 

Baldwin         Informational, Expires 12/25/1999         266


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

free byte in buffer "encodedData" and address of "_OutputLen" 
and length of free bytes in buffer "encodedData" and address of 
first initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Check equality of buffer "expectedResult" with contents of 
buffer "encodedData".

Call B_EncodeFinal passing "encodeAlg" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Finalize buffer "encodedData".
Check equality of buffer "expectedResult" with contents of 
buffer "encodedData".

Call Call B_DecodeInit passing "decodeAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecodeUpdate passing "decodeAlg" and address of next 
free byte in buffer "decodedData" and address of "_OutputLen" 
and length of free bytes in buffer "decodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Check equality of buffer "empty" with contents of buffer 
"decodedData".

Call B_DecodeFinal passing "decodeAlg" and address of next free 
byte in buffer "decodedData" and address of "_OutputLen" and 
length of free bytes in buffer "decodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Finalize buffer "decodedData".
Check equality of buffer "decodedData" with contents of buffer 
"inputData".

Note: input 4 bytes in update, output 4 bytes, and buffer 1 
Note: byte



Baldwin         Informational, Expires 12/25/1999         267


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set buffer "inputData" to hex value "00108310".
Set buffer "expectedResult" with string value "ABCD".
Set length of buffer "encodedData" to decimal value "0".
Set length of buffer "decodedData" to decimal value "0".

Call B_EncodeUpdate passing "encodeAlg" and address of next 
free byte in buffer "encodedData" and address of "_OutputLen" 
and length of free bytes in buffer "encodedData" and address of 
first initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Check equality of buffer "expectedResult" with contents of 
buffer "encodedData".

Call B_DecodeUpdate passing "decodeAlg" and address of next 
free byte in buffer "decodedData" and address of "_OutputLen" 
and length of free bytes in buffer "decodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Check equality of buffer "empty" with contents of buffer 
"decodedData".

Set length of buffer "encodedData" to decimal value "0".

Set buffer "expectedResult" with string value "EA==".
Call B_EncodeFinal passing "encodeAlg" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Finalize buffer "encodedData".
Check equality of buffer "expectedResult" with contents of 
buffer "encodedData".

Set buffer "expectedResult" to hex value "001083".
Call B_DecodeUpdate passing "decodeAlg" and address of next 
free byte in buffer "decodedData" and address of "_OutputLen" 
and length of free bytes in buffer "decodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         268


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of buffer "expectedResult" with contents of 
buffer "decodedData".

Call B_DecodeFinal passing "decodeAlg" and address of next free 
byte in buffer "decodedData" and address of "_OutputLen" and 
length of free bytes in buffer "decodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Finalize buffer "decodedData".
Check equality of buffer "inputData" with contents of buffer 
"decodedData".

Note: input 5 bytes in update, output 4 bytes, and buffer 2 
Note: byte


Set buffer "inputData" to hex value "0010831051".
Set buffer "expectedResult" with string value "ABCD".
Set length of buffer "encodedData" to decimal value "0".
Set length of buffer "decodedData" to decimal value "0".

Call B_EncodeUpdate passing "encodeAlg" and address of next 
free byte in buffer "encodedData" and address of "_OutputLen" 
and length of free bytes in buffer "encodedData" and address of 
first initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Check equality of buffer "expectedResult" with contents of 
buffer "encodedData".

Call B_DecodeUpdate passing "decodeAlg" and address of next 
free byte in buffer "decodedData" and address of "_OutputLen" 
and length of free bytes in buffer "decodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Check equality of buffer "empty" with contents of buffer 
"decodedData".

Set length of buffer "encodedData" to decimal value "0".

Set buffer "expectedResult" with string value "EFE=".
Call B_EncodeFinal passing "encodeAlg" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData"

Baldwin         Informational, Expires 12/25/1999         269


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Finalize buffer "encodedData".
Check equality of buffer "expectedResult" with contents of 
buffer "encodedData".

Set buffer "expectedResult" to hex value "001083".
Call B_DecodeUpdate passing "decodeAlg" and address of next 
free byte in buffer "decodedData" and address of "_OutputLen" 
and length of free bytes in buffer "decodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Check equality of buffer "expectedResult" with contents of 
buffer "decodedData".

Call B_DecodeFinal passing "decodeAlg" and address of next free 
byte in buffer "decodedData" and address of "_OutputLen" and 
length of free bytes in buffer "decodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Finalize buffer "decodedData".
Check equality of buffer "inputData" with contents of buffer 
"decodedData".

Note: input 6 bytes in 2 update, output 4 bytes for 1 and 
Note: second update, 0 output
Note: on final.

Set buffer "inputData" to hex value "001083".
Set buffer "expectedResult" with string value "ABCD".
Set length of buffer "encodedData" to decimal value "0".
Set length of buffer "decodedData" to decimal value "0".

Call B_EncodeUpdate passing "encodeAlg" and address of next 
free byte in buffer "encodedData" and address of "_OutputLen" 
and length of free bytes in buffer "encodedData" and address of 
first initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Check equality of buffer "expectedResult" with contents of 
buffer "encodedData".


Baldwin         Informational, Expires 12/25/1999         270


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_DecodeUpdate passing "decodeAlg" and address of next 
free byte in buffer "decodedData" and address of "_OutputLen" 
and length of free bytes in buffer "decodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Check equality of buffer "empty" with contents of buffer 
"decodedData".

Set length of buffer "encodedData" to decimal value "0".
Set buffer "inputData" to hex value "105187".
Set buffer "expectedResult" with string value "EFGH".
Call B_EncodeUpdate passing "encodeAlg" and address of next 
free byte in buffer "encodedData" and address of "_OutputLen" 
and length of free bytes in buffer "encodedData" and address of 
first initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Check equality of buffer "expectedResult" with contents of 
buffer "encodedData".

Call B_EncodeFinal passing "encodeAlg" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Finalize buffer "encodedData".
Check equality of buffer "expectedResult" with contents of 
buffer "encodedData".

Set buffer "expectedResult" to hex value "001083".
Call B_DecodeUpdate passing "decodeAlg" and address of next 
free byte in buffer "decodedData" and address of "_OutputLen" 
and length of free bytes in buffer "decodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Check equality of buffer "expectedResult" with contents of 
buffer "decodedData".

Set buffer "inputData" to hex value "001083105187".
Call B_DecodeFinal passing "decodeAlg" and address of next free 

Baldwin         Informational, Expires 12/25/1999         271


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

byte in buffer "decodedData" and address of "_OutputLen" and 
length of free bytes in buffer "decodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Finalize buffer "decodedData".
Check equality of buffer "inputData" with contents of buffer 
"decodedData".

Note: input 7 bytes in 6:1 update, output 8 bytes for 1, 0 for 
Note: second update,
Note: 4 on final.

Set buffer "inputData" to hex value "001083105187".
Set buffer "expectedResult" with string value "ABCDEFGH".
Set length of buffer "encodedData" to decimal value "0".
Set length of buffer "decodedData" to decimal value "0".

Call B_EncodeUpdate passing "encodeAlg" and address of next 
free byte in buffer "encodedData" and address of "_OutputLen" 
and length of free bytes in buffer "encodedData" and address of 
first initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Check equality of buffer "expectedResult" with contents of 
buffer "encodedData".

Set buffer "expectedResult" to hex value "001083".
Call B_DecodeUpdate passing "decodeAlg" and address of next 
free byte in buffer "decodedData" and address of "_OutputLen" 
and length of free bytes in buffer "decodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Check equality of buffer "expectedResult" with contents of 
buffer "decodedData".

Set length of buffer "encodedData" to decimal value "0".
Set buffer "inputData" to hex value "20".
Call B_EncodeUpdate passing "encodeAlg" and address of next 
free byte in buffer "encodedData" and address of "_OutputLen" 
and length of free bytes in buffer "encodedData" and address of 
first initialized byte in buffer "inputData" and length of 
initialized bytes in buffer "inputData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         272


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Check equality of buffer "empty" with contents of buffer 
"encodedData".

Set buffer "expectedResult" with string value "IA==".
Call B_EncodeFinal passing "encodeAlg" and address of next free 
byte in buffer "encodedData" and address of "_OutputLen" and 
length of free bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encodedData" by "_OutputLen".
Finalize buffer "encodedData".
Check equality of buffer "expectedResult" with contents of 
buffer "encodedData".

Set length of buffer "decodedData" to decimal value "0".
Set buffer "expectedResult" to hex value "105187".
Call B_DecodeUpdate passing "decodeAlg" and address of next 
free byte in buffer "decodedData" and address of "_OutputLen" 
and length of free bytes in buffer "decodedData" and address of 
first initialized byte in buffer "encodedData" and length of 
initialized bytes in buffer "encodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Check equality of buffer "expectedResult" with contents of 
buffer "decodedData".

Set length of buffer "decodedData" to decimal value "0".
Set buffer "expectedResult" to hex value "20".
Call B_DecodeFinal passing "decodeAlg" and address of next free 
byte in buffer "decodedData" and address of "_OutputLen" and 
length of free bytes in buffer "decodedData"
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decodedData" by "_OutputLen".
Finalize buffer "decodedData".
Check equality of buffer "expectedResult" with contents of 
buffer "decodedData".



This is the end of test case "TF111301".
This is the start of test case "TF931EVN".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".



Baldwin         Informational, Expires 12/25/1999         273


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: 1024 bit key vector test based on X9.31 example 4.5 for 
Note: AI_RSAStrongKeyGen, 
Note: KI_RSAPublic, KI_RSAPrivate
Note: AI_FormatX931, AI_SignVerify

Note: Depending on AI_DummyRandom algorithm


Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_DUMMY_RANDOM_MULT", "AM_FORMAT_X931", 
"AM_EXTRACT_X931", "AM_RSA_CRT_X931_ENCRYPT", 
"AM_RSA_X931_DECRYPT", "AM_RSA_STRONG_KEY_GEN", "NULL_PTR".


Note: Set up random object for param and key generation

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DummyRandomMult" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and 
"AI_DummyRandomMult" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "512" bytes.
Set buffer "seed" to hex value "1857FA8D9D0B0E4E033B68CE401A416A
5C0DAB5E4CEB97EB9EECDBB3CB4C375C0ECD2FD300DB4F08547293CA004CEDD2
019CE79CA08A15EEFB25DD3BAF981823961F4148FF03C6E96930B78C7A758D69
BC5070137900403807A4198C4AD4DBA81A560183DD19BA1A5A797EB98BEFF431
2D0C9EF7EEAA4A5347999FE76FB7876064BBEC66CB409A7739EF5A5906613DC3
7225D41D2BEB1F9F5EBF4CC95B6BF916A47C5EF2146BE00ECD4A1C5D88B3E85A
9569BE97".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate RSA Keypair

Create algorithm object "rsaKeyGen".
Call B_CreateAlgorithmObject passing "rsaKeyGen".

Baldwin         Informational, Expires 12/25/1999         274


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RSAStrongKeyGen" initialized from "1024", "2".
Call B_SetAlgorithmInfo passing "rsaKeyGen" and 
"AI_RSAStrongKeyGen" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "publicKey".
Call B_CreateKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "privateKey".
Call B_CreateKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_GenerateInit passing "rsaKeyGen" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_GenerateKeypair passing "rsaKeyGen" and "publicKey" 
and "privateKey" and "random" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Check the RSA public

Set "_ExpectedInfoPointer" to address of expected info 
structure for "KI_RSAPublic" initialized from 
"ccd34c2f4d95ffad1420e666c07e39d1450a13304c3f5891ede57595c772a36
91ab51d2bece1476b8f22ae223365f183bc3ee2d4cacdba3ad0c4d4781c523a1
0efe6203d6f3bc226bf9a459727b8f122c482d8c86019f9a869329187096430a
6c67cb103742bcbc66906ad23836ebabb511d5d80ab8cb59974e9aac62d785c4
5", "02".
Set "_InfoPointer" to address of info structure for 
"KI_RSAPublic".
Call B_GetKeyInfo passing "_InfoPointer" and "publicKey" and 
"KI_RSAPublic".
Check equality of info structure for "KI_RSAPublic" with 
expected info structure for "KI_RSAPublic".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: Check the RSA private


Baldwin         Informational, Expires 12/25/1999         275


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedInfoPointer" to address of expected info 
structure for "KI_RSAPrivate" initialized from 
"ccd34c2f4d95ffad1420e666c07e39d1450a13304c3f5891ede57595c772a36
91ab51d2bece1476b8f22ae223365f183bc3ee2d4cacdba3ad0c4d4781c523a1
0efe6203d6f3bc226bf9a459727b8f122c482d8c86019f9a869329187096430a
6c67cb103742bcbc66906ad23836ebabb511d5d80ab8cb59974e9aac62d785c4
5", "199a6985e9b2bff5a2841cccd80fc73a28a142660987eb123dbcaeb2b8e
e546d2356a3a57d9c28ed71e455c4466cbe307787dc5a9959b7475a189a8f038
a4741e4b10153be08c26e4401f7ab6e7e96092caf07c0870b13b64f669667302
9ec2c77aabc397fa528a245d7073ce69cc9bdcd7bef91599dca484000c0bd8ab
0814e".
Set "_InfoPointer" to address of info structure for 
"KI_RSAPrivate".
Call B_GetKeyInfo passing "_InfoPointer" and "privateKey" and 
"KI_RSAPrivate".
Check equality of info structure for "KI_RSAPrivate" with 
expected info structure for "KI_RSAPrivate".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Note: Now use the generated key in signing and verifying

Create buffer "signature" of decimal value "1024" bytes.
Create algorithm object "x931RSASigner".
Call B_CreateAlgorithmObject passing "x931RSASigner".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SignVerify" initialized from "rsaSignX931", "0", "sha1", 
"0", "formatX931", "128", "3".
Call B_SetAlgorithmInfo passing "x931RSASigner" and 
"AI_SignVerify" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Create algorithm object "x931RSAVerifier".
Call B_CreateAlgorithmObject passing "x931RSAVerifier".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SignVerify" initialized from "rsaVerifyX931", "0", "sha1", 
"0", "formatX931", "128", "3".
Call B_SetAlgorithmInfo passing "x931RSAVerifier" and 
"AI_SignVerify" and "_InfoPointer".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         276


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: Sign 3 bytes

Create algorithm object "dataSpring".
Call B_CreateAlgorithmObject passing "dataSpring".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "dataSpring" and "AI_MD5Random" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "dataSpring" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "dataSpring" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Begin a loop of decimal value "1000" iterations.
Set "_OutputLen" to decimal value "10".
Call B_GenerateRandomBytes passing "dataSpring" and address of 
next free byte in "seed" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "seed" by "_OutputLen".
Finalize "seed".
Display buffer "seed".
Call Call B_SignInit passing "x931RSASigner" and "privateKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignUpdate passing "x931RSASigner" and address of first 
initialized byte in buffer "seed" and length of initialized 
bytes in buffer "seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "x931RSASigner" and address of next 
free byte in buffer "signature" and address of "_OutputLen" and 
length of free bytes in buffer "signature" and "random" and 

Baldwin         Informational, Expires 12/25/1999         277


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "signature" by "_OutputLen".
Finalize buffer "signature".

Note: Verify the signature of the seed

Call Call B_VerifyInit passing "x931RSAVerifier" and 
"publicKey" and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyUpdate passing "x931RSAVerifier" and address of 
first initialized byte in buffer "seed" and length of 
initialized bytes in buffer "seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "x931RSAVerifier" and address of 
first initialized byte in buffer "signature" and length of 
initialized bytes in buffer "signature" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
End the loop and display execution times.


This is the end of test case "TF931EVN".
This is the start of test case "TF931RND".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional test for AI_SHARandom

Note: -------------------------------------------------------


Create buffer "input" of decimal value "256" bytes.
Set buffer "input" to hex value "99aabbcc".

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_X931Random" initialized from "6", "0a08080808080808080808080
8080808080808080808080809090909090909090909090909090909090909090

Baldwin         Informational, Expires 12/25/1999         278


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

90909090b08080808080808080808080808080808080808080808080a0909090
9090909090909090909090909090909090909090c08080808080808080808080
808080808080808080808080b090909090909090909090909090909090909090
9090909".
Call B_SetAlgorithmInfo passing "random" and "AI_X931Random" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create buffer "randBuffer" of decimal value "22" bytes.

Set "_OutputLen" to decimal value "22".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "randBuffer" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randBuffer" by "_OutputLen".
Finalize "randBuffer".
Display buffer "randBuffer".
Set "_OutputLen" to decimal value "22".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "randBuffer" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randBuffer" by "_OutputLen".
Finalize "randBuffer".
Display buffer "randBuffer".
Set "_OutputLen" to decimal value "22".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "randBuffer" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randBuffer" by "_OutputLen".
Finalize "randBuffer".
Display buffer "randBuffer".
Set "_OutputLen" to decimal value "22".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "randBuffer" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         279


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of "randBuffer" by "_OutputLen".
Finalize "randBuffer".
Display buffer "randBuffer".
Set "_OutputLen" to decimal value "22".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "randBuffer" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randBuffer" by "_OutputLen".
Finalize "randBuffer".
Display buffer "randBuffer".
Set "_OutputLen" to decimal value "22".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "randBuffer" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randBuffer" by "_OutputLen".
Finalize "randBuffer".
Display buffer "randBuffer".

Call Call B_DestroyAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Note: Test Null argument and update capability
Create buffer "seed" of decimal value "300" bytes.
Set buffer "seed" to hex value "08080808080808080808080808080808
0808080808080808090909090909090909090909090909090909090909090909
0808080808080808080808080808080808080808080808080909090909090909
0909090909090909090909090909090908080808080808080808080808080808
0808080808080808090909090909090909090909090909090909090909090909
".
Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_X931Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_X931Random" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 

Baldwin         Informational, Expires 12/25/1999         280


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create buffer "randBuffer" of decimal value "22" bytes.

Set "_OutputLen" to decimal value "22".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "randBuffer" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randBuffer" by "_OutputLen".
Finalize "randBuffer".
Display buffer "randBuffer".
Set "_OutputLen" to decimal value "22".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "randBuffer" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randBuffer" by "_OutputLen".
Finalize "randBuffer".
Display buffer "randBuffer".
Set "_OutputLen" to decimal value "22".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "randBuffer" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randBuffer" by "_OutputLen".
Finalize "randBuffer".
Display buffer "randBuffer".
Set "_OutputLen" to decimal value "22".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "randBuffer" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randBuffer" by "_OutputLen".
Finalize "randBuffer".
Display buffer "randBuffer".

Baldwin         Informational, Expires 12/25/1999         281


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_OutputLen" to decimal value "22".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "randBuffer" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randBuffer" by "_OutputLen".
Finalize "randBuffer".
Display buffer "randBuffer".
Set "_OutputLen" to decimal value "22".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "randBuffer" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randBuffer" by "_OutputLen".
Finalize "randBuffer".
Display buffer "randBuffer".

Call Call B_DestroyAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



This is the end of test case "TF931RND".
This is the start of test case "TFMD5RND".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional test for AI_RC5_CBCPadBER

Note: -------------------------------------------------------

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_MD5_RANDOM", "NULL_PTR".


Create buffer "input" of decimal value "256" bytes.
Set buffer "input" to hex value "99aabbcc".
Create buffer "ber" of decimal value "40" bytes.
Create buffer "keyData" of decimal value "256" bytes.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         282


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "input" and length of initialized bytes in 
"input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create buffer "keyLen" of decimal value "4" bytes.
Create buffer "initVector" of decimal value "8" bytes.

Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".
Display buffer "initVector".
Set "_OutputLen" to contents of buffer "keyLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".
Display buffer "keyData".
Set "_OutputLen" to decimal value "253".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Display buffer "input".



Baldwin         Informational, Expires 12/25/1999         283


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


This is the end of test case "TFMD5RND".
This is the start of test case "TFPNTRND".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional test for AI_HW_Random

Note: -------------------------------------------------------
Note: Define the session password
Create buffer "password" of decimal value "50" bytes.
Set buffer "password" with string value "Intel RNG at work!".


Note: Set the chooser
Set "_Chooser" to "AM_HW_RANDOM", "NULL_PTR".
Create buffer "newChooser" of decimal value "20" bytes.
Create buffer "tagList" of decimal value "50" bytes.


Create buffer "input" of decimal value "256" bytes.
Set buffer "input" to hex value "99aabbcc".

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_HW_Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_HW_Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create buffer "randBuffer" of decimal value "22" bytes.

Set "_OutputLen" to decimal value "22".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "randBuffer" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randBuffer" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         284


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Finalize "randBuffer".
Display buffer "randBuffer".
Set "_OutputLen" to decimal value "22".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "randBuffer" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randBuffer" by "_OutputLen".
Finalize "randBuffer".
Display buffer "randBuffer".
Set "_OutputLen" to decimal value "22".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "randBuffer" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randBuffer" by "_OutputLen".
Finalize "randBuffer".
Display buffer "randBuffer".
Set "_OutputLen" to decimal value "22".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "randBuffer" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randBuffer" by "_OutputLen".
Finalize "randBuffer".
Display buffer "randBuffer".
Set "_OutputLen" to decimal value "22".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "randBuffer" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randBuffer" by "_OutputLen".
Finalize "randBuffer".
Display buffer "randBuffer".
Set "_OutputLen" to decimal value "22".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "randBuffer" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "randBuffer" by "_OutputLen".
Finalize "randBuffer".
Display buffer "randBuffer".


Baldwin         Informational, Expires 12/25/1999         285


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_DestroyAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



This is the end of test case "TFPNTRND".
This is the start of test case "TLRSSTR1".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: This script is based on zzlrsa01 but replaces standard 
Note: key generation
Note: with strong key generation.
Note: It generates 1 RSA key pair of each modulus size of
Note: 512-1024 bits using f0 (3) as the public exponent.  To 
Note: attempt to
Note: confirm the accuracy of the key pair the following steps 
Note: are performed:
Note: - a public encryption/private decryption (with 
Note: comparison)
Note: - a private encryption/public decryption (with 
Note: comparison)
Note: Note: Due to the size of this script, DestroyAllObjects() 
Note: is used.

Set "_Chooser" to "AM_MD2_RANDOM", "AM_RSA_KEY_GEN", "NULL_PTR".

Set "_Chooser" to "AM_RSA_ENCRYPT", "AM_RSA_DECRYPT", 
"NULL_PTR".

Set "_Chooser" to "AM_RSA_CRT_ENCRYPT", "AM_RSA_CRT_DECRYPT", 
"NULL_PTR".

Create buffer "modSize" of decimal value "10" bytes.
Set buffer "modSize" to hex value "1F0".

Begin a loop of decimal value "40" iterations.
Increment buffer "modSize" by decimal value "16".

Note: Create necessary objects 

Create algorithm object "rsaKeyGen".
Call B_CreateAlgorithmObject passing "rsaKeyGen".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "rsaPrivateAlgorithm".
Call B_CreateAlgorithmObject passing "rsaPrivateAlgorithm".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         286


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "rsaPublicAlgorithm".
Call B_CreateAlgorithmObject passing "rsaPublicAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "randomObject".
Call B_CreateAlgorithmObject passing "randomObject".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "rsaPrivate".
Call B_CreateKeyObject passing "rsaPrivate".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "rsaPublic".
Call B_CreateKeyObject passing "rsaPublic".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "input" of decimal value "16" bytes.
Create buffer "intermediate" of decimal value "200" bytes.
Create buffer "output" of decimal value "16" bytes.

Note: Setup the objects

Set "_InfoPointer" to address of info structure for 
"AI_RSAStrongKeyGen" initialized from contents of buffer 
"modSize", "3".
Call B_SetAlgorithmInfo passing "rsaKeyGen" and 
"AI_RSAStrongKeyGen" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomObject" and 
"AI_MD2Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_PKCS_RSAPrivate" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "rsaPrivateAlgorithm" and 
"AI_PKCS_RSAPrivate" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_PKCS_RSAPublic" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "rsaPublicAlgorithm" and 

Baldwin         Informational, Expires 12/25/1999         287


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_PKCS_RSAPublic" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "input" to hex value "00112233445566778899aabbccddeef
f".

Note: Initialize whatever needs initialization

Call Call B_RandomInit passing "randomObject" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_GenerateInit passing "rsaKeyGen" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate the key pair.

Call Call B_GenerateKeypair passing "rsaKeyGen" and "rsaPublic" 
and "rsaPrivate" and "randomObject" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Test the key pair by performing an encryption & 
Note: decryption
Note: using each key. Start with public encryption/private 
Note: decryption.

Call Call B_EncryptInit passing "rsaPublicAlgorithm" and 
"rsaPublic" and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "rsaPublicAlgorithm" and address 
of next free byte in buffer "intermediate" and address of 
"_OutputLen" and length of free bytes in buffer "intermediate" 
and address of first initialized byte in buffer "input" and 
length of initialized bytes in buffer "input" and 
"randomObject" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "intermediate" by "_OutputLen".
Call B_EncryptFinal passing "rsaPublicAlgorithm" and address of 
next free byte in buffer "intermediate" and address of 
"_OutputLen" and length of free bytes in buffer "intermediate" 
and "randomObject" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         288


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "intermediate" by "_OutputLen".
Finalize buffer "intermediate".
Call Call B_DecryptInit passing "rsaPrivateAlgorithm" and 
"rsaPrivate" and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "rsaPrivateAlgorithm" and address 
of next free byte in buffer "output" and address of 
"_OutputLen" and length of free bytes in buffer "output" and 
address of first initialized byte in buffer "intermediate" and 
length of initialized bytes in buffer "intermediate" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_DecryptFinal passing "rsaPrivateAlgorithm" and address 
of next free byte in buffer "output" and address of 
"_OutputLen" and length of free bytes in buffer "output" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Compare the original input against the 
Note: encrypted/decrypted output.

Check equality of buffer "input" with contents of buffer 
"output".

Note: Now do a private encryption/public decryption.

Call Call B_EncryptInit passing "rsaPrivateAlgorithm" and 
"rsaPrivate" and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "rsaPrivateAlgorithm" and address 
of next free byte in buffer "intermediate" and address of 
"_OutputLen" and length of free bytes in buffer "intermediate" 
and address of first initialized byte in buffer "input" and 
length of initialized bytes in buffer "input" and 
"randomObject" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "intermediate" by "_OutputLen".
Call B_EncryptFinal passing "rsaPrivateAlgorithm" and address 

Baldwin         Informational, Expires 12/25/1999         289


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

of next free byte in buffer "intermediate" and address of 
"_OutputLen" and length of free bytes in buffer "intermediate" 
and "randomObject" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "intermediate" by "_OutputLen".
Finalize buffer "intermediate".
Call Call B_DecryptInit passing "rsaPublicAlgorithm" and 
"rsaPublic" and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "rsaPublicAlgorithm" and address 
of next free byte in buffer "output" and address of 
"_OutputLen" and length of free bytes in buffer "output" and 
address of first initialized byte in buffer "intermediate" and 
length of initialized bytes in buffer "intermediate" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_DecryptFinal passing "rsaPublicAlgorithm" and address of 
next free byte in buffer "output" and address of "_OutputLen" 
and length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Compare the original input against the 
Note: encrypted/decrypted output.

Check equality of buffer "input" with contents of buffer 
"output".

Note: Now destroy all this hard work.

Call Call B_DestroyAlgorithmObject passing "rsaKeyGen".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "rsaPrivateAlgorithm"
.
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "rsaPublicAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         290


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "randomObject".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyKeyObject passing "rsaPrivate".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyKeyObject passing "rsaPublic".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.







End the loop and display execution times.


This is the end of test case "TLRSSTR1".
This is the start of test case "TLDHKA01".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".



Note: Testing Diffie-Hellman Key Agreement for all prime 
Note: modulus sizes
Note: Functional test starting from minimal key size to 1025

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_MD2_RANDOM", "AM_DH_PARAM_GEN", 
"AM_DH_KEY_AGREE", "NULL_PTR".



Note: Allocate space for storage arrays

Create buffer "primeBits" of decimal value "4" bytes.
Create buffer "exponentBits" of decimal value "4" bytes.

Set buffer "primeBits" to hex value "0100".
Set buffer "exponentBits" to hex value "f8".
Create buffer "outputA" of decimal value "768" bytes.
Create buffer "outputB" of decimal value "768" bytes.
Create buffer "params" of decimal value "768" bytes.
Create buffer "input" of decimal value "768" bytes.

Baldwin         Informational, Expires 12/25/1999         291


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Build a randomAlgorithm object

Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD5Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "input" to hex value "0102030405060708fffefdfcfbfaf9f
8".
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "input" and length of initialized 
bytes in "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: For complete test use Loop (1793, 0, 0),
Note: IncrementData (primeBits, 1) and IncrementData 
Note: (exponentBits, 1) and

Begin a loop of decimal value "37" iterations.
Note: Setup Algorithm Objects

Create algorithm object "DHAlgorithmA".
Call B_CreateAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "DHAlgorithmB".
Call B_CreateAlgorithmObject passing "DHAlgorithmB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "generateAlg".
Call B_CreateAlgorithmObject passing "generateAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "generateAlgOutA".
Call B_CreateAlgorithmObject passing "generateAlgOutA".

Baldwin         Informational, Expires 12/25/1999         292


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "generateAlgOutB".
Call B_CreateAlgorithmObject passing "generateAlgOutB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate DH parameters and transfer to public key 
Note: generator objects.

Set "_InfoPointer" to address of info structure for 
"AI_DHParamGen" initialized from contents of buffer 
"primeBits", contents of buffer "exponentBits".
Call B_SetAlgorithmInfo passing "generateAlg" and 
"AI_DHParamGen" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_GenerateInit passing "generateAlg" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_GenerateParameters passing "generateAlg" and 
"DHAlgorithmA" and "randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Copy the parameter object

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"DHAlgorithmA" and "AI_DHKeyAgreeBER".
Load buffer "params" from info structure for "AI_DHKeyAgreeBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer "params".
Call B_SetAlgorithmInfo passing "DHAlgorithmB" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate public key for first party.

Call Call B_KeyAgreeInit passing "DHAlgorithmA" and "NULL_PTR" 

Baldwin         Informational, Expires 12/25/1999         293


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".
Note: Generate public key for second party.

Call Call B_KeyAgreeInit passing "DHAlgorithmB" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Note: Save the public key of first party for phase2 processing 
Note: of second party.

Set buffer "input" to contents of buffer "outputA".

Note: Each party now generates the shared secret key.

Call B_KeyAgreePhase2 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and address of 
first initialized byte in buffer "outputB" and length of 
initialized bytes in buffer "outputB" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".
Call B_KeyAgreePhase2 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         294


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Compare shared secret keys to test functional 
Note: correctness.

Check equality of buffer "outputA" with contents of buffer 
"outputB".

Note: Destroy algorithm objects.

Call Call B_DestroyAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "DHAlgorithmB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "generateAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "generateAlgOutA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "generateAlgOutB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Increment buffer "primeBits" by decimal value "7".
Increment buffer "exponentBits" by decimal value "7".

End the loop and display execution times.

Begin a loop of decimal value "30" iterations.
Note: Setup Algorithm Objects

Create algorithm object "DHAlgorithmA".
Call B_CreateAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "DHAlgorithmB".
Call B_CreateAlgorithmObject passing "DHAlgorithmB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "generateAlg".
Call B_CreateAlgorithmObject passing "generateAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         295


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create algorithm object "generateAlgOutA".
Call B_CreateAlgorithmObject passing "generateAlgOutA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "generateAlgOutB".
Call B_CreateAlgorithmObject passing "generateAlgOutB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate DH parameters and transfer to public key 
Note: generator objects.

Set "_InfoPointer" to address of info structure for 
"AI_DHParamGen" initialized from contents of buffer 
"primeBits", contents of buffer "exponentBits".
Call B_SetAlgorithmInfo passing "generateAlg" and 
"AI_DHParamGen" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_GenerateInit passing "generateAlg" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_GenerateParameters passing "generateAlg" and 
"DHAlgorithmA" and "randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Copy the parameter object

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"DHAlgorithmA" and "AI_DHKeyAgreeBER".
Load buffer "params" from info structure for "AI_DHKeyAgreeBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer "params".
Call B_SetAlgorithmInfo passing "DHAlgorithmB" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate public key for first party.

Baldwin         Informational, Expires 12/25/1999         296


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Call Call B_KeyAgreeInit passing "DHAlgorithmA" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".
Note: Generate public key for second party.

Call Call B_KeyAgreeInit passing "DHAlgorithmB" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Note: Save the public key of first party for phase2 processing 
Note: of second party.

Set buffer "input" to contents of buffer "outputA".

Note: Each party now generates the shared secret key.

Call B_KeyAgreePhase2 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and address of 
first initialized byte in buffer "outputB" and length of 
initialized bytes in buffer "outputB" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".
Call B_KeyAgreePhase2 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         297


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Note: Compare shared secret keys to test functional 
Note: correctness.

Check equality of buffer "outputA" with contents of buffer 
"outputB".

Note: Destroy algorithm objects.

Call Call B_DestroyAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "DHAlgorithmB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "generateAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "generateAlgOutA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "generateAlgOutB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Increment buffer "primeBits" by decimal value "17".
Increment buffer "exponentBits" by decimal value "17".

End the loop and display execution times.

Begin a loop of decimal value "16" iterations.
Note: Setup Algorithm Objects

Create algorithm object "DHAlgorithmA".
Call B_CreateAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "DHAlgorithmB".
Call B_CreateAlgorithmObject passing "DHAlgorithmB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "generateAlg".
Call B_CreateAlgorithmObject passing "generateAlg".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         298


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "generateAlgOutA".
Call B_CreateAlgorithmObject passing "generateAlgOutA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "generateAlgOutB".
Call B_CreateAlgorithmObject passing "generateAlgOutB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate DH parameters and transfer to public key 
Note: generator objects.

Set "_InfoPointer" to address of info structure for 
"AI_DHParamGen" initialized from contents of buffer 
"primeBits", contents of buffer "exponentBits".
Call B_SetAlgorithmInfo passing "generateAlg" and 
"AI_DHParamGen" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_GenerateInit passing "generateAlg" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_GenerateParameters passing "generateAlg" and 
"DHAlgorithmA" and "randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Copy the parameter object

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"DHAlgorithmA" and "AI_DHKeyAgreeBER".
Load buffer "params" from info structure for "AI_DHKeyAgreeBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer "params".
Call B_SetAlgorithmInfo passing "DHAlgorithmB" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         299


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Generate public key for first party.

Call Call B_KeyAgreeInit passing "DHAlgorithmA" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".
Note: Generate public key for second party.

Call Call B_KeyAgreeInit passing "DHAlgorithmB" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Note: Save the public key of first party for phase2 processing 
Note: of second party.

Set buffer "input" to contents of buffer "outputA".

Note: Each party now generates the shared secret key.

Call B_KeyAgreePhase2 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and address of 
first initialized byte in buffer "outputB" and length of 
initialized bytes in buffer "outputB" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".
Call B_KeyAgreePhase2 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         300


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Note: Compare shared secret keys to test functional 
Note: correctness.

Check equality of buffer "outputA" with contents of buffer 
"outputB".

Note: Destroy algorithm objects.

Call Call B_DestroyAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "DHAlgorithmB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "generateAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "generateAlgOutA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "generateAlgOutB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Increment buffer "primeBits" by decimal value "61".
Increment buffer "exponentBits" by decimal value "61".

End the loop and display execution times.

Note: One last run at length 2048
Note: Setup Algorithm Objects

Create algorithm object "DHAlgorithmA".
Call B_CreateAlgorithmObject passing "DHAlgorithmA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "DHAlgorithmB".
Call B_CreateAlgorithmObject passing "DHAlgorithmB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "generateAlg".

Baldwin         Informational, Expires 12/25/1999         301


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_CreateAlgorithmObject passing "generateAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "generateAlgOutA".
Call B_CreateAlgorithmObject passing "generateAlgOutA".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "generateAlgOutB".
Call B_CreateAlgorithmObject passing "generateAlgOutB".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Generate DH parameters and transfer to public key 
Note: generator objects.

Set "_InfoPointer" to address of info structure for 
"AI_DHParamGen" initialized from "2048", "2040".
Call B_SetAlgorithmInfo passing "generateAlg" and 
"AI_DHParamGen" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_GenerateInit passing "generateAlg" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_GenerateParameters passing "generateAlg" and 
"DHAlgorithmA" and "randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Copy the parameter object

Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"DHAlgorithmA" and "AI_DHKeyAgreeBER".
Load buffer "params" from info structure for "AI_DHKeyAgreeBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DHKeyAgreeBER" initialized from contents of buffer "params".
Call B_SetAlgorithmInfo passing "DHAlgorithmB" and 
"AI_DHKeyAgreeBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         302


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.

Note: Generate public key for first party.

Call Call B_KeyAgreeInit passing "DHAlgorithmA" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".
Note: Generate public key for second party.

Call Call B_KeyAgreeInit passing "DHAlgorithmB" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_KeyAgreePhase1 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and 
"randomAlgorithm" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Note: Save the public key of first party for phase2 processing 
Note: of second party.

Set buffer "input" to contents of buffer "outputA".

Note: Each party now generates the shared secret key.

Call B_KeyAgreePhase2 passing "DHAlgorithmA" and address of 
next free byte in buffer "outputA" and address of "_OutputLen" 
and length of free bytes in buffer "outputA" and address of 
first initialized byte in buffer "outputB" and length of 
initialized bytes in buffer "outputB" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputA" by "_OutputLen".
Call B_KeyAgreePhase2 passing "DHAlgorithmB" and address of 
next free byte in buffer "outputB" and address of "_OutputLen" 
and length of free bytes in buffer "outputB" and address of 
first initialized byte in buffer "input" and length of 

Baldwin         Informational, Expires 12/25/1999         303


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized bytes in buffer "input" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "outputB" by "_OutputLen".

Note: Compare shared secret keys to test functional 
Note: correctness.

Check equality of buffer "outputA" with contents of buffer 
"outputB".



This is the end of test case "TLDHKA01".
This is the start of test case "TLOAEP01".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional tests, RSA key generation, raw RSA operations, 
Note: PKCS
Note: RSA signatures and PKCS encryption and decryption.

Note: ----------------------------------------------------------
Note: ----------

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_MD5_RANDOM", "AM_RSA_KEY_GEN", 
"AM_RSA_ENCRYPT", "AM_RSA_DECRYPT", "AM_RSA_CRT_ENCRYPT", 
"AM_RSA_CRT_DECRYPT", "AM_MD2", "NULL_PTR".



Note: Use the following random algorithm throughout.

Create buffer "seed" of decimal value "1" bytes.
Set buffer "seed" to hex value "00".
Create algorithm object "randomObj".
Call B_CreateAlgorithmObject passing "randomObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomObj" and "AI_MD5Random" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "randomObj" and "_Chooser" and 

Baldwin         Informational, Expires 12/25/1999         304


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomObj" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Set the following data object big enough to hold the 
Note: largest
Note: possible input, which would be input for a 2048-bit key.

Create buffer "inputZero" of decimal value "256" bytes.
Set buffer "inputZero" to hex value "000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000".

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Generate an RSA key, then do some encryption and 
Note: decryption.

Create buffer "modSize" of decimal value "2" bytes.
Create buffer "inputSize" of decimal value "2" bytes.
Create buffer "input" of decimal value "256" bytes.
Create buffer "output" of decimal value "256" bytes.
Create buffer "unput" of decimal value "256" bytes.

Note: Initialize modulus size to 464 bits.  Data is 16 bytes = 
Note: 128 bits
Note: OAEP needs at least 336 bits of modulus in excess of the 
Note: data size.
Note: 128 + 336 = 464 or 0x1d0.

Note: Each outer loop will increment the data size by 1 byte (8 
Note: bits).

Set buffer "inputSize" to hex value "0f".

Note: Each inner loop will increment the modulus size by 1.


Baldwin         Informational, Expires 12/25/1999         305


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set buffer "modSize" to hex value "01ef".

Note: The outer loop's limit is 2048-464 / 8.

Begin a loop of decimal value "194" iterations.
Increment buffer "inputSize" by decimal value "1".

Note: The inner loop count must be 8.

Begin a loop of decimal value "8" iterations.
Increment buffer "modSize" by decimal value "1".
Create key object "publicKey".
Call B_CreateKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "privateKey".
Call B_CreateKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "keyGen".
Call B_CreateAlgorithmObject passing "keyGen".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RSAKeyGen" initialized from contents of buffer "modSize", 
"010001".
Call B_SetAlgorithmInfo passing "keyGen" and "AI_RSAKeyGen" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_GenerateInit passing "keyGen" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: Generate the keypair.

Baldwin         Informational, Expires 12/25/1999         306


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Call Call B_GenerateKeypair passing "keyGen" and "publicKey" 
and "privateKey" and "randomObj" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Get the modulus, then subtract by 1. Encrypt and decrypt 
Note: this value
Note: using raw RSA, the result should be modulus - 1.

Set "_InfoPointer" to address of info structure for 
"KI_RSAPublic".
Call B_GetKeyInfo passing "_InfoPointer" and "publicKey" and 
"KI_RSAPublic".
Load buffer "input" from info structure for "KI_RSAPublic".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Decrement buffer "input" by decimal value "1".

Note: Generate some random bytes

Set "_OutputLen" to decimal value "10".
Call B_GenerateRandomBytes passing "randomObj" and address of 
next free byte in "input" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".

Note: PKCS OAEP RSA
Note: Encrypt that data with the public key.

Set "_InfoPointer" to address of info structure for 
"AI_PKCS_OAEP_RSAPublic" initialized from "sha1", "mgf1", 
"sha1", "specifiedParameters", "012345".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_PKCS_OAEP_RSAPublic" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "publicKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 

Baldwin         Informational, Expires 12/25/1999         307


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

bytes in buffer "input" and "randomObj" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "randomObj" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: PKCS OAEP RSA
Note: Decrypt the output with the private key.

Set "_InfoPointer" to address of info structure for 
"AI_PKCS_OAEP_RSAPrivate" initialized from "sha1", "mgf1", 
"sha1", "specifiedParameters", "012345".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_PKCS_OAEP_RSAPrivate" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "privateKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".
Check equality of buffer "unput" with contents of buffer 
"input".

Note: Destroy the objects for next loop.

Baldwin         Informational, Expires 12/25/1999         308


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "keyGen".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
End the loop and display execution times.
End the loop and display execution times.

Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TLOAEP01".
This is the start of test case "TLRSEVN1".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Long functional test for even exponents
Note: AI_RSAStrongKeyGen, 
Note: KI_RSAPublic, KI_RSAPrivate
Note: AI_FormatX931, AI_SignVerify

Note: Depending on AI_DummyRandom algorithm


Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_DUMMY_RANDOM", "AM_FORMAT_X931", 
"AM_EXTRACT_X931", "AM_RSA_CRT_X931_ENCRYPT", 
"AM_RSA_X931_DECRYPT", "AM_RSA_STRONG_KEY_GEN", "NULL_PTR".


Note: Create various objects

Baldwin         Informational, Expires 12/25/1999         309


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Create buffer "signature" of decimal value "1024" bytes.
Create buffer "modSize" of decimal value "10" bytes.
Set buffer "modSize" to hex value "200".
Create buffer "modByteSize" of decimal value "10" bytes.
Set buffer "modByteSize" to hex value "40".
Note: Set up random object for key generation

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "512" bytes.
Set buffer "seed" to hex value "1857FA8D9D0B0E4E033B68CE401A416A
5C0DAB5E4CEB97EB9EEC".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Set up random object for data signing
Create algorithm object "dataSpring".
Call B_CreateAlgorithmObject passing "dataSpring".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "dataSpring" and "AI_MD5Random" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "dataSpring" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         310


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_RandomUpdate passing "dataSpring" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: Execute a loop that generates RSA key pairs and signs and 
Note: verifies data
Begin a loop of decimal value "40" iterations.
Create algorithm object "rsaKeyGen".
Call B_CreateAlgorithmObject passing "rsaKeyGen".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RSAStrongKeyGen" initialized from contents of buffer 
"modSize", "2".
Call B_SetAlgorithmInfo passing "rsaKeyGen" and 
"AI_RSAStrongKeyGen" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "publicKey".
Call B_CreateKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "privateKey".
Call B_CreateKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_GenerateInit passing "rsaKeyGen" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_GenerateKeypair passing "rsaKeyGen" and "publicKey" 
and "privateKey" and "random" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Now use the generated key in signing and verifying

Create algorithm object "x931RSASigner".
Call B_CreateAlgorithmObject passing "x931RSASigner".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 

Baldwin         Informational, Expires 12/25/1999         311


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_SignVerify" initialized from "rsaSignX931", "0", "sha1", 
"0", "formatX931", contents of buffer "modByteSize", "3".
Call B_SetAlgorithmInfo passing "x931RSASigner" and 
"AI_SignVerify" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Create algorithm object "x931RSAVerifier".
Call B_CreateAlgorithmObject passing "x931RSAVerifier".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_SignVerify" initialized from "rsaVerifyX931", "0", "sha1", 
"0", "formatX931", contents of buffer "modByteSize", "3".
Call B_SetAlgorithmInfo passing "x931RSAVerifier" and 
"AI_SignVerify" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Set "_OutputLen" to decimal value "10".
Call B_GenerateRandomBytes passing "dataSpring" and address of 
next free byte in "seed" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "seed" by "_OutputLen".
Finalize "seed".
Display buffer "seed".
Call Call B_SignInit passing "x931RSASigner" and "privateKey" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignUpdate passing "x931RSASigner" and address of first 
initialized byte in buffer "seed" and length of initialized 
bytes in buffer "seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_SignFinal passing "x931RSASigner" and address of next 
free byte in buffer "signature" and address of "_OutputLen" and 
length of free bytes in buffer "signature" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         312


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Increment length of buffer "signature" by "_OutputLen".
Finalize buffer "signature".

Note: Verify the signature of the seed

Call Call B_VerifyInit passing "x931RSAVerifier" and 
"publicKey" and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyUpdate passing "x931RSAVerifier" and address of 
first initialized byte in buffer "seed" and length of 
initialized bytes in buffer "seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_VerifyFinal passing "x931RSAVerifier" and address of 
first initialized byte in buffer "signature" and length of 
initialized bytes in buffer "signature" and "random" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment buffer "modSize" by decimal value "16".
Increment buffer "modByteSize" by decimal value "2".
Call Call B_DestroyAlgorithmObject passing "x931RSAVerifier".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "x931RSASigner".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyKeyObject passing "publicKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyKeyObject passing "privateKey".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "rsaKeyGen".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
End the loop and display execution times.


This is the end of test case "TLRSEVN1".
This is the start of test case "TLBSSH01".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".

Baldwin         Informational, Expires 12/25/1999         313


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999



Note: AI_BSSecretSharing

Note: Test Bloom/Shamir secret sharing.
Note: Functionally test Bloom/Shamir secret-sharing by 
Note: consecutively testing
Note: the thresholding for 2, 3, ... 255. For each threshold k 
Note: we divide the
Note: secret into k shares while simultaneously collecting each 
Note: of the shares
Note: for secret recovery. After the k-th shares has been 
Note: produced and added
Note: to the previous k-1 shares, the secret is then recovered 
Note: and then compared
Note: to the original key for correctness.

Note: This test is executed on two passwords by an outer loop.
Note: ---------------------------------
Note: Note: This is hardly a satisfactory test, but it's the 
Note: best one can do
Note: with the current constructs in the btest interpreter.

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_MD2_RANDOM", "NULL_PTR".


Create buffer "password" of decimal value "100" bytes.
Create buffer "dummy" of decimal value "10" bytes.
Create buffer "result" of decimal value "100" bytes.
Create buffer "threshHold" of decimal value "10" bytes.

Set buffer "password" with string value "password".

Note: Make random algorithm
Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD2Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD2Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         314


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Loop over two distint passwords
Begin a loop of decimal value "2" iterations.

Set buffer "threshHold" to hex value "01".

Note: Looping over threshold values
Begin a loop of decimal value "254" iterations.
Increment buffer "threshHold" by decimal value "1".
Note: Create "threshold" number of random bytes to be used in 
Note: creation
Note: of random polynomial of degree "threshold - 1"
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "threshHold" and length of initialized 
bytes in "threshHold" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Create share splitting object and initialize
Create algorithm object "bssEncryptAlg".
Call B_CreateAlgorithmObject passing "bssEncryptAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_BSSecretSharing" initialized from contents of buffer 
"threshHold".
Call B_SetAlgorithmInfo passing "bssEncryptAlg" and 
"AI_BSSecretSharing" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "bssEncryptAlg" and "NULL_PTR" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Create share recovery object and initialize
Create algorithm object "bssDecryptAlg".
Call B_CreateAlgorithmObject passing "bssDecryptAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_BSSecretSharing" initialized from contents of buffer 
"threshHold".
Call B_SetAlgorithmInfo passing "bssDecryptAlg" and 
"AI_BSSecretSharing" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "bssDecryptAlg" and "NULL_PTR" 

Baldwin         Informational, Expires 12/25/1999         315


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Create "threshold" secret shares, simultaneous collecting 
Note: info for secret
Note: recovery.
Begin a loop of contents of buffer "threshHold" iterations.
Create buffer "part" of decimal value "500" bytes.
Call B_EncryptUpdate passing "bssEncryptAlg" and address of 
next free byte in buffer "part" and address of "_OutputLen" and 
length of free bytes in buffer "part" and address of first 
initialized byte in buffer "password" and length of initialized 
bytes in buffer "password" and "random" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "part" by "_OutputLen".
Call B_DecryptUpdate passing "bssDecryptAlg" and address of 
next free byte in buffer "result" and address of "_OutputLen" 
and length of free bytes in buffer "result" and address of 
first initialized byte in buffer "part" and length of 
initialized bytes in buffer "part" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "result" by "_OutputLen".


End the loop and display execution times.

Call B_EncryptFinal passing "bssEncryptAlg" and address of next 
free byte in buffer "dummy" and address of "_OutputLen" and 
length of free bytes in buffer "dummy" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "dummy" by "_OutputLen".
Finalize buffer "dummy".
Call B_DecryptFinal passing "bssDecryptAlg" and address of next 
free byte in buffer "result" and address of "_OutputLen" and 
length of free bytes in buffer "result" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "result" by "_OutputLen".
Finalize buffer "result".
Note: Test to make sure that secret was properly recovered
Check equality of buffer "password" with contents of buffer 

Baldwin         Informational, Expires 12/25/1999         316


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"result".

Call Call B_DestroyAlgorithmObject passing "bssEncryptAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "bssDecryptAlg".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: End loop over threshold values
End the loop and display execution times.

Set buffer "password" to hex value "aabbccddeeff0011223344556677
8899abbacddceffe01102332455467768998ffffffffffffffff000000000000
01".

End the loop and display execution times.



This is the end of test case "TLBSSH01".
This is the start of test case "TVR5WECB".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional test for Cipher Block Feedback using RC5/64 
Note: and ECB feedback methods.

Note: ----------------------------------------------------------
Note: ----------

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_MD5_RANDOM", "AM_RC5_64ENCRYPT", 
"AM_RC5_64DECRYPT", "AM_ECB_ENCRYPT", "AM_ECB_DECRYPT", 
"NULL_PTR".


Note: RC5 / 64 (128 bit block) Vector Tests

Note: This script contains 4 vector tests.


Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1



Baldwin         Informational, Expires 12/25/1999         317


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create buffer "input" of decimal value "16" bytes.
Create buffer "output" of decimal value "32" bytes.
Create buffer "unput" of decimal value "16" bytes.

Create buffer "keyData" of decimal value "20" bytes.
Set buffer "keyData" to hex value "00000000000000000000000000000
000".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create buffer "ciphertext1" of decimal value "16" bytes.
Set buffer "ciphertext1" to hex value "039c8d97d421151de99813bc9
08b09df".
Create buffer "plaintext1" of decimal value "16" bytes.
Set buffer "plaintext1" to hex value "00000000000000000000000000
000000".

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", "12", "64", 
"ecb", "16", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext1" and length of 
initialized bytes in buffer "plaintext1" and "NULL_PTR" and 
"_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         318


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext1".

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", "12", "64", 
"ecb", "16", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         319


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "plaintext1" with contents of buffer 
"unput".


Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.







Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-2


Create buffer "keyData" of decimal value "20" bytes.
Set buffer "keyData" to hex value "000102030405060708090a0b0c0d0
e0f".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         320


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.

Create buffer "plaintext2" of decimal value "16" bytes.
Set buffer "plaintext2" to hex value "00000000000000000000000000
000000".
Create buffer "ciphertext2" of decimal value "16" bytes.
Set buffer "ciphertext2" to hex value "ed3bce26f32adf4141f88b190
5d31b50".


Note: Encrypt.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", "12", "64", 
"ecb", "16", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext2" and length of 
initialized bytes in buffer "plaintext2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext2".



Baldwin         Informational, Expires 12/25/1999         321


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", "12", "64", 
"ecb", "16", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "plaintext2" with contents of buffer 
"unput".


Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Baldwin         Informational, Expires 12/25/1999         322


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999






Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-3


Create buffer "keyData" of decimal value "20" bytes.
Set buffer "keyData" to hex value "00000000000000000000000000000
000".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create buffer "plaintext3" of decimal value "16" bytes.
Set buffer "plaintext3" to hex value "000102030405060708090a0b0c
0d0e0f".
Create buffer "ciphertext3" of decimal value "16" bytes.
Set buffer "ciphertext3" to hex value "dbccd45c6de1caf3183c2dfd0
4a82fa9".


Note: Encrypt.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         323


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", "12", "64", 
"ecb", "16", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext3" and length of 
initialized bytes in buffer "plaintext3" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext3".


Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", "12", "64", 
"ecb", "16", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         324


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "plaintext3" with contents of buffer 
"unput".


Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.







Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------

Baldwin         Informational, Expires 12/25/1999         325


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Test 01-4


Create buffer "keyData" of decimal value "20" bytes.
Set buffer "keyData" to hex value "000102030405060708090a0b0c0d0
e0f".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create buffer "plaintext4" of decimal value "16" bytes.
Set buffer "plaintext4" to hex value "000102030405060708090a0b0c
0d0e0f".
Create buffer "ciphertext4" of decimal value "16" bytes.
Set buffer "ciphertext4" to hex value "75da0d750094184e218622c0b
fc16df0".


Note: Encrypt.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", "12", "64", 
"ecb", "16", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext4" and length of 

Baldwin         Informational, Expires 12/25/1999         326


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized bytes in buffer "plaintext4" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext4".


Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", "12", "64", 
"ecb", "16", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         327


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "plaintext4" with contents of buffer 
"unput".


Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.







Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-5


Create buffer "keyData" of decimal value "20" bytes.
Set buffer "keyData" to hex value "00000000000000000000000000000
000".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".

Baldwin         Informational, Expires 12/25/1999         328


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create buffer "plaintext4" of decimal value "16" bytes.
Set buffer "plaintext4" to hex value "92f836ddb75bd33a247f93805a
b485cd".
Create buffer "ciphertext4" of decimal value "16" bytes.
Set buffer "ciphertext4" to hex value "c24adf7f7a46747020c35c65e
a29e7e0".


Note: Encrypt.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", "12", "64", 
"ecb", "16", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext4" and length of 
initialized bytes in buffer "plaintext4" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext4".

Baldwin         Informational, Expires 12/25/1999         329


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999



Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", "12", "64", 
"ecb", "16", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "plaintext4" with contents of buffer 
"unput".


Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         330


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999








Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-6


Create buffer "keyData" of decimal value "20" bytes.
Set buffer "keyData" to hex value "ce9e07193fd8d69c9bab24b1686d7
565".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create buffer "plaintext4" of decimal value "16" bytes.
Set buffer "plaintext4" to hex value "37983eee84dec31157aec92eae
3b3388".
Create buffer "ciphertext4" of decimal value "16" bytes.
Set buffer "ciphertext4" to hex value "0130ce147e8e611698e0610d1
b6a5bc3".


Note: Encrypt.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         331


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", "12", "64", 
"ecb", "16", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext4" and length of 
initialized bytes in buffer "plaintext4" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext4".


Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", "12", "64", 
"ecb", "16", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         332


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "plaintext4" with contents of buffer 
"unput".


Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.







Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Baldwin         Informational, Expires 12/25/1999         333


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-7


Create buffer "keyData" of decimal value "20" bytes.
Set buffer "keyData" to hex value "37983eee84dec31157aec92eae3b3
388".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create buffer "plaintext4" of decimal value "16" bytes.
Set buffer "plaintext4" to hex value "ed3bce26f32adf4141f88b1905
d31b50".
Create buffer "ciphertext4" of decimal value "16" bytes.
Set buffer "ciphertext4" to hex value "ce9e07193fd8d69c9bab24b16
86d7565".


Note: Encrypt.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", "12", "64", 
"ecb", "16", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 

Baldwin         Informational, Expires 12/25/1999         334


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext4" and length of 
initialized bytes in buffer "plaintext4" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext4".


Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", "12", "64", 
"ecb", "16", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 

Baldwin         Informational, Expires 12/25/1999         335


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "plaintext4" with contents of buffer 
"unput".


Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.







Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-8


Create buffer "keyData" of decimal value "20" bytes.
Set buffer "keyData" to hex value "ed3bce26f32adf4141f88b1905d31
b50".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 

Baldwin         Informational, Expires 12/25/1999         336


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create buffer "plaintext4" of decimal value "16" bytes.
Set buffer "plaintext4" to hex value "000102030405060708090a0b0c
0d0e0f".
Create buffer "ciphertext4" of decimal value "16" bytes.
Set buffer "ciphertext4" to hex value "37983eee84dec31157aec92ea
e3b3388".


Note: Encrypt.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", "12", "64", 
"ecb", "16", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext4" and length of 
initialized bytes in buffer "plaintext4" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         337


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Finalize buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext4".


Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", "12", "64", 
"ecb", "16", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "plaintext4" with contents of buffer 
"unput".


Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".

Baldwin         Informational, Expires 12/25/1999         338


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.







Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.




Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TVR5WECB".
This is the start of test case "TFR5OFN1".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional test for Cipher Block Feedback using RC5 and 
Note: OFB feedback methods
Note: without padding.

Note: ----------------------------------------------------------
Note: ----------

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_RC5_ENCRYPT", "AM_RC5_DECRYPT", 
"AM_OFB_ENCRYPT", "AM_OFB_DECRYPT", "NULL_PTR".



Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Use the given input data, encrypt it, decrypt that output 
Note: and
Note: compare the decryption result with the original input. 

Baldwin         Informational, Expires 12/25/1999         339


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Create buffer "input" of decimal value "8" bytes.
Create buffer "output" of decimal value "16" bytes.
Create buffer "unput" of decimal value "8" bytes.

Create buffer "keyData" of decimal value "20" bytes.
Set buffer "keyData" to hex value "00000000000000000000000000000
000".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create buffer "plaintext" of decimal value "20" bytes.
Set buffer "plaintext" to hex value "0000000000000000".


Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5", "1", "12", "32", 
"ofb", "0000000000000000", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         340


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5", "1", "12", "32", 
"ofb", "0000000000000000", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.


Baldwin         Informational, Expires 12/25/1999         341


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TFR5OFN1".
This is the start of test case "TFR5WOFN".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional test for Cipher Block Feedback using RC5/64 
Note: and OFB feedback methods
Note: without padding.

Note: ----------------------------------------------------------
Note: ----------

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_RC5_64ENCRYPT", "AM_RC5_64DECRYPT", 
"AM_OFB_ENCRYPT", "AM_OFB_DECRYPT", "NULL_PTR".



Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Use the given input data, encrypt it, decrypt that output 
Note: and

Baldwin         Informational, Expires 12/25/1999         342


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: compare the decryption result with the original input. 

Create buffer "input" of decimal value "16" bytes.
Create buffer "output" of decimal value "32" bytes.
Create buffer "unput" of decimal value "16" bytes.

Create buffer "keyData" of decimal value "16" bytes.
Set buffer "keyData" to hex value "00000000000000000000000000000
000".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create buffer "plaintext" of decimal value "16" bytes.
Set buffer "plaintext" to hex value "000000000000000000000000000
00000".


Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", "12", "64", 
"ofb", "00000000000000000000000000000000", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         343


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", "12", "64", 
"ofb", "00000000000000000000000000000000", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".


Baldwin         Informational, Expires 12/25/1999         344


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Check the result.

Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TFR5WOFN".
This is the start of test case "TL3CFPPW".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional tests of AI_FeedbackCipher based on triple DES 
Note: and 64 bit 
Note: pipelined cfb with padding using reused encryption and 
Note: decryption objects.


Note: ----------------------------------------------------------
Note: ----------


Note: Use the following random object throughout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".

Baldwin         Informational, Expires 12/25/1999         345


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Generate random input data, encrypt it, decrypt that 
Note: output and
Note: compare the decryption result with the original input. Do 
Note: this with
Note: various round counts and word sizes.

Create buffer "input" of decimal value "46" bytes.
Create buffer "output" of decimal value "46" bytes.
Create buffer "unput" of decimal value "46" bytes.
Create buffer "initVector" of decimal value "8" bytes.
Create buffer "keyData" of decimal value "256" bytes.
Create buffer "dataLength" of decimal value "4" bytes.

Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Set "_OutputLen" to decimal value "24".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         346


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".

Note: Create encryption/decryption objects and set algorithm 
Note: info

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "1", 
"cfb_pipelined", contents of buffer "initVector", "64", "pad", 
"NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "1", 
"cfb_pipelined", contents of buffer "initVector", "64", "pad", 
"NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "dataLength" to hex value "7".
Begin a loop of decimal value "25" iterations.

Note: Encrypt.


Baldwin         Informational, Expires 12/25/1999         347


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999



Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to contents of buffer "dataLength".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.



Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 

Baldwin         Informational, Expires 12/25/1999         348


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".
Check equality of buffer "input" with contents of buffer 
"unput".
Increment buffer "dataLength" by decimal value "1".
End the loop and display execution times.

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Use a larger key.

Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TL3CFPPW".
This is the start of test case "TL3CFPS1".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional tests of AI_FeedbackCipher based on triple DES 
Note: and 1 bit 
Note: pipelined cfb with reused encryption and decryption 
Note: objects.


Note: ----------------------------------------------------------
Note: ----------



Baldwin         Informational, Expires 12/25/1999         349


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Use the following random object throughout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Generate random input data, encrypt it, decrypt that 
Note: output and
Note: compare the decryption result with the original input. Do 
Note: this with
Note: various round counts and word sizes.

Create buffer "input" of decimal value "16" bytes.
Create buffer "output" of decimal value "16" bytes.
Create buffer "unput" of decimal value "16" bytes.
Create buffer "initVector" of decimal value "8" bytes.
Create buffer "keyData" of decimal value "256" bytes.

Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Set "_OutputLen" to decimal value "24".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         350


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".

Note: Create encryption/decryption objects and set algorithm 
Note: info

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "1", 
"cfb_pipelined", contents of buffer "initVector", "1", 
"stream", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "1", 
"cfb_pipelined", contents of buffer "initVector", "1", 
"stream", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".

Baldwin         Informational, Expires 12/25/1999         351


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Begin a loop of decimal value "25" iterations.

Note: Encrypt.



Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "15".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.



Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 

Baldwin         Informational, Expires 12/25/1999         352


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".
Check equality of buffer "input" with contents of buffer 
"unput".
End the loop and display execution times.

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Use a larger key.

Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TL3CFPS1".
This is the start of test case "TL3DCFPW".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional tests of AI_FeedbackCipher based on triple DES 
Note: and 64 bit cfb 
Note: with padding using reused encryption and decryption 
Note: objects.

Baldwin         Informational, Expires 12/25/1999         353


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999



Note: ----------------------------------------------------------
Note: ----------


Note: Use the following random object throughout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Generate random input data, encrypt it, decrypt that 
Note: output and
Note: compare the decryption result with the original input. Do 
Note: this with
Note: various round counts and word sizes.

Create buffer "input" of decimal value "46" bytes.
Create buffer "output" of decimal value "46" bytes.
Create buffer "unput" of decimal value "46" bytes.
Create buffer "initVector" of decimal value "8" bytes.
Create buffer "keyData" of decimal value "256" bytes.
Create buffer "dataLength" of decimal value "4" bytes.

Note: Generate random input bytes, a random init vector, and a 

Baldwin         Informational, Expires 12/25/1999         354


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: random key.

Set "_OutputLen" to decimal value "24".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".

Note: Create encryption/decryption objects and set algorithm 
Note: info

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "1", "cfb", 
contents of buffer "initVector", "64", "pad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         355


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "1", "cfb", 
contents of buffer "initVector", "64", "pad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "dataLength" to hex value "7".
Begin a loop of decimal value "25" iterations.

Note: Encrypt.



Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to contents of buffer "dataLength".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.



Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         356


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".
Check equality of buffer "input" with contents of buffer 
"unput".
Increment buffer "dataLength" by decimal value "1".
End the loop and display execution times.

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Use a larger key.

Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TL3DCFPW".
This is the start of test case "TL3DCFS1".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".

Baldwin         Informational, Expires 12/25/1999         357


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_SurrenderContext" to "NULL_PTR".


Note: Functional tests of AI_FeedbackCipher based on triple DES 
Note: and 1 bit cfb with 
Note: reused encryption and decryption objects.


Note: ----------------------------------------------------------
Note: ----------


Note: Use the following random object throughout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Generate random input data, encrypt it, decrypt that 
Note: output and
Note: compare the decryption result with the original input. Do 
Note: this with
Note: various round counts and word sizes.

Create buffer "input" of decimal value "16" bytes.
Create buffer "output" of decimal value "16" bytes.

Baldwin         Informational, Expires 12/25/1999         358


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create buffer "unput" of decimal value "16" bytes.
Create buffer "initVector" of decimal value "8" bytes.
Create buffer "keyData" of decimal value "256" bytes.

Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Set "_OutputLen" to decimal value "24".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".

Note: Create encryption/decryption objects and set algorithm 
Note: info

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "1", "cfb", 
contents of buffer "initVector", "1", "stream", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         359


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "1", "cfb", 
contents of buffer "initVector", "1", "stream", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Begin a loop of decimal value "25" iterations.

Note: Encrypt.



Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "15".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.


Baldwin         Informational, Expires 12/25/1999         360


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999



Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".
Check equality of buffer "input" with contents of buffer 
"unput".
End the loop and display execution times.

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Use a larger key.

Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TL3DCFS1".

Baldwin         Informational, Expires 12/25/1999         361


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

This is the start of test case "TL3DCIP1".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional tests of AI_FeedbackCipher based on triple DES 
Note: and interleaved
Note: cbc with padding using reused encryption and decryption 
Note: objects.


Note: ----------------------------------------------------------
Note: ----------

Note: Use the following random object throughout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Generate random input data, encrypt it, decrypt that 
Note: output and
Note: compare the decryption result with the original input. Do 
Note: this with
Note: various round counts and word sizes.

Baldwin         Informational, Expires 12/25/1999         362


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Create buffer "input" of decimal value "46" bytes.
Create buffer "output" of decimal value "46" bytes.
Create buffer "unput" of decimal value "46" bytes.
Create buffer "initVector" of decimal value "8" bytes.
Create buffer "keyData" of decimal value "256" bytes.
Create buffer "dataLength" of decimal value "4" bytes.

Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Set "_OutputLen" to decimal value "24".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".

Note: Create encryption/decryption objects and set algorithm 
Note: info

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "1", 
"cbc_interleaved", contents of buffer "initVector", "pad", 
"NULL".

Baldwin         Informational, Expires 12/25/1999         363


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "1", 
"cbc_interleaved", contents of buffer "initVector", "pad", 
"NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "dataLength" to hex value "7".
Begin a loop of decimal value "25" iterations.

Note: Encrypt.



Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to contents of buffer "dataLength".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         364


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.



Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".
Check equality of buffer "input" with contents of buffer 
"unput".
Increment buffer "dataLength" by decimal value "1".
End the loop and display execution times.

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Use a larger key.

Baldwin         Informational, Expires 12/25/1999         365


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TL3DCIP1".
This is the start of test case "TL5WCFPS".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".



Note: Functional tests of AI_FeedbackCipher based on rc5/64 and 
Note: pipelined cfb with
Note: reused encryption and decryption objects.


Note: ----------------------------------------------------------
Note: ----------


Note: Use the following random object throughout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------

Baldwin         Informational, Expires 12/25/1999         366


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: ----------

Note: Test 01-1

Note: Generate random input data, encrypt it, decrypt that 
Note: output and
Note: compare the decryption result with the original input. Do 
Note: this with
Note: various round counts and word sizes.

Create buffer "input" of decimal value "16" bytes.
Create buffer "output" of decimal value "16" bytes.
Create buffer "unput" of decimal value "16" bytes.
Create buffer "initVector" of decimal value "16" bytes.
Create buffer "keyData" of decimal value "256" bytes.
Create buffer "keyLen" of decimal value "2" bytes.
Create buffer "rounds" of decimal value "2" bytes.
Create buffer "wordSize" of decimal value "2" bytes.
Set buffer "wordSize" to hex value "40".

Set buffer "rounds" to hex value "16".

Set buffer "keyLen" to hex value "24".

Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Display buffer "keyLen".
Set "_OutputLen" to contents of buffer "keyLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         367


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".

Note: Create encryption/decryption objects and set algorithm 
Note: info

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", contents of 
buffer "rounds", contents of buffer "wordSize", 
"cfb_pipelined", contents of buffer "initVector", "8", 
"stream", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", contents of 
buffer "rounds", contents of buffer "wordSize", 
"cfb_pipelined", contents of buffer "initVector", "8", 
"stream", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Begin a loop of decimal value "25" iterations.

Note: Encrypt.



Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "15".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         368


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.



Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".
Check equality of buffer "input" with contents of buffer 
"unput".
End the loop and display execution times.

Baldwin         Informational, Expires 12/25/1999         369


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Use a larger key.

Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TL5WCFPS".
This is the start of test case "TLR2CBN1".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional tests of AI_FeedbackCipher based on rc2 with 
Note: all allowed key sizes
Note: and using CBC without padding.

Note: Original Script: tqrc2c05

Note: Depends on:
Note: - KI_Item

Note: ----------------------------------------------------------
Note: ----------

Note: Use the following random object throughout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 

Baldwin         Informational, Expires 12/25/1999         370


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------
Note: Setup data objects

Create buffer "dataLen" of decimal value "2" bytes.
Note: Hex 20 = 32 decimal.
Set buffer "dataLen" to hex value "20".
Create buffer "input" of contents of buffer "dataLen" bytes.
Create buffer "output" of contents of buffer "dataLen" bytes.
Create buffer "unput" of contents of buffer "dataLen" bytes.
Create buffer "initVector" of decimal value "8" bytes.
Create buffer "keyData" of decimal value "500" bytes.
Create buffer "keyByteLen" of decimal value "2" bytes.
Create buffer "effectiveKeyBits" of decimal value "2" bytes.

Note: ----------------------------------------------------------
Note: ----------
Note: - For an 8 byte key, try effective key sizes from 1 to 
Note: 1024 bits
Note: check that encryption equals decryption for 32 byte 
Note: input.
Note: Generate new input data, key bytes and IV for each case.

Set buffer "keyData" to hex value "0102030405060708".
Set buffer "effectiveKeyBits" to hex value "1".
Set buffer "keyByteLen" to hex value "8".

Begin a loop of decimal value "31" iterations.

Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Set "_OutputLen" to contents of buffer "dataLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         371


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".
Set "_OutputLen" to contents of buffer "keyByteLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".

Note: Set the key object.

Display buffer "effectiveKeyBits".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Set the effective number of key bits in the algorithm 
Note: objects.

Display buffer "effectiveKeyBits".
Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc2", contents of buffer 
"effectiveKeyBits", "cbc", contents of buffer "initVector", 
"nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 

Baldwin         Informational, Expires 12/25/1999         372


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc2", contents of buffer 
"effectiveKeyBits", "cbc", contents of buffer "initVector", 
"nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.

Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 

Baldwin         Informational, Expires 12/25/1999         373


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "input" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Advance to next effective keysize.

Increment buffer "effectiveKeyBits" by decimal value "32".
End the loop and display execution times.

Note: ----------------------------------------------------------
Note: ----------
Note: - For an 80 bit effective keysize, try key byte length 
Note: from 1 to 128
Note: check that encryption equals decryption for 32 byte 
Note: input.
Note: Generate new input data, key bytes and IV for each case.

Set buffer "keyData" to hex value "0102030405060708".
Note: 50 hex == 80 decimal

Baldwin         Informational, Expires 12/25/1999         374


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set buffer "effectiveKeyBits" to hex value "50".
Set buffer "keyByteLen" to hex value "1".

Begin a loop of decimal value "15" iterations.

Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Set "_OutputLen" to contents of buffer "dataLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".
Set "_OutputLen" to contents of buffer "keyByteLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".

Note: Set the key object.

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Set the effective number of key bits in the algorithm 
Note: objects.

Display buffer "effectiveKeyBits".

Baldwin         Informational, Expires 12/25/1999         375


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc2", contents of buffer 
"effectiveKeyBits", "cbc", contents of buffer "initVector", 
"nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc2", contents of buffer 
"effectiveKeyBits", "cbc", contents of buffer "initVector", 
"nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         376


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Finalize buffer "output".

Note: Decrypt.

Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "input" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Advance to next key byte length.

Increment buffer "keyByteLen" by decimal value "8".
End the loop and display execution times.


Baldwin         Informational, Expires 12/25/1999         377


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: ----------------------------------------------------------
Note: ----------
Note: - For key byte length from 1 to 128 by 1, and
Note: for effective key size from 1 to 1024 by 1
Note: check that encryption equals decryption for 32 byte 
Note: input.
Note: Use same input block and IV for each case.

Set buffer "keyData" to hex value "0102030405060708".

Note: Use same input block and IV for each case.

Set "_OutputLen" to contents of buffer "dataLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".

Note: Loop over number of key bytes.
Set buffer "keyByteLen" to hex value "1".
Begin a loop of decimal value "7" iterations.

Note: Generate random key bytes.

Set "_OutputLen" to contents of buffer "keyByteLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".

Note: Set the key object.

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 

Baldwin         Informational, Expires 12/25/1999         378


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Loop over effective key bits.
Set buffer "effectiveKeyBits" to hex value "1".
Begin a loop of decimal value "15" iterations.

Note: Set the effective number of key bits in the algorithm 
Note: objects.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc2", contents of buffer 
"effectiveKeyBits", "cbc", contents of buffer "initVector", 
"nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc2", contents of buffer 
"effectiveKeyBits", "cbc", contents of buffer "initVector", 
"nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 

Baldwin         Informational, Expires 12/25/1999         379


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.

Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "input" with contents of buffer 
"unput".

Note: Destroy the encryption and decryption objects.

Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         380


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Advance to next effective keysize.

Increment buffer "effectiveKeyBits" by decimal value "64".
End the loop and display execution times.

Note: Advance to next key byte length.

Increment buffer "keyByteLen" by decimal value "16".

Note: Destroy the key object.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
End the loop and display execution times.

Note: ----------------------------------------------------------
Note: ----------
Note: Cleanup



This is the end of test case "TLR2CBN1".
This is the start of test case "TLR2OFN1".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional tests of AI_FeedbackCipher based on rc2 with 
Note: all allowed key sizes
Note: and using OFB without padding.

Note: Original Script: tqrc2c05

Note: Depends on:
Note: - KI_Item

Note: ----------------------------------------------------------
Note: ----------

Note: Use the following random object throughout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         381


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------
Note: Setup data objects

Create buffer "dataLen" of decimal value "2" bytes.
Note: Hex 20 = 32 decimal.
Set buffer "dataLen" to hex value "20".
Create buffer "input" of contents of buffer "dataLen" bytes.
Create buffer "output" of contents of buffer "dataLen" bytes.
Create buffer "unput" of contents of buffer "dataLen" bytes.
Create buffer "initVector" of decimal value "8" bytes.
Create buffer "keyData" of decimal value "500" bytes.
Create buffer "keyByteLen" of decimal value "2" bytes.
Create buffer "effectiveKeyBits" of decimal value "2" bytes.

Note: ----------------------------------------------------------
Note: ----------
Note: - For an 8 byte key, try effective key sizes from 1 to 
Note: 1024 bits
Note: check that encryption equals decryption for 32 byte 
Note: input.
Note: Generate new input data, key bytes and IV for each case.

Set buffer "keyData" to hex value "0102030405060708".
Set buffer "effectiveKeyBits" to hex value "1".
Set buffer "keyByteLen" to hex value "8".

Begin a loop of decimal value "31" iterations.

Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Baldwin         Informational, Expires 12/25/1999         382


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Set "_OutputLen" to contents of buffer "dataLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".
Set "_OutputLen" to contents of buffer "keyByteLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".

Note: Set the key object.

Display buffer "effectiveKeyBits".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Set the effective number of key bits in the algorithm 
Note: objects.

Display buffer "effectiveKeyBits".
Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 

Baldwin         Informational, Expires 12/25/1999         383


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_FeedbackCipher" initialized from "rc2", contents of buffer 
"effectiveKeyBits", "ofb", contents of buffer "initVector", 
"nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc2", contents of buffer 
"effectiveKeyBits", "ofb", contents of buffer "initVector", 
"nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.

Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         384


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "input" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Advance to next effective keysize.

Increment buffer "effectiveKeyBits" by decimal value "32".
End the loop and display execution times.

Note: ----------------------------------------------------------
Note: ----------
Note: - For an 80 bit effective keysize, try key byte length 
Note: from 1 to 128
Note: check that encryption equals decryption for 32 byte 
Note: input.

Baldwin         Informational, Expires 12/25/1999         385


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Generate new input data, key bytes and IV for each case.

Set buffer "keyData" to hex value "0102030405060708".
Note: 50 hex == 80 decimal
Set buffer "effectiveKeyBits" to hex value "50".
Set buffer "keyByteLen" to hex value "1".

Begin a loop of decimal value "15" iterations.

Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Set "_OutputLen" to contents of buffer "dataLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".
Set "_OutputLen" to contents of buffer "keyByteLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".

Note: Set the key object.

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Baldwin         Informational, Expires 12/25/1999         386


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Set the effective number of key bits in the algorithm 
Note: objects.

Display buffer "effectiveKeyBits".
Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc2", contents of buffer 
"effectiveKeyBits", "ofb", contents of buffer "initVector", 
"nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc2", contents of buffer 
"effectiveKeyBits", "ofb", contents of buffer "initVector", 
"nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         387


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.

Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "input" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Advance to next key byte length.

Baldwin         Informational, Expires 12/25/1999         388


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Increment buffer "keyByteLen" by decimal value "8".
End the loop and display execution times.

Note: ----------------------------------------------------------
Note: ----------
Note: - For key byte length from 1 to 128 by 1, and
Note: for effective key size from 1 to 1024 by 1
Note: check that encryption equals decryption for 32 byte 
Note: input.
Note: Use same input block and IV for each case.

Set buffer "keyData" to hex value "0102030405060708".

Note: Use same input block and IV for each case.

Set "_OutputLen" to contents of buffer "dataLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".

Note: Loop over number of key bytes.
Set buffer "keyByteLen" to hex value "1".
Begin a loop of decimal value "7" iterations.

Note: Generate random key bytes.

Set "_OutputLen" to contents of buffer "keyByteLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".

Note: Set the key object.

Create key object "key".
Call B_CreateKeyObject passing "key".

Baldwin         Informational, Expires 12/25/1999         389


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Loop over effective key bits.
Set buffer "effectiveKeyBits" to hex value "1".
Begin a loop of decimal value "15" iterations.

Note: Set the effective number of key bits in the algorithm 
Note: objects.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc2", contents of buffer 
"effectiveKeyBits", "ofb", contents of buffer "initVector", 
"nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc2", contents of buffer 
"effectiveKeyBits", "ofb", contents of buffer "initVector", 
"nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         390


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.

Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "input" with contents of buffer 
"unput".

Note: Destroy the encryption and decryption objects.


Baldwin         Informational, Expires 12/25/1999         391


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Advance to next effective keysize.

Increment buffer "effectiveKeyBits" by decimal value "64".
End the loop and display execution times.

Note: Advance to next key byte length.

Increment buffer "keyByteLen" by decimal value "16".

Note: Destroy the key object.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
End the loop and display execution times.

Note: ----------------------------------------------------------
Note: ----------
Note: Cleanup



This is the end of test case "TLR2OFN1".
This is the start of test case "TLR2OPN1".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional tests of AI_FeedbackCipher based on rc2 with 
Note: all allowed key sizes
Note: and using pipelined OFB without padding.

Note: Original Script: tqrc2c05

Note: Depends on:
Note: - KI_Item

Note: ----------------------------------------------------------
Note: ----------

Note: Use the following random object throughout.


Baldwin         Informational, Expires 12/25/1999         392


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------
Note: Setup data objects

Create buffer "dataLen" of decimal value "2" bytes.
Note: Hex 20 = 32 decimal.
Set buffer "dataLen" to hex value "20".
Create buffer "input" of contents of buffer "dataLen" bytes.
Create buffer "output" of contents of buffer "dataLen" bytes.
Create buffer "unput" of contents of buffer "dataLen" bytes.
Create buffer "initVector" of decimal value "8" bytes.
Create buffer "keyData" of decimal value "500" bytes.
Create buffer "keyByteLen" of decimal value "2" bytes.
Create buffer "effectiveKeyBits" of decimal value "2" bytes.

Note: ----------------------------------------------------------
Note: ----------
Note: - For an 8 byte key, try effective key sizes from 1 to 
Note: 1024 bits
Note: check that encryption equals decryption for 32 byte 
Note: input.
Note: Generate new input data, key bytes and IV for each case.

Set buffer "keyData" to hex value "0102030405060708".
Set buffer "effectiveKeyBits" to hex value "1".
Set buffer "keyByteLen" to hex value "8".


Baldwin         Informational, Expires 12/25/1999         393


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Begin a loop of decimal value "31" iterations.

Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Set "_OutputLen" to contents of buffer "dataLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".
Set "_OutputLen" to contents of buffer "keyByteLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".

Note: Set the key object.

Display buffer "effectiveKeyBits".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Set the effective number of key bits in the algorithm 
Note: objects.

Display buffer "effectiveKeyBits".
Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".

Baldwin         Informational, Expires 12/25/1999         394


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc2", contents of buffer 
"effectiveKeyBits", "ofb_pipelined", contents of buffer 
"initVector", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc2", contents of buffer 
"effectiveKeyBits", "ofb_pipelined", contents of buffer 
"initVector", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".


Baldwin         Informational, Expires 12/25/1999         395


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Decrypt.

Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "input" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Advance to next effective keysize.

Increment buffer "effectiveKeyBits" by decimal value "32".
End the loop and display execution times.

Note: ----------------------------------------------------------
Note: ----------

Baldwin         Informational, Expires 12/25/1999         396


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: - For an 80 bit effective keysize, try key byte length 
Note: from 1 to 128
Note: check that encryption equals decryption for 32 byte 
Note: input.
Note: Generate new input data, key bytes and IV for each case.

Set buffer "keyData" to hex value "0102030405060708".
Note: 50 hex == 80 decimal
Set buffer "effectiveKeyBits" to hex value "50".
Set buffer "keyByteLen" to hex value "1".

Begin a loop of decimal value "15" iterations.

Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Set "_OutputLen" to contents of buffer "dataLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".
Set "_OutputLen" to contents of buffer "keyByteLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".

Note: Set the key object.

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".

Baldwin         Informational, Expires 12/25/1999         397


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Set the effective number of key bits in the algorithm 
Note: objects.

Display buffer "effectiveKeyBits".
Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc2", contents of buffer 
"effectiveKeyBits", "ofb_pipelined", contents of buffer 
"initVector", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc2", contents of buffer 
"effectiveKeyBits", "ofb_pipelined", contents of buffer 
"initVector", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         398


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.

Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "input" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         399


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Advance to next key byte length.

Increment buffer "keyByteLen" by decimal value "8".
End the loop and display execution times.

Note: ----------------------------------------------------------
Note: ----------
Note: - For key byte length from 1 to 128 by 1, and
Note: for effective key size from 1 to 1024 by 1
Note: check that encryption equals decryption for 32 byte 
Note: input.
Note: Use same input block and IV for each case.

Set buffer "keyData" to hex value "0102030405060708".

Note: Use same input block and IV for each case.

Set "_OutputLen" to contents of buffer "dataLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".

Note: Loop over number of key bytes.
Set buffer "keyByteLen" to hex value "1".
Begin a loop of decimal value "7" iterations.

Note: Generate random key bytes.

Set "_OutputLen" to contents of buffer "keyByteLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".


Baldwin         Informational, Expires 12/25/1999         400


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Set the key object.

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Loop over effective key bits.
Set buffer "effectiveKeyBits" to hex value "1".
Begin a loop of decimal value "15" iterations.

Note: Set the effective number of key bits in the algorithm 
Note: objects.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc2", contents of buffer 
"effectiveKeyBits", "ofb_pipelined", contents of buffer 
"initVector", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc2", contents of buffer 
"effectiveKeyBits", "ofb_pipelined", contents of buffer 
"initVector", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.


Baldwin         Informational, Expires 12/25/1999         401


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.

Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "input" with contents of buffer 

Baldwin         Informational, Expires 12/25/1999         402


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"unput".

Note: Destroy the encryption and decryption objects.

Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Advance to next effective keysize.

Increment buffer "effectiveKeyBits" by decimal value "64".
End the loop and display execution times.

Note: Advance to next key byte length.

Increment buffer "keyByteLen" by decimal value "16".

Note: Destroy the key object.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
End the loop and display execution times.

Note: ----------------------------------------------------------
Note: ----------
Note: Cleanup



This is the end of test case "TLR2OPN1".
This is the start of test case "TLR5CBN1".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional tests of AI_FeedbackCipher based on rc5 with a 
Note: sequence of key 
Note: sizes and using CBC without padding.

Note: Original Script: tqrc501

Note: ----------------------------------------------------------
Note: ----------



Baldwin         Informational, Expires 12/25/1999         403


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Use the following random object throughout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Generate random input data, encrypt it, decrypt that 
Note: output and
Note: compare the decryption result with the original input. Do 
Note: this with
Note: various round counts and word sizes.

Create buffer "input" of decimal value "8" bytes.
Create buffer "output" of decimal value "8" bytes.
Create buffer "unput" of decimal value "8" bytes.
Create buffer "initVector" of decimal value "8" bytes.
Create buffer "keyData" of decimal value "256" bytes.
Create buffer "keyLen" of decimal value "2" bytes.
Create buffer "rounds" of decimal value "2" bytes.
Create buffer "wordSize" of decimal value "2" bytes.
Create buffer "wordIncrement" of decimal value "2" bytes.
Set buffer "wordSize" to hex value "10".
Set buffer "wordIncrement" to hex value "10".

Note: The maximum outer loop count is 3. It changes the word 
Note: size.

Baldwin         Informational, Expires 12/25/1999         404


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: As of Oct. 25, 1995, BSAFE 3.0 only accepts a word size 
Note: of 32.

Increment buffer "wordSize" by contents of buffer 
"wordIncrement".

Begin a loop of decimal value "1" iterations.
Set buffer "rounds" to hex value "00".

Note: The maximum inner loop count is 256. It is for round 
Note: count.

Begin a loop of decimal value "15" iterations.
Set buffer "keyLen" to hex value "00".

Note: The maximum inner-inner loop count is 256. It is for key 
Note: length.

Begin a loop of decimal value "15" iterations.

Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".
Display buffer "keyLen".
Set "_OutputLen" to contents of buffer "keyLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         405


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5", "1", contents of 
buffer "rounds", contents of buffer "wordSize", "cbc", contents 
of buffer "initVector", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.

Create algorithm object "decryptObj".

Baldwin         Informational, Expires 12/25/1999         406


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5", "1", contents of 
buffer "rounds", contents of buffer "wordSize", "cbc", contents 
of buffer "initVector", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "input" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".

Baldwin         Informational, Expires 12/25/1999         407


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Use a larger key.

Increment buffer "keyLen" by decimal value "16".
End the loop and display execution times.
Increment buffer "rounds" by decimal value "16".
End the loop and display execution times.
Increment buffer "wordSize" by contents of buffer 
"wordIncrement".
Increment buffer "wordIncrement" by decimal value "16".
End the loop and display execution times.
Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TLR5CBN1".
This is the start of test case "TLR5SCB1".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional tests of AI_FeedbackCipher based on rc5 64 bit 
Note: with a sequence 
Note: of key sizes and using CBC without padding.

Note: Original Script: tqrc501

Note: ----------------------------------------------------------
Note: ----------


Note: Use the following random object throughout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         408


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Generate random input data, encrypt it, decrypt that 
Note: output and
Note: compare the decryption result with the original input. Do 
Note: this with
Note: various round counts and word sizes.

Create buffer "input" of decimal value "16" bytes.
Create buffer "output" of decimal value "16" bytes.
Create buffer "unput" of decimal value "16" bytes.
Create buffer "initVector" of decimal value "16" bytes.
Create buffer "keyData" of decimal value "256" bytes.
Create buffer "keyLen" of decimal value "2" bytes.
Create buffer "rounds" of decimal value "2" bytes.
Create buffer "wordSize" of decimal value "2" bytes.
Create buffer "wordIncrement" of decimal value "2" bytes.
Set buffer "wordSize" to hex value "40".
Set buffer "wordIncrement" to hex value "10".

Note: The maximum outer loop count is 3. It changes the word 
Note: size.



Begin a loop of decimal value "1" iterations.
Set buffer "rounds" to hex value "0c".

Note: The maximum inner loop count is 256. It is for round 
Note: count.

Begin a loop of decimal value "15" iterations.
Set buffer "keyLen" to hex value "0b".

Note: The maximum inner-inner loop count is 256. It is for key 
Note: length.

Begin a loop of decimal value "15" iterations.

Baldwin         Informational, Expires 12/25/1999         409


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".
Display buffer "keyLen".
Set "_OutputLen" to contents of buffer "keyLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", contents of 
buffer "rounds", contents of buffer "wordSize", "cbc", contents 

Baldwin         Informational, Expires 12/25/1999         410


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

of buffer "initVector", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", contents of 
buffer "rounds", contents of buffer "wordSize", "cbc", contents 
of buffer "initVector", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 

Baldwin         Informational, Expires 12/25/1999         411


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "input" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Use a larger key.

Increment buffer "keyLen" by decimal value "16".
End the loop and display execution times.
Increment buffer "rounds" by decimal value "16".
End the loop and display execution times.
Increment buffer "wordSize" by contents of buffer 
"wordIncrement".
Increment buffer "wordIncrement" by decimal value "16".
End the loop and display execution times.
Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------

Baldwin         Informational, Expires 12/25/1999         412


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

This is the end of test case "TLR5SCB1".
This is the start of test case "TLR5WCBN".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional tests of AI_FeedbackCipher based on rc5/64 
Note: with a sequence of key 
Note: sizes and using CBC without padding.

Note: Original Script: tqrc501

Note: ----------------------------------------------------------
Note: ----------


Note: Use the following random object throughout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Generate random input data, encrypt it, decrypt that 
Note: output and
Note: compare the decryption result with the original input. Do 

Baldwin         Informational, Expires 12/25/1999         413


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: this with
Note: various round counts and word sizes.

Create buffer "input" of decimal value "16" bytes.
Create buffer "output" of decimal value "16" bytes.
Create buffer "unput" of decimal value "16" bytes.
Create buffer "initVector" of decimal value "16" bytes.
Create buffer "keyData" of decimal value "256" bytes.
Create buffer "keyLen" of decimal value "2" bytes.
Create buffer "rounds" of decimal value "2" bytes.
Create buffer "wordSize" of decimal value "2" bytes.
Create buffer "wordIncrement" of decimal value "2" bytes.
Set buffer "wordSize" to hex value "40".
Set buffer "wordIncrement" to hex value "40".

Note: The maximum outer loop count is 3. It changes the word 
Note: size.


Note: IncrementData (wordSize, @wordIncrement)

Begin a loop of decimal value "1" iterations.
Set buffer "rounds" to hex value "00".

Note: The maximum inner loop count is 256. It is for round 
Note: count.

Begin a loop of decimal value "15" iterations.
Set buffer "keyLen" to hex value "00".

Note: The maximum inner-inner loop count is 256. It is for key 
Note: length.

Begin a loop of decimal value "15" iterations.

Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         414


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Increment length of "initVector" by "_OutputLen".
Finalize "initVector".
Display buffer "keyLen".
Set "_OutputLen" to contents of buffer "keyLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", contents of 
buffer "rounds", contents of buffer "wordSize", "cbc", contents 
of buffer "initVector", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         415


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", contents of 
buffer "rounds", contents of buffer "wordSize", "cbc", contents 
of buffer "initVector", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.


Baldwin         Informational, Expires 12/25/1999         416


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of buffer "input" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Use a larger key.

Increment buffer "keyLen" by decimal value "10".
End the loop and display execution times.
Increment buffer "rounds" by decimal value "10".
End the loop and display execution times.
Increment buffer "wordSize" by contents of buffer 
"wordIncrement".
Increment buffer "wordIncrement" by decimal value "16".
End the loop and display execution times.
Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TLR5WCBN".
This is the start of test case "TLR5WCFS".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional tests of AI_FeedbackCipher based on rc5/64 and 
Note: cfb with reused
Note: encryption and decryption objects.


Note: ----------------------------------------------------------
Note: ----------


Note: Use the following random object throughout.

Create algorithm object "random".

Baldwin         Informational, Expires 12/25/1999         417


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Generate random input data, encrypt it, decrypt that 
Note: output and
Note: compare the decryption result with the original input. Do 
Note: this with
Note: various round counts and word sizes.

Create buffer "input" of decimal value "16" bytes.
Create buffer "output" of decimal value "16" bytes.
Create buffer "unput" of decimal value "16" bytes.
Create buffer "initVector" of decimal value "16" bytes.
Create buffer "keyData" of decimal value "256" bytes.
Create buffer "keyLen" of decimal value "2" bytes.
Create buffer "rounds" of decimal value "2" bytes.
Create buffer "wordSize" of decimal value "2" bytes.
Set buffer "wordSize" to hex value "40".

Set buffer "rounds" to hex value "16".

Set buffer "keyLen" to hex value "24".

Note: Generate random input bytes, a random init vector, and a 
Note: random key.


Baldwin         Informational, Expires 12/25/1999         418


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Display buffer "keyLen".
Set "_OutputLen" to contents of buffer "keyLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".

Note: Create encryption/decryption objects and set algorithm 
Note: info

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", contents of 
buffer "rounds", contents of buffer "wordSize", "cfb", contents 
of buffer "initVector", "8", "stream", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         419


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", contents of 
buffer "rounds", contents of buffer "wordSize", "cfb", contents 
of buffer "initVector", "8", "stream", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Begin a loop of decimal value "25" iterations.

Note: Encrypt.

Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "15".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.

Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 

Baldwin         Informational, Expires 12/25/1999         420


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".
Check equality of buffer "input" with contents of buffer 
"unput".
End the loop and display execution times.

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Use a larger key.

Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TLR5WCFS".
This is the start of test case "TLR5WOFN".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional tests of AI_FeedbackCipher based on rc5/64 and 
Note: ofb with reused

Baldwin         Informational, Expires 12/25/1999         421


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: encryption and decryption objects.


Note: ----------------------------------------------------------
Note: ----------


Note: Use the following random object throughout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Generate random input data, encrypt it, decrypt that 
Note: output and
Note: compare the decryption result with the original input. Do 
Note: this with
Note: various round counts and word sizes.

Create buffer "input" of decimal value "16" bytes.
Create buffer "output" of decimal value "16" bytes.
Create buffer "unput" of decimal value "16" bytes.
Create buffer "initVector" of decimal value "16" bytes.
Create buffer "keyData" of decimal value "256" bytes.
Create buffer "keyLen" of decimal value "2" bytes.
Create buffer "rounds" of decimal value "2" bytes.

Baldwin         Informational, Expires 12/25/1999         422


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create buffer "wordSize" of decimal value "2" bytes.
Set buffer "wordSize" to hex value "40".

Set buffer "rounds" to hex value "16".

Set buffer "keyLen" to hex value "24".

Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Display buffer "keyLen".
Set "_OutputLen" to contents of buffer "keyLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".

Note: Create encryption/decryption objects and set algorithm 
Note: info

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", contents of 
buffer "rounds", contents of buffer "wordSize", "ofb", contents 
of buffer "initVector", "nopad", "NULL".

Baldwin         Informational, Expires 12/25/1999         423


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", contents of 
buffer "rounds", contents of buffer "wordSize", "ofb", contents 
of buffer "initVector", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Begin a loop of decimal value "25" iterations.

Note: Encrypt.

Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         424


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Finalize buffer "output".

Note: Decrypt.

Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "input" with contents of buffer 
"unput".
End the loop and display execution times.

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Use a larger key.

Note: ----------------------------------------------------------
Note: ----------

Baldwin         Informational, Expires 12/25/1999         425


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999



Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TLR5WOFN".
This is the start of test case "TMDSCFP6".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional tests of AI_FeedbackCipher based on DES and 64 
Note: bit cfb 
Note: with padding using reused encryption and decryption 
Note: objects.


Note: ----------------------------------------------------------
Note: ----------


Note: Use the following random object throughout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Baldwin         Informational, Expires 12/25/1999         426


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Generate random input data, encrypt it, decrypt that 
Note: output and
Note: compare the decryption result with the original input. Do 
Note: this with
Note: various round counts and word sizes.

Create buffer "input" of decimal value "46" bytes.
Create buffer "output" of decimal value "46" bytes.
Create buffer "unput" of decimal value "46" bytes.
Create buffer "initVector" of decimal value "8" bytes.
Create buffer "keyData" of decimal value "256" bytes.
Create buffer "dataLength" of decimal value "4" bytes.

Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".

Note: Create encryption/decryption objects and set algorithm 
Note: info

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         427


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des", "64", "cfb", 
contents of buffer "initVector", "64", "pad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des", "64", "cfb", 
contents of buffer "initVector", "64", "pad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "dataLength" to hex value "25".
Display buffer "dataLength".
Create buffer "loopIndex" of decimal value "4" bytes.
Set buffer "loopIndex" to hex value "0".
Begin a loop of decimal value "400" iterations.
Increment buffer "loopIndex" by decimal value "1".
Display buffer "loopIndex".
Begin a loop of decimal value "2500" iterations.

Note: Encrypt.

Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to contents of buffer "dataLength".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         428


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.

Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".
Check equality of buffer "input" with contents of buffer 
"unput".
End the loop and display execution times.
End the loop and display execution times.

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         429


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Use a larger key.

Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TMDSCFP6".
This is the start of test case "TMDSCFP8".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional tests of AI_FeedbackCipher based on DES and 8 
Note: bit cfb 
Note: with padding using reused encryption and decryption 
Note: objects.


Note: ----------------------------------------------------------
Note: ----------


Note: Use the following random object throughout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 

Baldwin         Informational, Expires 12/25/1999         430


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Generate random input data, encrypt it, decrypt that 
Note: output and
Note: compare the decryption result with the original input. Do 
Note: this with
Note: various round counts and word sizes.

Create buffer "input" of decimal value "46" bytes.
Create buffer "output" of decimal value "46" bytes.
Create buffer "unput" of decimal value "46" bytes.
Create buffer "initVector" of decimal value "8" bytes.
Create buffer "keyData" of decimal value "256" bytes.
Create buffer "dataLength" of decimal value "4" bytes.

Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         431


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Increment length of "initVector" by "_OutputLen".
Finalize "initVector".

Note: Create encryption/decryption objects and set algorithm 
Note: info

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des", "8", "cfb", 
contents of buffer "initVector", "64", "pad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des", "8", "cfb", 
contents of buffer "initVector", "64", "pad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "dataLength" to hex value "25".
Display buffer "dataLength".
Begin a loop of decimal value "400" iterations.
Begin a loop of decimal value "2500" iterations.

Note: Encrypt.

Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to contents of buffer "dataLength".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Call B_EncryptUpdate passing "encryptObj" and address of next 

Baldwin         Informational, Expires 12/25/1999         432


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.

Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".
Check equality of buffer "input" with contents of buffer 
"unput".
End the loop and display execution times.
End the loop and display execution times.

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         433


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Use a larger key.

Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TMDSCFP8".
This is the start of test case "TMDSCFS1".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional tests of AI_FeedbackCipher based on DES and 1 
Note: bit cfb with 
Note: reused encryption and decryption objects.


Note: ----------------------------------------------------------
Note: ----------


Note: Use the following random object throughout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         434


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Generate random input data, encrypt it, decrypt that 
Note: output and
Note: compare the decryption result with the original input. Do 
Note: this with
Note: various round counts and word sizes.

Create buffer "input" of decimal value "16" bytes.
Create buffer "output" of decimal value "16" bytes.
Create buffer "unput" of decimal value "16" bytes.
Create buffer "initVector" of decimal value "8" bytes.
Create buffer "keyData" of decimal value "256" bytes.

Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         435


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".

Note: Create encryption/decryption objects and set algorithm 
Note: info

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des", "1", "cfb", 
contents of buffer "initVector", "1", "stream", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des", "1", "cfb", 
contents of buffer "initVector", "1", "stream", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Begin a loop of decimal value "400" iterations.
Begin a loop of decimal value "2500" iterations.

Note: Encrypt.

Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "15".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".

Baldwin         Informational, Expires 12/25/1999         436


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.

Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".
Check equality of buffer "input" with contents of buffer 
"unput".
End the loop and display execution times.
End the loop and display execution times.

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         437


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Use a larger key.

Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TMDSCFS1".
This is the start of test case "TMDSCIP2".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional tests of AI_FeedbackCipher based on DES and 
Note: interleaved
Note: cbc with padding using reused encryption and decryption 
Note: objects.


Note: ----------------------------------------------------------
Note: ----------


Note: Use the following random object throughout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         438


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Generate random input data, encrypt it, decrypt that 
Note: output and
Note: compare the decryption result with the original input. Do 
Note: this with
Note: various round counts and word sizes.

Create buffer "input" of decimal value "46" bytes.
Create buffer "output" of decimal value "46" bytes.
Create buffer "unput" of decimal value "46" bytes.
Create buffer "initVector" of decimal value "8" bytes.
Create buffer "keyData" of decimal value "256" bytes.
Create buffer "dataLength" of decimal value "4" bytes.

Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "8".

Baldwin         Informational, Expires 12/25/1999         439


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".

Note: Create encryption/decryption objects and set algorithm 
Note: info

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des", "1", 
"cbc_interleaved", contents of buffer "initVector", "pad", 
"NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des", "1", 
"cbc_interleaved", contents of buffer "initVector", "pad", 
"NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "dataLength" to hex value "25".
Begin a loop of decimal value "400" iterations.
Begin a loop of decimal value "2500" iterations.

Note: Encrypt.

Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to contents of buffer "dataLength".
Call B_GenerateRandomBytes passing "random" and address of next 

Baldwin         Informational, Expires 12/25/1999         440


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.

Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".
Check equality of buffer "input" with contents of buffer 
"unput".
End the loop and display execution times.

Baldwin         Informational, Expires 12/25/1999         441


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

End the loop and display execution times.

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Use a larger key.

Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TMDSCIP2".
This is the start of test case "TMR5WOFN".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional tests of AI_FeedbackCipher based on rc5/64 and 
Note: ofb with reused
Note: encryption and decryption objects.


Note: ----------------------------------------------------------
Note: ----------


Note: Use the following random object throughout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         442


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Generate random input data, encrypt it, decrypt that 
Note: output and
Note: compare the decryption result with the original input. Do 
Note: this with
Note: various round counts and word sizes.

Create buffer "input" of decimal value "16" bytes.
Create buffer "output" of decimal value "16" bytes.
Create buffer "unput" of decimal value "16" bytes.
Create buffer "initVector" of decimal value "16" bytes.
Create buffer "keyData" of decimal value "256" bytes.
Create buffer "keyLen" of decimal value "2" bytes.
Create buffer "rounds" of decimal value "2" bytes.
Create buffer "wordSize" of decimal value "2" bytes.
Set buffer "wordSize" to hex value "40".

Set buffer "rounds" to hex value "16".

Set buffer "keyLen" to hex value "24".

Note: Generate random input bytes, a random init vector, and a 
Note: random key.

Display buffer "keyLen".
Set "_OutputLen" to contents of buffer "keyLen".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "keyData" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "keyData" by "_OutputLen".
Finalize "keyData".

Baldwin         Informational, Expires 12/25/1999         443


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "initVector" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "initVector" by "_OutputLen".
Finalize "initVector".

Note: Create encryption/decryption objects and set algorithm 
Note: info

Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", contents of 
buffer "rounds", contents of buffer "wordSize", "ofb", contents 
of buffer "initVector", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5_64", "1", contents of 
buffer "rounds", contents of buffer "wordSize", "ofb", contents 
of buffer "initVector", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         444


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Begin a loop of decimal value "400" iterations.
Begin a loop of decimal value "2500" iterations.

Note: Encrypt.

Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_OutputLen" to decimal value "16".
Call B_GenerateRandomBytes passing "random" and address of next 
free byte in "input" and "_OutputLen" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "input" by "_OutputLen".
Finalize "input".
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Decrypt.

Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         445


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "input" with contents of buffer 
"unput".
End the loop and display execution times.
End the loop and display execution times.

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Use a larger key.

Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TMR5WOFN".
This is the start of test case "TV3CBIN0".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector test for Cipher Block Feedback using Triple DES 
Note: together with 
Note: interleaved CBC and no padding. Vectors were extracted 
Note: from X9.52 standard.

Note: ----------------------------------------------------------

Baldwin         Informational, Expires 12/25/1999         446


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: ----------

Note: Start with GlobalInit for code resource


Set "_Chooser" to "AM_EDE_ENCRYPT", "AM_EDE_DECRYPT", 
"AM_CFB_ENCRYPT", "AM_CFB_DECRYPT", "NULL_PTR".








Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Use input data, encrypt it, decrypt that output and
Note: compare the decryption result with the original input. 

Create buffer "output" of decimal value "80" bytes.
Create buffer "unput" of decimal value "80" bytes.

Create buffer "keyData" of decimal value "24" bytes.
Set buffer "keyData" to hex value "0123456789ABCDEF23456789ABCDE
F01456789ABCDEF0123".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create buffer "ciphertext1" of decimal value "80" bytes.
Set buffer "ciphertext1" to hex value "0EF198BE0DA40F4D03649EFA6
872A717E6B15686748A11401933FB0C744581C10364E942DF9A4B74901E57CCB
671CEBC".

Create buffer "plaintext" of decimal value "80" bytes.
Set buffer "plaintext" with string value "Now is the time for 
all good men to come to the ".
Create algorithm object "encryptObj".

Baldwin         Informational, Expires 12/25/1999         447


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", 
"cbc_interleaved", "0000000000055555", "nopad", "NULL_PTR".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Display buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext1".

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", 
"cbc_interleaved", "0000000000055555", "nopad", "NULL_PTR".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         448


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Display buffer "unput".
Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------

Baldwin         Informational, Expires 12/25/1999         449


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: ----------
This is the end of test case "TV3CBIN0".
This is the start of test case "TV3CBRI0".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional test for Cipher Block Feedback using Triple 
Note: DES together with CBC
Note: and no padding. Also tested the reinitialization 
Note: function.

Note: ----------------------------------------------------------
Note: ----------

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_EDE_ENCRYPT", "AM_EDE_DECRYPT", 
"AM_CFB_ENCRYPT", "AM_CFB_DECRYPT", "NULL_PTR".



Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Use input data, encrypt it, decrypt that output and
Note: compare the decryption result with the original input. 

Create buffer "output" of decimal value "80" bytes.
Create buffer "unput" of decimal value "80" bytes.

Create buffer "keyData" of decimal value "24" bytes.
Set buffer "keyData" to hex value "0123456789ABCDEF23456789ABCDE
F01456789ABCDEF0123".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create buffer "ciphertext1" of decimal value "80" bytes.

Baldwin         Informational, Expires 12/25/1999         450


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set buffer "ciphertext1" to hex value "F3C0FF026C023089656FBB169
DEF7EDB30BA36075D6F0176".
Create buffer "plaintext" of decimal value "80" bytes.
Set buffer "plaintext" with string value "Now is the ti".
Create buffer "plaintext1" of decimal value "80" bytes.
Set buffer "plaintext1" with string value "me for all ".
Create buffer "fullPlaintext" of decimal value "80" bytes.
Set buffer "fullPlaintext" with string value "Now is the time 
for all ".
Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", "cbc", 
"1234567890ABCDEF", "nopad", "NULL_PTR".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext1" and length of 
initialized bytes in buffer "plaintext1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Set "_InfoPointer" to address of info structure for 
"AI_RESET_IV" initialized from "00000000EFAB23EF".
Call B_SetAlgorithmInfo passing "encryptObj" and "AI_RESET_IV" 
and "_InfoPointer".

Baldwin         Informational, Expires 12/25/1999         451


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Display buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext1".

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", "cbc", 
"1234567890ABCDEF", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         452


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Display buffer "unput".
Check equality of buffer "fullPlaintext" with contents of 
buffer "unput".

Note: Test to see if reinitizalition worked correctly. Data 
Note: derived from
Note: symcbc\tvds3p00 script.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "keyData" to hex value "0123456789ABCDEF0123456789ABC
DEF0123456789ABCDEF".
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "plaintext" to hex value "6789ABCDEF012345".
Set buffer "ciphertext1" to hex value "fc624960b90f7a7d".


Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 

Baldwin         Informational, Expires 12/25/1999         453


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Display buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext1".
Set "_InfoPointer" to address of info structure for 
"AI_RESET_IV" initialized from "00000000EFAB23EF".
Call B_SetAlgorithmInfo passing "decryptObj" and "AI_RESET_IV" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".
Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         454


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TV3CBRI0".
This is the start of test case "TV3CFPN2".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector test for Cipher Block Feedback using Triple DES 
Note: together with 
Note: CFB_pipelined
Note: with a transfer size of 64 bits in no padding mode.

Note: ----------------------------------------------------------
Note: ----------





Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_EDE_ENCRYPT", "AM_EDE_DECRYPT", 
"AM_CFB_PIPELINED_ENCRYPT", "AM_CFB_PIPELINED_DECRYPT", 
"NULL_PTR".



Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Use input data, encrypt it, decrypt that output and
Note: compare the decryption result with the original input. 

Create buffer "output" of decimal value "80" bytes.
Create buffer "unput" of decimal value "80" bytes.

Create buffer "keyData" of decimal value "24" bytes.

Baldwin         Informational, Expires 12/25/1999         455


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set buffer "keyData" to hex value "0123456789ABCDEF23456789ABCDE
F01456789ABCDEF0123".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create buffer "ciphertext1" of decimal value "80" bytes.
Set buffer "ciphertext1" to hex value "6E664F920A9DF1E4E570C5631
10DA5248AB3D43134FC9101FF8E23D1B73E30543DEAABACDD241043449EED61D
7589148".


Create buffer "plaintext" of decimal value "80" bytes.
Set buffer "plaintext" with string value "Now is the time for 
all good men to come to the ".
Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", 
"cfb_pipelined", "0000000000055555", "64", "nopad", "NULL_PTR".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         456


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Display buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext1".

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", 
"cfb_pipelined", "0000000000055555", "64", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".


Baldwin         Informational, Expires 12/25/1999         457


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Check the result.

Display buffer "unput".
Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TV3CFPN2".
This is the start of test case "TV3CFPS0".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector test for Cipher Block Feedback using Triple DES 
Note: together with 
Note: CFB_pipelined
Note: with a transfer size of 8 bits in streaming mode.

Note: ----------------------------------------------------------
Note: ----------






Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_EDE_ENCRYPT", "AM_EDE_DECRYPT", 
"AM_CFB_PIPELINED_ENCRYPT", "AM_CFB_PIPELINED_DECRYPT", 
"NULL_PTR".

Baldwin         Informational, Expires 12/25/1999         458


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999




Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Use input data, encrypt it, decrypt that output and
Note: compare the decryption result with the original input. 

Create buffer "output" of decimal value "80" bytes.
Create buffer "unput" of decimal value "80" bytes.

Create buffer "keyData" of decimal value "24" bytes.
Set buffer "keyData" to hex value "0123456789ABCDEF23456789ABCDE
F01456789ABCDEF0123".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create buffer "ciphertext1" of decimal value "80" bytes.
Set buffer "ciphertext1" to hex value "6EE29BF123180889FC4C".



Create buffer "plaintext" of decimal value "80" bytes.
Set buffer "plaintext" with string value "Now is the".
Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", 
"cfb_pipelined", "0000000000055555", "8", "stream", "NULL_PTR".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 

Baldwin         Informational, Expires 12/25/1999         459


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Display buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext1".

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", 
"cfb_pipelined", "0000000000055555", "8", "stream", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         460


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Display buffer "unput".
Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TV3CFPS0".
This is the start of test case "TV3CFPS1".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector test for Cipher Block Feedback using Triple DES 
Note: together with 
Note: CFB_pipelined
Note: with a transfer size of 1 bit in streaming mode. Vectors 
Note: were extracted

Baldwin         Informational, Expires 12/25/1999         461


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: from the X9.52 standard.

Note: ----------------------------------------------------------
Note: ----------






Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_EDE_ENCRYPT", "AM_EDE_DECRYPT", 
"AM_CFB_PIPELINED_ENCRYPT", "AM_CFB_PIPELINED_DECRYPT", 
"NULL_PTR".



Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Use input data, encrypt it, decrypt that output and
Note: compare the decryption result with the original input. 

Create buffer "output" of decimal value "80" bytes.
Create buffer "unput" of decimal value "80" bytes.

Create buffer "keyData" of decimal value "24" bytes.
Set buffer "keyData" to hex value "0123456789ABCDEF23456789ABCDE
F01456789ABCDEF0123".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create buffer "ciphertext1" of decimal value "80" bytes.
Set buffer "ciphertext1" to hex value "372CD5".



Create buffer "plaintext" of decimal value "80" bytes.

Baldwin         Informational, Expires 12/25/1999         462


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set buffer "plaintext" with string value "Now".
Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", 
"cfb_pipelined", "0000000000055555", "1", "stream", "NULL_PTR".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Display buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext1".

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "1", 
"cfb_pipelined", "0000000000055555", "1", "stream", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 

Baldwin         Informational, Expires 12/25/1999         463


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Display buffer "unput".
Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Baldwin         Informational, Expires 12/25/1999         464


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TV3CFPS1".
This is the start of test case "TV3DCBN0".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector test for Cipher Block Feedback using Triple DES 
Note: together with CBC
Note: and no padding. Vectors were extracted from X9.52 
Note: standard.

Note: ----------------------------------------------------------
Note: ----------






Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_EDE_ENCRYPT", "AM_EDE_DECRYPT", 
"AM_CFB_ENCRYPT", "AM_CFB_DECRYPT", "NULL_PTR".



Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Use input data, encrypt it, decrypt that output and
Note: compare the decryption result with the original input. 

Create buffer "output" of decimal value "80" bytes.
Create buffer "unput" of decimal value "80" bytes.

Create buffer "keyData" of decimal value "24" bytes.
Set buffer "keyData" to hex value "0123456789ABCDEF23456789ABCDE
F01456789ABCDEF0123".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".

Baldwin         Informational, Expires 12/25/1999         465


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create buffer "ciphertext1" of decimal value "80" bytes.
Set buffer "ciphertext1" to hex value "F3C0FF026C023089656FBB169
DEF7EDB30BA36075D6F0176".
Create buffer "plaintext" of decimal value "80" bytes.
Set buffer "plaintext" with string value "Now is the time for 
all ".
Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", "cbc", 
"1234567890ABCDEF", "nopad", "NULL_PTR".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Display buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext1".


Baldwin         Informational, Expires 12/25/1999         466


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", "cbc", 
"1234567890ABCDEF", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Display buffer "unput".
Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         467


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TV3DCBN0".
This is the start of test case "TV3DCFN2".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector test for Cipher Block Feedback using Triple DES 
Note: together with CFB
Note: with a transfer size of 64 bits in no padding mode.

Note: ----------------------------------------------------------
Note: ----------






Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_EDE_ENCRYPT", "AM_EDE_DECRYPT", 
"AM_CFB_ENCRYPT", "AM_CFB_DECRYPT", "NULL_PTR".



Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Use input data, encrypt it, decrypt that output and
Note: compare the decryption result with the original input. 

Create buffer "output" of decimal value "80" bytes.
Create buffer "unput" of decimal value "80" bytes.

Create buffer "keyData" of decimal value "24" bytes.
Set buffer "keyData" to hex value "0123456789ABCDEF23456789ABCDE

Baldwin         Informational, Expires 12/25/1999         468


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

F01456789ABCDEF0123".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create buffer "ciphertext1" of decimal value "80" bytes.
Set buffer "ciphertext1" to hex value "EE7EC75C1A101301C4AB2F104
62E5DD417400B445B5F2A72".

Create buffer "plaintext" of decimal value "80" bytes.
Set buffer "plaintext" with string value "Now is the time for 
all ".
Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", "cfb", 
"1234567890ABCDEF", "64", "nopad", "NULL_PTR".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 

Baldwin         Informational, Expires 12/25/1999         469


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Display buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext1".

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", "cfb", 
"1234567890ABCDEF", "64", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Display buffer "unput".

Baldwin         Informational, Expires 12/25/1999         470


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TV3DCFN2".
This is the start of test case "TV3DCFS0".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector test for Cipher Block Feedback using Triple DES 
Note: together with CFB
Note: with a transfer size of 8 bits in streaming mode.

Note: ----------------------------------------------------------
Note: ----------






Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_EDE_ENCRYPT", "AM_EDE_DECRYPT", 
"AM_CFB_ENCRYPT", "AM_CFB_DECRYPT", "NULL_PTR".



Note: ----------------------------------------------------------
Note: ----------

Baldwin         Informational, Expires 12/25/1999         471


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Test 01-1

Note: Use input data, encrypt it, decrypt that output and
Note: compare the decryption result with the original input. 

Create buffer "output" of decimal value "80" bytes.
Create buffer "unput" of decimal value "80" bytes.

Create buffer "keyData" of decimal value "24" bytes.
Set buffer "keyData" to hex value "0123456789ABCDEF23456789ABCDE
F01456789ABCDEF0123".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create buffer "ciphertext1" of decimal value "80" bytes.
Set buffer "ciphertext1" to hex value "EE9B04FFCACEC8067060".
Create buffer "plaintext" of decimal value "80" bytes.
Set buffer "plaintext" with string value "Now is the".
Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", "cfb", 
"1234567890ABCDEF", "8", "stream", "NULL_PTR".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 

Baldwin         Informational, Expires 12/25/1999         472


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Display buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext1".

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", "cfb", 
"1234567890ABCDEF", "8", "stream", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         473


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Display buffer "unput".
Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TV3DCFS0".
This is the start of test case "TV3DCFS1".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector test for Cipher Block Feedback using Triple DES 
Note: together with CFB
Note: with a transfer size of 1 bit in streaming mode.

Note: ----------------------------------------------------------
Note: ----------






Note: Start with GlobalInit for code resource

Baldwin         Informational, Expires 12/25/1999         474


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Set "_Chooser" to "AM_EDE_ENCRYPT", "AM_EDE_DECRYPT", 
"AM_CFB_ENCRYPT", "AM_CFB_DECRYPT", "NULL_PTR".



Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Use input data, encrypt it, decrypt that output and
Note: compare the decryption result with the original input. 

Create buffer "output" of decimal value "80" bytes.
Create buffer "unput" of decimal value "80" bytes.

Create buffer "keyData" of decimal value "24" bytes.
Set buffer "keyData" to hex value "0123456789ABCDEF23456789ABCDE
F01456789ABCDEF0123".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create buffer "ciphertext1" of decimal value "80" bytes.
Set buffer "ciphertext1" to hex value "D9E64B".

Create buffer "plaintext" of decimal value "80" bytes.
Set buffer "plaintext" with string value "Now".
Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", "cfb", 
"1234567890ABCDEF", "1", "stream", "NULL_PTR".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         475


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Display buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext1".

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", "cfb", 
"1234567890ABCDEF", "1", "stream", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         476


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Display buffer "unput".
Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TV3DCFS1".
This is the start of test case "TV3DECN0".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector test for Cipher Block Feedback using Triple DES 
Note: together with ECB
Note: and no padding. Vectors were extracted from X9.52 
Note: standard.

Baldwin         Informational, Expires 12/25/1999         477


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: ----------------------------------------------------------
Note: ----------






Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_EDE_ENCRYPT", "AM_EDE_DECRYPT", 
"AM_CFB_ENCRYPT", "AM_CFB_DECRYPT", "NULL_PTR".



Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Use input data, encrypt it, decrypt that output and
Note: compare the decryption result with the original input. 

Create buffer "output" of decimal value "80" bytes.
Create buffer "unput" of decimal value "80" bytes.

Create buffer "keyData" of decimal value "24" bytes.
Set buffer "keyData" to hex value "0123456789ABCDEF23456789ABCDE
F01456789ABCDEF0123".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create buffer "ciphertext1" of decimal value "80" bytes.
Set buffer "ciphertext1" to hex value "314F8327FA7A09A84362760CC
13BA7DAFF55C5F80FAAAC45".

Create buffer "plaintext" of decimal value "80" bytes.
Set buffer "plaintext" with string value "Now is the time for 
all ".
Create algorithm object "encryptObj".

Baldwin         Informational, Expires 12/25/1999         478


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", "ecb", 
"8", "nopad", "NULL_PTR".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Display buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext1".

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", "ecb", 
"8", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         479


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Display buffer "unput".
Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------

Baldwin         Informational, Expires 12/25/1999         480


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: ----------
This is the end of test case "TV3DECN0".
This is the start of test case "TV3DOFP0".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional test for Cipher Block Feedback using Triple 
Note: DES and OFB feedback 
Note: methods without padding.

Note: ----------------------------------------------------------
Note: ----------






Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_EDE_ENCRYPT", "AM_EDE_DECRYPT", 
"AM_OFB_PIPELINED_ENCRYPT", "AM_OFB_PIPELINED_DECRYPT", 
"NULL_PTR".



Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Using supplied input data, encrypt it and compare to the 
Note: test vector, 
Note: decrypt that output and
Note: compare the decryption result with the original input. 

Create buffer "output" of decimal value "80" bytes.
Create buffer "unput" of decimal value "80" bytes.

Create buffer "keyData" of decimal value "24" bytes.
Set buffer "keyData" to hex value "0123456789ABCDEF23456789ABCDE
F01456789ABCDEF0123".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".

Baldwin         Informational, Expires 12/25/1999         481


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create buffer "ciphertext1" of decimal value "80" bytes.
Set buffer "ciphertext1" to hex value "6E664F920A9DF1E4E570C5631
10DA5248AB3D43134FC9101B73C082134D1CE8139F838BBCD2D99AA9EB49AFAA
8699D8C".

Create buffer "plaintext" of decimal value "80" bytes.
Set buffer "plaintext" with string value "Now is the time for 
all good men to come to the ".
Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "0", 
"ofb_pipelined", "0000000000055555", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Display buffer "output".
Check equality of buffer "output" with contents of buffer 

Baldwin         Informational, Expires 12/25/1999         482


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"ciphertext1".

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "0", 
"ofb_pipelined", "0000000000055555", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".

Baldwin         Informational, Expires 12/25/1999         483


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TV3DOFP0".
This is the start of test case "TV3OFBN0".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional test for Cipher Block Feedback using Triple 
Note: DES and OFB feedback 
Note: methods without padding.

Note: ----------------------------------------------------------
Note: ----------






Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_EDE_ENCRYPT", "AM_EDE_DECRYPT", 
"AM_OFB_ENCRYPT", "AM_OFB_DECRYPT", "NULL_PTR".



Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Using supplied input data, encrypt it and compare to the 
Note: test vector, 
Note: decrypt that output and
Note: compare the decryption result with the original input. 

Create buffer "output" of decimal value "80" bytes.
Create buffer "unput" of decimal value "80" bytes.

Baldwin         Informational, Expires 12/25/1999         484


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Create buffer "keyData" of decimal value "24" bytes.
Set buffer "keyData" to hex value "0123456789ABCDEF23456789ABCDE
F01456789ABCDEF0123".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create buffer "ciphertext1" of decimal value "80" bytes.
Set buffer "ciphertext1" to hex value "EE7EC75C1A1013019A8A61000
2668E0787E28AF9EC26B889".

Create buffer "plaintext" of decimal value "80" bytes.
Set buffer "plaintext" with string value "Now is the time for 
all ".
Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "0", "ofb", 
"1234567890ABCDEF", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         485


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Display buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext1".

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "0", "ofb", 
"1234567890ABCDEF", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".


Baldwin         Informational, Expires 12/25/1999         486


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Check the result.

Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TV3OFBN0".
This is the start of test case "TVDSCBP0".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Test vectors for AI_FeedbackCipher using DES with CBC and 
Note: padding.

Note: Depends on:
Note: AI_FeedbackCipher

Note: Test cases:
Note: - For 8 byte input, first block matches DES_CBC of input
Note: and the second byte decrypts to eight bytes of 0x08.
Note: - For inputs ranging from 0 to 16 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Note: -------------------------------------------------------
Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_DES_ENCRYPT", "AM_DES_DECRYPT", 
"AM_CBC_ENCRYPT", "AM_CBC_DECRYPT", "NULL_PTR".

Baldwin         Informational, Expires 12/25/1999         487


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999




Note: Setup data objects

Create buffer "keytext" of decimal value "100" bytes.
Create buffer "plaintext" of decimal value "100" bytes.
Create buffer "ciphertext1" of decimal value "100" bytes.
Create buffer "ivector" of decimal value "100" bytes.
Create buffer "encryptedtext" of decimal value "100" bytes.
Create buffer "decryptedtext" of decimal value "100" bytes.

Set buffer "keytext" to hex value "0123456789ABCDEF".
Set buffer "plaintext" to hex value "6789ABCDEF012345".
Set buffer "ciphertext1" to hex value "fc624960b90f7a7d".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Note: -------------------------------------------------------
Note: Setup	Key object 

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------

Note: Setup algorithm objects.

Create algorithm object "encrypter".
Call B_CreateAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decrypter".
Call B_CreateAlgorithmObject passing "decrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptNoPad".
Call B_CreateAlgorithmObject passing "decryptNoPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         488


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des", "0", "cbc", 
"00000000EFAB23EF", "pad", "NULL".
Call B_SetAlgorithmInfo passing "encrypter" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des", "0", "cbc", 
"00000000EFAB23EF", "pad", "NULL".
Call B_SetAlgorithmInfo passing "decrypter" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des", "0", "cbc", 
"00000000EFAB23EF", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptNoPad" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptNoPad" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: - For 8 byte input, first block matches DES_CBC of input
Note: and the second byte decrypts to eight bytes of 0x08.

Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         489


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"fc624960b90f7a7d2551005f74269110".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         490


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"6789abcdef0123450808080808080808".

Set length of buffer "encryptedtext" to decimal value "8".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext1".
Set length of buffer "decryptedtext" to decimal value "8".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Note: -------------------------------------------------------
Note: Setup plaintext array

Set buffer "plaintext" to hex value "010203040506070809101112131
41516".

Note: -------------------------------------------------------
Note: - For input of length 16 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "16".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"67d89fdd4db55cdfe7886e07ebd3b3df47d8b20e93909b58".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 

Baldwin         Informational, Expires 12/25/1999         491


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"010203040506070809101112131415160808080808080808".

Note: -------------------------------------------------------
Note: - For input of length 15 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "15".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 

Baldwin         Informational, Expires 12/25/1999         492


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"67d89fdd4db55cdff52a136d17a87e8f".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         493


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"01020304050607080910111213141501".

Note: -------------------------------------------------------
Note: - For input of length 14 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "14".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"67d89fdd4db55cdf9ff22b5301f5ba69".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         494


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"01020304050607080910111213140202".

Note: -------------------------------------------------------
Note: - For input of length 13 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "13".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 

Baldwin         Informational, Expires 12/25/1999         495


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"67d89fdd4db55cdf7ac916277cc636ef".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 

Baldwin         Informational, Expires 12/25/1999         496


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"01020304050607080910111213030303".

Note: -------------------------------------------------------
Note: - For input of length 12 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "12".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"67d89fdd4db55cdfe204db2a32a7b8c8".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Baldwin         Informational, Expires 12/25/1999         497


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"01020304050607080910111204040404".

Note: -------------------------------------------------------
Note: - For input of length 11 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "11".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"67d89fdd4db55cdf287f784d76357583".

Baldwin         Informational, Expires 12/25/1999         498


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"01020304050607080910110505050505".

Note: -------------------------------------------------------
Note: - For input of length 10 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "10".

Baldwin         Informational, Expires 12/25/1999         499


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"67d89fdd4db55cdf4c58ea5623cd0b5b".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         500


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"01020304050607080910060606060606".

Note: -------------------------------------------------------
Note: - For input of length 09 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "09".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"67d89fdd4db55cdfd784a16124df7747".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         501


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"01020304050607080907070707070707".

Note: -------------------------------------------------------
Note: - For input of length 08 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "08".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         502


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"67d89fdd4db55cdf9a19483adb5c2975".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         503


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"01020304050607080808080808080808".

Note: -------------------------------------------------------
Note: - For input of length 07 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "07".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"977c3a184fa1e78d".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         504


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"0102030405060701".

Note: -------------------------------------------------------
Note: - For input of length  6 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "6".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         505


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"d1aee6c6fae1828b".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"0102030405060202".

Note: -------------------------------------------------------
Note: - For input of length  5 bytes, check that
Note: - Encrypt and Decrypt are inverses.

Baldwin         Informational, Expires 12/25/1999         506


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "5".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"a5ef9a711de975ca".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 

Baldwin         Informational, Expires 12/25/1999         507


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"0102030405030303".

Note: -------------------------------------------------------
Note: - For input of length  4 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "4".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"a429c178f9a65553".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 

Baldwin         Informational, Expires 12/25/1999         508


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"0102030404040404".

Note: -------------------------------------------------------
Note: - For input of length  3 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "3".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 

Baldwin         Informational, Expires 12/25/1999         509


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"b53a1c038d1b89cd".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 

Baldwin         Informational, Expires 12/25/1999         510


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"0102030505050505".

Note: -------------------------------------------------------
Note: - For input of length  2 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "2".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"0d00d9d7ca3c98a4".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 

Baldwin         Informational, Expires 12/25/1999         511


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"0102060606060606".

Note: -------------------------------------------------------
Note: - For input of length  1 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "1".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         512


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"c3f1ba84fb6e4664".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"0107070707070707".

Baldwin         Informational, Expires 12/25/1999         513


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: -------------------------------------------------------
Note: - For input of length  0 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "0".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"d470869b58d76fad".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".


Baldwin         Informational, Expires 12/25/1999         514


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"0808080808080808".

Note: -------------------------------------------------------
Note: Cleanup



This is the end of test case "TVDSCBP0".
This is the start of test case "TVDSECN0".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Tests AI_FeedbackCipher using DES in ECB mode and no 
Note: padding.

Note: Test cases:
Note: - The NIST test vectors for DES ECB.

Note: Depends on:
Note: - AI_FeedbackCipher

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_DES_ENCRYPT", "AM_DES_DECRYPT", 
"AM_ECB_ENCRYPT", "AM_ECB_DECRYPT", "NULL_PTR".



Note: -------------------------------------------------------


Baldwin         Informational, Expires 12/25/1999         515


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Setup data objects

Create buffer "keytext" of decimal value "100" bytes.
Create buffer "plaintext" of decimal value "100" bytes.
Create buffer "ciphertext" of decimal value "100" bytes.
Create buffer "encryptedtext" of decimal value "100" bytes.
Create buffer "decryptedtext" of decimal value "100" bytes.

Note: -------------------------------------------------------

Note: Setup algorithm objects.

Create algorithm object "encrypter".
Call B_CreateAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decrypter".
Call B_CreateAlgorithmObject passing "decrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des", "0", "ecb", "8", 
"nopad", "NULL".
Call B_SetAlgorithmInfo passing "encrypter" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des", "0", "ecb", "8", 
"nopad", "NULL".
Call B_SetAlgorithmInfo passing "decrypter" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case  0

Set buffer "keytext" to hex value "0000000000000000".
Set buffer "plaintext" to hex value "0000000000000000".
Set buffer "ciphertext" to hex value "8CA64DE9C1B123A7".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".

Baldwin         Informational, Expires 12/25/1999         516


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         517


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case  1

Set buffer "keytext" to hex value "FFFFFFFFFFFFFFFF".
Set buffer "plaintext" to hex value "FFFFFFFFFFFFFFFF".
Set buffer "ciphertext" to hex value "7359B2163E4EDC58".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         518


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case  2

Set buffer "keytext" to hex value "3000000000000000".
Set buffer "plaintext" to hex value "1000000000000001".
Set buffer "ciphertext" to hex value "958E6E627A05557B".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 

Baldwin         Informational, Expires 12/25/1999         519


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         520


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case  3

Set buffer "keytext" to hex value "1111111111111111".
Set buffer "plaintext" to hex value "1111111111111111".
Set buffer "ciphertext" to hex value "F40379AB9E0EC533".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         521


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case  4

Set buffer "keytext" to hex value "0123456789ABCDEF".
Set buffer "plaintext" to hex value "1111111111111111".
Set buffer "ciphertext" to hex value "17668DFC7292532D".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 

Baldwin         Informational, Expires 12/25/1999         522


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         523


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case  5

Set buffer "keytext" to hex value "1111111111111111".
Set buffer "plaintext" to hex value "0123456789ABCDEF".
Set buffer "ciphertext" to hex value "8A5AE1F81AB8F2DD".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         524


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case  6

Set buffer "keytext" to hex value "0000000000000000".
Set buffer "plaintext" to hex value "0000000000000000".
Set buffer "ciphertext" to hex value "8CA64DE9C1B123A7".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".

Baldwin         Informational, Expires 12/25/1999         525


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         526


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case  7

Set buffer "keytext" to hex value "FEDCBA9876543210".
Set buffer "plaintext" to hex value "0123456789ABCDEF".
Set buffer "ciphertext" to hex value "ED39D950FA74BCC4".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         527


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case  8

Set buffer "keytext" to hex value "7CA110454A1A6E57".
Set buffer "plaintext" to hex value "01A1D6D039776742".
Set buffer "ciphertext" to hex value "690F5B0D9A26939B".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 

Baldwin         Informational, Expires 12/25/1999         528


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         529


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case  9

Set buffer "keytext" to hex value "0131D9619DC1376E".
Set buffer "plaintext" to hex value "5CD54CA83DEF57DA".
Set buffer "ciphertext" to hex value "7A389D10354BD271".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         530


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 10

Set buffer "keytext" to hex value "07A1133E4A0B2686".
Set buffer "plaintext" to hex value "0248D43806F67172".
Set buffer "ciphertext" to hex value "868EBB51CAB4599A".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".

Baldwin         Informational, Expires 12/25/1999         531


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         532


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 11

Set buffer "keytext" to hex value "3849674C2602319E".
Set buffer "plaintext" to hex value "51454B582DDF440A".
Set buffer "ciphertext" to hex value "7178876E01F19B2A".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".

Baldwin         Informational, Expires 12/25/1999         533


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 12

Set buffer "keytext" to hex value "04B915BA43FEB5B6".
Set buffer "plaintext" to hex value "42FD443059577FA2".
Set buffer "ciphertext" to hex value "AF37FB421F8C4095".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         534


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".

Baldwin         Informational, Expires 12/25/1999         535


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 13

Set buffer "keytext" to hex value "0113B970FD34F2CE".
Set buffer "plaintext" to hex value "059B5E0851CF143A".
Set buffer "ciphertext" to hex value "86A560F10EC6D85B".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 

Baldwin         Informational, Expires 12/25/1999         536


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 14

Set buffer "keytext" to hex value "0170F175468FB5E6".
Set buffer "plaintext" to hex value "0756D8E0774761D2".
Set buffer "ciphertext" to hex value "0CD3DA020021DC09".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         537


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 

Baldwin         Informational, Expires 12/25/1999         538


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 15

Set buffer "keytext" to hex value "43297FAD38E373FE".
Set buffer "plaintext" to hex value "762514B829BF486A".
Set buffer "ciphertext" to hex value "EA676B2CB7DB2B7A".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Baldwin         Informational, Expires 12/25/1999         539


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 16

Set buffer "keytext" to hex value "07A7137045DA2A16".
Set buffer "plaintext" to hex value "3BDD119049372802".
Set buffer "ciphertext" to hex value "DFD64A815CAF1A0F".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         540


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Baldwin         Informational, Expires 12/25/1999         541


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 17

Set buffer "keytext" to hex value "04689104C2FD3B2F".
Set buffer "plaintext" to hex value "26955F6835AF609A".
Set buffer "ciphertext" to hex value "5C513C9C4886C088".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".


Baldwin         Informational, Expires 12/25/1999         542


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 18

Set buffer "keytext" to hex value "37D06BB516CB7546".
Set buffer "plaintext" to hex value "164D5E404F275232".
Set buffer "ciphertext" to hex value "0A2AEEAE3FF4AB77".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 

Baldwin         Informational, Expires 12/25/1999         543


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".

Baldwin         Informational, Expires 12/25/1999         544


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 19

Set buffer "keytext" to hex value "1F08260D1AC2465E".
Set buffer "plaintext" to hex value "6B056E18759F5CCA".
Set buffer "ciphertext" to hex value "EF1BF03E5DFA575A".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 

Baldwin         Informational, Expires 12/25/1999         545


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 20

Set buffer "keytext" to hex value "584023641ABA6176".
Set buffer "plaintext" to hex value "004BD6EF09176062".
Set buffer "ciphertext" to hex value "88BF0DB6D70DEE56".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         546


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         547


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 21

Set buffer "keytext" to hex value "025816164629B007".
Set buffer "plaintext" to hex value "480D39006EE762F2".
Set buffer "ciphertext" to hex value "A1F9915541020B56".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         548


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 22

Set buffer "keytext" to hex value "49793EBC79B3258F".
Set buffer "plaintext" to hex value "437540C8698F3CFA".
Set buffer "ciphertext" to hex value "6FBF1CAFCFFD0556".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         549


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         550


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 23

Set buffer "keytext" to hex value "4FB05E1515AB73A7".
Set buffer "plaintext" to hex value "072D43A077075292".
Set buffer "ciphertext" to hex value "2F22E49BAB7CA1AC".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         551


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 24

Set buffer "keytext" to hex value "49E95D6D4CA229BF".
Set buffer "plaintext" to hex value "02FE55778117F12A".
Set buffer "ciphertext" to hex value "5A6B612CC26CCE4A".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         552


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         553


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: -------------------------------------------------------
Note: Test case 25

Set buffer "keytext" to hex value "018310DC409B26D6".
Set buffer "plaintext" to hex value "1D9D5C5018F728C2".
Set buffer "ciphertext" to hex value "5F4C038ED12B2E41".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         554


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 26

Set buffer "keytext" to hex value "1C587F1C13924FEF".
Set buffer "plaintext" to hex value "305532286D6F295A".
Set buffer "ciphertext" to hex value "63FAC0D034D9F793".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         555


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Baldwin         Informational, Expires 12/25/1999         556


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: -------------------------------------------------------
Note: Test case 27

Set buffer "keytext" to hex value "0101010101010101".
Set buffer "plaintext" to hex value "0123456789ABCDEF".
Set buffer "ciphertext" to hex value "617B3A0CE8F07100".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         557


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 28

Set buffer "keytext" to hex value "1F1F1F1F0E0E0E0E".
Set buffer "plaintext" to hex value "0123456789ABCDEF".
Set buffer "ciphertext" to hex value "DB958605F8C8C606".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 

Baldwin         Informational, Expires 12/25/1999         558


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------

Baldwin         Informational, Expires 12/25/1999         559


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Test case 29

Set buffer "keytext" to hex value "E0FEE0FEF1FEF1FE".
Set buffer "plaintext" to hex value "0123456789ABCDEF".
Set buffer "ciphertext" to hex value "EDBFD1C66C29CCC7".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 

Baldwin         Informational, Expires 12/25/1999         560


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 30

Set buffer "keytext" to hex value "0000000000000000".
Set buffer "plaintext" to hex value "FFFFFFFFFFFFFFFF".
Set buffer "ciphertext" to hex value "355550B2150E2451".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         561


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 31

Baldwin         Informational, Expires 12/25/1999         562


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Set buffer "keytext" to hex value "FFFFFFFFFFFFFFFF".
Set buffer "plaintext" to hex value "0000000000000000".
Set buffer "ciphertext" to hex value "CAAAAF4DEAF1DBAE".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         563


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 32

Set buffer "keytext" to hex value "0123456789ABCDEF".
Set buffer "plaintext" to hex value "0000000000000000".
Set buffer "ciphertext" to hex value "D5D44FF720683D0D".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 

Baldwin         Informational, Expires 12/25/1999         564


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Test case 33


Baldwin         Informational, Expires 12/25/1999         565


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set buffer "keytext" to hex value "FEDCBA9876543210".
Set buffer "plaintext" to hex value "FFFFFFFFFFFFFFFF".
Set buffer "ciphertext" to hex value "2A2BB008DF97C2F2".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 

Baldwin         Informational, Expires 12/25/1999         566


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: Cleanup

Call Call B_DestroyAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



This is the end of test case "TVDSECN0".
This is the start of test case "TVDXCBN0".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Test vectors for AI_FeedbackCipher using DESX with CBC 
Note: without padding.
Note: Assuming that DESX CBC is tested elsewhere, just test the
Note: input and output whitening mechanism.

Note: Depends on:
Note: - AI_FeedbackCipher

Note: Test cases:

Baldwin         Informational, Expires 12/25/1999         567


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: - Check single block matching DES and DESX keys for zero 
Note: IV.
Note: - Check single block DESX result against DES for non-zero
Note: input whitening.
Note: - Check single block DESX result against DES for non-zero
Note: output whitening.
Note: - Check single block DESX result against DES for non-zero
Note: input and output whitening (not equal to each other).
Note: - Test vector for input of length 16 and non-zero	I&O 
Note: whitening.
Note: - Test vector for input of length 24 and non-zero	I&O 
Note: whitening.

Note: -------------------------------------------------------

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_DES_ENCRYPT", "AM_DESX_ENCRYPT", 
"AM_DESX_DECRYPT", "AM_CBC_ENCRYPT", "AM_CBC_DECRYPT", 
"NULL_PTR".



Note: Setup data objects

Create buffer "keytext" of decimal value "100" bytes.
Create buffer "keytextDES" of decimal value "100" bytes.
Create buffer "plaintext" of decimal value "100" bytes.
Create buffer "plaintextDES" of decimal value "100" bytes.
Create buffer "ciphertext" of decimal value "100" bytes.
Create buffer "ciphertextDES" of decimal value "100" bytes.
Create buffer "encryptedtext" of decimal value "100" bytes.
Create buffer "encryptedtextDES" of decimal value "100" bytes.
Create buffer "decryptedtext" of decimal value "100" bytes.

Note: -------------------------------------------------------

Note: Setup algorithm objects.

Create algorithm object "encrypter".
Call B_CreateAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "encrypterDES".
Call B_CreateAlgorithmObject passing "encrypterDES".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decrypter".
Call B_CreateAlgorithmObject passing "decrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         568


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "desx", "0", "cbc", 
"0000000000000000", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encrypter" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des", "0", "cbc", 
"0000000000000000", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encrypterDES" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "desx", "0", "cbc", 
"0000000000000000", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decrypter" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: - Check single block matching DES and DESX keys for zero 
Note: IV.

Set buffer "plaintext" to hex value "0248D43806F67172".
Set buffer "keytext" to hex value "07A1133E4A0B26860000000000000
0000000000000000000".
Set buffer "ciphertext" to hex value "868EBB51CAB4599A".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Call Call B_EncryptInit passing "encrypter" and "key" and 

Baldwin         Informational, Expires 12/25/1999         569


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".



Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 

Baldwin         Informational, Expires 12/25/1999         570


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: - Check single block DESX result against DES for non-zero
Note: input whitening.

Set buffer "keytextDES" to hex value "07A1133E4A0B2686".
Set buffer "keytext" to hex value "07A1133E4A0B26860100000010F08
E400000000000000000".
Set buffer "plaintext" to hex value "0248D43806F67172".
Set buffer "plaintextDES" to hex value "0348D4381606FF32".

Note: Compute result using plain DES

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keytextDES".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encrypterDES" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypterDES" and address of next 
free byte in buffer "encryptedtextDES" and address of 
"_OutputLen" and length of free bytes in buffer 
"encryptedtextDES" and address of first initialized byte in 
buffer "plaintextDES" and length of initialized bytes in buffer 
"plaintextDES" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtextDES" by "_OutputLen".
Call B_EncryptFinal passing "encrypterDES" and address of next 
free byte in buffer "encryptedtextDES" and address of 
"_OutputLen" and length of free bytes in buffer 
"encryptedtextDES" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         571


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Increment length of buffer "encryptedtextDES" by "_OutputLen".
Finalize buffer "encryptedtextDES".
Display buffer "encryptedtextDES".

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "encryptedtextDES".




Baldwin         Informational, Expires 12/25/1999         572


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: - Check single block DESX result against DES for non-zero
Note: output whitening.

Set buffer "keytextDES" to hex value "07A1133E4A0B2686".
Set buffer "keytext" to hex value "07A1133E4A0B26860000000000000
0000100000010F08E40".
Set buffer "plaintext" to hex value "0248D43806F67172".
Set buffer "plaintextDES" to hex value "0248D43806F67172".
Set buffer "ciphertextDES" to hex value "868ebb51cab4599a".
Set buffer "ciphertextDES" to hex value "878ebb51da44d7da".

Note: Compute result using plain DES

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keytextDES".

Baldwin         Informational, Expires 12/25/1999         573


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encrypterDES" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypterDES" and address of next 
free byte in buffer "encryptedtextDES" and address of 
"_OutputLen" and length of free bytes in buffer 
"encryptedtextDES" and address of first initialized byte in 
buffer "plaintextDES" and length of initialized bytes in buffer 
"plaintextDES" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtextDES" by "_OutputLen".
Call B_EncryptFinal passing "encrypterDES" and address of next 
free byte in buffer "encryptedtextDES" and address of 
"_OutputLen" and length of free bytes in buffer 
"encryptedtextDES" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtextDES" by "_OutputLen".
Finalize buffer "encryptedtextDES".
Display buffer "encryptedtextDES".

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         574


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertextDES".



Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".

Baldwin         Informational, Expires 12/25/1999         575


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: - Check single block DESX result against DES for non-zero
Note: input and output whitening (not equal to each other).

Set buffer "keytextDES" to hex value "07A1133E4A0B2686".
Set buffer "keytext" to hex value "07A1133E4A0B26861001010101010
1100001020408102040".
Set buffer "plaintext" to hex value "0248D43806F67172".
Set buffer "plaintextDES" to hex value "1249D53907F77062".
Set buffer "ciphertextDES" to hex value "0d461502f0e8bd06".
Set buffer "ciphertextDES" to hex value "0d471706f8f89d46".

Note: Compute result using plain DES

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keytextDES".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encrypterDES" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypterDES" and address of next 
free byte in buffer "encryptedtextDES" and address of 
"_OutputLen" and length of free bytes in buffer 
"encryptedtextDES" and address of first initialized byte in 
buffer "plaintextDES" and length of initialized bytes in buffer 
"plaintextDES" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtextDES" by "_OutputLen".
Call B_EncryptFinal passing "encrypterDES" and address of next 
free byte in buffer "encryptedtextDES" and address of 
"_OutputLen" and length of free bytes in buffer 
"encryptedtextDES" and "NULL_PTR" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         576


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtextDES" by "_OutputLen".
Finalize buffer "encryptedtextDES".
Display buffer "encryptedtextDES".

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertextDES".

Baldwin         Informational, Expires 12/25/1999         577


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999




Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: - Test vector for input of length 16 and non-zero	I&O 
Note: whitening.

Set buffer "keytext" to hex value "07A1133E4A0B26861001010101010
1100001020408102040".
Set buffer "plaintext" to hex value "0248D43806F6717207A1133E4A0
B2686".
Set buffer "ciphertext" to hex value "0d471706f8f89d46ea5f3c3bb9
a8d600".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keytext".

Baldwin         Informational, Expires 12/25/1999         578


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".



Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         579


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: - Test vector for input of length 24 and non-zero	I&O 
Note: whitening.

Set buffer "keytext" to hex value "07A1133E4A0B26861001010101010
1100001020408102040".
Set buffer "plaintext" to hex value "0248D43806F6717207A1133E4A0
B26861001010101010110".
Set buffer "ciphertext" to hex value "0d471706f8f89d46ea5f3c3bb9
a8d600b445c8d722d91e3e".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 

Baldwin         Informational, Expires 12/25/1999         580


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".



Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------

Baldwin         Informational, Expires 12/25/1999         581


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Cleanup



This is the end of test case "TVDXCBN0".
This is the start of test case "TVDXCBN1".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector test for Cipher Block Feedback using DESX and CBC 
Note: feedback methods 
Note: without padding, based on tvdsx100 vectors.

Note: ----------------------------------------------------------
Note: ----------
Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_DESX_ENCRYPT", "AM_DESX_DECRYPT", 
"AM_CBC_ENCRYPT", "AM_CBC_DECRYPT", "NULL_PTR".



Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1


Create buffer "input" of decimal value "24" bytes.
Create buffer "output" of decimal value "24" bytes.
Create buffer "unput" of decimal value "24" bytes.

Create buffer "ciphertext" of decimal value "24" bytes.
Create buffer "keyData" of decimal value "24" bytes.
Create buffer "plaintext" of decimal value "24" bytes.

Note: Fill out data objects

Set buffer "keyData" to hex value "07A1133E4A0B26861001010101010
1100001020408102040".
Set buffer "ciphertext" to hex value "0d471706f8f89d46".
Set buffer "plaintext" to hex value "0248D43806F67172".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 

Baldwin         Informational, Expires 12/25/1999         582


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.



Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "desx", "0", "cbc", 
"0000000000000000", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext".

Note: Decrypt.


Baldwin         Informational, Expires 12/25/1999         583


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "desx", "0", "cbc", 
"0000000000000000", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key object.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: Fill out data objects using vectors for 16 byte input 

Baldwin         Informational, Expires 12/25/1999         584


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: data.

Set buffer "keyData" to hex value "07A1133E4A0B26861001010101010
1100001020408102040".
Set buffer "plaintext" to hex value "0248D43806F6717207A1133E4A0
B2686".
Set buffer "ciphertext" to hex value "0d471706f8f89d46ea5f3c3bb9
a8d600".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.




Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext".

Baldwin         Informational, Expires 12/25/1999         585


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Decrypt.



Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key object.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: Fill out data objects using vectors for 24 byte input 
Note: data.

Set buffer "keyData" to hex value "07A1133E4A0B26861001010101010
1100001020408102040".
Set buffer "plaintext" to hex value "0248D43806F6717207A1133E4A0
B26861001010101010110".
Set buffer "ciphertext" to hex value "0d471706f8f89d46ea5f3c3bb9
a8d600b445c8d722d91e3e".

Create key object "key".

Baldwin         Informational, Expires 12/25/1999         586


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.



Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext".

Note: Decrypt.



Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 

Baldwin         Informational, Expires 12/25/1999         587


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key object.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Note: ----------------------------------------------------------
Note: ----------
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TVDXCBN1".
This is the start of test case "TVDXCBP0".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".



Baldwin         Informational, Expires 12/25/1999         588


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Test vectors for AI_FeedbackCipher using DESX with CBC 
Note: and padding
Note: Assuming that DESX CBC is tested elsewhere, just test the
Note: padding mechanism.

Note: Depends on:
Note: AI_FeedbackCipher

Note: Test cases:
Note: - For 8 byte input, first block matches DESX_CBC of input
Note: and the second byte decrypts to eight bytes of 0x08.
Note: - For inputs ranging from 0 to 16 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Note: -------------------------------------------------------
Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_DESX_ENCRYPT", "AM_DESX_DECRYPT", 
"AM_CBC_ENCRYPT", "AM_CBC_DECRYPT", "NULL_PTR".



Note: Setup data objects

Create buffer "keytext" of decimal value "100" bytes.
Create buffer "plaintext" of decimal value "100" bytes.
Create buffer "ciphertext1" of decimal value "100" bytes.
Create buffer "ivector" of decimal value "100" bytes.
Create buffer "encryptedtext" of decimal value "100" bytes.
Create buffer "decryptedtext" of decimal value "100" bytes.

Set buffer "keytext" to hex value "07A1133E4A0B26861001010101010
1100001020408102040".
Set buffer "plaintext" to hex value "0248D43806F67172".
Set buffer "ciphertext1" to hex value "0d471706f8f89d46".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Note: -------------------------------------------------------
Note: Setup	Key object 

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         589


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------

Note: Setup algorithm objects.

Create algorithm object "encrypter".
Call B_CreateAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decrypter".
Call B_CreateAlgorithmObject passing "decrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptNoPad".
Call B_CreateAlgorithmObject passing "decryptNoPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "desx", "0", "cbc", 
"0000000000000000", "pad", "NULL".
Call B_SetAlgorithmInfo passing "encrypter" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "desx", "0", "cbc", 
"0000000000000000", "pad", "NULL".
Call B_SetAlgorithmInfo passing "decrypter" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "desx", "0", "cbc", 
"0000000000000000", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptNoPad" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.




Call Call B_EncryptInit passing "encrypter" and "key" and 

Baldwin         Informational, Expires 12/25/1999         590


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Call Call B_DecryptInit passing "decryptNoPad" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: - For 8 byte input, first block matches DESX_CBC of input
Note: and the second byte decrypts to eight bytes of 0x08.

Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"0d471706f8f89d464d1a007258539f4e".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         591


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"0248D43806F671720808080808080808".

Set length of buffer "encryptedtext" to decimal value "8".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext1".
Set length of buffer "decryptedtext" to decimal value "8".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Note: -------------------------------------------------------
Note: Setup plaintext array

Set buffer "plaintext" to hex value "010203040506070809101112131
41516".

Note: -------------------------------------------------------
Note: - For input of length 16 bytes, check that

Baldwin         Informational, Expires 12/25/1999         592


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "16".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"f960bce55663bb42f58d04a7c82d2c0ebfe0986d529aa3fc".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         593


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"010203040506070809101112131415160808080808080808".

Note: -------------------------------------------------------
Note: - For input of length 15 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "15".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"f960bce55663bb4278fbaa5fdcea59ef".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         594


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"01020304050607080910111213141501".

Note: -------------------------------------------------------
Note: - For input of length 14 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "14".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 

Baldwin         Informational, Expires 12/25/1999         595


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"f960bce55663bb42eb9a0665761fe635".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 

Baldwin         Informational, Expires 12/25/1999         596


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"01020304050607080910111213140202".

Note: -------------------------------------------------------
Note: - For input of length 13 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "13".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"f960bce55663bb429819a65ef7d68172".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 

Baldwin         Informational, Expires 12/25/1999         597


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"01020304050607080910111213030303".

Note: -------------------------------------------------------
Note: - For input of length 12 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "12".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         598


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"f960bce55663bb42b173d53943062561".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".

Baldwin         Informational, Expires 12/25/1999         599


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of buffer "decryptedtext" with hex value 
"01020304050607080910111204040404".

Note: -------------------------------------------------------
Note: - For input of length 11 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "11".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"f960bce55663bb42a6bacd5952a8545e".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 

Baldwin         Informational, Expires 12/25/1999         600


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"01020304050607080910110505050505".

Note: -------------------------------------------------------
Note: - For input of length 10 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "10".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 

Baldwin         Informational, Expires 12/25/1999         601


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"f960bce55663bb421ae704b9a596a02a".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"01020304050607080910060606060606".

Note: -------------------------------------------------------
Note: - For input of length 09 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.


Baldwin         Informational, Expires 12/25/1999         602


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set length of buffer "plaintext" to decimal value "09".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"f960bce55663bb42678873de204738e7".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         603


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"01020304050607080907070707070707".

Note: -------------------------------------------------------
Note: - For input of length 08 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "08".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"f960bce55663bb420440c32cc313e99e".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         604


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"01020304050607080808080808080808".

Note: -------------------------------------------------------
Note: - For input of length 07 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "07".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         605


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"8d190aa85805810a".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         606


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"0102030405060701".

Note: -------------------------------------------------------
Note: - For input of length  6 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "6".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"7e0b278857bae309".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         607


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"0102030405060202".

Note: -------------------------------------------------------
Note: - For input of length  5 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "5".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         608


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"efb2c11df5851d38".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"0102030405030303".

Note: -------------------------------------------------------
Note: - For input of length  4 bytes, check that

Baldwin         Informational, Expires 12/25/1999         609


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "4".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"cac9a1f1e979e1ff".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 

Baldwin         Informational, Expires 12/25/1999         610


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"0102030404040404".

Note: -------------------------------------------------------
Note: - For input of length  3 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "3".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"3baa090e6eeea244".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 

Baldwin         Informational, Expires 12/25/1999         611


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"0102030505050505".

Note: -------------------------------------------------------
Note: - For input of length  2 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "2".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 

Baldwin         Informational, Expires 12/25/1999         612


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"20a0cad833dcd868".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         613


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"0102060606060606".

Note: -------------------------------------------------------
Note: - For input of length  1 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "1".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"bce4fde9fdc2990c".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         614


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 
"0107070707070707".

Note: -------------------------------------------------------
Note: - For input of length  0 bytes, check that
Note: - Encrypt and Decrypt are inverses.
Note: - Cipher text is the expected value.
Note: - Padding bytes have the expected value.

Set length of buffer "plaintext" to decimal value "0".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 

Baldwin         Informational, Expires 12/25/1999         615


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with hex value 
"70943a5611926ece".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Call B_DecryptUpdate passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "encryptedtext" and length 
of initialized bytes in buffer "encryptedtext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decryptNoPad" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Display buffer "decryptedtext".
Check equality of buffer "decryptedtext" with hex value 

Baldwin         Informational, Expires 12/25/1999         616


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"0808080808080808".

Note: -------------------------------------------------------
Note: Cleanup



This is the end of test case "TVDXCBP0".
This is the start of test case "TVR2CBN0".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector test for Cipher Block Feedback using RC2 with CBC 
Note: and no padding.

Note: ----------------------------------------------------------
Note: ----------

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_RC2_ENCRYPT", "AM_RC2_DECRYPT", 
"AM_CBC_ENCRYPT", "AM_CBC_DECRYPT", "NULL_PTR".



Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Using the given input data, encrypt it and compare cipher 
Note: text with test
Note: vector, decrypt that output and
Note: compare the decryption result with the original input. 

Create buffer "input" of decimal value "8" bytes.
Create buffer "output" of decimal value "16" bytes.
Create buffer "unput" of decimal value "8" bytes.

Create buffer "keyData" of decimal value "20" bytes.
Set buffer "keyData" to hex value "0000000000000000".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         617


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create buffer "ciphertext1" of decimal value "20" bytes.
Set buffer "ciphertext1" to hex value "ebb773f993278eff".
Create buffer "plaintext" of decimal value "20" bytes.
Set buffer "plaintext" to hex value "0000000000000000".


Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc2", "64", "cbc", 
"0000000000000000", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext1".

Note: Decrypt.


Baldwin         Informational, Expires 12/25/1999         618


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc2", "64", "cbc", 
"0000000000000000", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".

Baldwin         Informational, Expires 12/25/1999         619


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TVR2CBN0".
This is the start of test case "TVR5CBN0".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector test for Cipher Block Feedback using RC5 and CBC 
Note: feedback methods.

Note: ----------------------------------------------------------
Note: ----------

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_RC5_ENCRYPT", "AM_RC5_DECRYPT", 
"AM_CBC_ENCRYPT", "AM_CBC_DECRYPT", "NULL_PTR".



Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Encrypt given text and compare cipher text against test 
Note: vector, 
Note: decrypt cipher text compare the decryption result with 
Note: the original input.

Create buffer "input" of decimal value "8" bytes.
Create buffer "output" of decimal value "16" bytes.
Create buffer "unput" of decimal value "8" bytes.

Create buffer "keyData" of decimal value "20" bytes.
Set buffer "keyData" to hex value "00000000000000000000000000000
000".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         620


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create buffer "ciphertext1" of decimal value "20" bytes.
Set buffer "ciphertext1" to hex value "21a5dbee154b8f6d".
Create buffer "plaintext" of decimal value "20" bytes.
Set buffer "plaintext" to hex value "0000000000000000".


Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5", "1", "12", "32", 
"cbc", "0000000000000000", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Baldwin         Informational, Expires 12/25/1999         621


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of buffer "output" with contents of buffer 
"ciphertext1".

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5", "1", "12", "32", 
"cbc", "0000000000000000", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         622


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TVR5CBN0".
This is the start of test case "TVR5ECB1".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional test for Cipher Block Feedback using RC5 and 
Note: ECB feedback methods.

Note: ----------------------------------------------------------
Note: ----------

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_MD5_RANDOM", "AM_RC5_ENCRYPT", 
"AM_RC5_DECRYPT", "AM_ECB_ENCRYPT", "AM_ECB_DECRYPT", 
"NULL_PTR".



Note: Use the following random object throughout.

Create algorithm object "random".
Call B_CreateAlgorithmObject passing "random".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "random" and "AI_MD5Random" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "random" and "_Chooser" and 
"_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         623


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create buffer "seed" of decimal value "8" bytes.
Set buffer "seed" to hex value "1122".
Call B_RandomUpdate passing "random" and address of first 
initialized byte in "seed" and length of initialized bytes in 
"seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Generate random input data, encrypt it, decrypt that 
Note: output and
Note: compare the decryption result with the original input. Do 
Note: this with
Note: various round counts and word sizes.

Create buffer "input" of decimal value "8" bytes.
Create buffer "output" of decimal value "16" bytes.
Create buffer "unput" of decimal value "8" bytes.

Create buffer "keyData" of decimal value "20" bytes.
Set buffer "keyData" to hex value "00000000000000000000000000000
000".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create buffer "ciphertext1" of decimal value "20" bytes.
Set buffer "ciphertext1" to hex value "21a5dbee154b8f6d".
Create buffer "plaintext" of decimal value "20" bytes.
Set buffer "plaintext" to hex value "0000000000000000".


Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".

Baldwin         Informational, Expires 12/25/1999         624


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5", "1", "12", "32", 
"ecb", "8", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".
Check equality of buffer "output" with contents of buffer 
"ciphertext1".

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "rc5", "1", "12", "32", 
"ecb", "8", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         625


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".

Note: Check the result.

Check equality of buffer "plaintext" with contents of buffer 
"unput".

Note: Destroy the key, encryption and decryption objects.

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------
This is the end of test case "TVR5ECB1".
This is the start of test case "TF3CBRI0".

Baldwin         Informational, Expires 12/25/1999         626


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional test for Cipher Block Feedback using Triple 
Note: DES together with CBC
Note: and no padding. Additional test for reinitialization 
Note: function.
Note: Run same test but with padding and slightly altered 
Note: inputs.

Note: ----------------------------------------------------------
Note: ----------

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_EDE_ENCRYPT", "AM_EDE_DECRYPT", 
"AM_CFB_ENCRYPT", "AM_CFB_DECRYPT", "NULL_PTR".



Note: ----------------------------------------------------------
Note: ----------

Note: Test 01-1

Note: Use input data, encrypt it, decrypt that output and
Note: compare the decryption result with the original input. 
Note: But encrypt data in two parts testing the 
Note: reinitialization function.

Create buffer "output" of decimal value "80" bytes.
Create buffer "output1" of decimal value "80" bytes.
Create buffer "output2" of decimal value "80" bytes.
Create buffer "unput" of decimal value "80" bytes.
Create buffer "unput1" of decimal value "80" bytes.

Create buffer "keyData" of decimal value "24" bytes.
Set buffer "keyData" to hex value "0123456789ABCDEF23456789ABCDE
F01456789ABCDEF0123".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         627


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: Encrypt.

Create buffer "plaintext" of decimal value "80" bytes.
Set buffer "plaintext" with string value "Now is the time ".
Create buffer "plaintext1" of decimal value "80" bytes.
Set buffer "plaintext1" with string value "for all ".



Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", "cbc", 
"1234567890ABCDEF", "nopad", "NULL_PTR".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Set "_InfoPointer" to address of info structure for 
"AI_RESET_IV" initialized from "00000000EFAB23EF".
Call B_SetAlgorithmInfo passing "encryptObj" and "AI_RESET_IV" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         628


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Finalize buffer "output".

Note: Reset iv and encrypt tail



Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output1" and address of "_OutputLen" and 
length of free bytes in buffer "output1" and address of first 
initialized byte in buffer "plaintext1" and length of 
initialized bytes in buffer "plaintext1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output1" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output1" and address of "_OutputLen" and 
length of free bytes in buffer "output1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output1" by "_OutputLen".
Finalize buffer "output1".
Display buffer "output1".

Note: Use encryptObj2 to simulate the resetting and compare 
Note: results



Create algorithm object "encryptObj2".
Call B_CreateAlgorithmObject passing "encryptObj2".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", "cbc", 
"00000000EFAB23EF", "nopad", "NULL_PTR".
Call B_SetAlgorithmInfo passing "encryptObj2" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj2" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         629


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj2" and address of next 
free byte in buffer "output2" and address of "_OutputLen" and 
length of free bytes in buffer "output2" and address of first 
initialized byte in buffer "plaintext1" and length of 
initialized bytes in buffer "plaintext1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output2" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj2" and address of next 
free byte in buffer "output2" and address of "_OutputLen" and 
length of free bytes in buffer "output2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output2" by "_OutputLen".
Finalize buffer "output2".
Check equality of buffer "output1" with contents of buffer 
"output2".

Note: Decrypt.



Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", "cbc", 
"1234567890ABCDEF", "nopad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 
bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         630


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".


Set "_InfoPointer" to address of info structure for 
"AI_RESET_IV" initialized from "00000000EFAB23EF".
Call B_SetAlgorithmInfo passing "decryptObj" and "AI_RESET_IV" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".
Check equality of buffer "unput" with contents of buffer 
"plaintext".

Note: Reset iv and decrypt tail



Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput1" and address of "_OutputLen" and 
length of free bytes in buffer "unput1" and address of first 
initialized byte in buffer "output1" and length of initialized 
bytes in buffer "output1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput1" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput1" and address of "_OutputLen" and 
length of free bytes in buffer "unput1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput1" by "_OutputLen".
Finalize buffer "unput1".
Display buffer "unput1".
Check equality of buffer "unput1" with contents of buffer 

Baldwin         Informational, Expires 12/25/1999         631


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"plaintext1".


Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj2".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------

Note: ----------------------------------------------------------
Note: ----------

Note: Test 02-1

Note: Use input data, encrypt it, decrypt that output and
Note: compare the decryption result with the original input. 
Note: But encrypt data in two parts testing the 
Note: reinitialization function.

Create buffer "output" of decimal value "80" bytes.
Create buffer "output1" of decimal value "80" bytes.
Create buffer "output2" of decimal value "80" bytes.
Create buffer "unput" of decimal value "80" bytes.
Create buffer "unput1" of decimal value "80" bytes.

Create buffer "keyData" of decimal value "24" bytes.
Set buffer "keyData" to hex value "0123456789ABCDEF23456789ABCDE
F01456789ABCDEF0123".
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 

Baldwin         Informational, Expires 12/25/1999         632


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized from contents of buffer "keyData".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Encrypt.

Create buffer "plaintext" of decimal value "80" bytes.
Set buffer "plaintext" with string value "Now is the ti".
Create buffer "plaintext1" of decimal value "80" bytes.
Set buffer "plaintext1" with string value "me for all ".
Create algorithm object "encryptObj".
Call B_CreateAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", "cbc", 
"1234567890ABCDEF", "pad", "NULL_PTR".
Call B_SetAlgorithmInfo passing "encryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and address of first 
initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Set "_InfoPointer" to address of info structure for 
"AI_RESET_IV" initialized from "00000000EFAB23EF".
Call B_SetAlgorithmInfo passing "encryptObj" and "AI_RESET_IV" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output" and address of "_OutputLen" and 
length of free bytes in buffer "output" and "NULL_PTR" and 

Baldwin         Informational, Expires 12/25/1999         633


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output" by "_OutputLen".
Finalize buffer "output".

Note: Reset iv and encrypt tail

Call Call B_EncryptInit passing "encryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj" and address of next 
free byte in buffer "output1" and address of "_OutputLen" and 
length of free bytes in buffer "output1" and address of first 
initialized byte in buffer "plaintext1" and length of 
initialized bytes in buffer "plaintext1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output1" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj" and address of next 
free byte in buffer "output1" and address of "_OutputLen" and 
length of free bytes in buffer "output1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output1" by "_OutputLen".
Finalize buffer "output1".
Display buffer "output1".

Note: Use encryptObj2 to simulate the resetting and compare 
Note: results

Create algorithm object "encryptObj2".
Call B_CreateAlgorithmObject passing "encryptObj2".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", "cbc", 
"00000000EFAB23EF", "pad", "NULL_PTR".
Call B_SetAlgorithmInfo passing "encryptObj2" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         634


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_EncryptInit passing "encryptObj2" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encryptObj2" and address of next 
free byte in buffer "output2" and address of "_OutputLen" and 
length of free bytes in buffer "output2" and address of first 
initialized byte in buffer "plaintext1" and length of 
initialized bytes in buffer "plaintext1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output2" by "_OutputLen".
Call B_EncryptFinal passing "encryptObj2" and address of next 
free byte in buffer "output2" and address of "_OutputLen" and 
length of free bytes in buffer "output2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output2" by "_OutputLen".
Finalize buffer "output2".
Check equality of buffer "output1" with contents of buffer 
"output2".

Note: Decrypt.

Create algorithm object "decryptObj".
Call B_CreateAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Set "_InfoPointer" to address of info structure for 
"AI_FeedbackCipher" initialized from "des_ede", "8", "cbc", 
"1234567890ABCDEF", "pad", "NULL".
Call B_SetAlgorithmInfo passing "decryptObj" and 
"AI_FeedbackCipher" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and address of first 
initialized byte in buffer "output" and length of initialized 

Baldwin         Informational, Expires 12/25/1999         635


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

bytes in buffer "output" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".


Set "_InfoPointer" to address of info structure for 
"AI_RESET_IV" initialized from "00000000EFAB23EF".
Call B_SetAlgorithmInfo passing "decryptObj" and "AI_RESET_IV" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput" and address of "_OutputLen" and 
length of free bytes in buffer "unput" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput" by "_OutputLen".
Finalize buffer "unput".
Check equality of buffer "unput" with contents of buffer 
"plaintext".

Note: Reset iv and decrypt tail

Call Call B_DecryptInit passing "decryptObj" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decryptObj" and address of next 
free byte in buffer "unput1" and address of "_OutputLen" and 
length of free bytes in buffer "unput1" and address of first 
initialized byte in buffer "output1" and length of initialized 
bytes in buffer "output1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput1" by "_OutputLen".
Call B_DecryptFinal passing "decryptObj" and address of next 
free byte in buffer "unput1" and address of "_OutputLen" and 
length of free bytes in buffer "unput1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "unput1" by "_OutputLen".
Finalize buffer "unput1".
Display buffer "unput1".

Baldwin         Informational, Expires 12/25/1999         636


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of buffer "unput1" with contents of buffer 
"plaintext1".


Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "encryptObj2".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: ----------------------------------------------------------
Note: ----------


Note: ----------------------------------------------------------
Note: ----------

This is the end of test case "TF3CBRI0".
This is the start of test case "TERC2C00".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Error tests of AI_RC2_CBC

Note: Depends on:
Note: - KI_Item
Note: - KI_8Byte
Note: - KI_DES8
Note: - KI_RSAPublic

Note: Test cases
Note: - Check for NO error: BE_INPUT_LEN if input length is 
Note: zero.
Note: - Check for error: BE_INPUT_LEN from EncryptFinal for
Note: input lengths of 0, 7, 9.
Note: - Check for error: BE_INPUT_LEN from DecryptFinal for
Note: input lengths of 0, 7, 9.
Note: - Check for BE_OUTPUT_LEN error from En/DecryptUpdate.
Note: - Check for NO error: BE_OUTPUT_LEN for En/DecryptFinal

Baldwin         Informational, Expires 12/25/1999         637


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: - Check for error: BE_ALGORITHM_ALREADY_SET
Note: - Check for error: BE_ALGORITHM_NOT_INITIALIZED 
Note: - Check for error: BE_ALGORITHM_NOT_SET 
Note: - Check for error: BE_WRONG_KEY_INFO (public key) 
Note: - Check for error: BE_METHOD_NOT_IN_CHOOSER
Note: - Check for error: BE_KEY_NOT_SET 
Note: - Check for error: BE_KEY_ALREADY_SET 
Note: - Check for error: BE_KEY_OBJ and BE_ALGORITHM_NOT_INITIAL
Note: IZED
Note: - Check for error: BE_NOT_SUPPORTED (0 and 300 byte key)
Note: - Check for error: BE_NOT_SUPPORTED (0 and 3000 bit 
Note: effective keysize)

Note: Not testable: 
Note: - Check for error: BE_WRONG_ALGORITHM_INFO 
Note: - Check for error: BE_KEY_LEN 
Note: - Check for error: BE_DATA 
Note: - Check for error: BE_NOT_INITIALIZED 
Note: - Check for error: BE_INPUT_COUNT 
Note: - Check for error: BE_OUTPUT_COUNT

Note: To do:
Note: - Add tests using the CreateNull operations
Note: - Add out of memory error testing, should only effect 
Note: Init.

Note: -------------------------------------------------------
Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_RC2_CBC_ENCRYPT", "AM_RC2_CBC_DECRYPT", 
"NULL_PTR".


Note: Setup data objects

Create buffer "keytext" of decimal value "100" bytes.
Create buffer "plaintext" of decimal value "100" bytes.
Create buffer "input" of decimal value "100" bytes.
Create buffer "output" of decimal value "100" bytes.
Create buffer "ciphertext" of decimal value "100" bytes.
Create buffer "ivector" of decimal value "100" bytes.
Create buffer "encryptedtext" of decimal value "100" bytes.
Create buffer "decryptedtext" of decimal value "100" bytes.
Create buffer "onebytelong" of decimal value "1" bytes.

Note: -------------------------------------------------------

Note: Setup algorithm objects.

Create algorithm object "encrypter".
Call B_CreateAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         638


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Create algorithm object "decrypter".
Call B_CreateAlgorithmObject passing "decrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set buffer "ivector" to hex value "0001101001101011".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC" initialized from "128", contents of buffer 
"ivector".
Call B_SetAlgorithmInfo passing "encrypter" and "AI_RC2_CBC" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC" initialized from "128", contents of buffer 
"ivector".
Call B_SetAlgorithmInfo passing "decrypter" and "AI_RC2_CBC" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from "0102030405060708".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: - Check for no BE_INPUT_LEN error if input length is 
Note: zero.

Set buffer "input" to hex value "".
Call B_EncryptUpdate passing "encrypter" and address of next 

Baldwin         Informational, Expires 12/25/1999         639


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Finalize buffer "ciphertext".
Check equality of buffer "ciphertext" with hex value "".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Finalize buffer "ciphertext".
Check equality of buffer "ciphertext" with hex value "".

Note: -------------------------------------------------------
Note: - Check for BE_INPUT_LEN error from En/DecryptFinal for
Note: input lengths of 1, 7, 9.

Note: Input length is 1

Set buffer "input" to hex value "01".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "NULL_PTR" and 

Baldwin         Informational, Expires 12/25/1999         640


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Set "_ExpectedStatus" to "BE_INPUT_LEN".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Finalize buffer "ciphertext".
Display buffer "ciphertext".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Set "_ExpectedStatus" to "BE_INPUT_LEN".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Finalize buffer "ciphertext".
Display buffer "ciphertext".

Note: Input length is 7

Set buffer "input" to hex value "01020304050607".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Set "_ExpectedStatus" to "BE_INPUT_LEN".

Baldwin         Informational, Expires 12/25/1999         641


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Finalize buffer "ciphertext".
Display buffer "ciphertext".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Set "_ExpectedStatus" to "BE_INPUT_LEN".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Finalize buffer "ciphertext".
Display buffer "ciphertext".

Note: Input length is 9 

Set buffer "input" to hex value "010203040506070809".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Set "_ExpectedStatus" to "BE_INPUT_LEN".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         642


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Finalize buffer "ciphertext".
Display buffer "ciphertext".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Set "_ExpectedStatus" to "BE_INPUT_LEN".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Finalize buffer "ciphertext".
Display buffer "ciphertext".

Note: -------------------------------------------------------
Note: Check for error: BE_OUTPUT_LEN for En/DecryptUpdate

Set buffer "input" to hex value "112233445566778899".
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_OUTPUT_LEN".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "onebytelong" and address of "_OutputLen" 
and length of free bytes in buffer "onebytelong" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "onebytelong" by "_OutputLen".
Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_OUTPUT_LEN".

Baldwin         Informational, Expires 12/25/1999         643


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "onebytelong" and address of "_OutputLen" 
and length of free bytes in buffer "onebytelong" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "onebytelong" by "_OutputLen".

Note: -------------------------------------------------------
Note: Check for NO error: BE_OUTPUT_LEN for En/DecryptFinal
Note: Since CBC mode w/o padding does not hang onto bytes,
Note: there is never any output for En/DecryptFinal.
Note: Before BSafe 2.5 this could produce an error because
Note: the CBC routines would always buffer 8 bytes.

Set buffer "input" to hex value "1122334455667788112233445566778
8".
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "onebytelong" and address of "_OutputLen" 
and length of free bytes in buffer "onebytelong" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "onebytelong" by "_OutputLen".
Finalize buffer "onebytelong".
Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and address of 
first initialized byte in buffer "input" and length of 

Baldwin         Informational, Expires 12/25/1999         644


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized bytes in buffer "input" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Call B_DecryptFinal passing "encrypter" and address of next 
free byte in buffer "onebytelong" and address of "_OutputLen" 
and length of free bytes in buffer "onebytelong" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "onebytelong" by "_OutputLen".
Finalize buffer "onebytelong".

Note: -------------------------------------------------------
Note: - Check for error: BE_ALGORITHM_ALREADY_SET

Set "_ExpectedStatus" to "BE_ALGORITHM_ALREADY_SET".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC" initialized from "128", contents of buffer 
"ivector".
Call B_SetAlgorithmInfo passing "encrypter" and "AI_RC2_CBC" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: - Check for error: BE_ALGORITHM_NOT_INITIALIZED

Call Call B_DestroyAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "encrypter".
Call B_CreateAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC" initialized from "128", contents of buffer 
"ivector".
Call B_SetAlgorithmInfo passing "encrypter" and "AI_RC2_CBC" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         645


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create algorithm object "decrypter".
Call B_CreateAlgorithmObject passing "decrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC" initialized from "128", contents of buffer 
"ivector".
Call B_SetAlgorithmInfo passing "decrypter" and "AI_RC2_CBC" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_ALGORITHM_NOT_INITIALIZED".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Set "_ExpectedStatus" to "BE_ALGORITHM_NOT_INITIALIZED".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "onebytelong" and address of "_OutputLen" 
and length of free bytes in buffer "onebytelong" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "onebytelong" by "_OutputLen".
Finalize buffer "onebytelong".
Set "_ExpectedStatus" to "BE_ALGORITHM_NOT_INITIALIZED".
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Set "_ExpectedStatus" to "BE_ALGORITHM_NOT_INITIALIZED".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "onebytelong" and address of "_OutputLen" 
and length of free bytes in buffer "onebytelong" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         646


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Increment length of buffer "onebytelong" by "_OutputLen".
Finalize buffer "onebytelong".

Note: -------------------------------------------------------
Note: - Check for error: BE_ALGORITHM_NOT_SET

Call Call B_DestroyAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "encrypter".
Call B_CreateAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decrypter".
Call B_CreateAlgorithmObject passing "decrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_ALGORITHM_NOT_SET".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and "encrypter" 
and "AI_RC2_CBC".
Display info structure for "AI_RC2_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_ALGORITHM_NOT_SET".
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_ALGORITHM_NOT_SET".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Set "_ExpectedStatus" to "BE_ALGORITHM_NOT_SET".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "onebytelong" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         647


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "onebytelong" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "onebytelong" by "_OutputLen".
Finalize buffer "onebytelong".
Set "_ExpectedStatus" to "BE_ALGORITHM_NOT_SET".
Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_ALGORITHM_NOT_SET".
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Set "_ExpectedStatus" to "BE_ALGORITHM_NOT_SET".
Call B_DecryptFinal passing "encrypter" and address of next 
free byte in buffer "onebytelong" and address of "_OutputLen" 
and length of free bytes in buffer "onebytelong" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "onebytelong" by "_OutputLen".
Finalize buffer "onebytelong".

Note: -------------------------------------------------------
Note: - Check for error: BE_WRONG_KEY_INFO

Call Call B_DestroyAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "encrypter".
Call B_CreateAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC" initialized from "128", contents of buffer 

Baldwin         Informational, Expires 12/25/1999         648


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"ivector".
Call B_SetAlgorithmInfo passing "encrypter" and "AI_RC2_CBC" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"KI_RSAPublic" initialized from "11", "22".
Call B_SetKeyInfo passing "key" and "KI_RSAPublic" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_WRONG_KEY_INFO".
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_WRONG_KEY_INFO".
Call Call B_DecryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_DestroyAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: - Check for error: BE_METHOD_NOT_IN_CHOOSER

Set "_Chooser" to "AM_MD2", "NULL_PTR".
Create algorithm object "encrypter".
Call B_CreateAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC" initialized from "128", contents of buffer 
"ivector".
Call B_SetAlgorithmInfo passing "encrypter" and "AI_RC2_CBC" 

Baldwin         Informational, Expires 12/25/1999         649


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from "0102030405060708".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_METHOD_NOT_IN_CHOOSER".
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_METHOD_NOT_IN_CHOOSER".
Call Call B_DecryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Note: Now, reset the Chooser to Default Chooser values.
Set "_Chooser" to DEMO_ALGORITHM_CHOOSER.

Note: -------------------------------------------------------
Note: - Check for error: BE_KEY_NOT_SET

Call Call B_DestroyAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "encrypter".
Call B_CreateAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC" initialized from "128", contents of buffer 
"ivector".
Call B_SetAlgorithmInfo passing "encrypter" and "AI_RC2_CBC" 
and "_InfoPointer".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         650


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_KEY_NOT_SET".
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_KEY_NOT_SET".
Call Call B_DecryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: - Check for error: BE_KEY_ALREADY_SET

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_DES8" 
initialized from "0102030405060708".
Call B_SetKeyInfo passing "key" and "KI_DES8" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_KEY_ALREADY_SET".
Set "_InfoPointer" to address of info structure for "KI_DES8" 
initialized from "0102030405060708".
Call B_SetKeyInfo passing "key" and "KI_DES8" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: - Check for error: BE_KEY_OBJ and BE_ALGORITHM_NOT_INITIAL
Note: IZED

Call Call B_DestroyAlgorithmObject passing "encrypter".

Baldwin         Informational, Expires 12/25/1999         651


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "encrypter".
Call B_CreateAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC" initialized from "128", contents of buffer 
"ivector".
Call B_SetAlgorithmInfo passing "encrypter" and "AI_RC2_CBC" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decrypter".
Call B_CreateAlgorithmObject passing "decrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC" initialized from "128", contents of buffer 
"ivector".
Call B_SetAlgorithmInfo passing "decrypter" and "AI_RC2_CBC" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_KEY_OBJ".
Call Call B_EncryptInit passing "encrypter" and "decrypter" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_ALGORITHM_NOT_INITIALIZED".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Set "_ExpectedStatus" to "BE_ALGORITHM_NOT_INITIALIZED".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         652


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "ciphertext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Finalize buffer "ciphertext".
Set "_ExpectedStatus" to "BE_KEY_OBJ".
Call Call B_DecryptInit passing "decrypter" and "encrypter" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_ALGORITHM_NOT_INITIALIZED".
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and address of 
first initialized byte in buffer "input" and length of 
initialized bytes in buffer "input" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Set "_ExpectedStatus" to "BE_ALGORITHM_NOT_INITIALIZED".
Call B_DecryptFinal passing "encrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Finalize buffer "ciphertext".

Note: -------------------------------------------------------
Note: - Check for error: BE_KEY_LEN on zero and 300 byte keys

Call Call B_DestroyAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "encrypter".
Call B_CreateAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC" initialized from "128", contents of buffer 
"ivector".
Call B_SetAlgorithmInfo passing "encrypter" and "AI_RC2_CBC" 
and "_InfoPointer".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         653


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Zero length key

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized fromRC2_CBC".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_NOT_SUPPORTED".
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_NOT_SUPPORTED".
Call Call B_DecryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: 300 byte key

Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from "0102030405060708091011121314151617181920212223
2425262728293001020304050607080910111213141516171819202122232425
2627282930010203040506070809101112131415161718192021222324252627
2829300102030405060708091011121314151617181920212223242526272829
3001020304050607080910111213141516171819202122232425262728293001
0203040506070809101112131415161718192021222324252627282930010203
0405060708091011121314151617181920212223242526272829300102030405

Baldwin         Informational, Expires 12/25/1999         654


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

0607080910111213141516171819202122232425262728293001020304050607
0809101112131415161718192021222324252627282930010203040506070809
101112131415161718192021222324252627282930".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_NOT_SUPPORTED".
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_NOT_SUPPORTED".
Call Call B_DecryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: - Check for error: BE_NOT_SUPPORTED (0 and 3000 bit 
Note: effective keysize)

Call Call B_DestroyAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "encrypter".
Call B_CreateAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Zero length effective key size

Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC" initialized from "0", contents of buffer "ivector".
Call B_SetAlgorithmInfo passing "encrypter" and "AI_RC2_CBC" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         655


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from "01020304050607080910".
Call B_SetKeyInfo passing "key" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_NOT_SUPPORTED".
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedStatus" to "BE_NOT_SUPPORTED".
Call Call B_DecryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_DestroyAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "encrypter".
Call B_CreateAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: 3000 bit effective key size

Set "_ExpectedStatus" to "BE_ALGORITHM_INFO".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC" initialized from "3000", contents of buffer 
"ivector".
Call B_SetAlgorithmInfo passing "encrypter" and "AI_RC2_CBC" 
and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from "01020304050607080910".
Call B_SetKeyInfo passing "key" and "KI_Item" and 

Baldwin         Informational, Expires 12/25/1999         656


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Note: NextExpectedError (BE_NOT_SUPPORTED)
Note: EncryptInit (encrypter, key)
Note: NextExpectedError (BE_NOT_SUPPORTED)
Note: DecryptInit (encrypter, key)
Note: -------------------------------------------------------
Note: Cleanup



This is the end of test case "TERC2C00".
This is the start of test case "TFCIV800".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector test for AI_CBC_IV8 corresponding to 
Note: AI_DES_CBC_IV8, AI_DES_CBCPadBER, AI_DES_CBCPadIV8, 
Note: AI_DES_CBCPadPEM

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_DES_CBC_ENCRYPT", "AM_DES_CBC_DECRYPT", 
"NULL_PTR".


Create buffer "inputData" of decimal value "100" bytes.
Create buffer "cypherText" of decimal value "100" bytes.
Create buffer "plainText" of decimal value "100" bytes.
Create buffer "iv" of decimal value "8" bytes.
Create buffer "newiv" of decimal value "8" bytes.
Create buffer "key" of decimal value "8" bytes.

Set buffer "inputData" to hex value "000102030405060708091011121
314151617181920212223".
Set buffer "iv" to hex value "0011223344556677".
Set buffer "newiv" to hex value "7766554433221100".
Set buffer "key" to hex value "1234567890123456".

Note: global key object

Create key object "keyObj".
Call B_CreateKeyObject passing "keyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "key".
Call B_SetKeyInfo passing "keyObj" and "KI_Item" and 

Baldwin         Informational, Expires 12/25/1999         657


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case: AI_DES_CBC_IV8

Note: Case 0: Check the output of the base algorithm

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_DES_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_DES_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBC_IV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBC_IV8".
Check equality of info structure for "AI_DES_CBC_IV8" with 
expected info structure for "AI_DES_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBC_IV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBC_IV8".

Baldwin         Informational, Expires 12/25/1999         658


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of info structure for "AI_DES_CBC_IV8" with 
expected info structure for "AI_DES_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"ee213f0eb081e4f0dffbff5462293364779769731295aa59".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         659


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: use the initial iv

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_DES_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_DES_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBC_IV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBC_IV8".
Check equality of info structure for "AI_DES_CBC_IV8" with 
expected info structure for "AI_DES_CBC_IV8".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         660


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBC_IV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBC_IV8".
Check equality of info structure for "AI_DES_CBC_IV8" with 
expected info structure for "AI_DES_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"5363cdc050bc40e578a1f1c5c3b8d9e39960a03ec7ded8ef".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 

Baldwin         Informational, Expires 12/25/1999         661


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 2: give the new iv to the algorithm; however, the 
Note: encryption 
Note: and decryption operation still use the iv from 
Note: AI_DES_CBC_IV8
Note: since final already calls.

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBC_IV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBC_IV8".
Check equality of info structure for "AI_DES_CBC_IV8" with 
expected info structure for "AI_DES_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 

Baldwin         Informational, Expires 12/25/1999         662


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

structure for "AI_DES_CBC_IV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBC_IV8".
Check equality of info structure for "AI_DES_CBC_IV8" with 
expected info structure for "AI_DES_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"5363cdc050bc40e578a1f1c5c3b8d9e39960a03ec7ded8ef".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         663


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 3: Final was call, so the new iv will start taking 
Note: effect;
Note: therefore, the algorithm will return with the new iv

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBC_IV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBC_IV8".
Check equality of info structure for "AI_DES_CBC_IV8" with 
expected info structure for "AI_DES_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBC_IV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBC_IV8".
Check equality of info structure for "AI_DES_CBC_IV8" with 
expected info structure for "AI_DES_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         664


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"ee213f0eb081e4f0dffbff5462293364779769731295aa59".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: case 4: Set the algorithm with the new IV like case 2, 
Note: but now calling the
Note: init right away.  The new iv will take effect right away. 

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         665


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBC_IV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBC_IV8".
Check equality of info structure for "AI_DES_CBC_IV8" with 
expected info structure for "AI_DES_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBC_IV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBC_IV8".
Check equality of info structure for "AI_DES_CBC_IV8" with 
expected info structure for "AI_DES_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".

Baldwin         Informational, Expires 12/25/1999         666


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of buffer "cypherText" with hex value 
"5363cdc050bc40e578a1f1c5c3b8d9e39960a03ec7ded8ef".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case: AI_DES_CBCPadIV8

Note: Case 0: Check the output of the base algorithm

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_DES_CBCPadIV8" and "_InfoPointer".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         667


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_DES_CBCPadIV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadBER".

Baldwin         Informational, Expires 12/25/1999         668


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"7766554433221100"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"7766554433221100"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         669


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"ee213f0eb081e4f0dffbff5462293364779769731295aa591301f0c35115731
1".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: use the initial iv

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         670


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_DES_CBCPadIV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_DES_CBCPadIV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 

Baldwin         Informational, Expires 12/25/1999         671


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 

Baldwin         Informational, Expires 12/25/1999         672


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"5363cdc050bc40e578a1f1c5c3b8d9e39960a03ec7ded8ef4256b062c4dd9fd
e".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 2: give the new iv to the algorithm; however, the 
Note: encryption 
Note: and decryption operation still use the initial iv
Note: since final already calls.

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         673


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 

Baldwin         Informational, Expires 12/25/1999         674


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"5363cdc050bc40e578a1f1c5c3b8d9e39960a03ec7ded8ef4256b062c4dd9fd

Baldwin         Informational, Expires 12/25/1999         675


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

e".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 3: Final was call, so the new iv will start taking 
Note: effect;
Note: therefore, the algorithm will return with the new iv

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 

Baldwin         Informational, Expires 12/25/1999         676


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"7766554433221100"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"7766554433221100"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 

Baldwin         Informational, Expires 12/25/1999         677


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"ee213f0eb081e4f0dffbff5462293364779769731295aa591301f0c35115731
1".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: case 4: Set the algorithm with the new IV like case 2, 
Note: but now calling the
Note: init right away.  The new iv will take effect right away. 

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         678


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from contents of 
buffer "iv".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from contents of 
buffer "iv".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".

Baldwin         Informational, Expires 12/25/1999         679


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         680


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"5363cdc050bc40e578a1f1c5c3b8d9e39960a03ec7ded8ef4256b062c4dd9fd
e".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case: AI_DES_CBCPadBER

Note: Case 1: use the initial iv

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         681


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER" initialized from "301106052b0e030207040800112
23344556677".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_DES_CBCPadBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER" initialized from "301106052b0e030207040800112
23344556677".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_DES_CBCPadBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadIV8".

Baldwin         Informational, Expires 12/25/1999         682


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Baldwin         Informational, Expires 12/25/1999         683


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"5363cdc050bc40e578a1f1c5c3b8d9e39960a03ec7ded8ef4256b062c4dd9fd
e".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 2: give the new iv to the algorithm; however, the 
Note: encryption 
Note: and decryption operation still use the initial iv
Note: since final already calls.


Baldwin         Informational, Expires 12/25/1999         684


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 

Baldwin         Informational, Expires 12/25/1999         685


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         686


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"5363cdc050bc40e578a1f1c5c3b8d9e39960a03ec7ded8ef4256b062c4dd9fd
e".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 3: Final was call, so the new iv will start taking 
Note: effect;
Note: therefore, the algorithm will return with the new iv

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         687


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"7766554433221100"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"7766554433221100"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Baldwin         Informational, Expires 12/25/1999         688


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"ee213f0eb081e4f0dffbff5462293364779769731295aa591301f0c35115731
1".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: case 4: Set the algorithm with the new IV like case 2, 
Note: but now calling the
Note: init right away.  The new iv will take effect right away. 

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 

Baldwin         Informational, Expires 12/25/1999         689


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 

Baldwin         Informational, Expires 12/25/1999         690


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"encryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         691


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"5363cdc050bc40e578a1f1c5c3b8d9e39960a03ec7ded8ef4256b062c4dd9fd
e".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case: AI_DES_CBCPadPEM

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         692


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_DES_CBCPadPEM" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_DES_CBCPadPEM" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 

Baldwin         Informational, Expires 12/25/1999         693


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"encryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: use the initial iv

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".
Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 

Baldwin         Informational, Expires 12/25/1999         694


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"5363cdc050bc40e578a1f1c5c3b8d9e39960a03ec7ded8ef4256b062c4dd9fd
e".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 2: give the new iv to the algorithm; however, the 
Note: encryption 
Note: and decryption operation still use the initial iv

Baldwin         Informational, Expires 12/25/1999         695


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: since final already calls.

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         696


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         697


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"5363cdc050bc40e578a1f1c5c3b8d9e39960a03ec7ded8ef4256b062c4dd9fd
e".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 3: Final was call, so the new iv will start taking 
Note: effect;
Note: therefore, the algorithm will return with the new iv

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 

Baldwin         Informational, Expires 12/25/1999         698


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"7766554433221100"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"7766554433221100"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Baldwin         Informational, Expires 12/25/1999         699


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"ee213f0eb081e4f0dffbff5462293364779769731295aa591301f0c35115731
1".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: case 4: Set the algorithm with the new IV like case 2, 
Note: but now calling the
Note: init right away.  The new iv will take effect right away. 

Set "_InfoPointer" to address of info structure for 

Baldwin         Informational, Expires 12/25/1999         700


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadBER" initialized from 
"301106052b0e03020704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadBER".
Check equality of info structure for "AI_DES_CBCPadBER" with 
expected info structure for "AI_DES_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 

Baldwin         Informational, Expires 12/25/1999         701


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadIV8".
Check equality of info structure for "AI_DES_CBCPadIV8" with 
expected info structure for "AI_DES_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_CBCPadPEM" initialized from "DES-CBC", 
"0011223344556677"".
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_CBCPadPEM".
Check equality of info structure for "AI_DES_CBCPadPEM" with 
expected info structure for "AI_DES_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         702


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"5363cdc050bc40e578a1f1c5c3b8d9e39960a03ec7ded8ef4256b062c4dd9fd
e".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.





This is the end of test case "TFCIV800".
This is the start of test case "TFCIV801".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         703


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector test for AI_CBC_IV8 corresponding to 
Note: AI_RC2_CBC, AI_RC2_CBCPadBER, AI_RC2_CBCPad, 
Note: AI_RC2_CBCPadPEM

Note: -------------------------------------------------------

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_RC2_CBC_ENCRYPT", "AM_RC2_CBC_DECRYPT", 
"NULL_PTR".



Note: Initialize, set up data

Create buffer "inputData" of decimal value "100" bytes.
Create buffer "cypherText" of decimal value "100" bytes.
Create buffer "plainText" of decimal value "100" bytes.
Create buffer "iv" of decimal value "8" bytes.
Create buffer "newiv" of decimal value "8" bytes.
Create buffer "key" of decimal value "8" bytes.

Note: vector data

Set buffer "inputData" to hex value "000102030405060708091011121
314151617181920212223".
Set buffer "iv" to hex value "0011223344556677".
Set buffer "newiv" to hex value "7766554433221100".
Set buffer "key" to hex value "1234567890123456".

Note: global key object

Create key object "keyObj".
Call B_CreateKeyObject passing "keyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "key".
Call B_SetKeyInfo passing "keyObj" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: Case: AI_RC2_CBC

Note: Case 0: Check the output of the base algorithm

Baldwin         Informational, Expires 12/25/1999         704


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC" initialized from "32", contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_RC2_CBC" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC" initialized from "32", contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_RC2_CBC" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBC" initialized from "32", 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBC".
Check equality of info structure for "AI_RC2_CBC" with expected 
info structure for "AI_RC2_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBC" initialized from "32", 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBC".
Check equality of info structure for "AI_RC2_CBC" with expected 
info structure for "AI_RC2_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         705


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"ada134f25ba7e0281cbe461f05491f1cc08e67d3aea1f190".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".


Baldwin         Informational, Expires 12/25/1999         706


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: use the initial iv

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC" initialized from "32", contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_RC2_CBC" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC" initialized from "32", contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_RC2_CBC" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBC" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBC".
Check equality of info structure for "AI_RC2_CBC" with expected 
info structure for "AI_RC2_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBC" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC".

Baldwin         Informational, Expires 12/25/1999         707


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBC".
Check equality of info structure for "AI_RC2_CBC" with expected 
info structure for "AI_RC2_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"d08502e791f56b76535055800911b4d6724ecd8ee3e3443b".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         708


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 2: give the new iv to the algorithm; however, the 
Note: encryption 
Note: and decryption operation still use the iv from 
Note: AI_DES_CBC_IV8
Note: since final already calls.

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBC" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBC".
Check equality of info structure for "AI_RC2_CBC" with expected 
info structure for "AI_RC2_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBC" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBC".

Baldwin         Informational, Expires 12/25/1999         709


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of info structure for "AI_RC2_CBC" with expected 
info structure for "AI_RC2_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"d08502e791f56b76535055800911b4d6724ecd8ee3e3443b".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".


Baldwin         Informational, Expires 12/25/1999         710


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Case 3: Final was call, so the new iv will start taking 
Note: effect;
Note: therefore, the algorithm will return with the new iv

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBC" initialized from "32", 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBC".
Check equality of info structure for "AI_RC2_CBC" with expected 
info structure for "AI_RC2_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBC" initialized from "32", 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBC".
Check equality of info structure for "AI_RC2_CBC" with expected 
info structure for "AI_RC2_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"ada134f25ba7e0281cbe461f05491f1cc08e67d3aea1f190".

Baldwin         Informational, Expires 12/25/1999         711


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: case 4: Set the algorithm with the new IV like case 2, 
Note: but now calling the
Note: init right away.  The new iv will take effect right away. 

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Baldwin         Informational, Expires 12/25/1999         712


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBC" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBC".
Check equality of info structure for "AI_RC2_CBC" with expected 
info structure for "AI_RC2_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBC" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBC".
Check equality of info structure for "AI_RC2_CBC" with expected 
info structure for "AI_RC2_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"d08502e791f56b76535055800911b4d6724ecd8ee3e3443b".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 

Baldwin         Informational, Expires 12/25/1999         713


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case: AI_RC2_CBCPad

Note: Case 0: Check the output of the base algorithm

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad" initialized from "32", contents of buffer 
"newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_RC2_CBCPad" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad" initialized from "32", contents of buffer 
"newiv".

Baldwin         Informational, Expires 12/25/1999         714


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_RC2_CBCPad" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         715


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAh3ZlVEMyIRAA=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAh3ZlVEMyIRAA=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         716


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"ada134f25ba7e0281cbe461f05491f1cc08e67d3aea1f19084916f303c1453e
6".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: use the initial iv

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad" initialized from "32", contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 

Baldwin         Informational, Expires 12/25/1999         717


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_RC2_CBCPad" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad" initialized from "32", contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_RC2_CBCPad" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".

Baldwin         Informational, Expires 12/25/1999         718


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         719


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"d08502e791f56b76535055800911b4d6724ecd8ee3e3443b7e5f1c09a3e624a
9".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 2: give the new iv to the algorithm; however, the 
Note: encryption 
Note: and decryption operation still use the initial iv
Note: since final already calls.

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 

Baldwin         Informational, Expires 12/25/1999         720


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         721


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"d08502e791f56b76535055800911b4d6724ecd8ee3e3443b7e5f1c09a3e624a
9".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 

Baldwin         Informational, Expires 12/25/1999         722


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 3: Final was call, so the new iv will start taking 
Note: effect;
Note: therefore, the algorithm will return with the new iv

Note: Update the algorithm with new IV8

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204087766554433221100".

Baldwin         Informational, Expires 12/25/1999         723


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAh3ZlVEMyIRAA=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAh3ZlVEMyIRAA=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 

Baldwin         Informational, Expires 12/25/1999         724


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"ada134f25ba7e0281cbe461f05491f1cc08e67d3aea1f19084916f303c1453e
6".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: case 4: Set the algorithm with the new IV like case 2, 
Note: but now calling the
Note: init right away.  The new iv will take effect right away. 

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 

Baldwin         Informational, Expires 12/25/1999         725


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         726


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         727


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"d08502e791f56b76535055800911b4d6724ecd8ee3e3443b7e5f1c09a3e624a
9".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case: AI_RC2_CBCPadBER

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER" initialized from "301406082a864886f70d0302040

Baldwin         Informational, Expires 12/25/1999         728


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

80011223344556677".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_RC2_CBCPadBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER" initialized from "301406082a864886f70d0302040
80011223344556677".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_RC2_CBCPadBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 

Baldwin         Informational, Expires 12/25/1999         729


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"301406082a864886f70d030204080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: use the initial iv

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 

Baldwin         Informational, Expires 12/25/1999         730


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"d08502e791f56b76535055800911b4d6724ecd8ee3e3443b7e5f1c09a3e624a
9".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 2: give the new iv to the algorithm; however, the 
Note: encryption 
Note: and decryption operation still use the initial iv
Note: since final already calls.

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         731


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadBER".

Baldwin         Informational, Expires 12/25/1999         732


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"d08502e791f56b76535055800911b4d6724ecd8ee3e3443b7e5f1c09a3e624a
9".


Baldwin         Informational, Expires 12/25/1999         733


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 3: Final was call, so the new iv will start taking 
Note: effect;
Note: therefore, the algorithm will return with the new iv

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204087766554433221100".

Baldwin         Informational, Expires 12/25/1999         734


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAh3ZlVEMyIRAA=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAh3ZlVEMyIRAA=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 

Baldwin         Informational, Expires 12/25/1999         735


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"ada134f25ba7e0281cbe461f05491f1cc08e67d3aea1f19084916f303c1453e
6".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: case 4: Set the algorithm with the new IV like case 2, 
Note: but now calling the
Note: init right away.  The new iv will take effect right away. 

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 

Baldwin         Informational, Expires 12/25/1999         736


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         737


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         738


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"d08502e791f56b76535055800911b4d6724ecd8ee3e3443b7e5f1c09a3e624a
9".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case: AI_RC2_CBCPadPEM

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         739


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_RC2_CBCPadPEM" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_RC2_CBCPadPEM" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         740


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: use the initial iv

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Baldwin         Informational, Expires 12/25/1999         741


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"d08502e791f56b76535055800911b4d6724ecd8ee3e3443b7e5f1c09a3e624a
9".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 2: give the new iv to the algorithm; however, the 
Note: encryption 
Note: and decryption operation still use the initial iv
Note: since final already calls.


Set "_InfoPointer" to address of info structure for 

Baldwin         Informational, Expires 12/25/1999         742


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204080011223344556677".

Baldwin         Informational, Expires 12/25/1999         743


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         744


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"d08502e791f56b76535055800911b4d6724ecd8ee3e3443b7e5f1c09a3e624a
9".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 3: Final was call, so the new iv will start taking 
Note: effect;
Note: therefore, the algorithm will return with the new iv

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 

Baldwin         Informational, Expires 12/25/1999         745


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAh3ZlVEMyIRAA=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAh3ZlVEMyIRAA=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Baldwin         Informational, Expires 12/25/1999         746


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"ada134f25ba7e0281cbe461f05491f1cc08e67d3aea1f19084916f303c1453e
6".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: case 4: Set the algorithm with the new IV like case 2, 
Note: but now calling the
Note: init right away.  The new iv will take effect right away. 

Set "_InfoPointer" to address of info structure for 

Baldwin         Informational, Expires 12/25/1999         747


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPad" initialized from "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPad".
Check equality of info structure for "AI_RC2_CBCPad" with 
expected info structure for "AI_RC2_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204080011223344556677".
Set "_InfoPointer" to address of info structure for 

Baldwin         Informational, Expires 12/25/1999         748


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadBER" initialized from 
"301406082a864886f70d030204080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadBER".
Check equality of info structure for "AI_RC2_CBCPadBER" with 
expected info structure for "AI_RC2_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC2_CBCPadPEM" initialized from "RC2-CBC", 
"BAgAESIzRFVmdw=="".
Set "_InfoPointer" to address of info structure for 
"AI_RC2_CBCPadPEM".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC2_CBCPadPEM".
Check equality of info structure for "AI_RC2_CBCPadPEM" with 
expected info structure for "AI_RC2_CBCPadPEM".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         749


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"d08502e791f56b76535055800911b4d6724ecd8ee3e3443b7e5f1c09a3e624a
9".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         750


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



This is the end of test case "TFCIV801".
This is the start of test case "TFCIV802".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector test for AI_CBC_IV8 corresponding to 
Note: AI_DES_EDE3_CBC_IV8, AI_DES_EDE3_CBCPadBER, 
Note: AI_DES_EDE3_CBCPadIV8

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_DES_EDE3_CBC_ENCRYPT", 
"AM_DES_EDE3_CBC_DECRYPT", "NULL_PTR".


Note: Initialize, set up data

Create buffer "inputData" of decimal value "100" bytes.
Create buffer "cypherText" of decimal value "100" bytes.
Create buffer "plainText" of decimal value "100" bytes.
Create buffer "iv" of decimal value "8" bytes.
Create buffer "newiv" of decimal value "8" bytes.
Create buffer "key" of decimal value "24" bytes.

Note: vector data

Set buffer "inputData" to hex value "000102030405060708091011121
314151617181920212223".
Set buffer "iv" to hex value "0011223344556677".
Set buffer "newiv" to hex value "7766554433221100".
Set buffer "key" to hex value "112233445566778811223344556677881
122334455667788".

Note: global key object

Create key object "keyObj".
Call B_CreateKeyObject passing "keyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "key".

Baldwin         Informational, Expires 12/25/1999         751


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_SetKeyInfo passing "keyObj" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case: AI_DES_EDE3_CBC_IV8

Note: Case 0: Check the output of the base algorithm

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBC_IV8" initialized from contents of buffer 
"newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_DES_EDE3_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBC_IV8" initialized from contents of buffer 
"newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_DES_EDE3_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBC_IV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBC_IV8".
Check equality of info structure for "AI_DES_EDE3_CBC_IV8" with 
expected info structure for "AI_DES_EDE3_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBC_IV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 

Baldwin         Informational, Expires 12/25/1999         752


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_DES_EDE3_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBC_IV8".
Check equality of info structure for "AI_DES_EDE3_CBC_IV8" with 
expected info structure for "AI_DES_EDE3_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"3bd6e1d301a382e0f6dc9868c7a019ec470f379d9928148d".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         753


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: use the initial iv

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_DES_EDE3_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_DES_EDE3_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBC_IV8" initialized from 

Baldwin         Informational, Expires 12/25/1999         754


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBC_IV8".
Check equality of info structure for "AI_DES_EDE3_CBC_IV8" with 
expected info structure for "AI_DES_EDE3_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBC_IV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBC_IV8".
Check equality of info structure for "AI_DES_EDE3_CBC_IV8" with 
expected info structure for "AI_DES_EDE3_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         755


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"4c0ce7ea6e1fd7c57284b9d5de41e8aa00e1f61dd4537842".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 2: give the new iv to the algorithm; however, the 
Note: encryption 
Note: and decryption operation still use the iv from 
Note: AI_DES_CBC_IV8
Note: since final already calls.

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Baldwin         Informational, Expires 12/25/1999         756


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Update the algorithm with new IV8

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBC_IV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBC_IV8".
Check equality of info structure for "AI_DES_EDE3_CBC_IV8" with 
expected info structure for "AI_DES_EDE3_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBC_IV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBC_IV8".
Check equality of info structure for "AI_DES_EDE3_CBC_IV8" with 
expected info structure for "AI_DES_EDE3_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 

Baldwin         Informational, Expires 12/25/1999         757


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"4c0ce7ea6e1fd7c57284b9d5de41e8aa00e1f61dd4537842".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 3: Final was call, so the new iv will start taking 
Note: effect;
Note: therefore, the algorithm will return with the new iv

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBC_IV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBC_IV8".
Check equality of info structure for "AI_DES_EDE3_CBC_IV8" with 
expected info structure for "AI_DES_EDE3_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBC_IV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBC_IV8".
Check equality of info structure for "AI_DES_EDE3_CBC_IV8" with 
expected info structure for "AI_DES_EDE3_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Baldwin         Informational, Expires 12/25/1999         758


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"3bd6e1d301a382e0f6dc9868c7a019ec470f379d9928148d".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: case 4: Set the algorithm with the new IV like case 2, 
Note: but now calling the
Note: init right away.  The new iv will take effect right away. 

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         759


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBC_IV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBC_IV8".
Check equality of info structure for "AI_DES_EDE3_CBC_IV8" with 
expected info structure for "AI_DES_EDE3_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBC_IV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBC_IV8".
Check equality of info structure for "AI_DES_EDE3_CBC_IV8" with 
expected info structure for "AI_DES_EDE3_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".


Baldwin         Informational, Expires 12/25/1999         760


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"4c0ce7ea6e1fd7c57284b9d5de41e8aa00e1f61dd4537842".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Baldwin         Informational, Expires 12/25/1999         761


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Case: AI_DES_EDE3_CBCPadIV8

Note: Case 0: Check the output of the base algorithm

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8" initialized from contents of buffer 
"newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_DES_EDE3_CBCPadIV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8" initialized from contents of buffer 
"newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_DES_EDE3_CBCPadIV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBCPadIV8".
Check equality of info structure for "AI_DES_EDE3_CBCPadIV8" 
with expected info structure for "AI_DES_EDE3_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBCPadIV8".
Check equality of info structure for "AI_DES_EDE3_CBCPadIV8" 
with expected info structure for "AI_DES_EDE3_CBCPadIV8".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         762


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadBER" initialized from 
"301406082a864886f70d030704087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBCPadBER".
Check equality of info structure for "AI_DES_EDE3_CBCPadBER" 
with expected info structure for "AI_DES_EDE3_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadBER" initialized from 
"301406082a864886f70d030704087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBCPadBER".
Check equality of info structure for "AI_DES_EDE3_CBCPadBER" 
with expected info structure for "AI_DES_EDE3_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 

Baldwin         Informational, Expires 12/25/1999         763


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"3bd6e1d301a382e0f6dc9868c7a019ec470f379d9928148d1f7e7108b485ce3
2".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: use the initial iv

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         764


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8" initialized from contents of buffer 
"iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_DES_EDE3_CBCPadIV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8" initialized from contents of buffer 
"iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_DES_EDE3_CBCPadIV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBCPadIV8".
Check equality of info structure for "AI_DES_EDE3_CBCPadIV8" 
with expected info structure for "AI_DES_EDE3_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBCPadIV8".
Check equality of info structure for "AI_DES_EDE3_CBCPadIV8" 
with expected info structure for "AI_DES_EDE3_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadBER" initialized from 
"301406082a864886f70d030704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBCPadBER".
Check equality of info structure for "AI_DES_EDE3_CBCPadBER" 
with expected info structure for "AI_DES_EDE3_CBCPadBER".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         765


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadBER" initialized from 
"301406082a864886f70d030704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBCPadBER".
Check equality of info structure for "AI_DES_EDE3_CBCPadBER" 
with expected info structure for "AI_DES_EDE3_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 

Baldwin         Informational, Expires 12/25/1999         766


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"4c0ce7ea6e1fd7c57284b9d5de41e8aa00e1f61dd4537842f65661c5fc8021b
4".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 2: give the new iv to the algorithm; however, the 
Note: encryption 
Note: and decryption operation still use the iv from 
Note: AI_DES_CBC_IV8
Note: since final already calls.

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBCPadIV8".

Baldwin         Informational, Expires 12/25/1999         767


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of info structure for "AI_DES_EDE3_CBCPadIV8" 
with expected info structure for "AI_DES_EDE3_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBCPadIV8".
Check equality of info structure for "AI_DES_EDE3_CBCPadIV8" 
with expected info structure for "AI_DES_EDE3_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadBER" initialized from 
"301406082a864886f70d030704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBCPadBER".
Check equality of info structure for "AI_DES_EDE3_CBCPadBER" 
with expected info structure for "AI_DES_EDE3_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadBER" initialized from 
"301406082a864886f70d030704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBCPadBER".
Check equality of info structure for "AI_DES_EDE3_CBCPadBER" 
with expected info structure for "AI_DES_EDE3_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         768


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"4c0ce7ea6e1fd7c57284b9d5de41e8aa00e1f61dd4537842f65661c5fc8021b
4".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 3: Final was call, so the new iv will start taking 
Note: effect;
Note: therefore, the algorithm will return with the new iv

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBCPadIV8".
Check equality of info structure for "AI_DES_EDE3_CBCPadIV8" 
with expected info structure for "AI_DES_EDE3_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         769


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBCPadIV8".
Check equality of info structure for "AI_DES_EDE3_CBCPadIV8" 
with expected info structure for "AI_DES_EDE3_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadBER" initialized from 
"301406082a864886f70d030704087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBCPadBER".
Check equality of info structure for "AI_DES_EDE3_CBCPadBER" 
with expected info structure for "AI_DES_EDE3_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadBER" initialized from 
"301406082a864886f70d030704087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBCPadBER".
Check equality of info structure for "AI_DES_EDE3_CBCPadBER" 
with expected info structure for "AI_DES_EDE3_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 

Baldwin         Informational, Expires 12/25/1999         770


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"3bd6e1d301a382e0f6dc9868c7a019ec470f379d9928148d1f7e7108b485ce3
2".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: case 4: Set the algorithm with the new IV like case 2, 
Note: but now calling the
Note: init right away.  The new iv will take effect right away. 

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.




Baldwin         Informational, Expires 12/25/1999         771


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBCPadIV8".
Check equality of info structure for "AI_DES_EDE3_CBCPadIV8" 
with expected info structure for "AI_DES_EDE3_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBCPadIV8".
Check equality of info structure for "AI_DES_EDE3_CBCPadIV8" 
with expected info structure for "AI_DES_EDE3_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadBER" initialized from 
"301406082a864886f70d030704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBCPadBER".
Check equality of info structure for "AI_DES_EDE3_CBCPadBER" 
with expected info structure for "AI_DES_EDE3_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadBER" initialized from 
"301406082a864886f70d030704080011223344556677".
Set "_InfoPointer" to address of info structure for 

Baldwin         Informational, Expires 12/25/1999         772


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_DES_EDE3_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBCPadBER".
Check equality of info structure for "AI_DES_EDE3_CBCPadBER" 
with expected info structure for "AI_DES_EDE3_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"4c0ce7ea6e1fd7c57284b9d5de41e8aa00e1f61dd4537842f65661c5fc8021b
4".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         773


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case: AI_DES_EDE3_CBCPadBER

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadBER" initialized from "301406082a864886f70d03
0704080011223344556677".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_DES_EDE3_CBCPadBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadBER" initialized from "301406082a864886f70d03
0704080011223344556677".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_DES_EDE3_CBCPadBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBCPadIV8".
Check equality of info structure for "AI_DES_EDE3_CBCPadIV8" 
with expected info structure for "AI_DES_EDE3_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         774


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBCPadIV8".
Check equality of info structure for "AI_DES_EDE3_CBCPadIV8" 
with expected info structure for "AI_DES_EDE3_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadBER" initialized from 
"301406082a864886f70d030704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBCPadBER".
Check equality of info structure for "AI_DES_EDE3_CBCPadBER" 
with expected info structure for "AI_DES_EDE3_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadBER" initialized from 
"301406082a864886f70d030704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBCPadBER".
Check equality of info structure for "AI_DES_EDE3_CBCPadBER" 
with expected info structure for "AI_DES_EDE3_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: use the initial iv



Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         775


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"4c0ce7ea6e1fd7c57284b9d5de41e8aa00e1f61dd4537842f65661c5fc8021b
4".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 2: give the new iv to the algorithm; however, the 
Note: encryption 
Note: and decryption operation still use the iv from 

Baldwin         Informational, Expires 12/25/1999         776


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: AI_DES_CBC_IV8
Note: since final already calls.

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBCPadIV8".
Check equality of info structure for "AI_DES_EDE3_CBCPadIV8" 
with expected info structure for "AI_DES_EDE3_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBCPadIV8".
Check equality of info structure for "AI_DES_EDE3_CBCPadIV8" 
with expected info structure for "AI_DES_EDE3_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadBER" initialized from 
"301406082a864886f70d030704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBCPadBER".
Check equality of info structure for "AI_DES_EDE3_CBCPadBER" 
with expected info structure for "AI_DES_EDE3_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         777


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadBER" initialized from 
"301406082a864886f70d030704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBCPadBER".
Check equality of info structure for "AI_DES_EDE3_CBCPadBER" 
with expected info structure for "AI_DES_EDE3_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"4c0ce7ea6e1fd7c57284b9d5de41e8aa00e1f61dd4537842f65661c5fc8021b
4".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 

Baldwin         Informational, Expires 12/25/1999         778


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 3: Final was call, so the new iv will start taking 
Note: effect;
Note: therefore, the algorithm will return with the new iv

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBCPadIV8".
Check equality of info structure for "AI_DES_EDE3_CBCPadIV8" 
with expected info structure for "AI_DES_EDE3_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBCPadIV8".
Check equality of info structure for "AI_DES_EDE3_CBCPadIV8" 
with expected info structure for "AI_DES_EDE3_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadBER" initialized from 
"301406082a864886f70d030704087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBCPadBER".
Check equality of info structure for "AI_DES_EDE3_CBCPadBER" 
with expected info structure for "AI_DES_EDE3_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadBER" initialized from 
"301406082a864886f70d030704087766554433221100".
Set "_InfoPointer" to address of info structure for 

Baldwin         Informational, Expires 12/25/1999         779


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_DES_EDE3_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBCPadBER".
Check equality of info structure for "AI_DES_EDE3_CBCPadBER" 
with expected info structure for "AI_DES_EDE3_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"3bd6e1d301a382e0f6dc9868c7a019ec470f379d9928148d1f7e7108b485ce3
2".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         780


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: case 4: Set the algorithm with the new IV like case 2, 
Note: but now calling the
Note: init right away.  The new iv will take effect right away. 

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBCPadIV8".
Check equality of info structure for "AI_DES_EDE3_CBCPadIV8" 
with expected info structure for "AI_DES_EDE3_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadIV8" initialized from 
"0011223344556677".

Baldwin         Informational, Expires 12/25/1999         781


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBCPadIV8".
Check equality of info structure for "AI_DES_EDE3_CBCPadIV8" 
with expected info structure for "AI_DES_EDE3_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadBER" initialized from 
"301406082a864886f70d030704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DES_EDE3_CBCPadBER".
Check equality of info structure for "AI_DES_EDE3_CBCPadBER" 
with expected info structure for "AI_DES_EDE3_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DES_EDE3_CBCPadBER" initialized from 
"301406082a864886f70d030704080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DES_EDE3_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DES_EDE3_CBCPadBER".
Check equality of info structure for "AI_DES_EDE3_CBCPadBER" 
with expected info structure for "AI_DES_EDE3_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         782


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"4c0ce7ea6e1fd7c57284b9d5de41e8aa00e1f61dd4537842f65661c5fc8021b
4".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.




This is the end of test case "TFCIV802".
This is the start of test case "TFCIV803".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector test for AI_CBC_IV8 corresponding to 
Note: AI_DESX_CBC_IV8, AI_DESX_CBCPadBER, AI_DESX_CBCPadIV8

Note: -------------------------------------------------------


Baldwin         Informational, Expires 12/25/1999         783


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_DESX_CBC_ENCRYPT", "AM_DESX_CBC_DECRYPT", 
"NULL_PTR".







Note: Initialize, set up data

Create buffer "inputData" of decimal value "100" bytes.
Create buffer "cypherText" of decimal value "100" bytes.
Create buffer "plainText" of decimal value "100" bytes.
Create buffer "iv" of decimal value "8" bytes.
Create buffer "newiv" of decimal value "8" bytes.
Create buffer "key" of decimal value "24" bytes.

Note: vector data

Set buffer "inputData" to hex value "000102030405060708091011121
314151617181920212223".
Set buffer "iv" to hex value "0011223344556677".
Set buffer "newiv" to hex value "7766554433221100".
Set buffer "key" to hex value "112233445566778811223344556677881
122334455667788".

Note: global key object

Create key object "keyObj".
Call B_CreateKeyObject passing "keyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "key".
Call B_SetKeyInfo passing "keyObj" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case: AI_DESX_CBC_IV8

Note: Case 0: Check the output of the base algorithm

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         784


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_DESX_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_DESX_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBC_IV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBC_IV8".
Check equality of info structure for "AI_DESX_CBC_IV8" with 
expected info structure for "AI_DESX_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBC_IV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBC_IV8".
Check equality of info structure for "AI_DESX_CBC_IV8" with 
expected info structure for "AI_DESX_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         785


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"1df06d88215404ca6023d25142167e1ea6d8bd0fce5d3fb7".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         786


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: use the initial iv

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_DESX_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_DESX_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBC_IV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBC_IV8".
Check equality of info structure for "AI_DESX_CBC_IV8" with 
expected info structure for "AI_DESX_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBC_IV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBC_IV8".
Check equality of info structure for "AI_DESX_CBC_IV8" with 
expected info structure for "AI_DESX_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         787


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.






Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"3fe6e5475b08323ad7862f3a1680afe52ee2447f8f01b136".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         788


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 2: give the new iv to the algorithm; however, the 
Note: encryption 
Note: and decryption operation still use the iv from 
Note: AI_DES_CBC_IV8
Note: since final already calls.

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBC_IV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBC_IV8".
Check equality of info structure for "AI_DESX_CBC_IV8" with 
expected info structure for "AI_DESX_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBC_IV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBC_IV8".
Check equality of info structure for "AI_DESX_CBC_IV8" with 

Baldwin         Informational, Expires 12/25/1999         789


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

expected info structure for "AI_DESX_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"3fe6e5475b08323ad7862f3a1680afe52ee2447f8f01b136".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 3: Final was call, so the new iv will start taking 

Baldwin         Informational, Expires 12/25/1999         790


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: effect;
Note: therefore, the algorithm will return with the new iv

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBC_IV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBC_IV8".
Check equality of info structure for "AI_DESX_CBC_IV8" with 
expected info structure for "AI_DESX_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBC_IV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBC_IV8".
Check equality of info structure for "AI_DESX_CBC_IV8" with 
expected info structure for "AI_DESX_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"1df06d88215404ca6023d25142167e1ea6d8bd0fce5d3fb7".


Baldwin         Informational, Expires 12/25/1999         791


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: case 4: Set the algorithm with the new IV like case 2, 
Note: but now calling the
Note: init right away.  The new iv will take effect right away. 

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.






Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         792


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBC_IV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBC_IV8".
Check equality of info structure for "AI_DESX_CBC_IV8" with 
expected info structure for "AI_DESX_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBC_IV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBC_IV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBC_IV8".
Check equality of info structure for "AI_DESX_CBC_IV8" with 
expected info structure for "AI_DESX_CBC_IV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"3fe6e5475b08323ad7862f3a1680afe52ee2447f8f01b136".

Baldwin         Informational, Expires 12/25/1999         793


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case: AI_DESX_CBCPadIV8

Note: Case 0: Check the output of the base algorithm

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_DESX_CBCPadIV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         794


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_DESX_CBCPadIV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBCPadIV8".
Check equality of info structure for "AI_DESX_CBCPadIV8" with 
expected info structure for "AI_DESX_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBCPadIV8".
Check equality of info structure for "AI_DESX_CBCPadIV8" with 
expected info structure for "AI_DESX_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadBER" initialized from 
"301406082a864886f70d030604087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBCPadBER".
Check equality of info structure for "AI_DESX_CBCPadBER" with 
expected info structure for "AI_DESX_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadBER" initialized from 
"301406082a864886f70d030604087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBCPadBER".
Check equality of info structure for "AI_DESX_CBCPadBER" with 
expected info structure for "AI_DESX_CBCPadBER".

Baldwin         Informational, Expires 12/25/1999         795


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.






Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"1df06d88215404ca6023d25142167e1ea6d8bd0fce5d3fb7c21ae689e96f71a
9".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         796


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: use the initial iv

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_DESX_CBCPadIV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_DESX_CBCPadIV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8".

Baldwin         Informational, Expires 12/25/1999         797


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBCPadIV8".
Check equality of info structure for "AI_DESX_CBCPadIV8" with 
expected info structure for "AI_DESX_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBCPadIV8".
Check equality of info structure for "AI_DESX_CBCPadIV8" with 
expected info structure for "AI_DESX_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadBER" initialized from 
"301406082a864886f70d030604080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBCPadBER".
Check equality of info structure for "AI_DESX_CBCPadBER" with 
expected info structure for "AI_DESX_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadBER" initialized from 
"301406082a864886f70d030604080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBCPadBER".
Check equality of info structure for "AI_DESX_CBCPadBER" with 
expected info structure for "AI_DESX_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.






Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         798


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"3fe6e5475b08323ad7862f3a1680afe52ee2447f8f01b136352c2d512397c29
d".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 

Baldwin         Informational, Expires 12/25/1999         799


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"inputData".

Note: Case 2: give the new iv to the algorithm; however, the 
Note: encryption 
Note: and decryption operation still use the iv from 
Note: AI_DES_CBC_IV8
Note: since final already calls.

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBCPadIV8".
Check equality of info structure for "AI_DESX_CBCPadIV8" with 
expected info structure for "AI_DESX_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBCPadIV8".
Check equality of info structure for "AI_DESX_CBCPadIV8" with 
expected info structure for "AI_DESX_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadBER" initialized from 
"301406082a864886f70d030604080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 

Baldwin         Informational, Expires 12/25/1999         800


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"encryptionObj" and "AI_DESX_CBCPadBER".
Check equality of info structure for "AI_DESX_CBCPadBER" with 
expected info structure for "AI_DESX_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadBER" initialized from 
"301406082a864886f70d030604080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBCPadBER".
Check equality of info structure for "AI_DESX_CBCPadBER" with 
expected info structure for "AI_DESX_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"3fe6e5475b08323ad7862f3a1680afe52ee2447f8f01b136352c2d512397c29
d".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 

Baldwin         Informational, Expires 12/25/1999         801


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 3: Final was call, so the new iv will start taking 
Note: effect;
Note: therefore, the algorithm will return with the new iv

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBCPadIV8".
Check equality of info structure for "AI_DESX_CBCPadIV8" with 
expected info structure for "AI_DESX_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBCPadIV8".
Check equality of info structure for "AI_DESX_CBCPadIV8" with 
expected info structure for "AI_DESX_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadBER" initialized from 
"301406082a864886f70d030604087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBCPadBER".
Check equality of info structure for "AI_DESX_CBCPadBER" with 
expected info structure for "AI_DESX_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadBER" initialized from 

Baldwin         Informational, Expires 12/25/1999         802


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"301406082a864886f70d030604087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBCPadBER".
Check equality of info structure for "AI_DESX_CBCPadBER" with 
expected info structure for "AI_DESX_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"1df06d88215404ca6023d25142167e1ea6d8bd0fce5d3fb7c21ae689e96f71a
9".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         803


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: case 4: Set the algorithm with the new IV like case 2, 
Note: but now calling the
Note: init right away.  The new iv will take effect right away. 

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.






Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBCPadIV8".
Check equality of info structure for "AI_DESX_CBCPadIV8" with 
expected info structure for "AI_DESX_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         804


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBCPadIV8".
Check equality of info structure for "AI_DESX_CBCPadIV8" with 
expected info structure for "AI_DESX_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadBER" initialized from 
"301406082a864886f70d030604080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBCPadBER".
Check equality of info structure for "AI_DESX_CBCPadBER" with 
expected info structure for "AI_DESX_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadBER" initialized from 
"301406082a864886f70d030604080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBCPadBER".
Check equality of info structure for "AI_DESX_CBCPadBER" with 
expected info structure for "AI_DESX_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 

Baldwin         Informational, Expires 12/25/1999         805


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"3fe6e5475b08323ad7862f3a1680afe52ee2447f8f01b136352c2d512397c29
d".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case: AI_DESX_CBCPadBER

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         806


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER" initialized from "301406082a864886f70d030604
080011223344556677".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_DESX_CBCPadBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER" initialized from "301406082a864886f70d030604
080011223344556677".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_DESX_CBCPadBER" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBCPadIV8".
Check equality of info structure for "AI_DESX_CBCPadIV8" with 
expected info structure for "AI_DESX_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBCPadIV8".
Check equality of info structure for "AI_DESX_CBCPadIV8" with 
expected info structure for "AI_DESX_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadBER" initialized from 
"301406082a864886f70d030604080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBCPadBER".
Check equality of info structure for "AI_DESX_CBCPadBER" with 
expected info structure for "AI_DESX_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         807


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadBER" initialized from 
"301406082a864886f70d030604080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBCPadBER".
Check equality of info structure for "AI_DESX_CBCPadBER" with 
expected info structure for "AI_DESX_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: use the initial iv






Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".

Baldwin         Informational, Expires 12/25/1999         808


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of buffer "cypherText" with hex value 
"3fe6e5475b08323ad7862f3a1680afe52ee2447f8f01b136352c2d512397c29
d".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 2: give the new iv to the algorithm; however, the 
Note: encryption 
Note: and decryption operation still use the iv from 
Note: AI_DES_CBC_IV8
Note: since final already calls.

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 

Baldwin         Informational, Expires 12/25/1999         809


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"encryptionObj" and "AI_DESX_CBCPadIV8".
Check equality of info structure for "AI_DESX_CBCPadIV8" with 
expected info structure for "AI_DESX_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBCPadIV8".
Check equality of info structure for "AI_DESX_CBCPadIV8" with 
expected info structure for "AI_DESX_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadBER" initialized from 
"301406082a864886f70d030604080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBCPadBER".
Check equality of info structure for "AI_DESX_CBCPadBER" with 
expected info structure for "AI_DESX_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadBER" initialized from 
"301406082a864886f70d030604080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBCPadBER".
Check equality of info structure for "AI_DESX_CBCPadBER" with 
expected info structure for "AI_DESX_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         810


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"3fe6e5475b08323ad7862f3a1680afe52ee2447f8f01b136352c2d512397c29
d".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 3: Final was call, so the new iv will start taking 
Note: effect;
Note: therefore, the algorithm will return with the new iv

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBCPadIV8".
Check equality of info structure for "AI_DESX_CBCPadIV8" with 
expected info structure for "AI_DESX_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         811


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadIV8" initialized from 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBCPadIV8".
Check equality of info structure for "AI_DESX_CBCPadIV8" with 
expected info structure for "AI_DESX_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadBER" initialized from 
"301406082a864886f70d030604087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBCPadBER".
Check equality of info structure for "AI_DESX_CBCPadBER" with 
expected info structure for "AI_DESX_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadBER" initialized from 
"301406082a864886f70d030604087766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBCPadBER".
Check equality of info structure for "AI_DESX_CBCPadBER" with 
expected info structure for "AI_DESX_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         812


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"1df06d88215404ca6023d25142167e1ea6d8bd0fce5d3fb7c21ae689e96f71a
9".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: case 4: Set the algorithm with the new IV like case 2, 
Note: but now calling the
Note: init right away.  The new iv will take effect right away. 

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



Baldwin         Informational, Expires 12/25/1999         813


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999





Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBCPadIV8".
Check equality of info structure for "AI_DESX_CBCPadIV8" with 
expected info structure for "AI_DESX_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadIV8" initialized from 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadIV8".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBCPadIV8".
Check equality of info structure for "AI_DESX_CBCPadIV8" with 
expected info structure for "AI_DESX_CBCPadIV8".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadBER" initialized from 
"301406082a864886f70d030604080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_DESX_CBCPadBER".
Check equality of info structure for "AI_DESX_CBCPadBER" with 
expected info structure for "AI_DESX_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_DESX_CBCPadBER" initialized from 

Baldwin         Informational, Expires 12/25/1999         814


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"301406082a864886f70d030604080011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_DESX_CBCPadBER".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_DESX_CBCPadBER".
Check equality of info structure for "AI_DESX_CBCPadBER" with 
expected info structure for "AI_DESX_CBCPadBER".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"3fe6e5475b08323ad7862f3a1680afe52ee2447f8f01b136352c2d512397c29
d".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         815


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.



This is the end of test case "TFCIV803".
This is the start of test case "TFCIV804".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Vector test for AI_CBC_IV8 corresponding to 
Note: AI_RC5_CBC, AI_RC5_CBCPad

Note: -------------------------------------------------------

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_RC5_CBC_ENCRYPT", "AM_RC5_CBC_DECRYPT", 
"NULL_PTR".



Note: Initialize, set up data

Create buffer "inputData" of decimal value "100" bytes.
Create buffer "cypherText" of decimal value "100" bytes.
Create buffer "plainText" of decimal value "100" bytes.
Create buffer "iv" of decimal value "8" bytes.
Create buffer "newiv" of decimal value "8" bytes.
Create buffer "key" of decimal value "8" bytes.

Note: vector data

Set buffer "inputData" to hex value "000102030405060708091011121
314151617181920212223".
Set buffer "iv" to hex value "0011223344556677".
Set buffer "newiv" to hex value "7766554433221100".
Set buffer "key" to hex value "1234567890123456".


Baldwin         Informational, Expires 12/25/1999         816


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: global key object

Create key object "keyObj".
Call B_CreateKeyObject passing "keyObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_Item" 
initialized from contents of buffer "key".
Call B_SetKeyInfo passing "keyObj" and "KI_Item" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Note: Case: AI_RC5_CBC

Note: Case 0: Check the output of the base algorithm

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBC" initialized from "10", "12", "32", contents of 
buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_RC5_CBC" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBC" initialized from "10", "12", "32", contents of 
buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_RC5_CBC" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC5_CBC" initialized from "10", "12", "32", 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 

Baldwin         Informational, Expires 12/25/1999         817


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"encryptionObj" and "AI_RC5_CBC".
Check equality of info structure for "AI_RC5_CBC" with expected 
info structure for "AI_RC5_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC5_CBC" initialized from "10", "12", "32", 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC5_CBC".
Check equality of info structure for "AI_RC5_CBC" with expected 
info structure for "AI_RC5_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"211394f772f9b728a2649d018de1d2aee8c3ee063507136f".

Call B_DecryptUpdate passing "decryptionObj" and address of 

Baldwin         Informational, Expires 12/25/1999         818


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: use the initial iv

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBC" initialized from "10", "12", "32", contents of 
buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_RC5_CBC" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBC" initialized from "10", "12", "32", contents of 
buffer "iv".

Baldwin         Informational, Expires 12/25/1999         819


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_RC5_CBC" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC5_CBC" initialized from "10", "12", "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC5_CBC".
Check equality of info structure for "AI_RC5_CBC" with expected 
info structure for "AI_RC5_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC5_CBC" initialized from "10", "12", "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC5_CBC".
Check equality of info structure for "AI_RC5_CBC" with expected 
info structure for "AI_RC5_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         820


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"53decc19ee94e6d0fb497ee707bfff094dba7e93ebe17981".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 2: give the new iv to the algorithm; however, the 
Note: encryption 
Note: and decryption operation still use the iv from 
Note: AI_DES_CBC_IV8
Note: since final already calls.

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".

Baldwin         Informational, Expires 12/25/1999         821


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC5_CBC" initialized from "10", "12", "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC5_CBC".
Check equality of info structure for "AI_RC5_CBC" with expected 
info structure for "AI_RC5_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC5_CBC" initialized from "10", "12", "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC5_CBC".
Check equality of info structure for "AI_RC5_CBC" with expected 
info structure for "AI_RC5_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"53decc19ee94e6d0fb497ee707bfff094dba7e93ebe17981".

Baldwin         Informational, Expires 12/25/1999         822


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 3: Final was call, so the new iv will start taking 
Note: effect;
Note: therefore, the algorithm will return with the new iv

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC5_CBC" initialized from "10", "12", "32", 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC5_CBC".
Check equality of info structure for "AI_RC5_CBC" with expected 
info structure for "AI_RC5_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC5_CBC" initialized from "10", "12", "32", 
"7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC5_CBC".
Check equality of info structure for "AI_RC5_CBC" with expected 
info structure for "AI_RC5_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".

Baldwin         Informational, Expires 12/25/1999         823


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"211394f772f9b728a2649d018de1d2aee8c3ee063507136f".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: case 4: Set the algorithm with the new IV like case 2, 
Note: but now calling the
Note: init right away.  The new iv will take effect right away. 

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 

Baldwin         Informational, Expires 12/25/1999         824


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC5_CBC" initialized from "10", "12", "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC5_CBC".
Check equality of info structure for "AI_RC5_CBC" with expected 
info structure for "AI_RC5_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC5_CBC" initialized from "10", "12", "32", 
"0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBC".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC5_CBC".
Check equality of info structure for "AI_RC5_CBC" with expected 
info structure for "AI_RC5_CBC".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 

Baldwin         Informational, Expires 12/25/1999         825


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"53decc19ee94e6d0fb497ee707bfff094dba7e93ebe17981".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case: AI_RC5_CBCPad


Baldwin         Informational, Expires 12/25/1999         826


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: Case 0: Check the output of the base algorithm

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBCPad" initialized from "10", "12", "32", contents of 
buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_RC5_CBCPad" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBCPad" initialized from "10", "12", "32", contents of 
buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_RC5_CBCPad" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC5_CBCPad" initialized from "10", "12", 
"32", "7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC5_CBCPad".
Check equality of info structure for "AI_RC5_CBCPad" with 
expected info structure for "AI_RC5_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC5_CBCPad" initialized from "10", "12", 
"32", "7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC5_CBCPad".
Check equality of info structure for "AI_RC5_CBCPad" with 
expected info structure for "AI_RC5_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         827


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"211394f772f9b728a2649d018de1d2aee8c3ee063507136f27e98e494564787
9".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         828


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Case 1: use the initial iv

Create algorithm object "encryptionObj".
Call B_CreateAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decryptionObj".
Call B_CreateAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBCPad" initialized from "10", "12", "32", contents of 
buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_RC5_CBCPad" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBCPad" initialized from "10", "12", "32", contents of 
buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_RC5_CBCPad" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC5_CBCPad" initialized from "10", "12", 
"32", "0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC5_CBCPad".
Check equality of info structure for "AI_RC5_CBCPad" with 
expected info structure for "AI_RC5_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         829


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC5_CBCPad" initialized from "10", "12", 
"32", "0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC5_CBCPad".
Check equality of info structure for "AI_RC5_CBCPad" with 
expected info structure for "AI_RC5_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"53decc19ee94e6d0fb497ee707bfff094dba7e93ebe17981da1a461100f42dc
6".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 

Baldwin         Informational, Expires 12/25/1999         830


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 2: give the new iv to the algorithm; however, the 
Note: encryption 
Note: and decryption operation still use the initial iv
Note: since final already calls.

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "newiv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC5_CBCPad" initialized from "10", "12", 
"32", "0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC5_CBCPad".
Check equality of info structure for "AI_RC5_CBCPad" with 
expected info structure for "AI_RC5_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 

Baldwin         Informational, Expires 12/25/1999         831


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

structure for "AI_RC5_CBCPad" initialized from "10", "12", 
"32", "0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC5_CBCPad".
Check equality of info structure for "AI_RC5_CBCPad" with 
expected info structure for "AI_RC5_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"53decc19ee94e6d0fb497ee707bfff094dba7e93ebe17981da1a461100f42dc
6".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         832


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: Case 3: Final was call, so the new iv will start taking 
Note: effect;
Note: therefore, the algorithm will return with the new iv

Note: Update the algorithm with new IV8

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC5_CBCPad" initialized from "10", "12", 
"32", "7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC5_CBCPad".
Check equality of info structure for "AI_RC5_CBCPad" with 
expected info structure for "AI_RC5_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC5_CBCPad" initialized from "10", "12", 
"32", "7766554433221100".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC5_CBCPad".
Check equality of info structure for "AI_RC5_CBCPad" with 
expected info structure for "AI_RC5_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set length of buffer "cypherText" to decimal value "0".
Set length of buffer "plainText" to decimal value "0".

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         833


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"211394f772f9b728a2649d018de1d2aee8c3ee063507136f27e98e494564787
9".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Note: case 4: Set the algorithm with the new IV like case 2, 
Note: but now calling the
Note: init right away.  The new iv will take effect right away. 

Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "encryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_CBC_IV8" initialized from contents of buffer "iv".
Call B_SetAlgorithmInfo passing "decryptionObj" and 
"AI_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encryptionObj" and "keyObj" 

Baldwin         Informational, Expires 12/25/1999         834


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DecryptInit passing "decryptionObj" and "keyObj" 
and "_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC5_CBCPad" initialized from "10", "12", 
"32", "0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"encryptionObj" and "AI_RC5_CBCPad".
Check equality of info structure for "AI_RC5_CBCPad" with 
expected info structure for "AI_RC5_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_ExpectedInfoPointer" to address of expected info 
structure for "AI_RC5_CBCPad" initialized from "10", "12", 
"32", "0011223344556677".
Set "_InfoPointer" to address of info structure for 
"AI_RC5_CBCPad".
Call B_GetAlgorithmInfo passing "_InfoPointer" and 
"decryptionObj" and "AI_RC5_CBCPad".
Check equality of info structure for "AI_RC5_CBCPad" with 
expected info structure for "AI_RC5_CBCPad".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call B_EncryptUpdate passing "encryptionObj" and address of 
next free byte in buffer "cypherText" and address of 
"_OutputLen" and length of free bytes in buffer "cypherText" 
and address of first initialized byte in buffer "inputData" and 
length of initialized bytes in buffer "inputData" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".
Call B_EncryptFinal passing "encryptionObj" and address of next 
free byte in buffer "cypherText" and address of "_OutputLen" 
and length of free bytes in buffer "cypherText" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "cypherText" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         835


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Finalize buffer "cypherText".
Check equality of buffer "cypherText" with hex value 
"53decc19ee94e6d0fb497ee707bfff094dba7e93ebe17981da1a461100f42dc
6".

Call B_DecryptUpdate passing "decryptionObj" and address of 
next free byte in buffer "plainText" and address of 
"_OutputLen" and length of free bytes in buffer "plainText" and 
address of first initialized byte in buffer "cypherText" and 
length of initialized bytes in buffer "cypherText" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Call B_DecryptFinal passing "decryptionObj" and address of next 
free byte in buffer "plainText" and address of "_OutputLen" and 
length of free bytes in buffer "plainText" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "plainText" by "_OutputLen".
Finalize buffer "plainText".
Check equality of buffer "plainText" with contents of buffer 
"inputData".

Call Call B_DestroyAlgorithmObject passing "encryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decryptionObj".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

This is the end of test case "TFCIV804".
This is the start of test case "TFDESC00".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional test of AI_DES_CBC_IV8

Note: Depends on:
Note: - AI_MD5Random
Note: - KI_8Byte

Note: Test cases
Note: - Same result produced for first block of CBC
Note: when the IV and plaintext are switched, since
Note: it is their xor that is encrypted.  Test for

Baldwin         Informational, Expires 12/25/1999         836


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Note: non-zero plaintext and IV.
Note: - Check that encrypting 3 blocks at once produces
Note: the same answer	doing them one at a time with
Note: the appropriate IVs.

Note: To Do:
Note: - Test 3 block decryption.

Note: History:

Note: -------------------------------------------------------
Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_DES_CBC_ENCRYPT", "AM_DES_CBC_DECRYPT", 
"AM_MD5_RANDOM", "NULL_PTR".


Note: Setup data objects

Create buffer "keytext" of decimal value "100" bytes.
Create buffer "plaintext" of decimal value "100" bytes.
Create buffer "ciphertext" of decimal value "100" bytes.
Create buffer "ivector" of decimal value "100" bytes.
Create buffer "encryptedtext" of decimal value "100" bytes.
Create buffer "decryptedtext" of decimal value "100" bytes.

Note: -------------------------------------------------------

Note: Setup algorithm objects.

Create algorithm object "encrypter".
Call B_CreateAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decrypter".
Call B_CreateAlgorithmObject passing "decrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: - Same result produced for first block of CBC
Note: when the IV and plaintext are switched, since
Note: it is their xor that is encrypted.  Test for
Note: zero and non-zero plaintext.

Set buffer "keytext" to hex value "0123456789ABCDEF".
Note: SetData (plaintext,  11 11 11 11 11 11 11 11)
Set buffer "plaintext" to hex value "1110010110010100".
Set buffer "ivector" to hex value "0001101001101011".
Set buffer "ciphertext" to hex value "17668DFC7292532D".
Set buffer "encryptedtext" to hex value "".

Baldwin         Informational, Expires 12/25/1999         837


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set buffer "decryptedtext" to hex value "".

Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8" initialized from contents of buffer "ivector".
Call B_SetAlgorithmInfo passing "encrypter" and 
"AI_DES_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8" initialized from contents of buffer "ivector".
Call B_SetAlgorithmInfo passing "decrypter" and 
"AI_DES_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".

Baldwin         Informational, Expires 12/25/1999         838


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Note: Setup algorithm objects.

Call Call B_DestroyAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "encrypter".
Call B_CreateAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decrypter".
Call B_CreateAlgorithmObject passing "decrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8" initialized from contents of buffer 

Baldwin         Informational, Expires 12/25/1999         839


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"plaintext".
Call B_SetAlgorithmInfo passing "encrypter" and 
"AI_DES_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8" initialized from contents of buffer 
"plaintext".
Call B_SetAlgorithmInfo passing "decrypter" and 
"AI_DES_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "ivector" and length of 
initialized bytes in buffer "ivector" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Display buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 

Baldwin         Informational, Expires 12/25/1999         840


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "ivector".
Display buffer "encryptedtext".
Call Call B_DestroyKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Cleanup

Call Call B_DestroyAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_DestroyAlgorithmObject passing "decrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: - Check that encrypting 3 blocks at once produces
Note: the same answer	doing them one at a time with
Note: the appropriate IVs.

Set buffer "keytext" to hex value "0123456789ABCDEF".
Set buffer "ivector" to hex value "456789ABCDEF0123".
Set buffer "plaintext" to hex value "".
Set buffer "ciphertext" to hex value "".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 

Baldwin         Informational, Expires 12/25/1999         841


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create algorithm object "encrypter".
Call B_CreateAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decrypter".
Call B_CreateAlgorithmObject passing "decrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8" initialized from contents of buffer "ivector".
Call B_SetAlgorithmInfo passing "encrypter" and 
"AI_DES_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8" initialized from contents of buffer "ivector".
Call B_SetAlgorithmInfo passing "decrypter" and 
"AI_DES_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Fill in data object with 24 random bytes.

Create buffer "seed" of decimal value "6" bytes.
Set buffer "seed" to hex value "a1b2c3d4e5f6".
Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD5Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "seed" and length of initialized 

Baldwin         Informational, Expires 12/25/1999         842


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

bytes in "seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Set "_OutputLen" to decimal value "24".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "plaintext" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "plaintext" by "_OutputLen".
Finalize "plaintext".
Display buffer "plaintext".
Call Call B_DestroyAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and address of 
first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Finalize buffer "ciphertext".
Display buffer "ciphertext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         843


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "ciphertext" and length of 
initialized bytes in buffer "ciphertext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Note: Try again one block at a time.

Create buffer "ciphertext1" of decimal value "16" bytes.
Create buffer "ciphertext2" of decimal value "16" bytes.
Create buffer "ciphertext3" of decimal value "16" bytes.
Create buffer "plaintext1" of decimal value "16" bytes.
Create buffer "plaintext2" of decimal value "16" bytes.
Create buffer "plaintext3" of decimal value "16" bytes.

Create algorithm object "randomAlgorithm".
Call B_CreateAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_MD5Random" initialized from "NULL_PTR".
Call B_SetAlgorithmInfo passing "randomAlgorithm" and 
"AI_MD5Random" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_RandomInit passing "randomAlgorithm" and "_Chooser" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_RandomUpdate passing "randomAlgorithm" and address of 
first initialized byte in "seed" and length of initialized 
bytes in "seed" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.


Baldwin         Informational, Expires 12/25/1999         844


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "plaintext1" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "plaintext1" by "_OutputLen".
Finalize "plaintext1".
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "plaintext2" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "plaintext2" by "_OutputLen".
Finalize "plaintext2".
Set "_OutputLen" to decimal value "8".
Call B_GenerateRandomBytes passing "randomAlgorithm" and 
address of next free byte in "plaintext3" and "_OutputLen" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of "plaintext3" by "_OutputLen".
Finalize "plaintext3".
Display buffer "plaintext1".
Display buffer "plaintext2".
Display buffer "plaintext3".
Call Call B_DestroyAlgorithmObject passing "randomAlgorithm".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Create algorithm object "encrypter1".
Call B_CreateAlgorithmObject passing "encrypter1".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8" initialized from contents of buffer "ivector".
Call B_SetAlgorithmInfo passing "encrypter1" and 
"AI_DES_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encrypter1" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Baldwin         Informational, Expires 12/25/1999         845


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_EncryptUpdate passing "encrypter1" and address of next 
free byte in buffer "ciphertext1" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext1" and address of 
first initialized byte in buffer "plaintext1" and length of 
initialized bytes in buffer "plaintext1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext1" by "_OutputLen".
Call B_EncryptFinal passing "encrypter1" and address of next 
free byte in buffer "ciphertext1" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext1" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext1" by "_OutputLen".
Finalize buffer "ciphertext1".

Create algorithm object "encrypter2".
Call B_CreateAlgorithmObject passing "encrypter2".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8" initialized from contents of buffer 
"ciphertext1".
Call B_SetAlgorithmInfo passing "encrypter2" and 
"AI_DES_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encrypter2" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter2" and address of next 
free byte in buffer "ciphertext2" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext2" and address of 
first initialized byte in buffer "plaintext2" and length of 
initialized bytes in buffer "plaintext2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext2" by "_OutputLen".
Call B_EncryptFinal passing "encrypter2" and address of next 
free byte in buffer "ciphertext2" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext2" and "NULL_PTR" 
and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         846


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext2" by "_OutputLen".
Finalize buffer "ciphertext2".

Create algorithm object "encrypter3".
Call B_CreateAlgorithmObject passing "encrypter3".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8" initialized from contents of buffer 
"ciphertext2".
Call B_SetAlgorithmInfo passing "encrypter3" and 
"AI_DES_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Call Call B_EncryptInit passing "encrypter3" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter3" and address of next 
free byte in buffer "ciphertext3" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext3" and address of 
first initialized byte in buffer "plaintext3" and length of 
initialized bytes in buffer "plaintext3" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext3" by "_OutputLen".
Call B_EncryptFinal passing "encrypter3" and address of next 
free byte in buffer "ciphertext3" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext3" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext3" by "_OutputLen".
Finalize buffer "ciphertext3".

Note: Check the plaintext.

Display buffer "plaintext".
Check equality of buffer "plaintext1" with hex value 
"88bca90e90875a7f".
Check equality of buffer "plaintext2" with hex value 
"0f79c384627bafb2".
Check equality of buffer "plaintext3" with hex value 

Baldwin         Informational, Expires 12/25/1999         847


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"16f80a6f85920584".

Note: Check the ciphertext.

Display buffer "ciphertext".
Check equality of buffer "ciphertext1" with hex value 
"7b9a60072946f295".
Check equality of buffer "ciphertext2" with hex value 
"75d6c6ac805c5a23".
Check equality of buffer "ciphertext3" with hex value 
"0d91b1830c8d1142".

Note: -------------------------------------------------------
Note: - Check that output is produced whenever possible.
Note: Test output of EncryptUpdate on various size inputs.
Note: Try input lengths of 7, 8, 9, 15, 16, 17, 23, 24, 25.

Create buffer "input" of decimal value "100" bytes.
Create buffer "output1" of decimal value "100" bytes.
Create buffer "output2" of decimal value "100" bytes.
Create buffer "output3" of decimal value "100" bytes.

Set buffer "input" to hex value "1122334455667788AA1122334455667
788AA1122334455667722334455667788".

Set length of buffer "input" to decimal value "7".
Set length of buffer "output1" to decimal value "0".
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "output1" and address of "_OutputLen" and 
length of free bytes in buffer "output1" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output1" by "_OutputLen".
Check equality of buffer "output1" with hex value "".

Set length of buffer "input" to decimal value "8".
Set length of buffer "output1" to decimal value "0".
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "output1" and address of "_OutputLen" and 
length of free bytes in buffer "output1" and address of first 

Baldwin         Informational, Expires 12/25/1999         848


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output1" by "_OutputLen".
Check equality of buffer "output1" with hex value 
"0e75051bb4870f36".

Set length of buffer "input" to decimal value "9".
Set length of buffer "output2" to decimal value "0".
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "output2" and address of "_OutputLen" and 
length of free bytes in buffer "output2" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output2" by "_OutputLen".
Display buffer "output2".
Check equality of buffer "output2" with contents of buffer 
"output1".

Set length of buffer "input" to decimal value "15".
Set length of buffer "output2" to decimal value "0".
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "output2" and address of "_OutputLen" and 
length of free bytes in buffer "output2" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output2" by "_OutputLen".
Display buffer "output2".
Check equality of buffer "output2" with contents of buffer 
"output1".

Set length of buffer "input" to decimal value "16".
Set length of buffer "output1" to decimal value "0".
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         849


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "output1" and address of "_OutputLen" and 
length of free bytes in buffer "output1" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output1" by "_OutputLen".
Display buffer "output1".
Check equality of buffer "output1" with hex value 
"0e75051bb4870f36dec089c77d3d3ba3".

Set length of buffer "input" to decimal value "17".
Set length of buffer "output2" to decimal value "0".
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "output2" and address of "_OutputLen" and 
length of free bytes in buffer "output2" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output2" by "_OutputLen".
Display buffer "output2".
Check equality of buffer "output2" with contents of buffer 
"output1".

Set length of buffer "input" to decimal value "23".
Set length of buffer "output2" to decimal value "0".
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "output2" and address of "_OutputLen" and 
length of free bytes in buffer "output2" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output2" by "_OutputLen".
Display buffer "output2".

Baldwin         Informational, Expires 12/25/1999         850


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of buffer "output2" with contents of buffer 
"output1".

Set length of buffer "input" to decimal value "24".
Set length of buffer "output1" to decimal value "0".
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "output1" and address of "_OutputLen" and 
length of free bytes in buffer "output1" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output1" by "_OutputLen".
Display buffer "output1".
Check equality of buffer "output1" with hex value 
"0e75051bb4870f36dec089c77d3d3ba3affd94870f492273".

Set length of buffer "input" to decimal value "25".
Set length of buffer "output2" to decimal value "0".
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "output2" and address of "_OutputLen" and 
length of free bytes in buffer "output2" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output2" by "_OutputLen".
Display buffer "output2".
Check equality of buffer "output2" with contents of buffer 
"output1".

Note: -------------------------------------------------------
Note: - Check that output is produced whenever possible.
Note: Test output of DecryptUpdate on various size inputs.
Note: Try input lengths of 7, 8, 9, 15, 16, 17, 23, 24, 25.

Set buffer "input" to hex value "1122334455667788AA1122334455667
788AA1122334455667722334455667788".

Set length of buffer "input" to decimal value "7".
Set length of buffer "output1" to decimal value "0".

Baldwin         Informational, Expires 12/25/1999         851


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "output1" and address of "_OutputLen" and 
length of free bytes in buffer "output1" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output1" by "_OutputLen".
Check equality of buffer "output1" with hex value "".

Set length of buffer "input" to decimal value "8".
Set length of buffer "output1" to decimal value "0".
Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "output1" and address of "_OutputLen" and 
length of free bytes in buffer "output1" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output1" by "_OutputLen".
Display buffer "output1".
Check equality of buffer "output1" with hex value 
"ba3a677d27e39feb".

Set length of buffer "input" to decimal value "9".
Set length of buffer "output2" to decimal value "0".
Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "output2" and address of "_OutputLen" and 
length of free bytes in buffer "output2" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output2" by "_OutputLen".
Display buffer "output2".

Baldwin         Informational, Expires 12/25/1999         852


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of buffer "output2" with contents of buffer 
"output1".

Set length of buffer "input" to decimal value "15".
Set length of buffer "output2" to decimal value "0".
Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "output2" and address of "_OutputLen" and 
length of free bytes in buffer "output2" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output2" by "_OutputLen".
Display buffer "output2".
Check equality of buffer "output2" with contents of buffer 
"output1".

Set length of buffer "input" to decimal value "16".
Set length of buffer "output1" to decimal value "0".
Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "output1" and address of "_OutputLen" and 
length of free bytes in buffer "output1" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output1" by "_OutputLen".
Display buffer "output1".
Check equality of buffer "output1" with hex value 
"ba3a677d27e39feb433c6d6b428a430a".

Set length of buffer "input" to decimal value "17".
Set length of buffer "output2" to decimal value "0".
Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "output2" and address of "_OutputLen" and 
length of free bytes in buffer "output2" and address of first 

Baldwin         Informational, Expires 12/25/1999         853


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output2" by "_OutputLen".
Display buffer "output2".
Check equality of buffer "output2" with contents of buffer 
"output1".

Set length of buffer "input" to decimal value "23".
Set length of buffer "output2" to decimal value "0".
Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "output2" and address of "_OutputLen" and 
length of free bytes in buffer "output2" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output2" by "_OutputLen".
Display buffer "output2".
Check equality of buffer "output2" with contents of buffer 
"output1".

Set length of buffer "input" to decimal value "24".
Set length of buffer "output1" to decimal value "0".
Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "output1" and address of "_OutputLen" and 
length of free bytes in buffer "output1" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output1" by "_OutputLen".
Display buffer "output1".
Check equality of buffer "output1" with hex value 
"ba3a677d27e39feb433c6d6b428a430aa2ecc6cbba99f6e3".

Set length of buffer "input" to decimal value "25".
Set length of buffer "output2" to decimal value "0".
Call Call B_DecryptInit passing "decrypter" and "key" and 

Baldwin         Informational, Expires 12/25/1999         854


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "output2" and address of "_OutputLen" and 
length of free bytes in buffer "output2" and address of first 
initialized byte in buffer "input" and length of initialized 
bytes in buffer "input" and "NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "output2" by "_OutputLen".
Display buffer "output2".
Check equality of buffer "output2" with contents of buffer 
"output1".


Note: Cleanup



This is the end of test case "TFDESC00".
This is the start of test case "TFDESC01".
Set "_ExpectedStatus" to zero.
Set "_Chooser" to "NULL_PTR".
Set "_SurrenderContext" to "NULL_PTR".


Note: Functional test of AI_DES_CBC_IV8

Note: Depends on:
Note: - KI_8Byte

Note: Test cases
Note: - Test that multiple EncryptUpdate calls produce the same
Note: result as a single call.  Two Update calls are made
Note: with the first input block ranges from 0 to 8 long,
Note: the second is ranges from 8 to 0.
Note: - Test that multiple EncryptUpdate calls produce the same
Note: result as a single call.  Three Update calls are made
Note: with the first input block ranges from 8 to 16 long,
Note: the second block is 16 bytes long, and
Note: the third ranges from 8 to 0.
Note: - Test that multiple DecryptUpdate calls produce the same
Note: result as a single call.  Three Update calls are made
Note: with the first input block ranges from 8 to 16 long,
Note: the second block is 16 bytes long, and
Note: the third ranges from 8 to 0.
Note: - Test that multiple DecryptUpdate calls produce the same
Note: result as a single call.  Two Update calls are made
Note: with the first input block ranges from 8 to 16 long,
Note: the second ranges from 8 to 0.

Baldwin         Informational, Expires 12/25/1999         855


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Note: - Check that output is produced whenever possible.
Note: Test output of EncryptUpdate on various size inputs.
Note: Try input lengths of 7, 8, 9, 15, 16, 17, 23, 24, 25.
Note: - Check that output is produced whenever possible.
Note: Test output of DecryptUpdate on various size inputs.
Note: Try input lengths of 7, 8, 9, 15, 16, 17, 23, 24, 25.

Note: -------------------------------------------------------

Note: Start with GlobalInit for code resource

Set "_Chooser" to "AM_DES_CBC_ENCRYPT", "AM_DES_CBC_DECRYPT", 
"NULL_PTR".


Note: Setup data objects

Create buffer "keytext" of decimal value "100" bytes.
Create buffer "plaintext" of decimal value "100" bytes.
Create buffer "ciphertext" of decimal value "100" bytes.
Create buffer "ivector" of decimal value "100" bytes.
Create buffer "encryptedtext" of decimal value "100" bytes.
Create buffer "decryptedtext" of decimal value "100" bytes.
Create buffer "input1" of decimal value "100" bytes.
Create buffer "input2" of decimal value "100" bytes.

Note: -------------------------------------------------------

Note: Setup algorithm objects.

Create algorithm object "encrypter".
Call B_CreateAlgorithmObject passing "encrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Create algorithm object "decrypter".
Call B_CreateAlgorithmObject passing "decrypter".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: -------------------------------------------------------
Note: - Test that multiple EncryptUpdate calls produce the same
Note: result as a single call.  Two Update calls are made
Note: with the first input block ranges from 0 to 8 long,
Note: the second is ranges from 8 to 0.

Set buffer "keytext" to hex value "0123456789ABCDEF".
Set buffer "plaintext" to hex value "6789ABCDEF012345".
Set buffer "ivector" to hex value "0000000000000000".
Set buffer "encryptedtext" to hex value "".
Set buffer "decryptedtext" to hex value "".

Baldwin         Informational, Expires 12/25/1999         856


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8" initialized from contents of buffer "ivector".
Call B_SetAlgorithmInfo passing "encrypter" and 
"AI_DES_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for 
"AI_DES_CBC_IV8" initialized from contents of buffer "ivector".
Call B_SetAlgorithmInfo passing "decrypter" and 
"AI_DES_CBC_IV8" and "_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Compute the expected answer.

Create key object "key".
Call B_CreateKeyObject passing "key".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Set "_InfoPointer" to address of info structure for "KI_8Byte" 
initialized from contents of buffer "keytext".
Call B_SetKeyInfo passing "key" and "KI_8Byte" and 
"_InfoPointer".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and address of 
first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         857


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Finalize buffer "ciphertext".
Display buffer "ciphertext".

Note: Try 1-7 split

Set buffer "input1" to hex value "67".
Set buffer "input2" to hex value "89ABCDEF012345".
Set buffer "encryptedtext" to hex value "".

Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Note: Try 2-6 split

Set buffer "input1" to hex value "6789".
Set buffer "input2" to hex value "ABCDEF012345".
Set buffer "encryptedtext" to hex value "".

Call Call B_EncryptInit passing "encrypter" and "key" and 

Baldwin         Informational, Expires 12/25/1999         858


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Note: Try 3-5 split

Set buffer "input1" to hex value "6789AB".
Set buffer "input2" to hex value "CDEF012345".
Set buffer "encryptedtext" to hex value "".

Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         859


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Note: Try 4-4 split

Set buffer "input1" to hex value "6789ABCD".
Set buffer "input2" to hex value "EF012345".
Set buffer "encryptedtext" to hex value "".

Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         860


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Note: Try 5-3 split

Set buffer "input1" to hex value "6789ABCDEF".
Set buffer "input2" to hex value "012345".
Set buffer "encryptedtext" to hex value "".

Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         861


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Note: Try 6-2 split

Set buffer "input1" to hex value "6789ABCDEF01".
Set buffer "input2" to hex value "2345".
Set buffer "encryptedtext" to hex value "".

Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Note: Try 7-1 split

Set buffer "input1" to hex value "6789ABCDEF0123".
Set buffer "input2" to hex value "45".

Baldwin         Informational, Expires 12/25/1999         862


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set buffer "encryptedtext" to hex value "".

Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Note: Try 8-0 split

Set buffer "input1" to hex value "6789ABCDEF012345".
Set buffer "input2" to hex value "".
Set buffer "encryptedtext" to hex value "".

Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 

Baldwin         Informational, Expires 12/25/1999         863


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Note: -------------------------------------------------------
Note: - Test that multiple EncryptUpdate calls produce the same
Note: result as a single call.  Three Update calls are made
Note: with the first input block ranges from 8 to 16 long,
Note: the second block is 16 bytes long, and
Note: the third ranges from 8 to 0.

Set buffer "plaintext" to hex value "101112131415161718192021222
3242526272829303132333435363738394041".
Create buffer "input3" of decimal value "100" bytes.

Note: Compute the expected answer.

Call Call B_EncryptInit passing "encrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and address of 
first initialized byte in buffer "plaintext" and length of 
initialized bytes in buffer "plaintext" and "NULL_PTR" and 
"_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         864


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "ciphertext" and address of "_OutputLen" 
and length of free bytes in buffer "ciphertext" and "NULL_PTR" 
and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "ciphertext" by "_OutputLen".
Finalize buffer "ciphertext".
Display buffer "ciphertext".

Note: Try 8-16-8.

Set buffer "input1" to hex value "1011121314151617".
Set buffer "input2" to hex value "181920212223242526272829303132
33".
Set buffer "input3" to hex value "3435363738394041".

Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input3" and length of 
initialized bytes in buffer "input3" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 

Baldwin         Informational, Expires 12/25/1999         865


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Note: Try 9-16-7.

Set buffer "input1" to hex value "101112131415161718".
Set buffer "input2" to hex value "192021222324252627282930313233
34".
Set buffer "input3" to hex value "35363738394041".

Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input3" and length of 
initialized bytes in buffer "input3" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.

Baldwin         Informational, Expires 12/25/1999         866


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Note: Try 10-16-6.

Set buffer "input1" to hex value "10111213141516171819".
Set buffer "input2" to hex value "202122232425262728293031323334
35".
Set buffer "input3" to hex value "363738394041".

Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input3" and length of 
initialized bytes in buffer "input3" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".

Baldwin         Informational, Expires 12/25/1999         867


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Note: Try 11-16-5.

Set buffer "input1" to hex value "1011121314151617181920".
Set buffer "input2" to hex value "212223242526272829303132333435
36".
Set buffer "input3" to hex value "3738394041".

Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input3" and length of 
initialized bytes in buffer "input3" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Note: Try 12-16-4.

Baldwin         Informational, Expires 12/25/1999         868


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999


Set buffer "input1" to hex value "101112131415161718192021".
Set buffer "input2" to hex value "222324252627282930313233343536
37".
Set buffer "input3" to hex value "38394041".

Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input3" and length of 
initialized bytes in buffer "input3" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Note: Try 13-16-3.

Set buffer "input1" to hex value "10111213141516171819202122".
Set buffer "input2" to hex value "232425262728293031323334353637
38".

Baldwin         Informational, Expires 12/25/1999         869


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set buffer "input3" to hex value "394041".

Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input3" and length of 
initialized bytes in buffer "input3" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Note: Try 14-16-2.

Set buffer "input1" to hex value "1011121314151617181920212223".
Set buffer "input2" to hex value "242526272829303132333435363738
39".
Set buffer "input3" to hex value "4041".

Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         870


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input3" and length of 
initialized bytes in buffer "input3" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Note: Try 15-16-1.

Set buffer "input1" to hex value "101112131415161718192021222324
".
Set buffer "input2" to hex value "252627282930313233343536373839
40".
Set buffer "input3" to hex value "41".

Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 

Baldwin         Informational, Expires 12/25/1999         871


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input3" and length of 
initialized bytes in buffer "input3" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Note: Try 16-16-0.

Set buffer "input1" to hex value "101112131415161718192021222324
25".
Set buffer "input2" to hex value "262728293031323334353637383940
41".
Set buffer "input3" to hex value "".

Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".

Baldwin         Informational, Expires 12/25/1999         872


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptUpdate passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and address 
of first initialized byte in buffer "input3" and length of 
initialized bytes in buffer "input3" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Call B_EncryptFinal passing "encrypter" and address of next 
free byte in buffer "encryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "encryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "encryptedtext" by "_OutputLen".
Finalize buffer "encryptedtext".
Check equality of buffer "encryptedtext" with contents of 
buffer "ciphertext".

Note: -------------------------------------------------------
Note: - Test that multiple DecryptUpdate calls produce the same
Note: result as a single call.  Three Update calls are made
Note: with the first input block ranges from 8 to 16 long,
Note: the second block is 16 bytes long, and
Note: the third ranges from 8 to 0.

Note: The expected decryption of "ciphertext" is "plaintext".

Call Call B_DecryptInit passing "decrypter" and "key" and 
"_Chooser" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.

Note: Try 8-16-8.
Set buffer "input1" to hex value "d41f760b73919265".
Set buffer "input2" to hex value "52423c5b3204dfeecbdc9d7e6b8366
fa".

Baldwin         Informational, Expires 12/25/1999         873


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set buffer "input3" to hex value "397cdf48a2e359dc".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "input3" and length of 
initialized bytes in buffer "input3" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Note: Try 9-16-7.

Set buffer "input1" to hex value "d41f760b7391926552".
Set buffer "input2" to hex value "423c5b3204dfeecbdc9d7e6b8366fa
39".
Set buffer "input3" to hex value "7cdf48a2e359dc".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 

Baldwin         Informational, Expires 12/25/1999         874


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "input3" and length of 
initialized bytes in buffer "input3" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Note: Try 10-16-6.

Set buffer "input1" to hex value "d41f760b739192655242".
Set buffer "input2" to hex value "3c5b3204dfeecbdc9d7e6b8366fa39
7c".
Set buffer "input3" to hex value "df48a2e359dc".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".

Baldwin         Informational, Expires 12/25/1999         875


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "input3" and length of 
initialized bytes in buffer "input3" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Note: Try 11-16-5.

Set buffer "input1" to hex value "d41f760b7391926552423c".
Set buffer "input2" to hex value "5b3204dfeecbdc9d7e6b8366fa397c
df".
Set buffer "input3" to hex value "48a2e359dc".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".

Baldwin         Informational, Expires 12/25/1999         876


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "input2" and length of 
initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "input3" and length of 
initialized bytes in buffer "input3" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Note: Try 12-16-4.

Set buffer "input1" to hex value "d41f760b7391926552423c5b".
Set buffer "input2" to hex value "3204dfeecbdc9d7e6b8366fa397cdf
48".
Set buffer "input3" to hex value "a2e359dc".

Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "input1" and length of 
initialized bytes in buffer "input1" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "input2" and length of 

Baldwin         Informational, Expires 12/25/1999         877


draft-baldwin-bsafe-test-00.txt       TESTING BSAFE       June 1999

initialized bytes in buffer "input2" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptUpdate passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and address 
of first initialized byte in buffer "input3" and length of 
initialized bytes in buffer "input3" and "NULL_PTR" and 
"_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Call B_DecryptFinal passing "decrypter" and address of next 
free byte in buffer "decryptedtext" and address of "_OutputLen" 
and length of free bytes in buffer "decryptedtext" and 
"NULL_PTR" and "_SurrenderContext".
Set "_Status" to return value.
Check equality of "_Status" with "_ExpectedStatus".
Set "_ExpectedStatus" to zero.
Increment length of buffer "decryptedtext" by "_OutputLen".
Finalize buffer "decryptedtext".
Check equality of buffer "decryptedtext" with contents of 
buffer "plaintext".

Note: Try 13-16-3.

Set buffer "input1" to hex value "d41f760b7391926552423c5b32".
Set buffer "input2" to hex value "04dfeecbdc9d7e6b8366fa397cdf48
a2".
Set buffer "input3" to hex value "e359dc"