gtpc2m0rC/C++ Language Support User's Guide

cifrc-Cipher Program Interface

An ECB-controlled program calls the cifrc function whenever a portion of a message needs to be enciphered or deciphered. Calling the cifrc function causes the IBM-supplied cipher programs BQKCIPH or BQKDES to be executed.

Format

#include   <tpfapi.h>
void cifrc(int cipher_program, struct cifrc_arg *c_req);

cipher_program
Code the defined terms CIFRC_AET to activate IBM-supplied cipher program BQKCIPH, or CIFRC_DES to activate cipher program BQKDES.

c_req
Pointer to structure cifrc_arg, which contains the request code, a pointer to an 8-byte key, and a pointer to the text to be ciphered. (See the tpfapi.h header file.)

Normal Return

Void. The text pointed to by ciftext has been replaced by the enciphered or deciphered text.

Error Return

Not applicable.

Programming Considerations

Examples

The following example enciphers the first 4 bytes of text starting at EBX000, using the 8-byte key at EBW000.

#include <tpfapi.h>
 
/* storage for cifrc_arg */
struct  cifrc_arg *reqptr = (struct cifrc_arg *) &(ecbptr()->ebw032);

  ·
  ·
  ·
reqptr->cifreqst = 0; /* Encipher the Text */ reqptr->cifkey = &(ecbptr()->ebw000); /* pointer to key in EBW000-007 */ reqptr->ciftext = &(ecbptr()->ebx000); /* text to be enciphered */ cifrc(CIFRC_AET, reqptr);

Related Information

None.