diff options
| author | Michael Brown | 2025-12-02 14:13:01 +0100 |
|---|---|---|
| committer | Michael Brown | 2025-12-02 14:13:01 +0100 |
| commit | 3e566818f747baa135e1b693ab2ab67fe4f942e2 (patch) | |
| tree | abb1f3cfd0fc61c41ed548a251cf91701d3cf346 /src/crypto | |
| parent | [crypto] Construct asymmetric ciphered data using ASN.1 builders (diff) | |
| download | ipxe-3e566818f747baa135e1b693ab2ab67fe4f942e2.tar.gz ipxe-3e566818f747baa135e1b693ab2ab67fe4f942e2.tar.xz ipxe-3e566818f747baa135e1b693ab2ab67fe4f942e2.zip | |
[crypto] Remove obsolete maximum output length method
Now that public-key algorithms use ASN.1 builders to dynamically
allocate the output data, there is no further need for callers to be
able to determine the maximum output length.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/crypto')
| -rw-r--r-- | src/crypto/crypto_null.c | 5 | ||||
| -rw-r--r-- | src/crypto/rsa.c | 22 |
2 files changed, 0 insertions, 27 deletions
diff --git a/src/crypto/crypto_null.c b/src/crypto/crypto_null.c index e8f8cbde8..e80f2707f 100644 --- a/src/crypto/crypto_null.c +++ b/src/crypto/crypto_null.c @@ -93,10 +93,6 @@ struct cipher_algorithm cipher_null = { .auth = cipher_null_auth, }; -size_t pubkey_null_max_len ( const struct asn1_cursor *key __unused ) { - return 0; -} - int pubkey_null_encrypt ( const struct asn1_cursor *key __unused, const struct asn1_cursor *plaintext __unused, struct asn1_builder *ciphertext __unused ) { @@ -125,7 +121,6 @@ int pubkey_null_verify ( const struct asn1_cursor *key __unused, struct pubkey_algorithm pubkey_null = { .name = "null", - .max_len = pubkey_null_max_len, .encrypt = pubkey_null_encrypt, .decrypt = pubkey_null_decrypt, .sign = pubkey_null_sign, diff --git a/src/crypto/rsa.c b/src/crypto/rsa.c index 18b2b1c14..051bbfa08 100644 --- a/src/crypto/rsa.c +++ b/src/crypto/rsa.c @@ -288,27 +288,6 @@ static int rsa_init ( struct rsa_context *context, } /** - * Calculate RSA maximum output length - * - * @v key Key - * @ret max_len Maximum output length - */ -static size_t rsa_max_len ( const struct asn1_cursor *key ) { - struct asn1_cursor modulus; - struct asn1_cursor exponent; - int rc; - - /* Parse moduli and exponents */ - if ( ( rc = rsa_parse_mod_exp ( &modulus, &exponent, key ) ) != 0 ) { - /* Return a zero maximum length on error */ - return 0; - } - - /* Output length can never exceed modulus length */ - return modulus.len; -} - -/** * Perform RSA cipher operation * * @v context RSA context @@ -706,7 +685,6 @@ static int rsa_match ( const struct asn1_cursor *private_key, /** RSA public-key algorithm */ struct pubkey_algorithm rsa_algorithm = { .name = "rsa", - .max_len = rsa_max_len, .encrypt = rsa_encrypt, .decrypt = rsa_decrypt, .sign = rsa_sign, |
