summaryrefslogtreecommitdiff
path: root/lib/x509/privkey.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-07-25 11:37:04 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-08-03 11:57:52 +0200
commit66cb33d888428312c5f11f3e9e1d1b9adeb431e8 (patch)
tree379981337bcab60ddf3506357d5ef1b5b51cbfba /lib/x509/privkey.c
parent958f45aae0c8f4f5f2f9798ad883051caa1acbc9 (diff)
downloadgnutls-66cb33d888428312c5f11f3e9e1d1b9adeb431e8.tar.gz
x509.h: Renamed SPKI related functions
This better reflects their purpose as providers of information for subject public key. In addition use 'const' for fields that should be left intact. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'lib/x509/privkey.c')
-rw-r--r--lib/x509/privkey.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/lib/x509/privkey.c b/lib/x509/privkey.c
index 9c62b551eb..0ae924338a 100644
--- a/lib/x509/privkey.c
+++ b/lib/x509/privkey.c
@@ -1231,45 +1231,45 @@ int
gnutls_x509_privkey_get_pk_algorithm2(gnutls_x509_privkey_t key,
unsigned int *bits)
{
- return gnutls_x509_privkey_get_pk_algorithm3(key, NULL, bits);
+ int ret;
+
+ if (key == NULL) {
+ gnutls_assert();
+ return GNUTLS_E_INVALID_REQUEST;
+ }
+
+ if (bits) {
+ ret = pubkey_to_bits(key->pk_algorithm, &key->params);
+ if (ret < 0)
+ ret = 0;
+ *bits = ret;
+ }
+
+ return key->pk_algorithm;
}
/**
- * gnutls_x509_privkey_get_pk_algorithm3:
+ * gnutls_x509_privkey_get_spki:
* @key: should contain a #gnutls_x509_privkey_t type
* @spki: a SubjectPublicKeyInfo structure of type #gnutls_x509_spki_t
- * @bits: The number of bits in the public key algorithm
+ * @flags: must be zero
*
- * This function will return the public key algorithm of a private
- * key.
+ * This function will return the public key information of a private
+ * key. The provided @spki must be initialized.
*
- * Returns: a member of the #gnutls_pk_algorithm_t enumeration on
- * success, or a negative error code on error.
+ * Returns: Zero on success, or a negative error code on error.
**/
int
-gnutls_x509_privkey_get_pk_algorithm3(gnutls_x509_privkey_t key,
- gnutls_x509_spki_t spki,
- unsigned int *bits)
+gnutls_x509_privkey_get_spki(gnutls_x509_privkey_t key, gnutls_x509_spki_t spki, unsigned int flags)
{
- int ret;
-
if (key == NULL) {
gnutls_assert();
return GNUTLS_E_INVALID_REQUEST;
}
- if (spki) {
- memcpy(spki, &key->params.spki, sizeof (gnutls_x509_spki_st));
- }
-
- if (bits) {
- ret = pubkey_to_bits(key->pk_algorithm, &key->params);
- if (ret < 0)
- ret = 0;
- *bits = ret;
- }
+ memcpy(spki, &key->params.spki, sizeof (gnutls_x509_spki_st));
- return key->pk_algorithm;
+ return 0;
}
static const char *set_msg(gnutls_x509_privkey_t key)