~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/security/digsig.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 ==================================
  2 Digital Signature Verification API
  3 ==================================
  4 
  5 :Author: Dmitry Kasatkin
  6 :Date: 06.10.2011
  7 
  8 
  9 .. CONTENTS
 10 
 11    1. Introduction
 12    2. API
 13    3. User-space utilities
 14 
 15 
 16 Introduction
 17 ============
 18 
 19 Digital signature verification API provides a method to verify digital signature.
 20 Currently digital signatures are used by the IMA/EVM integrity protection subsystem.
 21 
 22 Digital signature verification is implemented using cut-down kernel port of
 23 GnuPG multi-precision integers (MPI) library. The kernel port provides
 24 memory allocation errors handling, has been refactored according to kernel
 25 coding style, and checkpatch.pl reported errors and warnings have been fixed.
 26 
 27 Public key and signature consist of header and MPIs::
 28 
 29         struct pubkey_hdr {
 30                 uint8_t         version;        /* key format version */
 31                 time_t          timestamp;      /* key made, always 0 for now */
 32                 uint8_t         algo;
 33                 uint8_t         nmpi;
 34                 char            mpi[0];
 35         } __packed;
 36 
 37         struct signature_hdr {
 38                 uint8_t         version;        /* signature format version */
 39                 time_t          timestamp;      /* signature made */
 40                 uint8_t         algo;
 41                 uint8_t         hash;
 42                 uint8_t         keyid[8];
 43                 uint8_t         nmpi;
 44                 char            mpi[0];
 45         } __packed;
 46 
 47 keyid equals to SHA1[12-19] over the total key content.
 48 Signature header is used as an input to generate a signature.
 49 Such approach insures that key or signature header could not be changed.
 50 It protects timestamp from been changed and can be used for rollback
 51 protection.
 52 
 53 API
 54 ===
 55 
 56 API currently includes only 1 function::
 57 
 58         digsig_verify() - digital signature verification with public key
 59 
 60 
 61         /**
 62         * digsig_verify() - digital signature verification with public key
 63         * @keyring:     keyring to search key in
 64         * @sig: digital signature
 65         * @sigen:       length of the signature
 66         * @data:        data
 67         * @datalen:     length of the data
 68         * @return:      0 on success, -EINVAL otherwise
 69         *
 70         * Verifies data integrity against digital signature.
 71         * Currently only RSA is supported.
 72         * Normally hash of the content is used as a data for this function.
 73         *
 74         */
 75         int digsig_verify(struct key *keyring, const char *sig, int siglen,
 76                           const char *data, int datalen);
 77 
 78 User-space utilities
 79 ====================
 80 
 81 The signing and key management utilities evm-utils provide functionality
 82 to generate signatures, to load keys into the kernel keyring.
 83 Keys can be in PEM or converted to the kernel format.
 84 When the key is added to the kernel keyring, the keyid defines the name
 85 of the key: 5D2B05FC633EE3E8 in the example below.
 86 
 87 Here is example output of the keyctl utility::
 88 
 89         $ keyctl show
 90         Session Keyring
 91         -3 --alswrv      0     0  keyring: _ses
 92         603976250 --alswrv      0    -1   \_ keyring: _uid.0
 93         817777377 --alswrv      0     0       \_ user: kmk
 94         891974900 --alswrv      0     0       \_ encrypted: evm-key
 95         170323636 --alswrv      0     0       \_ keyring: _module
 96         548221616 --alswrv      0     0       \_ keyring: _ima
 97         128198054 --alswrv      0     0       \_ keyring: _evm
 98 
 99         $ keyctl list 128198054
100         1 key in keyring:
101         620789745: --alswrv     0     0 user: 5D2B05FC633EE3E8

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php