diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2021-11-18 17:26:44 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2021-11-18 17:26:44 +0000 |
commit | 347f8c6a61bb704cac0e0ee306adf71b707dc0d3 (patch) | |
tree | c8b48f464a8b80ec171bc36bfadb2534dfa08131 /usr.sbin/acme-client | |
parent | 9758561d33f2126a5f3a8180ab73b224a6887c34 (diff) |
acme-client: use EVP_PKEY_base_id()
In an upcoming libcrypto bump, EVP_PKEY will become opaque. In order to
stop reaching inside EVP_PKEY, we must replace EVP_PKEY_type(pkey->type)
with the equivalent EVP_PKEY_base_Id(pkey) in various places.
ok florian
Diffstat (limited to 'usr.sbin/acme-client')
-rw-r--r-- | usr.sbin/acme-client/acctproc.c | 16 | ||||
-rw-r--r-- | usr.sbin/acme-client/key.c | 7 |
2 files changed, 12 insertions, 11 deletions
diff --git a/usr.sbin/acme-client/acctproc.c b/usr.sbin/acme-client/acctproc.c index 377f53c12fa..8352c2d4b7d 100644 --- a/usr.sbin/acme-client/acctproc.c +++ b/usr.sbin/acme-client/acctproc.c @@ -1,4 +1,4 @@ -/* $Id: acctproc.c,v 1.21 2021/05/13 07:10:57 tb Exp $ */ +/* $Id: acctproc.c,v 1.22 2021/11/18 17:26:43 tb Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -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 acctop op) 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 acctop op) 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 acctop op) 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 acctop op) 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 acctop op) break; default: - warnx("EVP_PKEY_type"); + warnx("EVP_PKEY_base_id"); goto out; } diff --git a/usr.sbin/acme-client/key.c b/usr.sbin/acme-client/key.c index 1bc1eee8f59..6604751caef 100644 --- a/usr.sbin/acme-client/key.c +++ b/usr.sbin/acme-client/key.c @@ -1,4 +1,4 @@ -/* $Id: key.c,v 1.2 2019/06/17 15:41:59 florian Exp $ */ +/* $Id: key.c,v 1.3 2021/11/18 17:26:43 tb Exp $ */ /* * Copyright (c) 2019 Renaud Allard <renaud@allard.it> * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv> @@ -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); |