X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/d190cdc3f5544636abb56dc1874be391d3e1b148..c6bf4f310a33a9262d455ea4d3f0630b1255e3fe:/libkern/crypto/corecrypto_rsa.c?ds=sidebyside diff --git a/libkern/crypto/corecrypto_rsa.c b/libkern/crypto/corecrypto_rsa.c index 8bf03214a..d47da83a6 100644 --- a/libkern/crypto/corecrypto_rsa.c +++ b/libkern/crypto/corecrypto_rsa.c @@ -31,26 +31,28 @@ #include -int rsa_make_pub(rsa_pub_ctx *pub, - size_t exp_nbytes, const uint8_t *exp, - size_t mod_nbytes, const uint8_t *mod) { - if ((exp_nbytes>RSA_MAX_KEY_BITSIZE/8) - || (mod_nbytes>RSA_MAX_KEY_BITSIZE/8)) { +int +rsa_make_pub(rsa_pub_ctx *pub, + size_t exp_nbytes, const uint8_t *exp, + size_t mod_nbytes, const uint8_t *mod) +{ + if ((exp_nbytes > RSA_MAX_KEY_BITSIZE / 8) + || (mod_nbytes > RSA_MAX_KEY_BITSIZE / 8)) { return -1; // Too big } ccrsa_ctx_n(pub->key) = ccn_nof(RSA_MAX_KEY_BITSIZE); return g_crypto_funcs->ccrsa_make_pub_fn(pub->key, - exp_nbytes, exp, - mod_nbytes, mod); + exp_nbytes, exp, + mod_nbytes, mod); } -int rsa_verify_pkcs1v15(rsa_pub_ctx *pub, const uint8_t *oid, - size_t digest_len, const uint8_t *digest, - size_t sig_len, const uint8_t *sig, - bool *valid) { - return g_crypto_funcs->ccrsa_verify_pkcs1v15_fn(pub->key,oid, - digest_len,digest, - sig_len,sig,valid); +int +rsa_verify_pkcs1v15(rsa_pub_ctx *pub, const uint8_t *oid, + size_t digest_len, const uint8_t *digest, + size_t sig_len, const uint8_t *sig, + bool *valid) +{ + return g_crypto_funcs->ccrsa_verify_pkcs1v15_fn(pub->key, oid, + digest_len, digest, + sig_len, sig, valid); } - -