Example: ILE C program for clearing a function control vector from your Coprocessor

Change this program example to suit your needs for clearing a function control vector from your Coprocessor.

Note: Read the Code license and disclaimer information for important legal information.
/*------------------------------------------------------------*/
/* Clear the Function Control Vector from the  card.      */
/* The Function Control Vector enables the cryptographic      */
/* functions of the  card.  Clearing it from the      */
/* disabled the cryptographic functions.                      */
/*                                                            */
/*  COPYRIGHT 5769-SS1 (C) IBM CORP. 1999, 2000               */
/*                                                            */
/*  This material contains programming source code for your   */
/*  consideration.  These examples have not been thoroughly   */
/*  tested under all conditions.  IBM, therefore, cannot      */
/*  guarantee or imply reliability, serviceability, or        */
/*  functions of these program.  All programs contained       */
/*  herein are provided to you "AS IS".  THE IMPLIED          */
/*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A           */
/*  PARTICULAR PURPOSE ARE ARE EXPRESSLY DISCLAIMED.  IBM     */
/*  provides no program services for these programs and files.*/
/*                                                            */
/*                                                            */
/* Note: Input format is more fully described in Chapter 2 of */
/*       IBM  CCA Basic Services Reference and Guide      */
/*       (SC31-8609) publication.                             */
/*                                                            */
/* Parameters:                                                */
/*   none.                                                    */
/*                                                            */
/* Example:                                                   */
/*   CALL PGM(CLEARFCV)                                       */
/*                                                            */
/*                                                            */
/* Use the following command to compile this program:         */
/* CRTCMOD MODULE(CLEARFCV) SRCFILE(SAMPLE)                   */
/* CRTPGM  PGM(CLEARFCV) MODULE(CLEARFCV)                     */
/*         BNDSRVPGM(QCCA/CSUACFC)                            */
/*                                                            */
/* Common Cryptographic Architecture (CCA) verbs used:        */
/* - Cryptographic_Facility_Control (CSUACFC)                 */
/*                                                            */
/*------------------------------------------------------------*/

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "csucincl.h"

void main(void)
 {
  long return_code;
  long reason_code;
  long exit_data_length;
  char exit_data[2];
  char rule_array[4][8];
  long rule_array_count;
  long verb_data_length;
  char *verb_data;
  char buffer[4];


/*-------------------------------------------------------------------*/
/* No verb data is needed for this option.                           */
/*-------------------------------------------------------------------*/
  verb_data_length = 0;
  verb_data = buffer;

/*-------------------------------------------------------------------*/
/* Rule array has two elements or rule array keywords                */
/*-------------------------------------------------------------------*/
  rule_array_count = 2;
  memcpy((char*)rule_array,"ADAPTER1CLR-FCV ",16);

/*-------------------------------------------------------------------*/
/* Clear the Function control vector from the card                  */
/*-------------------------------------------------------------------*/
  CSUACFC(&return_code,
          &reason_code,
          &exit_data_length,
          exit_data,
          &rule_array_count,
          (char*)rule_array,
          &verb_data_length,
          verb_data);

  if (return_code != 0)
    printf("Operation failed: return code %d : reason code %d \n",
            return_code, reason_code);
  else
    printf("FCV is successfullly cleared\n");
 }