1717
1818import Foundation
1919
20- #if os(OSX )
20+ #if os(macOS )
2121 import CommonCrypto
2222#elseif os(Linux)
2323 import OpenSSL
@@ -51,7 +51,7 @@ public class HMAC : Updateable {
5151 /// Secure Hash Algorithm 2 512-bit
5252 case sha512
5353
54- #if os(OSX )
54+ #if os(macOS )
5555
5656 static let fromNative : [ CCHmacAlgorithm : Algorithm ] = [
5757 CCHmacAlgorithm ( kCCHmacAlgSHA1) : . sha1,
@@ -113,7 +113,7 @@ public class HMAC : Updateable {
113113 ///
114114 public func digestLength( ) -> Int {
115115
116- #if os(OSX )
116+ #if os(macOS )
117117
118118 switch self {
119119
@@ -155,7 +155,7 @@ public class HMAC : Updateable {
155155 }
156156
157157 /// Context
158- #if os(OSX )
158+ #if os(macOS )
159159
160160 typealias Context = UnsafeMutablePointer < CCHmacContext >
161161
@@ -169,7 +169,7 @@ public class HMAC : Updateable {
169169 public internal( set) var status : Status = . success
170170
171171
172- private let context = Context ( allocatingCapacity : 1 )
172+ private let context = Context . allocate ( capacity : 1 )
173173 private var algorithm : Algorithm
174174
175175 // MARK: Lifecycle Methods
@@ -185,7 +185,7 @@ public class HMAC : Updateable {
185185 init ( using algorithm: Algorithm , keyBuffer: UnsafePointer < Void > , keyByteCount: Int ) {
186186
187187 self . algorithm = algorithm
188- #if os(OSX )
188+ #if os(macOS )
189189 CCHmacInit ( context, algorithm. nativeValue ( ) , keyBuffer, size_t ( keyByteCount) )
190190 #elseif os(Linux)
191191 HMAC_Init ( context, keyBuffer, Int32 ( keyByteCount) , algorithm. nativeValue ( ) )
@@ -202,7 +202,7 @@ public class HMAC : Updateable {
202202 public init ( using algorithm: Algorithm , key: NSData ) {
203203
204204 self . algorithm = algorithm
205- #if os(OSX )
205+ #if os(macOS )
206206 CCHmacInit ( context, algorithm. nativeValue ( ) , key. bytes, size_t ( key. length) )
207207 #elseif os(Linux)
208208 HMAC_Init ( context, key. bytes, Int32 ( key. length) , algorithm. nativeValue ( ) )
@@ -219,7 +219,7 @@ public class HMAC : Updateable {
219219 public init ( using algorithm: Algorithm , key: [ UInt8 ] ) {
220220
221221 self . algorithm = algorithm
222- #if os(OSX )
222+ #if os(macOS )
223223 CCHmacInit ( context, algorithm. nativeValue ( ) , key, size_t ( key. count) )
224224 #elseif os(Linux)
225225 HMAC_Init ( context, key, Int32 ( key. count) , algorithm. nativeValue ( ) )
@@ -237,7 +237,7 @@ public class HMAC : Updateable {
237237 public init ( using algorithm: Algorithm , key: String ) {
238238
239239 self . algorithm = algorithm
240- #if os(OSX )
240+ #if os(macOS )
241241 CCHmacInit ( context, algorithm. nativeValue ( ) , key, size_t ( key. lengthOfBytes ( using: String . Encoding. utf8) ) )
242242 #elseif os(Linux)
243243 HMAC_Init ( context, key, Int32 ( key. utf8. count) , algorithm. nativeValue ( ) )
@@ -248,7 +248,7 @@ public class HMAC : Updateable {
248248 /// Cleanup
249249 ///
250250 deinit {
251- context. deallocateCapacity ( 1 )
251+ context. deallocate ( capacity : 1 )
252252 }
253253
254254 // MARK: Public Methods
@@ -262,7 +262,7 @@ public class HMAC : Updateable {
262262 ///
263263 public func update( from buffer: UnsafePointer < Void > , byteCount: size_t ) -> Self ? {
264264
265- #if os(OSX )
265+ #if os(macOS )
266266 CCHmacUpdate ( context, buffer, byteCount)
267267 #elseif os(Linux)
268268 HMAC_Update ( context, UnsafePointer < UInt8 > ( buffer) , byteCount)
@@ -278,7 +278,7 @@ public class HMAC : Updateable {
278278 public func final( ) -> [ UInt8 ] {
279279
280280 var hmac = Array < UInt8 > ( repeating: 0 , count: algorithm. digestLength ( ) )
281- #if os(OSX )
281+ #if os(macOS )
282282 CCHmacFinal ( context, & hmac)
283283 #elseif os(Linux)
284284 var length : UInt32 = 0
0 commit comments