softKeystore.c revision 7b79d84636ec82b45f00c982cf6810db81852d17
110N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
110N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
110N/A#include <cryptoutil.h>
110N/A#include "softGlobal.h"
110N/A#include "softCrypt.h"
110N/A#include "softSession.h"
110N/A#include "softObject.h"
110N/A#include "softKeys.h"
110N/A#include "softKeystore.h"
110N/A#include "softKeystoreUtil.h"
529N/A if (pin_initialized) {
goto cleanup;
goto cleanup;
goto cleanup;
* encryption/decryption of the private objects in
goto cleanup;
if (salt)
if (tmp_pin)
if (ks_cryptpin)
return (rv);
B_FALSE);
return (rv);
if (pin_initialized) {
goto cleanup;
goto cleanup;
&salt) < 0) {
goto cleanup;
goto cleanup;
ulOldPinLen) != 0) {
goto cleanup;
goto cleanup;
goto cleanup;
if (salt)
if (ks_cryptpin)
if (tmp_old_pin)
if (tmp_new_pin)
return (rv);
int num_attrs = 0;
while (extra_attr) {
num_attrs++;
return (CKR_HOST_MEMORY);
for (i = 0; i < num_attrs; i++) {
return (rv);
return (CKR_HOST_MEMORY);
return (rv);
return (rv);
return (CKR_HOST_MEMORY);
if (cert) {
return (rv);
return (CKR_OK);
switch (class) {
case CKO_PUBLIC_KEY:
switch (keytype) {
case CKK_RSA:
case CKK_DSA:
case CKK_DH:
case CKK_X9_42_DH:
case CKO_PRIVATE_KEY:
switch (keytype) {
case CKK_RSA:
case CKK_DSA:
case CKK_DH:
case CKK_X9_42_DH:
case CKO_SECRET_KEY:
sizeof (uint64_t));
case CKO_CERTIFICATE:
switch (certtype) {
case CKC_X_509:
case CKC_X_509_ATTR_CERT:
case CKO_DOMAIN_PARAMETERS:
switch (class) {
case CKO_PUBLIC_KEY:
switch (keytype) {
case CKK_RSA:
((biginteger_t *)
((biginteger_t *)
case CKK_DSA:
((biginteger_t *)
((biginteger_t *)
((biginteger_t *)
((biginteger_t *)
case CKK_DH:
((biginteger_t *)
((biginteger_t *)
((biginteger_t *)
case CKK_X9_42_DH:
((biginteger_t *)
((biginteger_t *)
((biginteger_t *)
((biginteger_t *)
case CKO_PRIVATE_KEY:
switch (keytype) {
case CKK_RSA:
((biginteger_t *)
((biginteger_t *)
((biginteger_t *)
((biginteger_t *)
((biginteger_t *)
((biginteger_t *)
((biginteger_t *)
((biginteger_t *)
case CKK_DSA:
((biginteger_t *)
((biginteger_t *)
((biginteger_t *)
((biginteger_t *)
case CKK_DH:
((biginteger_t *)
((biginteger_t *)
((biginteger_t *)
case CKK_X9_42_DH:
((biginteger_t *)
((biginteger_t *)
((biginteger_t *)
((biginteger_t *)
case CKO_SECRET_KEY:
case CKO_CERTIFICATE:
switch (certtype) {
case CKC_X_509:
((cert_attr_t *)
((cert_attr_t *)
case CKC_X_509_ATTR_CERT:
((cert_attr_t *)
((cert_attr_t *)
case CKO_DOMAIN_PARAMETERS:
return (CKR_OK);
switch (class) {
case CKO_PUBLIC_KEY:
return (rv);
switch (keytype) {
goto pub_cleanup;
goto pub_cleanup;
case CKK_DSA:
goto pub_cleanup;
goto pub_cleanup;
goto pub_cleanup;
goto pub_cleanup;
case CKK_DH:
goto pub_cleanup;
goto pub_cleanup;
goto pub_cleanup;
case CKK_X9_42_DH:
goto pub_cleanup;
goto pub_cleanup;
goto pub_cleanup;
goto pub_cleanup;
case CKO_PRIVATE_KEY:
return (rv);
switch (keytype) {
case CKK_RSA:
goto pri_cleanup;
goto pri_cleanup;
goto pri_cleanup;
goto pri_cleanup;
goto pri_cleanup;
goto pri_cleanup;
goto pri_cleanup;
goto pri_cleanup;
case CKK_DSA:
goto pri_cleanup;
goto pri_cleanup;
goto pri_cleanup;
goto pri_cleanup;
case CKK_DH:
goto pri_cleanup;
goto pri_cleanup;
goto pri_cleanup;
case CKK_X9_42_DH:
goto pri_cleanup;
goto pri_cleanup;
goto pri_cleanup;
goto pri_cleanup;
case CKO_SECRET_KEY:
return (CKR_HOST_MEMORY);
return (CKR_HOST_MEMORY);
return (rv);
case CKO_CERTIFICATE:
return (CKR_HOST_MEMORY);
switch (certtype) {
case CKC_X_509:
return (rv);
return (rv);
case CKC_X_509_ATTR_CERT:
return (rv);
return (rv);
return (rv);
case CKO_DOMAIN_PARAMETERS:
return (rv);
return (rv);
return (rv);
return (CKR_FUNCTION_FAILED);
return (CKR_FUNCTION_FAILED);
return (CKR_OK);
return (rv);
B_TRUE) < 0) {
return (CKR_FUNCTION_FAILED);
return (CKR_OK);
return (rv);
while (ks_obj) {
goto cleanup;
goto cleanup;
return (CKR_OK);
while (ks_obj) {
return (rv);
int attrs = 0;
return (CKR_FUNCTION_FAILED);
attrs++;
attrs++;
attrs++;
attrs++;
attrs++;
return (CKR_HOST_MEMORY);
return (rv);
return (CKR_HOST_MEMORY);
return (rv);
int attrs = 0;
return (CKR_FUNCTION_FAILED);
attrs++;
attrs++;
attrs++;
attrs++;
attrs++;
return (CKR_HOST_MEMORY);
return (rv);
return (CKR_HOST_MEMORY);
return (rv);
* to hold some information during encryption/decryption and
soft_init_token_session(void)
return (CKR_CANT_LOCK);
return (CKR_OK);
if (encrypt)
return (rv);
if (encrypt)
if (encrypt) {
return (CKR_HOST_MEMORY);
if (encrypt) {
* are doing the real encryption/decryption this time.
if (encrypt) {
return (rv);
return (rv);
if (sign) {
return (rv);