98 }
99 }
100 }
101
102 return (BC_ERROR);
103 }
104
105 /*
106 * Given a pointer to the extra information area (a sequence of bb_header_ext_t
107 * + payload chunks), find the extended information structure.
108 */
109 bblk_einfo_t *
110 find_einfo(char *extra)
111 {
112 bb_header_ext_t *ext_header;
113 bblk_einfo_t *einfo;
114 uint32_t cksum;
115
116 assert(extra != NULL);
117
118 ext_header = (bb_header_ext_t *)extra;
119 cksum = compute_checksum(extra + sizeof (bb_header_ext_t),
120 ext_header->size);
121 BOOT_DEBUG("Extended information header checksum is %x\n", cksum);
122
123 if (cksum != ext_header->checksum) {
124 BOOT_DEBUG("Unable to find extended versioning information, "
125 "data looks corrupted\n");
126 return (NULL);
127 }
128
129 /*
130 * Currently we only have one extra header so it must be encapsulating
131 * the extended information structure.
132 */
133 einfo = (bblk_einfo_t *)(extra + sizeof (bb_header_ext_t));
134 if (memcmp(einfo->magic, EINFO_MAGIC, EINFO_MAGIC_SIZE) != 0) {
135 BOOT_DEBUG("Unable to read stage2 extended versioning "
136 "information, wrong magic identifier\n");
137 BOOT_DEBUG("Found %s, expected %s\n", einfo->magic,
138 EINFO_MAGIC);
139 return (NULL);
140 }
141
142 return (einfo);
143 }
144
145 /*
146 * Given a pointer to the extra area, add the extended information structure
147 * encapsulated by a bb_header_ext_t structure.
148 */
149 void
150 add_einfo(char *extra, char *updt_str, bblk_hs_t *hs, uint32_t avail_space)
151 {
152 bb_header_ext_t *ext_hdr;
153 uint32_t used_space;
154 unsigned char *dest;
155 int ret;
156
157 assert(extra != NULL);
158
159 if (updt_str == NULL) {
160 BOOT_DEBUG("WARNING: no update string passed to "
|
98 }
99 }
100 }
101
102 return (BC_ERROR);
103 }
104
105 /*
106 * Given a pointer to the extra information area (a sequence of bb_header_ext_t
107 * + payload chunks), find the extended information structure.
108 */
109 bblk_einfo_t *
110 find_einfo(char *extra)
111 {
112 bb_header_ext_t *ext_header;
113 bblk_einfo_t *einfo;
114 uint32_t cksum;
115
116 assert(extra != NULL);
117
118 /*
119 * Currently we only have one extra header so it must be encapsulating
120 * the extended information structure.
121 */
122 einfo = (bblk_einfo_t *)(extra + sizeof (bb_header_ext_t));
123 if (memcmp(einfo->magic, EINFO_MAGIC, EINFO_MAGIC_SIZE) != 0) {
124 BOOT_DEBUG("Unable to read stage2 extended versioning "
125 "information, wrong magic identifier\n");
126 BOOT_DEBUG("Found %s, expected %s\n", einfo->magic,
127 EINFO_MAGIC);
128 return (NULL);
129 }
130
131 ext_header = (bb_header_ext_t *)extra;
132 cksum = compute_checksum(extra + sizeof (bb_header_ext_t),
133 ext_header->size);
134 BOOT_DEBUG("Extended information header checksum is %x\n", cksum);
135
136 if (cksum != ext_header->checksum) {
137 BOOT_DEBUG("Unable to find extended versioning information, "
138 "data looks corrupted\n");
139 return (NULL);
140 }
141
142 return (einfo);
143 }
144
145 /*
146 * Given a pointer to the extra area, add the extended information structure
147 * encapsulated by a bb_header_ext_t structure.
148 */
149 void
150 add_einfo(char *extra, char *updt_str, bblk_hs_t *hs, uint32_t avail_space)
151 {
152 bb_header_ext_t *ext_hdr;
153 uint32_t used_space;
154 unsigned char *dest;
155 int ret;
156
157 assert(extra != NULL);
158
159 if (updt_str == NULL) {
160 BOOT_DEBUG("WARNING: no update string passed to "
|