Lines Matching refs:key

83 	crypto_key_t *key;
92 crypto_key_t *key;
368 check_mech_and_key(crypto_mechanism_t *mechanism, crypto_key_t *key)
382 if (key->ck_format != CRYPTO_KEY_ATTR_LIST) {
386 if ((rv = crypto_get_key_attr(key, SUN_CKA_MODULUS, &modulus,
492 crypto_key_t *key, crypto_spi_ctx_template_t template,
499 if ((rv = check_mech_and_key(mechanism, key)) != CRYPTO_SUCCESS)
509 if ((rv = crypto_copy_key_to_ctx(key, &ctxp->key, &ctxp->keychunk_size,
540 rv = rsa_encrypt_common(ctxp->mech_type, ctxp->key, plaintext,
553 crypto_key_t *key, crypto_data_t *plaintext, crypto_data_t *ciphertext,
558 if ((rv = check_mech_and_key(mechanism, key)) != CRYPTO_SUCCESS)
562 return (rsa_encrypt_common(mechanism->cm_type, key, plaintext,
572 bzero(ctxp->key, ctxp->keychunk_size);
573 kmem_free(ctxp->key, ctxp->keychunk_size);
588 rsa_encrypt_common(rsa_mech_type_t mech_type, crypto_key_t *key,
601 if ((rv = crypto_get_key_attr(key, SUN_CKA_MODULUS, &modulus,
639 rv = core_rsa_encrypt(key, plain_data, modulus_len, cipher_data, 1);
653 core_rsa_encrypt(crypto_key_t *key, uchar_t *in,
663 if ((rv = crypto_get_key_attr(key, SUN_CKA_PUBLIC_EXPONENT,
669 * RSA secret key. See the comments in core_rsa_decrypt
670 * routine which calls this routine with a private key.
672 if ((rv = crypto_get_key_attr(key, SUN_CKA_PRIVATE_EXPONENT,
677 if ((rv = crypto_get_key_attr(key, SUN_CKA_MODULUS, &modulus,
707 rv = rsa_decrypt_common(ctxp->mech_type, ctxp->key,
720 crypto_key_t *key, crypto_data_t *ciphertext, crypto_data_t *plaintext,
725 if ((rv = check_mech_and_key(mechanism, key)) != CRYPTO_SUCCESS)
729 return (rsa_decrypt_common(mechanism->cm_type, key, ciphertext,
734 rsa_decrypt_common(rsa_mech_type_t mech_type, crypto_key_t *key,
746 if ((rv = crypto_get_key_attr(key, SUN_CKA_MODULUS, &modulus,
762 rv = core_rsa_decrypt(key, ctptr, modulus_len, plain_data);
791 core_rsa_decrypt(crypto_key_t *key, uchar_t *in, int in_len, uchar_t *out)
800 if ((rv = crypto_get_key_attr(key, SUN_CKA_MODULUS, &modulus,
807 * present in a RSA secret key. If any of them is not present
810 * a required attribute for a RSA secret key.
812 if ((crypto_get_key_attr(key, SUN_CKA_PRIME_1, &prime1, &prime1_len)
814 (crypto_get_key_attr(key, SUN_CKA_PRIME_2, &prime2, &prime2_len)
816 (crypto_get_key_attr(key, SUN_CKA_EXPONENT_1, &expo1, &expo1_len)
818 (crypto_get_key_attr(key, SUN_CKA_EXPONENT_2, &expo2, &expo2_len)
820 (crypto_get_key_attr(key, SUN_CKA_COEFFICIENT, &coef, &coef_len)
822 return (core_rsa_encrypt(key, in, in_len, out, 0));
847 crypto_key_t *key, crypto_spi_ctx_template_t ctx_template,
855 if ((rv = check_mech_and_key(mechanism, key)) != CRYPTO_SUCCESS)
880 if ((rv = crypto_copy_key_to_ctx(key, &ctxp->key, &ctxp->keychunk_size,
964 if ((rv = crypto_get_key_attr(ctxp->key, SUN_CKA_MODULUS,
1039 rv = rsa_sign_common(mech_type, ctxp->key, &der_cd,
1042 rv = rsa_verify_common(mech_type, ctxp->key, &der_cd,
1049 rsa_sign_common(rsa_mech_type_t mech_type, crypto_key_t *key,
1061 if ((rv = crypto_get_key_attr(key, SUN_CKA_MODULUS, &modulus,
1112 rv = core_rsa_decrypt(key, plain_data, modulus_len, signed_data);
1148 rv = rsa_sign_common(ctxp->mech_type, ctxp->key, data,
1216 crypto_key_t *key, crypto_data_t *data, crypto_data_t *signature,
1222 if ((rv = check_mech_and_key(mechanism, key)) != CRYPTO_SUCCESS)
1227 rv = rsa_sign_common(mechanism->cm_type, key, data,
1232 dctx.key = key;
1263 rsa_verify_common(rsa_mech_type_t mech_type, crypto_key_t *key,
1273 if ((rv = crypto_get_key_attr(key, SUN_CKA_MODULUS, &modulus,
1286 rv = core_rsa_encrypt(key, sigptr, modulus_len, plain_data, 1);
1341 rv = rsa_verify_common(ctxp->mech_type, ctxp->key, data,
1416 crypto_mechanism_t *mechanism, crypto_key_t *key, crypto_data_t *data,
1423 if ((rv = check_mech_and_key(mechanism, key)) != CRYPTO_SUCCESS)
1428 rv = rsa_verify_common(mechanism->cm_type, key, data,
1433 dctx.key = key;
1465 rsa_verify_recover_common(rsa_mech_type_t mech_type, crypto_key_t *key,
1476 if ((rv = crypto_get_key_attr(key, SUN_CKA_MODULUS, &modulus,
1489 rv = core_rsa_encrypt(key, sigptr, modulus_len, plain_data, 1);
1531 rv = rsa_verify_recover_common(ctxp->mech_type, ctxp->key,
1544 crypto_key_t *key, crypto_data_t *signature, crypto_data_t *data,
1549 if ((rv = check_mech_and_key(mechanism, key)) != CRYPTO_SUCCESS)
1552 return (rsa_verify_recover_common(mechanism->cm_type, key,