#!/usr/bin/perl -w # # extract-mod-sig # # Reads the module file and writes out some or all of the signature # section to stdout. Part is the bit to be written and is one of: # # -0: The unsigned module, no signature data at all # -a: All of the signature data, including magic number # -d: Just the descriptor values as a sequence of numbers # -n: Just the signer's name # -k: Just the key ID # -s: Just the crypto signature or PKCS#7 message # use strict; die "Format: $0 -[0adnks] module-file >out\n" if ($#ARGV != 1); my $part = $ARGV[0]; my $modfile = $ARGV[1]; my $magic_number = "~Module signature appended~\n"; # # Read the module contents # open FD, "<$modfile" || die $modfile; binmode(FD); my @st = stat(FD); die "$modfile" unless (@st); my $buf = ""; my $len = sysread(FD, $buf, $st[7]); die "$modfile" unless (defined($len)); die "Short read on $modfile\n" unless ($len == $st[7]); close(FD) || die $modfile; print STDERR "Read ", $len, " bytes from module file\n"; die "The file is too short to have a sig magic number and descriptor\n" if ($len < 12 + length($magic_number)); # # Check for the magic number and extract the information block # my $p = $len - length($magic_number); my $raw_magic = substr($buf, $p); die "Magic number not found at $len\n" if ($raw_magic ne $magic_number); print STDERR "Found magic number at $len\n"; $p -= 12; my $raw_info = substr($buf, $p, 12); my @info = unpack("CCCCCxxxN", $raw_info); my ($algo, $hash, $id_type, $name_len, $kid_len, $sig_len) = @info; if ($id_type == 0) { print STDERR "Found PGP key identifier\n"; } elsif ($id_type == 1) { print STDERR "Found X.509 cert identifier\n"; } elsif ($id_type == 2) { print STDERR "Found PKCS#7/CMS encapsulation\n"; } else { print STDERR "Found unsupported identifier type $id_type\n"; } # # Extract the three pieces of info data # die "Insufficient name+kid+sig data in file\n" unless ($p >= $name_len + $kid_len + $sig_len); $p -= $sig_len; my $raw_sig = substr($buf, $p, $sig_len); $p -= $kid_len; my $raw_kid = substr($buf, $p, $kid_len); $p -= $name_len; my $raw_name = substr($buf, $p, $name_len); my $module_len = $p; if ($sig_len > 0) { print STDERR "Found $sig_len bytes of signature ["; my $n = $sig_len > 16 ? 16 : $sig_len; foreach my $i (unpack("C" x $n, substr($raw_sig, 0, $n))) { printf STDERR "%02x", $i; } print STDERR "]\n"; } if ($kid_len > 0) { print STDERR "Found $kid_len bytes of key identifier ["; my $n = $kid_len > 16 ? 16 : $kid_len; foreach my $i (unpack("C" x $n, substr($raw_kid, 0, $n))) { printf STDERR "%02x", $i; } print STDERR "]\n"; } if ($name_len > 0) { print STDERR "Found $name_len bytes of signer's name [$raw_name]\n"; } # # Produce the requested output # if ($part eq "-0") { # The unsigned module, no signature data at all binmode(STDOUT); print substr($buf, 0, $module_len); } elsif ($part eq "-a") { # All of the signature data, including magic number binmode(STDOUT); print substr($buf, $module_len); } elsif ($part eq "-d") { # Just the descriptor values as a sequence of numbers print join(" ", @info), "\n"; } elsif ($part eq "-n") { # Just the signer's name print STDERR "No signer's name for PKCS#7 message type sig\n" if ($id_type == 2); binmode(STDOUT); print $raw_name; } elsif ($part eq "-k") { # Just the key identifier print STDERR "No key ID for PKCS#7 message type sig\n" if ($id_type == 2); binmode(STDOUT); print $raw_kid; } elsif ($part eq "-s") { # Just the crypto signature or PKCS#7 message binmode(STDOUT); print $raw_sig; } ect name='context' onchange='this.form.submit();'>space:mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-27 12:29:30 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-27 12:29:30 -0800
commitdd3b9f25c867cb2507a45e436d6ede8eb08e7b05 (patch)
tree1ec6c08cd75610083d117a2c8d5eb0829e65f33e /include/dt-bindings/reset/altr,rst-mgr.h
parent69978aa0f21f43529e11f924504dadb6ce2f229a (diff)
parentb4cfe3971f6eab542dd7ecc398bfa1aeec889934 (diff)
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma
Pull rdma fixes from Doug Ledford: "Second round of -rc fixes for 4.10. This -rc cycle has been slow for the rdma subsystem. I had already sent you the first batch before the Holiday break. After that, we kept only getting a few here or there. Up until this week, when I got a drop of 13 to one driver (qedr). So, here's the -rc patches I have. I currently have none held in reserve, so unless something new comes in, this is it until the next merge window opens. Summary: - series of iw_cxgb4 fixes to make it work with the drain cq API - one or two patches each to: srp, iser, cxgb3, vmw_pvrdma, umem, rxe, and ipoib - one big series (13 patches) for the new qedr driver" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma: (27 commits) RDMA/cma: Fix unknown symbol when CONFIG_IPV6 is not enabled IB/rxe: Prevent from completer to operate on non valid QP IB/rxe: Fix rxe dev insertion to rxe_dev_list IB/umem: Release pid in error and ODP flow RDMA/qedr: Dispatch port active event from qedr_add RDMA/qedr: Fix and simplify memory leak in PD alloc RDMA/qedr: Fix RDMA CM loopback RDMA/qedr: Fix formatting RDMA/qedr: Mark three functions as static RDMA/qedr: Don't reset QP when queues aren't flushed RDMA/qedr: Don't spam dmesg if QP is in error state RDMA/qedr: Remove CQ spinlock from CM completion handlers RDMA/qedr: Return max inline data in QP query result RDMA/qedr: Return success when not changing QP state RDMA/qedr: Add uapi header qedr-abi.h RDMA/qedr: Fix MTU returned from QP query RDMA/core: Add the function ib_mtu_int_to_enum IB/vmw_pvrdma: Fix incorrect cleanup on pvrdma_pci_probe error path IB/vmw_pvrdma: Don't leak info from alloc_ucontext IB/cxgb3: fix misspelling in header guard ...
Diffstat (limited to 'include/dt-bindings/reset/altr,rst-mgr.h')