aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/c_src
diff options
context:
space:
mode:
authorDoug Hogan <[email protected]>2019-01-04 01:29:33 -0800
committerDoug Hogan <[email protected]>2019-01-08 01:11:59 -0800
commit420161f96effc135a52bb590a1b4bea717466449 (patch)
tree15eb7d95587c4710f2aff61deac6ebf2b67cad03 /lib/crypto/c_src
parentb4b8f69a507770b7a0031c79d01bd58cc27763ef (diff)
downloadotp-420161f96effc135a52bb590a1b4bea717466449.tar.gz
otp-420161f96effc135a52bb590a1b4bea717466449.tar.bz2
otp-420161f96effc135a52bb590a1b4bea717466449.zip
Revamp get_pkey_digest_type()
* Whitespace
Diffstat (limited to 'lib/crypto/c_src')
-rw-r--r--lib/crypto/c_src/pkey.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/crypto/c_src/pkey.c b/lib/crypto/c_src/pkey.c
index bd56b2d977..d67163468d 100644
--- a/lib/crypto/c_src/pkey.c
+++ b/lib/crypto/c_src/pkey.c
@@ -68,13 +68,16 @@ static int get_pkey_digest_type(ErlNifEnv *env, ERL_NIF_TERM algorithm, ERL_NIF_
struct digest_type_t *digp = NULL;
*md = NULL;
- if (type == atom_none && algorithm == atom_rsa) return PKEY_OK;
+ if (type == atom_none && algorithm == atom_rsa)
+ return PKEY_OK;
#ifdef HAVE_EDDSA
- if (algorithm == atom_eddsa) return PKEY_OK;
+ if (algorithm == atom_eddsa)
+ return PKEY_OK;
#endif
- digp = get_digest_type(type);
- if (!digp) return PKEY_BADARG;
- if (!digp->md.p) return PKEY_NOTSUP;
+ if ((digp = get_digest_type(type)) == NULL)
+ return PKEY_BADARG;
+ if (digp->md.p == NULL)
+ return PKEY_NOTSUP;
*md = digp->md.p;
return PKEY_OK;