Skip to content

Commit d6514c4

Browse files
committed
Formatting
1 parent eae0298 commit d6514c4

File tree

2 files changed

+72
-30
lines changed

2 files changed

+72
-30
lines changed

.daily_canary

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Me, again.
1+
Me, again and again.

src/tls/key_pair_openssl.h

Lines changed: 71 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313

1414
namespace tls
1515
{
16-
namespace {
16+
namespace
17+
{
1718
inline void OPENSSL_CHECK1(int rc)
1819
{
1920
unsigned long ec = ERR_get_error();
@@ -32,52 +33,93 @@ namespace tls
3233
}
3334
}
3435

35-
class Unique_BIO {
36-
std::unique_ptr<BIO, void(*)(BIO*)> p;
36+
class Unique_BIO
37+
{
38+
std::unique_ptr<BIO, void (*)(BIO*)> p;
39+
3740
public:
38-
Unique_BIO() : p(BIO_new(BIO_s_mem()), [](auto x){ BIO_free(x); }) {
39-
if (!p) throw std::runtime_error("out of memory");
41+
Unique_BIO() : p(BIO_new(BIO_s_mem()), [](auto x) { BIO_free(x); })
42+
{
43+
if (!p)
44+
throw std::runtime_error("out of memory");
4045
}
41-
Unique_BIO(const void *buf, int len) : p(BIO_new_mem_buf(buf, len), [](auto x){ BIO_free(x); }) {
42-
if (!p) throw std::runtime_error("out of memory");
46+
Unique_BIO(const void* buf, int len) :
47+
p(BIO_new_mem_buf(buf, len), [](auto x) { BIO_free(x); })
48+
{
49+
if (!p)
50+
throw std::runtime_error("out of memory");
51+
}
52+
operator BIO*()
53+
{
54+
return p.get();
4355
}
44-
operator BIO*() { return p.get(); }
4556
};
4657

47-
class Unique_EVP_PKEY_CTX {
48-
std::unique_ptr<EVP_PKEY_CTX, void(*)(EVP_PKEY_CTX*)> p;
58+
class Unique_EVP_PKEY_CTX
59+
{
60+
std::unique_ptr<EVP_PKEY_CTX, void (*)(EVP_PKEY_CTX*)> p;
61+
4962
public:
50-
Unique_EVP_PKEY_CTX(EVP_PKEY* key) : p(EVP_PKEY_CTX_new(key, NULL), EVP_PKEY_CTX_free) {
51-
if (!p) throw std::runtime_error("out of memory");
63+
Unique_EVP_PKEY_CTX(EVP_PKEY* key) :
64+
p(EVP_PKEY_CTX_new(key, NULL), EVP_PKEY_CTX_free)
65+
{
66+
if (!p)
67+
throw std::runtime_error("out of memory");
5268
}
53-
Unique_EVP_PKEY_CTX() : p(EVP_PKEY_CTX_new_id(EVP_PKEY_EC, NULL), EVP_PKEY_CTX_free) {
54-
if (!p) throw std::runtime_error("out of memory");
69+
Unique_EVP_PKEY_CTX() :
70+
p(EVP_PKEY_CTX_new_id(EVP_PKEY_EC, NULL), EVP_PKEY_CTX_free)
71+
{
72+
if (!p)
73+
throw std::runtime_error("out of memory");
74+
}
75+
operator EVP_PKEY_CTX*()
76+
{
77+
return p.get();
5578
}
56-
operator EVP_PKEY_CTX*() { return p.get(); }
5779
};
5880

59-
class Unique_X509_REQ {
60-
std::unique_ptr<X509_REQ, void(*)(X509_REQ*)> p;
81+
class Unique_X509_REQ
82+
{
83+
std::unique_ptr<X509_REQ, void (*)(X509_REQ*)> p;
84+
6185
public:
62-
Unique_X509_REQ() : p(X509_REQ_new(), X509_REQ_free) {
63-
if (!p) throw std::runtime_error("out of memory");
86+
Unique_X509_REQ() : p(X509_REQ_new(), X509_REQ_free)
87+
{
88+
if (!p)
89+
throw std::runtime_error("out of memory");
6490
}
65-
Unique_X509_REQ(BIO *mem): p(PEM_read_bio_X509_REQ(mem, NULL, NULL, NULL), X509_REQ_free) {
66-
if (!p) throw std::runtime_error("out of memory");
91+
Unique_X509_REQ(BIO* mem) :
92+
p(PEM_read_bio_X509_REQ(mem, NULL, NULL, NULL), X509_REQ_free)
93+
{
94+
if (!p)
95+
throw std::runtime_error("out of memory");
96+
}
97+
operator X509_REQ*()
98+
{
99+
return p.get();
67100
}
68-
operator X509_REQ*() { return p.get(); }
69101
};
70102

71-
class Unique_X509 {
72-
std::unique_ptr<X509, void(*)(X509*)> p;
103+
class Unique_X509
104+
{
105+
std::unique_ptr<X509, void (*)(X509*)> p;
106+
73107
public:
74-
Unique_X509() : p(X509_new(), X509_free) {
75-
if (!p) throw std::runtime_error("out of memory");
108+
Unique_X509() : p(X509_new(), X509_free)
109+
{
110+
if (!p)
111+
throw std::runtime_error("out of memory");
76112
}
77-
Unique_X509(BIO *mem): p(PEM_read_bio_X509(mem, NULL, NULL, NULL), X509_free) {
78-
if (!p) throw std::runtime_error("out of memory");
113+
Unique_X509(BIO* mem) :
114+
p(PEM_read_bio_X509(mem, NULL, NULL, NULL), X509_free)
115+
{
116+
if (!p)
117+
throw std::runtime_error("out of memory");
118+
}
119+
operator X509*()
120+
{
121+
return p.get();
79122
}
80-
operator X509*() { return p.get(); }
81123
};
82124
}
83125

0 commit comments

Comments
 (0)