EVP_PKEY_get_int_param is not getting degree from EC key

Blumenthal, Uri - 0553 - MITLL uri at ll.mit.edu
Tue Jan 4 16:46:02 UTC 2022


On 1/4/22, 11:23, "Tomas Mraz" <tomas at openssl.org> wrote:

>  > Theoretically, shouldn’t
>  > 
>  > EVP_PKEY_get_int_param(pkey, OSSL_PARAM_EC_ORDER, &(unsigned int)order)
>  > 
>  > work? I verified that it does not seem to work, at least in the
>  > obvious context. 
>
>  OSSL_PARAM_EC_ORDER is an unsigned integer (also a bignum) and it won't
>  fit into int. So that's the reason why that call fails.

In other words, the man page says it's unsigned int, but in fact it's BIGNUM? Because the pointer I gave was to "unsigned int", like in the OP's code.

This works, BTW:

      if (!(ec_grp = EC_GROUP_new_by_curve_name(ECCTYPE)))
            ERR("EC_GROUP_new_by_curve_name");
      const BIGNUM *ord = EC_GROUP_get0_order(ec_grp);
      fprintf(stderr, "order = ");
      BN_print_fp(stderr, ord); fprintf(stderr, "\n");
      printf("order = %s\n", BN_bn2dec(ord));


>  Also the order is not a degree (maximum number of bits of a curve
>  coordinate).

Yeah, I was trying to figure if *any* of EC-related parameters would work...


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5249 bytes
Desc: not available
URL: <https://mta.openssl.org/pipermail/openssl-users/attachments/20220104/6fe63e67/attachment-0001.bin>


More information about the openssl-users mailing list