VirtualBox

source: vbox/trunk/src/libs/openssl-1.1.1g/crypto/bf/bf_local.h@ 85622

Last change on this file since 85622 was 83916, checked in by vboxsync, 5 years ago

openssl-1.1.1g: Applied and adjusted our OpenSSL changes to 1.1.1g. bugref:9719

File size: 3.9 KB
Line 
1/*
2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10#ifndef OSSL_CRYPTO_BF_LOCAL_H
11# define OSSL_CRYPTO_BF_LOCAL_H
12# include <openssl/opensslconf.h>
13
14/* NOTE - c is not incremented as per n2l */
15# define n2ln(c,l1,l2,n) { \
16 c+=n; \
17 l1=l2=0; \
18 switch (n) { \
19 case 8: l2 =((unsigned long)(*(--(c)))) ; \
20 /* fall thru */ \
21 case 7: l2|=((unsigned long)(*(--(c))))<< 8; \
22 /* fall thru */ \
23 case 6: l2|=((unsigned long)(*(--(c))))<<16; \
24 /* fall thru */ \
25 case 5: l2|=((unsigned long)(*(--(c))))<<24; \
26 /* fall thru */ \
27 case 4: l1 =((unsigned long)(*(--(c)))) ; \
28 /* fall thru */ \
29 case 3: l1|=((unsigned long)(*(--(c))))<< 8; \
30 /* fall thru */ \
31 case 2: l1|=((unsigned long)(*(--(c))))<<16; \
32 /* fall thru */ \
33 case 1: l1|=((unsigned long)(*(--(c))))<<24; \
34 } \
35 }
36
37/* NOTE - c is not incremented as per l2n */
38# define l2nn(l1,l2,c,n) { \
39 c+=n; \
40 switch (n) { \
41 case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \
42 /* fall thru */ \
43 case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \
44 /* fall thru */ \
45 case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \
46 /* fall thru */ \
47 case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \
48 /* fall thru */ \
49 case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \
50 /* fall thru */ \
51 case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \
52 /* fall thru */ \
53 case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \
54 /* fall thru */ \
55 case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \
56 } \
57 }
58
59# undef n2l
60# define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \
61 l|=((unsigned long)(*((c)++)))<<16L, \
62 l|=((unsigned long)(*((c)++)))<< 8L, \
63 l|=((unsigned long)(*((c)++))))
64
65# undef l2n
66# define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \
67 *((c)++)=(unsigned char)(((l)>>16L)&0xff), \
68 *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
69 *((c)++)=(unsigned char)(((l) )&0xff))
70
71/*
72 * This is actually a big endian algorithm, the most significant byte is used
73 * to lookup array 0
74 */
75
76# define BF_ENC(LL,R,S,P) ( \
77 LL^=P, \
78 LL^=((( S[ ((R>>24)&0xff)] + \
79 S[0x0100+((R>>16)&0xff)])^ \
80 S[0x0200+((R>> 8)&0xff)])+ \
81 S[0x0300+((R )&0xff)])&0xffffffffU \
82 )
83
84#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette