diff options
author | Miloslav Trmač <mitr@redhat.com> | 2010-11-26 02:00:31 +0100 |
---|---|---|
committer | Miloslav Trmač <mitr@redhat.com> | 2010-11-26 02:00:31 +0100 |
commit | e7fa04556e265d65232d6ef2afc6c0c472198011 (patch) | |
tree | 643f5a76d98b49b051ccc47575d5a72f6a763afe /include/ncrypto/ncrypto.h | |
parent | 21c90e0365ac50c57ad5a3493582e996a236d1a3 (diff) | |
download | ncrypto-e7fa04556e265d65232d6ef2afc6c0c472198011.tar.gz ncrypto-e7fa04556e265d65232d6ef2afc6c0c472198011.tar.xz ncrypto-e7fa04556e265d65232d6ef2afc6c0c472198011.zip |
Pass MPIs around in arrays, not named parameters
Diffstat (limited to 'include/ncrypto/ncrypto.h')
-rw-r--r-- | include/ncrypto/ncrypto.h | 70 |
1 files changed, 39 insertions, 31 deletions
diff --git a/include/ncrypto/ncrypto.h b/include/ncrypto/ncrypto.h index fe10d9f..16d8258 100644 --- a/include/ncrypto/ncrypto.h +++ b/include/ncrypto/ncrypto.h @@ -86,42 +86,50 @@ CK_RV ncr_private_key_export (struct ncr_private_key *key, void *dest, size_t *dest_size_ptr); CK_RV ncr_private_key_destroy (struct ncr_private_key *key); + /* Multi-precision integers */ + +/* This is used to avoid e.g. 8 separate parameters for RSA private key + passing. */ +struct ncr_mpi +{ + void *data; + size_t size; +}; + /* RSA keys */ +enum + { + NCR_RSA_PUBLIC_MPI_MODULUS, + NCR_RSA_PUBLIC_MPI_PUBLIC_EXPONENT, + NCR_RSA_PUBLIC_NUM_MPIS + }; + +enum + { + NCR_RSA_PRIVATE_MPI_MODULUS, + NCR_RSA_PRIVATE_MPI_PUBLIC_EXPONENT, + NCR_RSA_PRIVATE_MPI_PRIVATE_EXPONENT, + NCR_RSA_PRIVATE_MPI_PRIME_1, + NCR_RSA_PRIVATE_MPI_PRIME_2, + NCR_RSA_PRIVATE_MPI_EXPONENT_1, + NCR_RSA_PRIVATE_MPI_EXPONENT_2, + NCR_RSA_PRIVATE_MPI_COEFFICIENT, + NCR_RSA_PRIVATE_NUM_MPIS + }; + CK_RV ncr_public_key_create_rsa (struct ncr_public_key **key, - const void *modulus, size_t modulus_size, - const void *public_exponent, - size_t public_exponent_size); + const struct ncr_mpi + mpis[static NCR_RSA_PUBLIC_NUM_MPIS]); CK_RV ncr_public_key_export_rsa (struct ncr_public_key *key, - void *modulus, size_t *modulus_size_ptr, - void *public_exponent, - size_t *public_exponent_size_ptr); + struct ncr_mpi + mpis [static NCR_RSA_PUBLIC_NUM_MPIS]); CK_RV ncr_private_key_create_rsa (struct ncr_private_key **key, _Bool sensitive, - const void *modulus, size_t modulus_size, - const void *public_exponent, - size_t public_exponent_size, - const void *private_exponent, - size_t private_exponent_size, - const void *prime_1, size_t prime_1_size, - const void *prime_2, size_t prime_2_size, - const void *exponent_1, - size_t exponent_1_size, - const void *exponent_2, - size_t exponent_2_size, - const void *coefficient, - size_t coefficient_size); -CK_RV ncr_private_key_export_rsa (struct ncr_private_key *key, void *modulus, - size_t *modulus_size_ptr, - void *public_exponent, - size_t *public_exponent_size_ptr, - void *private_exponent, - size_t *private_exponent_size_ptr, - void *prime_1, size_t *prime_1_size_ptr, - void *prime_2, size_t *prime_2_size_ptr, - void *exponent_1, size_t *exponent_1_size_ptr, - void *exponent_2, size_t *exponent_2_size_ptr, - void *coefficient, - size_t *coefficient_size_ptr); + const struct ncr_mpi + mpis[static NCR_RSA_PRIVATE_NUM_MPIS]); +CK_RV ncr_private_key_export_rsa (struct ncr_private_key *key, + struct ncr_mpi + mpis[static NCR_RSA_PRIVATE_NUM_MPIS]); /* Asymmetric operations */ |