diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-07-29 20:38:46 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-07-29 20:38:46 -0400 |
| commit | 7a1e8b80fb1e8ead4cec15d1fc494ed290e4d2e9 (patch) | |
| tree | 55a36d4256f1ae793b5c8e88c0f158737447193f /scripts | |
| parent | a867d7349e94b6409b08629886a819f802377e91 (diff) | |
| parent | 7616ac70d1bb4f2e9d25c1a82d283f3368a7b632 (diff) | |
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull security subsystem updates from James Morris:
"Highlights:
- TPM core and driver updates/fixes
- IPv6 security labeling (CALIPSO)
- Lots of Apparmor fixes
- Seccomp: remove 2-phase API, close hole where ptrace can change
syscall #"
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (156 commits)
apparmor: fix SECURITY_APPARMOR_HASH_DEFAULT parameter handling
tpm: Add TPM 2.0 support to the Nuvoton i2c driver (NPCT6xx family)
tpm: Factor out common startup code
tpm: use devm_add_action_or_reset
tpm2_i2c_nuvoton: add irq validity check
tpm: read burstcount from TPM_STS in one 32-bit transaction
tpm: fix byte-order for the value read by tpm2_get_tpm_pt
tpm_tis_core: convert max timeouts from msec to jiffies
apparmor: fix arg_size computation for when setprocattr is null terminated
apparmor: fix oops, validate buffer size in apparmor_setprocattr()
apparmor: do not expose kernel stack
apparmor: fix module parameters can be changed after policy is locked
apparmor: fix oops in profile_unpack() when policy_db is not present
apparmor: don't check for vmalloc_addr if kvzalloc() failed
apparmor: add missing id bounds check on dfa verification
apparmor: allow SYS_CAP_RESOURCE to be sufficient to prlimit another task
apparmor: use list_next_entry instead of list_entry_next
apparmor: fix refcount race when finding a child profile
apparmor: fix ref count leak when profile sha1 hash is read
apparmor: check that xindex is in trans_table bounds
...
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/sign-file.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/scripts/sign-file.c b/scripts/sign-file.c index d912d5a56a5e..53af6dc3e6c1 100755 --- a/scripts/sign-file.c +++ b/scripts/sign-file.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Sign a module file using the given key. | 1 | /* Sign a module file using the given key. |
| 2 | * | 2 | * |
| 3 | * Copyright © 2014-2015 Red Hat, Inc. All Rights Reserved. | 3 | * Copyright © 2014-2016 Red Hat, Inc. All Rights Reserved. |
| 4 | * Copyright © 2015 Intel Corporation. | 4 | * Copyright © 2015 Intel Corporation. |
| 5 | * Copyright © 2016 Hewlett Packard Enterprise Development LP | 5 | * Copyright © 2016 Hewlett Packard Enterprise Development LP |
| 6 | * | 6 | * |
| @@ -167,19 +167,37 @@ static EVP_PKEY *read_private_key(const char *private_key_name) | |||
| 167 | 167 | ||
| 168 | static X509 *read_x509(const char *x509_name) | 168 | static X509 *read_x509(const char *x509_name) |
| 169 | { | 169 | { |
| 170 | unsigned char buf[2]; | ||
| 170 | X509 *x509; | 171 | X509 *x509; |
| 171 | BIO *b; | 172 | BIO *b; |
| 173 | int n; | ||
| 172 | 174 | ||
| 173 | b = BIO_new_file(x509_name, "rb"); | 175 | b = BIO_new_file(x509_name, "rb"); |
| 174 | ERR(!b, "%s", x509_name); | 176 | ERR(!b, "%s", x509_name); |
| 175 | x509 = d2i_X509_bio(b, NULL); /* Binary encoded X.509 */ | 177 | |
| 176 | if (!x509) { | 178 | /* Look at the first two bytes of the file to determine the encoding */ |
| 177 | ERR(BIO_reset(b) != 1, "%s", x509_name); | 179 | n = BIO_read(b, buf, 2); |
| 178 | x509 = PEM_read_bio_X509(b, NULL, NULL, | 180 | if (n != 2) { |
| 179 | NULL); /* PEM encoded X.509 */ | 181 | if (BIO_should_retry(b)) { |
| 180 | if (x509) | 182 | fprintf(stderr, "%s: Read wanted retry\n", x509_name); |
| 181 | drain_openssl_errors(); | 183 | exit(1); |
| 184 | } | ||
| 185 | if (n >= 0) { | ||
| 186 | fprintf(stderr, "%s: Short read\n", x509_name); | ||
| 187 | exit(1); | ||
| 188 | } | ||
| 189 | ERR(1, "%s", x509_name); | ||
| 182 | } | 190 | } |
| 191 | |||
| 192 | ERR(BIO_reset(b) != 0, "%s", x509_name); | ||
| 193 | |||
| 194 | if (buf[0] == 0x30 && buf[1] >= 0x81 && buf[1] <= 0x84) | ||
| 195 | /* Assume raw DER encoded X.509 */ | ||
| 196 | x509 = d2i_X509_bio(b, NULL); | ||
| 197 | else | ||
| 198 | /* Assume PEM encoded X.509 */ | ||
| 199 | x509 = PEM_read_bio_X509(b, NULL, NULL, NULL); | ||
| 200 | |||
| 183 | BIO_free(b); | 201 | BIO_free(b); |
| 184 | ERR(!x509, "%s", x509_name); | 202 | ERR(!x509, "%s", x509_name); |
| 185 | 203 | ||
