Debian Codegraph @

sources/ippcp/hash/md5/pcphashmethod_md5.c

raw symbols SCIP
1 /*************************************************************************
2 * Copyright (C) 2002 Intel Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *************************************************************************/
16
17 /*
18 //
19 // Purpose:
20 // Cryptography Primitive.
21 // Digesting message according to MD5
22 // (derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm)
23 //
24 // Equivalent code is available from RFC 1321.
25 //
26 // Contents:
27 // ippsHashMethod_MD5()
28 //
29 */
30
31 #include "owndefs.h"
32 #include "owncp.h"
33 #include "hash/pcphash.h"
34 #include "hash/pcphash_rmf.h"
35 #include "pcptool.h"
36 #include "hash/md5/pcpmd5stuff.h"
37
38 /*F*
39 // Name: ippsHashMethod_MD5
40 //
41 // Purpose: Return MD5 method.
42 //
43 // Returns:
44 // Pointer to MD5 hash-method.
45 //
46 *F*/
47
48 IPPFUN(const IppsHashMethod*, ippsHashMethod_MD5, (void))
49 {
50 /* Prevents re-initialization for better multi-threaded/repeated call performance */
51 static volatile int isInitialized = 0;
52
53 static IppsHashMethod method = { ippHashAlg_MD5,
54 IPP_MD5_DIGEST_BITSIZE / 8,
55 MBS_MD5,
56 MLR_MD5,
57 IPP_MD5_STATE_BYTESIZE,
58 NULL,
59 NULL,
60 NULL,
61 NULL };
62 if (isInitialized) {
63 CP_PREVENT_REORDER();
64 return &method;
65 }
66
67 method.hashInit = md5_hashInit;
68 method.hashUpdate = md5_hashUpdate;
69 method.hashOctStr = md5_hashOctString;
70 method.msgLenRep = md5_msgRep;
71
72 CP_PREVENT_REORDER();
73 isInitialized = 1;
74
75 return &method;
76 }