ahrsaenc.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/* Copyright (C) RSA Data Security, Inc. created 1990, 1996. This is an
unpublished work protected as such under copyright law. This work
contains proprietary, confidential, and trade secret information of
RSA Data Security, Inc. Use, disclosure or reproduction without the
express written authorization of RSA Data Security, Inc. is
prohibited.
*/
/* Define this so that the type of the 'this' pointer in the
virtual functions will be correct for this derived class.
*/
struct AH_RSAEncryption;
#define THIS_ENCRYPT_DECRYPT struct AH_RSAEncryption
#include "port_before.h"
#include "global.h"
#include "bsafe2.h"
#include "bkey.h"
#include "balg.h"
#include "ahrsaenc.h"
#include "port_after.h"
static AHEncryptDecryptVTable V_TABLE = {
};
struct B_AlgorithmInfoType *infoType;
{
/* Construct base class with the infoType. Assume info is NULL_PTR. */
/* Set the AHEncryptDecrypt vTable, but don't set the RSAEncryption vTable
since it is pure virtual. */
}
{
/* Call base class destructor */
}
unsigned int *blockLen;
{
return (BE_NOT_SUPPORTED);
}
{
int status;
if ((status = AHChooseEncryptEncryptInit
return (status);
}
{
int status;
if ((status = AHChooseEncryptDecryptInit
return (status);
return (AH_RSAEncryptionInitHelper (handler, 0));
}
/* Accumulate into the z.block.
*/
unsigned char *partOut;
unsigned int *partOutLen;
unsigned int maxPartOutLen;
const unsigned char *partIn;
unsigned int partInLen;
{
*partOutLen = 0;
return (BE_INPUT_LEN);
return (0);
}
unsigned char *partOut;
unsigned int *partOutLen;
unsigned int maxPartOutLen;
{
int status;
unsigned int dummyPartOutLen;
/* Encode methodContext in place. */
return (status);
/* This should not return BE_INPUT_DATA since it is well-formatted. */
return (status);
/* Expect final to return zero bytes. */
return (status);
/* Restart the handle for new input. */
return (0);
}
unsigned char *partOut;
unsigned int *partOutLen;
unsigned int maxPartOutLen;
{
int status;
unsigned int decryptedLen, dummyPartOutLen;
/* Decrypt block in place. The block lenghts are already within limits.
*/
surrenderContext)) != 0)
return (status);
/* Expect final to return zero bytes. */
return (status);
/* Restart the handle for new input. */
/* Now decode the block and copy the result to the partOut.
*/
return (status);
/* This implies that the block was encrypted with less than
8 bytes of padding */
return (BE_INPUT_DATA);
return (BE_OUTPUT_LEN);
return (0);
}
int encryptFlag;
{
int status;
unsigned int newBlockLen;
return (status);
if (newBlockLen < 12)
/* PKCS Requires at least 12 bytes of modulus */
return (BE_NOT_SUPPORTED);
/* During encrypt, this will ensure that there are 8 bytes of padding.
During decrypt, the DecodeBlock procedure must check that the block
was encrypted with 8 bytes of padding.
*/
/* Zeroize old block and realloc to new size.
*/
== (unsigned char *)NULL_PTR) {
return (BE_ALLOC);
}
return (0);
}