EC_KEY_METHOD *PKCS11_get_ec_key_method(void) { int (*orig_sign)(int type, const unsigned char *dgst, int dlen, unsigned char *sig, unsigned int *siglen, const BIGNUM *kinv, const BIGNUM *r, EC_KEY *eckey) = NULL; int (*orig_sign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) = NULL; ECDSA_SIG *(*orig_sign_sig)(const unsigned char *dgst, int dgst_len, const BIGNUM *in_kinv, const BIGNUM *in_r, EC_KEY *eckey) = NULL; alloc_ec_key_ex_index(); if (ops == NULL) { ops = EC_KEY_METHOD_new((EC_KEY_METHOD *)EC_KEY_OpenSSL()); EC_KEY_METHOD_get_sign(ops, &orig_sign, &orig_sign_setup, &orig_sign_sig); EC_KEY_METHOD_set_sign(ops, orig_sign, pkcs11_ecdsa_sign_setup, pkcs11_ecdsa_do_sign); EC_KEY_METHOD_set_compute_key(ops, pkcs11_ec_ckey); } return ops; }
EC_KEY_METHOD *PKCS11_get_ec_key_method(void) { static EC_KEY_METHOD *ops = NULL; int (*orig_sign)(int, const unsigned char *, int, unsigned char *, unsigned int *, const BIGNUM *, const BIGNUM *, EC_KEY *) = NULL; alloc_ec_ex_index(); if (ops == NULL) { ops = EC_KEY_METHOD_new((EC_KEY_METHOD *)EC_KEY_OpenSSL()); EC_KEY_METHOD_get_sign(ops, &orig_sign, NULL, NULL); EC_KEY_METHOD_set_sign(ops, orig_sign, NULL, pkcs11_ecdsa_sign_sig); EC_KEY_METHOD_get_compute_key(ops, &ossl_ecdh_compute_key); EC_KEY_METHOD_set_compute_key(ops, pkcs11_ec_ckey); } return ops; }