source: rtems-libbsd/mDNSResponder/mDNSCore/CryptoAlg.h @ f761b29

55-freebsd-126-freebsd-12
Last change on this file since f761b29 was f761b29, checked in by Sebastian Huber <sebastian.huber@…>, on 09/19/18 at 06:52:21

mDNSResponder: Update to v625.41.2

The sources can be obtained via:

https://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-625.41.2.tar.gz

Update #3522.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/* -*- Mode: C; tab-width: 4 -*-
2 *
3 * Copyright (c) 2011-2012 Apple Inc. All rights reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef __CRYPTO_ALG_H
19#define __CRYPTO_ALG_H
20
21typedef enum
22{
23    CRYPTO_ALG,
24    DIGEST_ALG,
25    ENC_ALG,
26} AlgType;
27
28typedef struct
29{
30    void *context;
31    AlgType type;
32    mDNSu8 alg;
33} AlgContext;
34
35typedef struct
36{
37    mStatus (*Create)(AlgContext *ctx);
38    mStatus (*Destroy)(AlgContext *ctx);
39    mDNSu32 (*Length)(AlgContext *ctx);
40    mStatus (*Add)(AlgContext *ctx, const void *data, mDNSu32 len);
41    // Verify the ctx using the key and compare it against signature/siglen
42    mStatus (*Verify)(AlgContext *ctx, mDNSu8 *key, mDNSu32 keylen, mDNSu8 *signature, mDNSu32 siglen);
43    // Encode the data and return the encoded data
44    mDNSu8* (*Encode)(AlgContext *ctx);
45    // Return the finalized data in data whose length is len (used by hash algorithms)
46    mStatus (*Final)(AlgContext *ctx, void *data, mDNSu32 len);
47} AlgFuncs;
48
49mDNSexport mStatus DigestAlgInit(mDNSu8 digestType, AlgFuncs *func);
50mDNSexport mStatus CryptoAlgInit(mDNSu8 algType, AlgFuncs *func);
51mDNSexport mStatus EncAlgInit(mDNSu8 algType, AlgFuncs *func);
52
53
54extern AlgContext *AlgCreate(AlgType type, mDNSu8 alg);
55extern mStatus AlgDestroy(AlgContext *ctx);
56extern mDNSu32 AlgLength(AlgContext *ctx);
57extern mStatus AlgAdd(AlgContext *ctx, const void *data, mDNSu32 len);
58extern mStatus AlgVerify(AlgContext *ctx, mDNSu8 *key, mDNSu32 keylen, mDNSu8 *signature, mDNSu32 siglen);
59extern mDNSu8* AlgEncode(AlgContext *ctx);
60extern mStatus AlgFinal(AlgContext *ctx, void *data, mDNSu32 len);
61
62#endif // __CRYPTO_ALG_H
Note: See TracBrowser for help on using the repository browser.