summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2013-10-15 07:53:51 +0200
committerAllan McRae <allan@archlinux.org>2013-10-31 07:20:02 +0100
commitc7f159c1c94517a92c3a66208e534e1a983dddef (patch)
treed96a1fadd416704119a9b99f5ded1be42e8176db
parent968486ecc0c20f3b075ad9b903b9df862621610a (diff)
downloadpacman-c7f159c1c94517a92c3a66208e534e1a983dddef.tar.gz
pacman-c7f159c1c94517a92c3a66208e534e1a983dddef.tar.xz
Make functions to decode a signature and extract keyid public
These are useful for frontends. Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--lib/libalpm/alpm.h6
-rw-r--r--lib/libalpm/be_package.c2
-rw-r--r--lib/libalpm/signing.c6
-rw-r--r--lib/libalpm/signing.h5
-rw-r--r--lib/libalpm/sync.c4
5 files changed, 12 insertions, 11 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index b049007c..29b9f378 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -1075,6 +1075,12 @@ int alpm_db_check_pgp_signature(alpm_db_t *db, alpm_siglist_t *siglist);
int alpm_siglist_cleanup(alpm_siglist_t *siglist);
+int alpm_decode_signature(const char *base64_data,
+ unsigned char **data, size_t *data_len);
+
+int alpm_extract_keyid(alpm_handle_t *handle, const char *identifier,
+ const unsigned char *sig, const size_t len, alpm_list_t **keys);
+
/*
* Groups
*/
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 526d9276..3f577bad 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -570,7 +570,7 @@ int SYMEXPORT alpm_pkg_load(alpm_handle_t *handle, const char *filename, int ful
return -1;
}
- if(_alpm_extract_keyid(handle, filename, sig, len, &keys) == 0) {
+ if(alpm_extract_keyid(handle, filename, sig, len, &keys) == 0) {
alpm_list_t *k;
for(k = keys; k; k = k->next) {
char *key = k->data;
diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c
index a856f136..7e4d41bc 100644
--- a/lib/libalpm/signing.c
+++ b/lib/libalpm/signing.c
@@ -425,7 +425,7 @@ int _alpm_key_import(alpm_handle_t *handle, const char *fpr)
* @return 0 on success, -1 on failure to properly decode
*/
-int _alpm_decode_signature(const char *base64_data,
+int SYMEXPORT alpm_decode_signature(const char *base64_data,
unsigned char **data, size_t *data_len)
{
size_t len = strlen(base64_data);
@@ -525,7 +525,7 @@ int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path,
if(base64_sig) {
/* memory-based, we loaded it from a sync DB */
size_t data_len;
- int decode_ret = _alpm_decode_signature(base64_sig,
+ int decode_ret = alpm_decode_signature(base64_sig,
&decoded_sigdata, &data_len);
if(decode_ret) {
handle->pm_errno = ALPM_ERR_SIG_INVALID;
@@ -964,7 +964,7 @@ int SYMEXPORT alpm_siglist_cleanup(alpm_siglist_t *siglist)
* @param keys a pointer to storage for key IDs
* @return 0 on success, -1 on error
*/
-int _alpm_extract_keyid(alpm_handle_t *handle, const char *identifier,
+int SYMEXPORT alpm_extract_keyid(alpm_handle_t *handle, const char *identifier,
const unsigned char *sig, const size_t len, alpm_list_t **keys)
{
size_t pos, spos, blen, hlen, ulen, slen;
diff --git a/lib/libalpm/signing.h b/lib/libalpm/signing.h
index 2d49240b..42b60b1f 100644
--- a/lib/libalpm/signing.h
+++ b/lib/libalpm/signing.h
@@ -34,11 +34,6 @@ int _alpm_process_siglist(alpm_handle_t *handle, const char *identifier,
int _alpm_key_in_keychain(alpm_handle_t *handle, const char *fpr);
int _alpm_key_import(alpm_handle_t *handle, const char *fpr);
-int _alpm_decode_signature(const char *base64_data,
- unsigned char **data, size_t *data_len);
-int _alpm_extract_keyid(alpm_handle_t *handle, const char *identifier,
- const unsigned char *sig, const size_t len, alpm_list_t **keys);
-
#endif /* _ALPM_SIGNING_H */
/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 9081c733..a4b1bb89 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -1007,11 +1007,11 @@ static int check_keyring(alpm_handle_t *handle)
if((level & ALPM_SIG_PACKAGE) && pkg->base64_sig) {
unsigned char *decoded_sigdata = NULL;
size_t data_len;
- int decode_ret = _alpm_decode_signature(pkg->base64_sig,
+ int decode_ret = alpm_decode_signature(pkg->base64_sig,
&decoded_sigdata, &data_len);
if(decode_ret == 0) {
alpm_list_t *keys = NULL;
- if(_alpm_extract_keyid(handle, pkg->name, decoded_sigdata,
+ if(alpm_extract_keyid(handle, pkg->name, decoded_sigdata,
data_len, &keys) == 0) {
alpm_list_t *k;
for(k = keys; k; k = k->next) {