-
Notifications
You must be signed in to change notification settings - Fork 232
/
Copy pathHAPMFiAuth.h
75 lines (66 loc) · 2.38 KB
/
HAPMFiAuth.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Copyright (c) 2015-2019 The HomeKit ADK Contributors
//
// Licensed under the Apache License, Version 2.0 (the “License”);
// you may not use this file except in compliance with the License.
// See [CONTRIBUTORS.md] for the list of HomeKit ADK project authors.
#ifndef HAP_MFI_AUTH_H
#define HAP_MFI_AUTH_H
#ifdef __cplusplus
extern "C" {
#endif
#include "HAP+Internal.h"
#if __has_feature(nullability)
#pragma clang assume_nonnull begin
#endif
/**
* MFiAuth implementation.
*/
typedef struct {
/**
* Retrieves a copy of the MFi certificate.
*
* @param server Accessory server.
* @param[out] certificateBytes MFi certificate buffer.
* @param maxCertificateBytes Capacity of MFi certificate buffer.
* @param[out] numCertificateBytes Effective length of MFi certificate buffer.
*
* @return kHAPError_None If successful.
* @return kHAPError_Unknown If communication with the MFi component failed.
* @return kHAPError_OutOfResources If out of resources to process request.
*/
HAP_RESULT_USE_CHECK
HAPError (*copyCertificate)(
HAPAccessoryServerRef* server,
void* certificateBytes,
size_t maxCertificateBytes,
size_t* numCertificateBytes);
/**
* Signs the digest of a challenge with the MFi Private Key.
*
* @param server Accessory server.
* @param challengeBytes Challenge buffer.
* @param numChallengeBytes Length of challenge buffer.
* @param[out] signatureBytes Signature buffer.
* @param maxSignatureBytes Capacity of signature buffer.
* @param[out] numSignatureBytes Effective length of signature buffer.
*
* @return kHAPError_None If successful.
* @return kHAPError_Unknown If communication with the MFi component failed.
* @return kHAPError_OutOfResources If out of resources to process request.
*/
HAP_RESULT_USE_CHECK
HAPError (*createSignature)(
HAPAccessoryServerRef* server,
const void* challengeBytes,
size_t numChallengeBytes,
void* signatureBytes,
size_t maxSignatureBytes,
size_t* numSignatureBytes);
} HAPMFiAuth;
#if __has_feature(nullability)
#pragma clang assume_nonnull end
#endif
#ifdef __cplusplus
}
#endif
#endif