2 * Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (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
11 * Suppress deprecation warnings for EC low level implementations that are
14 #define OPENSSL_SUPPRESS_DEPRECATED
16 #include <openssl/crypto.h>
17 #include <openssl/err.h>
18 #include <openssl/ec.h>
20 #ifndef OPENSSL_NO_DEPRECATED_3_0
21 BIGNUM
*EC_POINT_point2bn(const EC_GROUP
*group
,
22 const EC_POINT
*point
,
23 point_conversion_form_t form
,
24 BIGNUM
*ret
, BN_CTX
*ctx
)
29 buf_len
= EC_POINT_point2buf(group
, point
, form
, &buf
, ctx
);
34 ret
= BN_bin2bn(buf
, buf_len
, ret
);
41 EC_POINT
*EC_POINT_bn2point(const EC_GROUP
*group
,
42 const BIGNUM
*bn
, EC_POINT
*point
, BN_CTX
*ctx
)
48 if ((buf_len
= BN_num_bytes(bn
)) == 0)
50 if ((buf
= OPENSSL_malloc(buf_len
)) == NULL
) {
51 ECerr(EC_F_EC_POINT_BN2POINT
, ERR_R_MALLOC_FAILURE
);
55 if (!BN_bn2binpad(bn
, buf
, buf_len
)) {
61 if ((ret
= EC_POINT_new(group
)) == NULL
) {
68 if (!EC_POINT_oct2point(group
, ret
, buf
, buf_len
, ctx
)) {
70 EC_POINT_clear_free(ret
);
78 #endif /* OPENSSL_NO_DEPRECATED_3_0 */