aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2009-04-19 12:13:39 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-04-27 12:05:41 -0400
commitf8d3a644bec74fd55dbfb11f95af7bf98fa963dc (patch)
treeed34f7b0c573ecceea9a1b73ea6bba2f0752d527 /include
parent71f32e31e5638df37904697e2d04182935add85d (diff)
[SCSI] libosd: OSD2r05: OSD_CRYPTO_KEYID_SIZE will grow 20 => 32 bytes
In OSD2r04 draft, cryptographic key size changed to 32 bytes from OSD1's 20 bytes. This causes a couple of on-the-wire structures to change, including the CDB. In this patch the OSD1/OSD2 handling is separated out in regard to affected structures, but on-the-wire is still the same. All on the wire changes will be submitted in one patch for bisect-ability. Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'include')
-rw-r--r--include/scsi/osd_protocol.h55
1 files changed, 44 insertions, 11 deletions
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h
index fa8343ce3ca2..bbeceeb0e553 100644
--- a/include/scsi/osd_protocol.h
+++ b/include/scsi/osd_protocol.h
@@ -33,8 +33,10 @@ enum {
33 OSD_CAP_LEN = OSDv1_CAP_LEN,/* FIXME: Pete rev-001 sup */ 33 OSD_CAP_LEN = OSDv1_CAP_LEN,/* FIXME: Pete rev-001 sup */
34 34
35 OSD_SYSTEMID_LEN = 20, 35 OSD_SYSTEMID_LEN = 20,
36 OSD_CRYPTO_KEYID_SIZE = 20, 36 OSDv1_CRYPTO_KEYID_SIZE = 20,
37 /*FIXME: OSDv2_CRYPTO_KEYID_SIZE = 32,*/ 37 /*FIXME: OSDv2_CRYPTO_KEYID_SIZE = 32,*/
38 OSDv2_CRYPTO_KEYID_SIZE = 20,
39 OSD_CRYPTO_KEYID_SIZE = OSDv2_CRYPTO_KEYID_SIZE,
38 OSD_CRYPTO_SEED_SIZE = 4, 40 OSD_CRYPTO_SEED_SIZE = 4,
39 OSD_CRYPTO_NONCE_SIZE = 12, 41 OSD_CRYPTO_NONCE_SIZE = 12,
40 OSD_MAX_SENSE_LEN = 252, /* from SPC-3 */ 42 OSD_MAX_SENSE_LEN = 252, /* from SPC-3 */
@@ -204,29 +206,40 @@ struct osd_cdb_head {
204/*80*/ 206/*80*/
205 207
206/*160 v1*/ 208/*160 v1*/
207/*184 v2*/ 209struct osdv1_security_parameters {
208struct osd_security_parameters { 210/*160*/u8 integrity_check_value[OSDv1_CRYPTO_KEYID_SIZE];
209/*160*/u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
210/*180*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE]; 211/*180*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE];
211/*192*/osd_cdb_offset data_in_integrity_check_offset; 212/*192*/osd_cdb_offset data_in_integrity_check_offset;
212/*196*/osd_cdb_offset data_out_integrity_check_offset; 213/*196*/osd_cdb_offset data_out_integrity_check_offset;
213} __packed; 214} __packed;
214/*200 v1*/ 215/*200 v1*/
215/*224 v2*/
216 216
217/* FIXME: osdv2_security_parameters */ 217/*184 v2*/
218struct osdv2_security_parameters {
219/*184*/u8 integrity_check_value[OSDv2_CRYPTO_KEYID_SIZE];
220/*216*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE];
221/*228*/osd_cdb_offset data_in_integrity_check_offset;
222/*232*/osd_cdb_offset data_out_integrity_check_offset;
223} __packed;
224/*236 v2*/
225
226struct osd_security_parameters {
227 union {
228 struct osdv1_security_parameters v1;
229 struct osdv2_security_parameters v2;
230 };
231};
218 232
219struct osdv1_cdb { 233struct osdv1_cdb {
220 struct osd_cdb_head h; 234 struct osd_cdb_head h;
221 u8 caps[OSDv1_CAP_LEN]; 235 u8 caps[OSDv1_CAP_LEN];
222 struct osd_security_parameters sec_params; 236 struct osdv1_security_parameters sec_params;
223} __packed; 237} __packed;
224 238
225struct osdv2_cdb { 239struct osdv2_cdb {
226 struct osd_cdb_head h; 240 struct osd_cdb_head h;
227 u8 caps[OSD_CAP_LEN]; 241 u8 caps[OSD_CAP_LEN];
228 struct osd_security_parameters sec_params; 242 struct osdv2_security_parameters sec_params;
229 /* FIXME: osdv2_security_parameters */
230} __packed; 243} __packed;
231 244
232struct osd_cdb { 245struct osd_cdb {
@@ -429,15 +442,35 @@ struct osd_data_out_integrity_info {
429 __be64 data_bytes; 442 __be64 data_bytes;
430 __be64 set_attributes_bytes; 443 __be64 set_attributes_bytes;
431 __be64 get_attributes_bytes; 444 __be64 get_attributes_bytes;
432 __be64 integrity_check_value; 445 __u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
433} __packed; 446} __packed;
434 447
448/* Same osd_data_out_integrity_info is used for OSD2/OSD1. The only difference
449 * Is the sizeof the structure since in OSD1 the last array is smaller. Use
450 * below for version independent handling of this structure
451 */
452static inline int osd_data_out_integrity_info_sizeof(bool is_ver1)
453{
454 return sizeof(struct osd_data_out_integrity_info) -
455 (is_ver1 * (OSDv2_CRYPTO_KEYID_SIZE - OSDv1_CRYPTO_KEYID_SIZE));
456}
457
435struct osd_data_in_integrity_info { 458struct osd_data_in_integrity_info {
436 __be64 data_bytes; 459 __be64 data_bytes;
437 __be64 retrieved_attributes_bytes; 460 __be64 retrieved_attributes_bytes;
438 __be64 integrity_check_value; 461 __u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
439} __packed; 462} __packed;
440 463
464/* Same osd_data_in_integrity_info is used for OSD2/OSD1. The only difference
465 * Is the sizeof the structure since in OSD1 the last array is smaller. Use
466 * below for version independent handling of this structure
467 */
468static inline int osd_data_in_integrity_info_sizeof(bool is_ver1)
469{
470 return sizeof(struct osd_data_in_integrity_info) -
471 (is_ver1 * (OSDv2_CRYPTO_KEYID_SIZE - OSDv1_CRYPTO_KEYID_SIZE));
472}
473
441struct osd_timestamp { 474struct osd_timestamp {
442 u8 time[6]; /* number of milliseconds since 1/1/1970 UT (big endian) */ 475 u8 time[6]; /* number of milliseconds since 1/1/1970 UT (big endian) */
443} __packed; 476} __packed;