xbps-rindex/sign: simplify.
This commit is contained in:
parent
8030f47626
commit
0cff982e7b
@ -88,7 +88,6 @@ pubkey_from_privkey(RSA *rsa)
|
||||
assert(buf);
|
||||
len = BIO_read(bp, buf, 8191);
|
||||
BIO_free(bp);
|
||||
ERR_free_strings();
|
||||
buf[len] = '\0';
|
||||
|
||||
return buf;
|
||||
@ -130,11 +129,6 @@ load_rsa_key(const char *privkey)
|
||||
else
|
||||
defprivkey = strdup(privkey);
|
||||
|
||||
ERR_load_crypto_strings();
|
||||
OpenSSL_add_all_algorithms();
|
||||
OpenSSL_add_all_ciphers();
|
||||
OpenSSL_add_all_digests();
|
||||
|
||||
if ((rsa = load_rsa_privkey(defprivkey)) == NULL) {
|
||||
fprintf(stderr, "%s: failed to read the RSA privkey\n", _XBPS_RINDEX);
|
||||
exit(EXIT_FAILURE);
|
||||
@ -145,6 +139,13 @@ load_rsa_key(const char *privkey)
|
||||
return rsa;
|
||||
}
|
||||
|
||||
static void
|
||||
ssl_init(void)
|
||||
{
|
||||
SSL_load_error_strings();
|
||||
SSL_library_init();
|
||||
}
|
||||
|
||||
int
|
||||
sign_repo(struct xbps_handle *xhp, const char *repodir,
|
||||
const char *privkey, const char *signedby)
|
||||
@ -180,6 +181,8 @@ sign_repo(struct xbps_handle *xhp, const char *repodir,
|
||||
goto out;
|
||||
}
|
||||
|
||||
ssl_init();
|
||||
|
||||
rsa = load_rsa_key(privkey);
|
||||
/*
|
||||
* Check if repository index-meta contains changes compared to its
|
||||
@ -337,6 +340,7 @@ int
|
||||
sign_pkgs(struct xbps_handle *xhp, int args, int argmax, char **argv,
|
||||
const char *privkey, bool force)
|
||||
{
|
||||
ssl_init();
|
||||
/*
|
||||
* Process all packages specified in argv.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user