| /* |
| * |
| * Copyright (c) 2011-2015 Nest Labs, Inc. |
| * All rights reserved. |
| * |
| * This document is the property of Nest. It is considered |
| * confidential and proprietary information. |
| * |
| * This document may not be reproduced or transmitted in any form, |
| * in whole or in part, without the express written permission of |
| * Nest. |
| * |
| * Description: |
| * Simplified implementation of OpenSSL's ECDSA_SIG functions. |
| * |
| * These avoid references to OpenSSL's ASN1 infrastructure, which is bloated |
| * and unnecessary in this context. |
| */ |
| |
| #include <stdlib.h> |
| |
| #include <openssl/ecdsa.h> |
| #include <openssl/bn.h> |
| |
| ECDSA_SIG *ECDSA_SIG_new(void) |
| { |
| ECDSA_SIG *sig = (ECDSA_SIG *)CRYPTO_malloc(sizeof(ECDSA_SIG), __FILE__, __LINE__); |
| |
| if (sig != NULL) |
| { |
| sig->r = BN_new(); |
| sig->s = BN_new(); |
| } |
| |
| return sig; |
| } |
| |
| void ECDSA_SIG_free(ECDSA_SIG *sig) |
| { |
| if (sig != NULL) |
| { |
| BN_free(sig->r); |
| BN_free(sig->s); |
| |
| CRYPTO_free(sig); |
| } |
| } |
| |