iPXE
imgcrypt.h File Reference

Image encryption management. More...

#include <ipxe/image.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
int imgdecrypt (struct image *image, struct image *envelope, const char *name)
 Decrypt image using downloaded envelope.

Detailed Description

Image encryption management.

Definition in file imgcrypt.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

References name.

◆ imgdecrypt()

int imgdecrypt ( struct image * image,
struct image * envelope,
const char * name )
extern

Decrypt image using downloaded envelope.

Parameters
imageImage to decrypt
envelopeImage containing decryption key
nameDecrypted image name (or NULL to use default)
Return values
rcReturn status code

Definition at line 47 of file imgcrypt.c.

48 {
49 struct cms_message *cms;
50 int rc;
51
52 /* Parse envelope */
53 if ( ( rc = cms_message ( envelope, &cms ) ) != 0 )
54 goto err_parse;
55
56 /* Decrypt image */
57 if ( ( rc = cms_decrypt ( cms, image, name, &private_key ) ) != 0 )
58 goto err_decrypt;
59
60 /* Drop reference to message */
61 cms_put ( cms );
62 cms = NULL;
63
64 /* Record decryption */
65 syslog ( LOG_NOTICE, "Image \"%s\" decrypted OK\n", image->name );
66
67 return 0;
68
69 err_decrypt:
70 cms_put ( cms );
71 err_parse:
72 syslog ( LOG_ERR, "Image \"%s\" decryption failed: %s\n",
73 image->name, strerror ( rc ) );
74 return rc;
75}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
struct arbelprm_rc_send_wqe rc
Definition arbel.h:3
const char * name
Definition ath9k_hw.c:1986
int cms_decrypt(struct cms_message *cms, struct image *image, const char *name, struct private_key *private_key)
Decrypt CMS message.
Definition cms.c:1039
static void cms_put(struct cms_message *cms)
Drop reference to CMS message.
Definition cms.h:94
#define LOG_ERR
Error: error conditions.
Definition syslog.h:36
#define LOG_NOTICE
Notice: normal but significant conditions.
Definition syslog.h:42
char * strerror(int errno)
Retrieve string representation of error number.
Definition strerror.c:79
A CMS message.
Definition cms.h:55
An executable image.
Definition image.h:24
char * name
Name.
Definition image.h:38
A private key.
Definition privkey.h:17
#define syslog(priority, fmt,...)
Write message to system log.
Definition syslog.h:94

References cms_decrypt(), cms_put(), LOG_ERR, LOG_NOTICE, image::name, name, NULL, rc, strerror(), and syslog.

Referenced by COMMAND(), and imgdecrypt_exec().