selftest.c (3814baf3f2473226e479fc1f4f48d01de2ce0a7b) | selftest.c (c0153b0b901a16663ff91504fea25fb51d57cc29) |
---|---|
1/* 2 BlueZ - Bluetooth protocol stack for Linux 3 4 Copyright (C) 2014 Intel Corporation 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License version 2 as 8 published by the Free Software Foundation; --- 138 unchanged lines hidden (view full) --- 147 148 tmp = kmalloc(64, GFP_KERNEL); 149 if (!tmp) 150 return -EINVAL; 151 152 dhkey_a = &tmp[0]; 153 dhkey_b = &tmp[32]; 154 | 1/* 2 BlueZ - Bluetooth protocol stack for Linux 3 4 Copyright (C) 2014 Intel Corporation 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License version 2 as 8 published by the Free Software Foundation; --- 138 unchanged lines hidden (view full) --- 147 148 tmp = kmalloc(64, GFP_KERNEL); 149 if (!tmp) 150 return -EINVAL; 151 152 dhkey_a = &tmp[0]; 153 dhkey_b = &tmp[32]; 154 |
155 ret = compute_ecdh_secret(tfm, pub_b, priv_a, dhkey_a); | 155 ret = set_ecdh_privkey(tfm, priv_a); |
156 if (ret) 157 goto out; 158 | 156 if (ret) 157 goto out; 158 |
159 ret = compute_ecdh_secret(tfm, pub_a, priv_b, dhkey_b); | 159 ret = compute_ecdh_secret(tfm, pub_b, dhkey_a); |
160 if (ret) 161 goto out; 162 163 if (memcmp(dhkey_a, dhkey, 32)) { 164 ret = -EINVAL; 165 goto out; 166 } 167 | 160 if (ret) 161 goto out; 162 163 if (memcmp(dhkey_a, dhkey, 32)) { 164 ret = -EINVAL; 165 goto out; 166 } 167 |
168 ret = set_ecdh_privkey(tfm, priv_b); 169 if (ret) 170 goto out; 171 172 ret = compute_ecdh_secret(tfm, pub_a, dhkey_b); 173 if (ret) 174 goto out; 175 |
|
168 if (memcmp(dhkey_b, dhkey, 32)) 169 ret = -EINVAL; | 176 if (memcmp(dhkey_b, dhkey, 32)) 177 ret = -EINVAL; |
170 | 178 /* fall through*/ |
171out: 172 kfree(tmp); 173 return ret; 174} 175 176static char test_ecdh_buffer[32]; 177 178static ssize_t test_ecdh_read(struct file *file, char __user *user_buf, --- 123 unchanged lines hidden --- | 179out: 180 kfree(tmp); 181 return ret; 182} 183 184static char test_ecdh_buffer[32]; 185 186static ssize_t test_ecdh_read(struct file *file, char __user *user_buf, --- 123 unchanged lines hidden --- |