summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2019-10-15 20:28:02 +0200
committerRichard Levitte <levitte@openssl.org>2019-10-17 18:07:45 +0200
commitc3a4fa4cb849ba300d4691154c0c12ac19d24710 (patch)
treede8a929f7bb54e51a6fa3c9058a3686cd5857777 /include
parentb75d6310857bc44ef2851bde68a1979c18bb4807 (diff)
Added internal functions for easy getting and setting all RSA parameters.
rsa_set0_all_params() is used to set all the primes, exponents and coefficients. rsa_get0_all_params() is used to get all the primes, exponents and coefficients. "All" includes p, q, dP, dQ and qInv without making them separate. All arrays of numbers are implemented as stacks to make dynamic use easier. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10190)
Diffstat (limited to 'include')
-rw-r--r--include/crypto/rsa.h21
-rw-r--r--include/openssl/rsa.h2
-rw-r--r--include/openssl/types.h4
3 files changed, 27 insertions, 0 deletions
diff --git a/include/crypto/rsa.h b/include/crypto/rsa.h
new file mode 100644
index 0000000000..6d2e7ffb53
--- /dev/null
+++ b/include/crypto/rsa.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef OSSL_INTERNAL_RSA_H
+# define OSSL_INTERNAL_RSA_H
+
+#include <openssl/rsa.h>
+
+int rsa_set0_all_params(RSA *r, const STACK_OF(BIGNUM) *primes,
+ const STACK_OF(BIGNUM) *exps,
+ const STACK_OF(BIGNUM) *coeffs);
+int rsa_get0_all_params(RSA *r, STACK_OF(BIGNUM_const) *primes,
+ STACK_OF(BIGNUM_const) *exps,
+ STACK_OF(BIGNUM_const) *coeffs);
+#endif
diff --git a/include/openssl/rsa.h b/include/openssl/rsa.h
index 8ddc970396..9214efd499 100644
--- a/include/openssl/rsa.h
+++ b/include/openssl/rsa.h
@@ -27,6 +27,8 @@
# include <openssl/bn.h>
# endif
# include <openssl/rsaerr.h>
+# include <openssl/safestack.h>
+
# ifdef __cplusplus
extern "C" {
# endif
diff --git a/include/openssl/types.h b/include/openssl/types.h
index 73bf88d92d..8cfeb6ee22 100644
--- a/include/openssl/types.h
+++ b/include/openssl/types.h
@@ -17,6 +17,7 @@ extern "C" {
#endif
# include <openssl/e_os2.h>
+# include <openssl/safestack.h>
typedef struct ossl_provider_st OSSL_PROVIDER; /* Provider Object */
@@ -88,6 +89,9 @@ typedef struct bn_gencb_st BN_GENCB;
typedef struct buf_mem_st BUF_MEM;
+STACK_OF(BIGNUM);
+STACK_OF(BIGNUM_const);
+
typedef struct err_state_st ERR_STATE;
typedef struct evp_cipher_st EVP_CIPHER;