sure, go nuts.
On 2021-11-18 17:53 +01, Theo Buehler <[email protected]> wrote:
> EVP_PKEY will become opaque, so we must stop reaching inside it. As
> should be completely evident from the name, EVP_PKEY_type(pkey->type)
> is the same as EVP_KEY_base_id(pkey).
>
> From lib/libcrypto/evp/p_lib.c:
>
> int
> EVP_PKEY_base_id(const EVP_PKEY *pkey)
> {
>       return EVP_PKEY_type(pkey->type);
> }
>
> Index: acctproc.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/acme-client/acctproc.c,v
> retrieving revision 1.21
> diff -u -p -r1.21 acctproc.c
> --- acctproc.c        13 May 2021 07:10:57 -0000      1.21
> +++ acctproc.c        18 Nov 2021 16:46:35 -0000
> @@ -140,7 +140,7 @@ op_thumbprint(int fd, EVP_PKEY *pkey)
>  
>       /* Construct the thumbprint input itself. */
>  
> -     switch (EVP_PKEY_type(pkey->type)) {
> +     switch (EVP_PKEY_base_id(pkey)) {
>       case EVP_PKEY_RSA:
>               if ((thumb = op_thumb_rsa(pkey)) != NULL)
>                       break;
> @@ -150,7 +150,7 @@ op_thumbprint(int fd, EVP_PKEY *pkey)
>                       break;
>               goto out;
>       default:
> -             warnx("EVP_PKEY_type: unknown key type");
> +             warnx("EVP_PKEY_base_id: unknown key type");
>               goto out;
>       }
>  
> @@ -297,7 +297,7 @@ op_sign(int fd, EVP_PKEY *pkey, enum acc
>               goto out;
>       }
>  
> -     switch (EVP_PKEY_type(pkey->type)) {
> +     switch (EVP_PKEY_base_id(pkey)) {
>       case EVP_PKEY_RSA:
>               alg = "RS256";
>               evp_md = EVP_sha256();
> @@ -318,7 +318,7 @@ op_sign(int fd, EVP_PKEY *pkey, enum acc
>                       goto out;
>               }
>       } else {
> -             switch (EVP_PKEY_type(pkey->type)) {
> +             switch (EVP_PKEY_base_id(pkey)) {
>               case EVP_PKEY_RSA:
>                       if (!op_sign_rsa(&prot, pkey, nonce, url))
>                               goto out;
> @@ -328,7 +328,7 @@ op_sign(int fd, EVP_PKEY *pkey, enum acc
>                               goto out;
>                       break;
>               default:
> -                     warnx("EVP_PKEY_type");
> +                     warnx("EVP_PKEY_base_id");
>                       goto out;
>               }
>       }
> @@ -373,7 +373,7 @@ op_sign(int fd, EVP_PKEY *pkey, enum acc
>               goto out;
>       }
>  
> -     switch (EVP_PKEY_type(pkey->type)) {
> +     switch (EVP_PKEY_base_id(pkey)) {
>       case EVP_PKEY_RSA:
>               if ((dig64 = base64buf_url((char *)dig, digsz)) == NULL) {
>                       warnx("base64buf_url");
> @@ -421,7 +421,7 @@ op_sign(int fd, EVP_PKEY *pkey, enum acc
>  
>               break;
>       default:
> -             warnx("EVP_PKEY_type");
> +             warnx("EVP_PKEY_base_id");
>               goto out;
>       }
>  
> Index: key.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/acme-client/key.c,v
> retrieving revision 1.2
> diff -u -p -r1.2 key.c
> --- key.c     17 Jun 2019 15:41:59 -0000      1.2
> +++ key.c     18 Nov 2021 16:46:35 -0000
> @@ -136,8 +136,9 @@ key_load(FILE *f, const char *fname)
>       if (pkey == NULL) {
>               warnx("%s: PEM_read_PrivateKey", fname);
>               return NULL;
> -     } else if (EVP_PKEY_type(pkey->type) == EVP_PKEY_RSA ||
> -                EVP_PKEY_type(pkey->type) == EVP_PKEY_EC )
> +     }
> +     if (EVP_PKEY_base_id(pkey) == EVP_PKEY_RSA ||
> +         EVP_PKEY_base_id(pkey) == EVP_PKEY_EC)
>               return pkey;
>  
>       warnx("%s: unsupported key type", fname);
>

-- 
I'm not entirely sure you are real.

Reply via email to