• Denis Kenzior's avatar
    KEYS: asym_tpm: Implement pkey_query [ver #2] · dff5a61a
    Denis Kenzior authored
    This commit implements the pkey_query operation.  This is accomplished
    by utilizing the public key portion to obtain max encryption size
    information for the operations that utilize the public key (encrypt,
    verify).  The private key size extracted from the TPM_Key data structure
    is used to fill the information where the private key is used (decrypt,
    sign).
    
    The kernel uses a DER/BER format for public keys and does not support
    setting the key via the raw binary form.  To get around this a simple
    DER/BER formatter is implemented which stores the DER/BER formatted key
    and exponent in a temporary buffer for use by the crypto API.
    
    The only exponent supported currently is 65537.  This holds true for
    other Linux TPM tools such as 'create_tpm_key' and
    trousers-openssl_tpm_engine.
    Signed-off-by: default avatarDenis Kenzior <denkenz@gmail.com>
    Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
    Tested-by: default avatarMarcel Holtmann <marcel@holtmann.org>
    Reviewed-by: default avatarMarcel Holtmann <marcel@holtmann.org>
    Signed-off-by: default avatarJames Morris <james.morris@microsoft.com>
    dff5a61a
asym_tpm.c 6.92 KB