diff options
author | Adam Langley <agl@google.com> | 2015-03-05 19:55:49 -0800 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2015-03-05 19:55:49 -0800 |
commit | f4dabdd0527bd5cc09ab043ec6b0a53be190d93a (patch) | |
tree | 84181ca7ef62653dee367259d90794f0a32d6124 /src | |
parent | 1f6fdd5a306c0a08f5dcf7ef6696c2efe4839882 (diff) | |
download | external_boringssl-f4dabdd0527bd5cc09ab043ec6b0a53be190d93a.zip external_boringssl-f4dabdd0527bd5cc09ab043ec6b0a53be190d93a.tar.gz external_boringssl-f4dabdd0527bd5cc09ab043ec6b0a53be190d93a.tar.bz2 |
Export the PSS padding functions.
system/keymaster is using them now.
Change-Id: I396e7001e6edf443ed2726d68d21704c7e557748
Diffstat (limited to 'src')
-rw-r--r-- | src/crypto/rsa/internal.h | 9 | ||||
-rw-r--r-- | src/include/openssl/rsa.h | 29 |
2 files changed, 29 insertions, 9 deletions
diff --git a/src/crypto/rsa/internal.h b/src/crypto/rsa/internal.h index aa3a982..3dd4f04 100644 --- a/src/crypto/rsa/internal.h +++ b/src/crypto/rsa/internal.h @@ -113,15 +113,6 @@ int RSA_padding_add_none(uint8_t *to, unsigned to_len, const uint8_t *from, int RSA_padding_check_none(uint8_t *to, unsigned to_len, const uint8_t *from, unsigned from_len); -/* RSA_verify_PKCS1_PSS_mgf1 */ -int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const uint8_t *mHash, - const EVP_MD *Hash, const EVP_MD *mgf1Hash, - const uint8_t *EM, int sLen); - -int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, uint8_t *EM, const uint8_t *mHash, - const EVP_MD *Hash, const EVP_MD *mgf1Hash, - int sLen); - /* RSA_private_transform calls either the method-specific |private_transform| * function (if given) or the generic one. See the comment for * |private_transform| in |rsa_meth_st|. */ diff --git a/src/include/openssl/rsa.h b/src/include/openssl/rsa.h index ff2bd8b..5f39e0b 100644 --- a/src/include/openssl/rsa.h +++ b/src/include/openssl/rsa.h @@ -285,6 +285,35 @@ OPENSSL_EXPORT int RSA_check_key(const RSA *rsa); * otherwise. */ OPENSSL_EXPORT int RSA_recover_crt_params(RSA *rsa); +/* RSA_verify_PKCS1_PSS_mgf1 verifies that |EM| is a correct PSS padding of + * |mHash|, where |mHash| is a digest produced by |Hash|. The |mgf1Hash| + * argument specifies the hash function for generating the mask. If NULL, + * |Hash| is used. The |sLen| argument specifies the expected salt length in + * bytes. If |sLen| is -1 then the salt length is the same as the hash length. + * If -2, then the salt length is maximal and is taken from the size of |EM|. + * + * It returns one on success or zero on error. */ +OPENSSL_EXPORT int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const uint8_t *mHash, + const EVP_MD *Hash, + const EVP_MD *mgf1Hash, + const uint8_t *EM, int sLen); + +/* RSA_padding_add_PKCS1_PSS_mgf1 writes a PSS padding of |mHash| to |EM|, + * where |mHash| is a digest produced by |Hash|. There must be at least + * |RSA_size(rsa)| bytes of space in |EM|. The |mgf1Hash| argument specifies + * the hash function for generating the mask. If NULL, |Hash| is used. The + * |sLen| argument specifies the expected salt length in bytes. If |sLen| is -1 + * then the salt length is the same as the hash length. If -2, then the salt + * length is maximal given the space in |EM|. + * + * It returns one on success or zero on error. */ +OPENSSL_EXPORT int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, uint8_t *EM, + const uint8_t *mHash, + const EVP_MD *Hash, + const EVP_MD *mgf1Hash, + int sLen); + + /* ASN.1 functions. */ |