Lines Matching refs:rv

370 	int rv = CRYPTO_FAILED;  in check_mech_and_key()  local
386 if ((rv = crypto_get_key_attr(key, SUN_CKA_MODULUS, &modulus, in check_mech_and_key()
388 return (rv); in check_mech_and_key()
394 return (rv); in check_mech_and_key()
414 int rv; in knzero_random_generator() local
420 if ((rv = random_get_pseudo_bytes(ran_out, ran_len)) != 0) in knzero_random_generator()
421 return (rv); in knzero_random_generator()
443 if ((rv = random_get_pseudo_bytes(extrarand, in knzero_random_generator()
445 return (rv); in knzero_random_generator()
495 int rv; in rsa_common_init() local
499 if ((rv = check_mech_and_key(mechanism, key)) != CRYPTO_SUCCESS) in rsa_common_init()
500 return (rv); in rsa_common_init()
509 if ((rv = crypto_copy_key_to_ctx(key, &ctxp->key, &ctxp->keychunk_size, in rsa_common_init()
512 return (rv); in rsa_common_init()
526 int rv; in rsaprov_encrypt() local
540 rv = rsa_encrypt_common(ctxp->mech_type, ctxp->key, plaintext, in rsaprov_encrypt()
543 if (rv != CRYPTO_BUFFER_TOO_SMALL) in rsaprov_encrypt()
546 return (rv); in rsaprov_encrypt()
556 int rv; in rsa_encrypt_atomic() local
558 if ((rv = check_mech_and_key(mechanism, key)) != CRYPTO_SUCCESS) in rsa_encrypt_atomic()
559 return (rv); in rsa_encrypt_atomic()
591 int rv = CRYPTO_FAILED; in rsa_encrypt_common() local
601 if ((rv = crypto_get_key_attr(key, SUN_CKA_MODULUS, &modulus, in rsa_encrypt_common()
603 return (rv); in rsa_encrypt_common()
624 if ((rv = crypto_get_input_data(plaintext, &ptptr, tmp_data)) in rsa_encrypt_common()
626 return (rv); in rsa_encrypt_common()
629 rv = pkcs1_encode(PKCS1_ENCRYPT, ptptr, plen, in rsa_encrypt_common()
632 if (rv != CRYPTO_SUCCESS) in rsa_encrypt_common()
633 return (rv); in rsa_encrypt_common()
639 rv = core_rsa_encrypt(key, plain_data, modulus_len, cipher_data, 1); in rsa_encrypt_common()
640 if (rv == CRYPTO_SUCCESS) { in rsa_encrypt_common()
642 if ((rv = crypto_put_output_data(cipher_data, in rsa_encrypt_common()
644 return (rv); in rsa_encrypt_common()
649 return (rv); in rsa_encrypt_common()
656 int rv; in core_rsa_encrypt() local
663 if ((rv = crypto_get_key_attr(key, SUN_CKA_PUBLIC_EXPONENT, in core_rsa_encrypt()
665 return (rv); in core_rsa_encrypt()
672 if ((rv = crypto_get_key_attr(key, SUN_CKA_PRIVATE_EXPONENT, in core_rsa_encrypt()
674 return (rv); in core_rsa_encrypt()
677 if ((rv = crypto_get_key_attr(key, SUN_CKA_MODULUS, &modulus, in core_rsa_encrypt()
679 return (rv); in core_rsa_encrypt()
688 rv = rsa_encrypt(&k, in, in_len, out); in core_rsa_encrypt()
690 return (rv); in core_rsa_encrypt()
698 int rv; in rsaprov_decrypt() local
707 rv = rsa_decrypt_common(ctxp->mech_type, ctxp->key, in rsaprov_decrypt()
710 if (rv != CRYPTO_BUFFER_TOO_SMALL) in rsaprov_decrypt()
713 return (rv); in rsaprov_decrypt()
723 int rv; in rsa_decrypt_atomic() local
725 if ((rv = check_mech_and_key(mechanism, key)) != CRYPTO_SUCCESS) in rsa_decrypt_atomic()
726 return (rv); in rsa_decrypt_atomic()
737 int rv = CRYPTO_FAILED; in rsa_decrypt_common() local
746 if ((rv = crypto_get_key_attr(key, SUN_CKA_MODULUS, &modulus, in rsa_decrypt_common()
748 return (rv); in rsa_decrypt_common()
758 if ((rv = crypto_get_input_data(ciphertext, &ctptr, tmp_data)) in rsa_decrypt_common()
760 return (rv); in rsa_decrypt_common()
762 rv = core_rsa_decrypt(key, ctptr, modulus_len, plain_data); in rsa_decrypt_common()
763 if (rv == CRYPTO_SUCCESS) { in rsa_decrypt_common()
768 rv = pkcs1_decode(PKCS1_DECRYPT, plain_data, in rsa_decrypt_common()
770 if (rv != CRYPTO_SUCCESS) in rsa_decrypt_common()
771 return (rv); in rsa_decrypt_common()
779 if ((rv = crypto_put_output_data( in rsa_decrypt_common()
782 return (rv); in rsa_decrypt_common()
787 return (rv); in rsa_decrypt_common()
793 int rv; in core_rsa_decrypt() local
800 if ((rv = crypto_get_key_attr(key, SUN_CKA_MODULUS, &modulus, in core_rsa_decrypt()
802 return (rv); in core_rsa_decrypt()
839 rv = rsa_decrypt(&k, in, in_len, out); in core_rsa_decrypt()
841 return (rv); in core_rsa_decrypt()
850 int rv; in rsa_sign_verify_common_init() local
855 if ((rv = check_mech_and_key(mechanism, key)) != CRYPTO_SUCCESS) in rsa_sign_verify_common_init()
856 return (rv); in rsa_sign_verify_common_init()
880 if ((rv = crypto_copy_key_to_ctx(key, &ctxp->key, &ctxp->keychunk_size, in rsa_sign_verify_common_init()
894 return (rv); in rsa_sign_verify_common_init()
938 int rv = CRYPTO_FAILED; in rsa_digest_svrfy_common() local
964 if ((rv = crypto_get_key_attr(ctxp->key, SUN_CKA_MODULUS, in rsa_digest_svrfy_common()
966 return (rv); in rsa_digest_svrfy_common()
976 rv = crypto_digest_data(data, &(ctxp->md5_ctx), in rsa_digest_svrfy_common()
980 rv = crypto_digest_data(data, &(ctxp->sha1_ctx), in rsa_digest_svrfy_common()
984 rv = crypto_digest_data(data, &(ctxp->sha2_ctx), in rsa_digest_svrfy_common()
987 if (rv != CRYPTO_SUCCESS) in rsa_digest_svrfy_common()
988 return (rv); in rsa_digest_svrfy_common()
1039 rv = rsa_sign_common(mech_type, ctxp->key, &der_cd, in rsa_digest_svrfy_common()
1042 rv = rsa_verify_common(mech_type, ctxp->key, &der_cd, in rsa_digest_svrfy_common()
1045 return (rv); in rsa_digest_svrfy_common()
1052 int rv = CRYPTO_FAILED; in rsa_sign_common() local
1061 if ((rv = crypto_get_key_attr(key, SUN_CKA_MODULUS, &modulus, in rsa_sign_common()
1063 return (rv); in rsa_sign_common()
1084 if ((rv = crypto_get_input_data(data, &dataptr, tmp_data)) in rsa_sign_common()
1086 return (rv); in rsa_sign_common()
1099 rv = pkcs1_encode(PKCS1_SIGN, dataptr, dlen, plain_data, in rsa_sign_common()
1101 if (rv != CRYPTO_SUCCESS) in rsa_sign_common()
1102 return (rv); in rsa_sign_common()
1112 rv = core_rsa_decrypt(key, plain_data, modulus_len, signed_data); in rsa_sign_common()
1113 if (rv == CRYPTO_SUCCESS) { in rsa_sign_common()
1115 if ((rv = crypto_put_output_data(signed_data, in rsa_sign_common()
1117 return (rv); in rsa_sign_common()
1122 return (rv); in rsa_sign_common()
1130 int rv; in rsaprov_sign() local
1143 rv = rsa_digest_svrfy_common((digest_rsa_ctx_t *)ctxp, data, in rsaprov_sign()
1148 rv = rsa_sign_common(ctxp->mech_type, ctxp->key, data, in rsaprov_sign()
1153 if (rv != CRYPTO_BUFFER_TOO_SMALL) in rsaprov_sign()
1156 return (rv); in rsaprov_sign()
1163 int rv; in rsa_sign_update() local
1176 rv = crypto_digest_data(data, &(ctxp->md5_ctx), in rsa_sign_update()
1181 rv = crypto_digest_data(data, &(ctxp->sha1_ctx), in rsa_sign_update()
1186 rv = crypto_digest_data(data, &(ctxp->sha2_ctx), in rsa_sign_update()
1190 return (rv); in rsa_sign_update()
1198 int rv; in rsa_sign_final() local
1204 rv = rsa_digest_svrfy_common(ctxp, NULL, signature, in rsa_sign_final()
1206 if (rv != CRYPTO_BUFFER_TOO_SMALL) in rsa_sign_final()
1209 return (rv); in rsa_sign_final()
1219 int rv; in rsa_sign_atomic() local
1222 if ((rv = check_mech_and_key(mechanism, key)) != CRYPTO_SUCCESS) in rsa_sign_atomic()
1223 return (rv); in rsa_sign_atomic()
1227 rv = rsa_sign_common(mechanism->cm_type, key, data, in rsa_sign_atomic()
1255 rv = rsa_digest_svrfy_common(&dctx, data, signature, in rsa_sign_atomic()
1259 return (rv); in rsa_sign_atomic()
1266 int rv = CRYPTO_FAILED; in rsa_verify_common() local
1273 if ((rv = crypto_get_key_attr(key, SUN_CKA_MODULUS, &modulus, in rsa_verify_common()
1275 return (rv); in rsa_verify_common()
1282 if ((rv = crypto_get_input_data(signature, &sigptr, tmp_data)) in rsa_verify_common()
1284 return (rv); in rsa_verify_common()
1286 rv = core_rsa_encrypt(key, sigptr, modulus_len, plain_data, 1); in rsa_verify_common()
1287 if (rv != CRYPTO_SUCCESS) in rsa_verify_common()
1288 return (rv); in rsa_verify_common()
1293 rv = CRYPTO_SIGNATURE_INVALID; in rsa_verify_common()
1303 rv = pkcs1_decode(PKCS1_VERIFY, plain_data, &data_len); in rsa_verify_common()
1304 if (rv != CRYPTO_SUCCESS) in rsa_verify_common()
1305 return (rv); in rsa_verify_common()
1312 rv = CRYPTO_SIGNATURE_INVALID; in rsa_verify_common()
1315 return (rv); in rsa_verify_common()
1323 int rv; in rsaprov_verify() local
1336 rv = rsa_digest_svrfy_common((digest_rsa_ctx_t *)ctxp, data, in rsaprov_verify()
1341 rv = rsa_verify_common(ctxp->mech_type, ctxp->key, data, in rsaprov_verify()
1346 if (rv != CRYPTO_BUFFER_TOO_SMALL) in rsaprov_verify()
1349 return (rv); in rsaprov_verify()
1357 int rv; in rsa_verify_update() local
1366 rv = crypto_digest_data(data, &(ctxp->md5_ctx), in rsa_verify_update()
1372 rv = crypto_digest_data(data, &(ctxp->sha1_ctx), in rsa_verify_update()
1380 rv = crypto_digest_data(data, &(ctxp->sha2_ctx), in rsa_verify_update()
1389 return (rv); in rsa_verify_update()
1397 int rv; in rsa_verify_final() local
1403 rv = rsa_digest_svrfy_common(ctxp, NULL, signature, in rsa_verify_final()
1405 if (rv != CRYPTO_BUFFER_TOO_SMALL) in rsa_verify_final()
1408 return (rv); in rsa_verify_final()
1420 int rv; in rsa_verify_atomic() local
1423 if ((rv = check_mech_and_key(mechanism, key)) != CRYPTO_SUCCESS) in rsa_verify_atomic()
1424 return (rv); in rsa_verify_atomic()
1428 rv = rsa_verify_common(mechanism->cm_type, key, data, in rsa_verify_atomic()
1457 rv = rsa_digest_svrfy_common(&dctx, data, signature, in rsa_verify_atomic()
1461 return (rv); in rsa_verify_atomic()
1468 int rv = CRYPTO_FAILED; in rsa_verify_recover_common() local
1476 if ((rv = crypto_get_key_attr(key, SUN_CKA_MODULUS, &modulus, in rsa_verify_recover_common()
1478 return (rv); in rsa_verify_recover_common()
1485 if ((rv = crypto_get_input_data(signature, &sigptr, tmp_data)) in rsa_verify_recover_common()
1487 return (rv); in rsa_verify_recover_common()
1489 rv = core_rsa_encrypt(key, sigptr, modulus_len, plain_data, 1); in rsa_verify_recover_common()
1490 if (rv != CRYPTO_SUCCESS) in rsa_verify_recover_common()
1491 return (rv); in rsa_verify_recover_common()
1501 rv = pkcs1_decode(PKCS1_VERIFY, plain_data, &data_len); in rsa_verify_recover_common()
1502 if (rv != CRYPTO_SUCCESS) in rsa_verify_recover_common()
1503 return (rv); in rsa_verify_recover_common()
1511 if ((rv = crypto_put_output_data(plain_data + modulus_len - data_len, in rsa_verify_recover_common()
1513 return (rv); in rsa_verify_recover_common()
1516 return (rv); in rsa_verify_recover_common()
1524 int rv; in rsa_verify_recover() local
1531 rv = rsa_verify_recover_common(ctxp->mech_type, ctxp->key, in rsa_verify_recover()
1534 if (rv != CRYPTO_BUFFER_TOO_SMALL) in rsa_verify_recover()
1537 return (rv); in rsa_verify_recover()
1547 int rv; in rsa_verify_recover_atomic() local
1549 if ((rv = check_mech_and_key(mechanism, key)) != CRYPTO_SUCCESS) in rsa_verify_recover_atomic()
1550 return (rv); in rsa_verify_recover_atomic()