/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <security/cryptoki.h>
#include <des/des_impl.h>
#include <cryptoutil.h>
#include "softGlobal.h"
#include "softSession.h"
#include "softObject.h"
#include "softDH.h"
#include "softCrypt.h"
/*
* This function takes a converted big integer of the specified attribute
* as an octet string and stores it in the corresponding key object.
*/
static CK_RV
{
switch (type) {
case CKA_VALUE:
if (public)
else
break;
case CKA_PRIME:
break;
case CKA_BASE:
break;
}
goto cleanexit;
/* Copy the attribute in the key object. */
/* No need to free big_value because dst holds it now after copy. */
return (rv);
}
/*
* This function covers the DH Key agreement.
*/
{
DHbytekey k;
return (CKR_KEY_TYPE_INCONSISTENT);
}
return (CKR_KEY_TYPE_INCONSISTENT);
}
/* Get private-value length in bits */
return (CKR_HOST_MEMORY);
}
&template);
return (rv);
}
#ifdef __sparcv9
/* LINTED */
#else /* !__sparcv9 */
#endif /* __sparcv9 */
/*
* The input to the first phase shall be the Diffie-Hellman
* parameters, which include prime, base, and private-value length.
*/
return (rv);
}
goto ret;
}
/* Inputs to DH key pair generation. */
k.base_bytes = base_len;
k.x_len_bits = value_bits;
k.y_len_bits = k.prime_bits;
/* Outputs from DH key pair generation. */
/* If value_bits is 0, it will return as same size as prime */
goto ret;
}
/*
* The integer public value y shall be converted to an octet
* string PV of length k, the public value.
*/
goto ret;
}
/* Convert the big integer private value to an octet string. */
goto ret;
}
/* Convert the big integer prime to an octet string. */
goto ret;
}
/* Convert the big integer base to an octet string. */
goto ret;
}
/* Update private-value length in bits; could have been 0 before */
ret:
return (rv);
}
/* ARGSUSED3 */
{
DHbytekey k;
return (rv);
}
goto ret;
}
/* keylen may be 0 if CKA_VALUE_LEN did not specify */
goto ret;
}
k.prime = privateprime;
k.private_x = privatevalue;
k.public_y = publicvalue;
/* keylen may be modified if it was 0 or conflicts with key type */
goto ret;
}
goto ret;
}
ret:
return (rv);
}