mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
Merge tag 'keys-misc-20160708' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs into next
This commit is contained in:
commit
e1e5fa9616
@ -51,7 +51,7 @@ struct krb5_principal {
|
|||||||
struct krb5_tagged_data {
|
struct krb5_tagged_data {
|
||||||
/* for tag value, see /usr/include/krb5/krb5.h
|
/* for tag value, see /usr/include/krb5/krb5.h
|
||||||
* - KRB5_AUTHDATA_* for auth data
|
* - KRB5_AUTHDATA_* for auth data
|
||||||
* -
|
* -
|
||||||
*/
|
*/
|
||||||
s32 tag;
|
s32 tag;
|
||||||
u32 data_len;
|
u32 data_len;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* Sign a module file using the given key.
|
/* Sign a module file using the given key.
|
||||||
*
|
*
|
||||||
* Copyright © 2014-2015 Red Hat, Inc. All Rights Reserved.
|
* Copyright © 2014-2016 Red Hat, Inc. All Rights Reserved.
|
||||||
* Copyright © 2015 Intel Corporation.
|
* Copyright © 2015 Intel Corporation.
|
||||||
* Copyright © 2016 Hewlett Packard Enterprise Development LP
|
* Copyright © 2016 Hewlett Packard Enterprise Development LP
|
||||||
*
|
*
|
||||||
@ -167,19 +167,37 @@ static EVP_PKEY *read_private_key(const char *private_key_name)
|
|||||||
|
|
||||||
static X509 *read_x509(const char *x509_name)
|
static X509 *read_x509(const char *x509_name)
|
||||||
{
|
{
|
||||||
|
unsigned char buf[2];
|
||||||
X509 *x509;
|
X509 *x509;
|
||||||
BIO *b;
|
BIO *b;
|
||||||
|
int n;
|
||||||
|
|
||||||
b = BIO_new_file(x509_name, "rb");
|
b = BIO_new_file(x509_name, "rb");
|
||||||
ERR(!b, "%s", x509_name);
|
ERR(!b, "%s", x509_name);
|
||||||
x509 = d2i_X509_bio(b, NULL); /* Binary encoded X.509 */
|
|
||||||
if (!x509) {
|
/* Look at the first two bytes of the file to determine the encoding */
|
||||||
ERR(BIO_reset(b) != 1, "%s", x509_name);
|
n = BIO_read(b, buf, 2);
|
||||||
x509 = PEM_read_bio_X509(b, NULL, NULL,
|
if (n != 2) {
|
||||||
NULL); /* PEM encoded X.509 */
|
if (BIO_should_retry(b)) {
|
||||||
if (x509)
|
fprintf(stderr, "%s: Read wanted retry\n", x509_name);
|
||||||
drain_openssl_errors();
|
exit(1);
|
||||||
|
}
|
||||||
|
if (n >= 0) {
|
||||||
|
fprintf(stderr, "%s: Short read\n", x509_name);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
ERR(1, "%s", x509_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ERR(BIO_reset(b) != 0, "%s", x509_name);
|
||||||
|
|
||||||
|
if (buf[0] == 0x30 && buf[1] >= 0x81 && buf[1] <= 0x84)
|
||||||
|
/* Assume raw DER encoded X.509 */
|
||||||
|
x509 = d2i_X509_bio(b, NULL);
|
||||||
|
else
|
||||||
|
/* Assume PEM encoded X.509 */
|
||||||
|
x509 = PEM_read_bio_X509(b, NULL, NULL, NULL);
|
||||||
|
|
||||||
BIO_free(b);
|
BIO_free(b);
|
||||||
ERR(!x509, "%s", x509_name);
|
ERR(!x509, "%s", x509_name);
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ found:
|
|||||||
ret = key_link(key_ref_to_ptr(dest_ref), persistent);
|
ret = key_link(key_ref_to_ptr(dest_ref), persistent);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
key_set_timeout(persistent, persistent_keyring_expiry);
|
key_set_timeout(persistent, persistent_keyring_expiry);
|
||||||
ret = persistent->serial;
|
ret = persistent->serial;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,7 +442,7 @@ static struct key *construct_key_and_link(struct keyring_search_context *ctx,
|
|||||||
|
|
||||||
if (ctx->index_key.type == &key_type_keyring)
|
if (ctx->index_key.type == &key_type_keyring)
|
||||||
return ERR_PTR(-EPERM);
|
return ERR_PTR(-EPERM);
|
||||||
|
|
||||||
user = key_user_lookup(current_fsuid());
|
user = key_user_lookup(current_fsuid());
|
||||||
if (!user)
|
if (!user)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
Loading…
Reference in New Issue
Block a user