]> git.saurik.com Git - apple/security.git/blob - keychain/TrustedPeersHelper/proto/generated_source/OTAuthenticatedCiphertext.m
Security-59306.11.20.tar.gz
[apple/security.git] / keychain / TrustedPeersHelper / proto / generated_source / OTAuthenticatedCiphertext.m
1 // This file was automatically generated by protocompiler
2 // DO NOT EDIT!
3 // Compiled from OTAuthenticatedCiphertext.proto
4
5 #import "OTAuthenticatedCiphertext.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
9
10 #if !__has_feature(objc_arc)
11 # error This generated file depends on ARC but it is not enabled; turn on ARC, or use 'objc_use_arc' option to generate non-ARC code.
12 #endif
13
14 @implementation OTAuthenticatedCiphertext
15
16 @synthesize ciphertext = _ciphertext;
17 @synthesize authenticationCode = _authenticationCode;
18 @synthesize initializationVector = _initializationVector;
19
20 - (NSString *)description
21 {
22 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
23 }
24
25 - (NSDictionary *)dictionaryRepresentation
26 {
27 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
28 if (self->_ciphertext)
29 {
30 [dict setObject:self->_ciphertext forKey:@"ciphertext"];
31 }
32 if (self->_authenticationCode)
33 {
34 [dict setObject:self->_authenticationCode forKey:@"authenticationCode"];
35 }
36 if (self->_initializationVector)
37 {
38 [dict setObject:self->_initializationVector forKey:@"initializationVector"];
39 }
40 return dict;
41 }
42
43 BOOL OTAuthenticatedCiphertextReadFrom(__unsafe_unretained OTAuthenticatedCiphertext *self, __unsafe_unretained PBDataReader *reader) {
44 while (PBReaderHasMoreData(reader)) {
45 uint32_t tag = 0;
46 uint8_t aType = 0;
47
48 PBReaderReadTag32AndType(reader, &tag, &aType);
49
50 if (PBReaderHasError(reader))
51 break;
52
53 if (aType == TYPE_END_GROUP) {
54 break;
55 }
56
57 switch (tag) {
58
59 case 1 /* ciphertext */:
60 {
61 NSData *new_ciphertext = PBReaderReadData(reader);
62 self->_ciphertext = new_ciphertext;
63 }
64 break;
65 case 2 /* authenticationCode */:
66 {
67 NSData *new_authenticationCode = PBReaderReadData(reader);
68 self->_authenticationCode = new_authenticationCode;
69 }
70 break;
71 case 3 /* initializationVector */:
72 {
73 NSData *new_initializationVector = PBReaderReadData(reader);
74 self->_initializationVector = new_initializationVector;
75 }
76 break;
77 default:
78 if (!PBReaderSkipValueWithTag(reader, tag, aType))
79 return NO;
80 break;
81 }
82 }
83 return !PBReaderHasError(reader);
84 }
85
86 - (BOOL)readFrom:(PBDataReader *)reader
87 {
88 return OTAuthenticatedCiphertextReadFrom(self, reader);
89 }
90 - (void)writeTo:(PBDataWriter *)writer
91 {
92 /* ciphertext */
93 {
94 assert(nil != self->_ciphertext);
95 PBDataWriterWriteDataField(writer, self->_ciphertext, 1);
96 }
97 /* authenticationCode */
98 {
99 assert(nil != self->_authenticationCode);
100 PBDataWriterWriteDataField(writer, self->_authenticationCode, 2);
101 }
102 /* initializationVector */
103 {
104 assert(nil != self->_initializationVector);
105 PBDataWriterWriteDataField(writer, self->_initializationVector, 3);
106 }
107 }
108
109 - (void)copyTo:(OTAuthenticatedCiphertext *)other
110 {
111 other.ciphertext = _ciphertext;
112 other.authenticationCode = _authenticationCode;
113 other.initializationVector = _initializationVector;
114 }
115
116 - (id)copyWithZone:(NSZone *)zone
117 {
118 OTAuthenticatedCiphertext *copy = [[[self class] allocWithZone:zone] init];
119 copy->_ciphertext = [_ciphertext copyWithZone:zone];
120 copy->_authenticationCode = [_authenticationCode copyWithZone:zone];
121 copy->_initializationVector = [_initializationVector copyWithZone:zone];
122 return copy;
123 }
124
125 - (BOOL)isEqual:(id)object
126 {
127 OTAuthenticatedCiphertext *other = (OTAuthenticatedCiphertext *)object;
128 return [other isMemberOfClass:[self class]]
129 &&
130 ((!self->_ciphertext && !other->_ciphertext) || [self->_ciphertext isEqual:other->_ciphertext])
131 &&
132 ((!self->_authenticationCode && !other->_authenticationCode) || [self->_authenticationCode isEqual:other->_authenticationCode])
133 &&
134 ((!self->_initializationVector && !other->_initializationVector) || [self->_initializationVector isEqual:other->_initializationVector])
135 ;
136 }
137
138 - (NSUInteger)hash
139 {
140 return 0
141 ^
142 [self->_ciphertext hash]
143 ^
144 [self->_authenticationCode hash]
145 ^
146 [self->_initializationVector hash]
147 ;
148 }
149
150 - (void)mergeFrom:(OTAuthenticatedCiphertext *)other
151 {
152 if (other->_ciphertext)
153 {
154 [self setCiphertext:other->_ciphertext];
155 }
156 if (other->_authenticationCode)
157 {
158 [self setAuthenticationCode:other->_authenticationCode];
159 }
160 if (other->_initializationVector)
161 {
162 [self setInitializationVector:other->_initializationVector];
163 }
164 }
165
166 @end
167