Ruby: ext/openssl/ossl_cipher.c File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Macros | Functions | Variables
ossl_cipher.c File Reference
`#include "ossl.h"`

Go to the source code of this file.

## Macros
#define | NewCipher(klass) TypedData_Wrap_Struct((klass), &ossl_cipher_type, 0)
#define | AllocCipher(obj, ctx)
#define | GetCipherInit(obj, ctx)
#define | GetCipher(obj, ctx)

## Functions
const EVP_CIPHER * | ossl_evp_get_cipherbyname (VALUE obj)
VALUE | ossl_cipher_new (const EVP_CIPHER *cipher)
void | Init_ossl_cipher (void)

## Variables
VALUE | cCipher
VALUE | eCipherError

## Macro Definition Documentation

## ◆ AllocCipher

#define AllocCipher | ( |  | obj,
|  |  | ctx
| ) |  |

Value:
do { \
(ctx) = EVP_CIPHER_CTX_new(); \
if (!(ctx)) \
ossl_raise(rb_eRuntimeError, NULL); \
RTYPEDDATA_DATA(obj) = (ctx); \
} while (0)
rb_eRuntimeError
VALUE rb_eRuntimeError
Definition: error.c:1055
NULL
#define NULL
Definition: regenc.h:69

Definition at line 14 of file ossl_cipher.c.

## ◆ GetCipher

#define GetCipher | ( |  | obj,
|  |  | ctx
| ) |  |

Value:
do { \
GetCipherInit((obj), (ctx)); \
if (!(ctx)) { \
ossl_raise(rb_eRuntimeError, "Cipher not initialized!"); \
} \
} while (0)

Definition at line 23 of file ossl_cipher.c.

## ◆ GetCipherInit

#define GetCipherInit | ( |  | obj,
|  |  | ctx
| ) |  |

Value:
do { \
TypedData_Get_Struct((obj), EVP_CIPHER_CTX, &ossl_cipher_type, (ctx)); \
} while (0)

Definition at line 20 of file ossl_cipher.c.

## ◆ NewCipher

#define NewCipher | ( |  | klass | ) | TypedData_Wrap_Struct((klass), &ossl_cipher_type, 0)

Definition at line 12 of file ossl_cipher.c.

## Function Documentation

## ◆ Init_ossl_cipher()

void Init_ossl_cipher | ( | void |  | ) |

Definition at line 845 of file ossl_cipher.c.

References cCipher, eCipherError, eOSSLError, mOSSL, rb_cObject, rb_define_alloc_func(), rb_define_class_under(), rb_define_method, rb_define_module(), rb_define_module_function, and rb_eStandardError.

Referenced by Init_openssl().

## ◆ ossl_cipher_new()

VALUE ossl_cipher_new | ( | const EVP_CIPHER * | cipher | ) |

Definition at line 75 of file ossl_cipher.c.

References AllocCipher, cCipher, eCipherError, NULL, and ossl_raise().

## ◆ ossl_evp_get_cipherbyname()

const EVP_CIPHER * ossl_evp_get_cipherbyname | ( | VALUE | obj | ) |

Definition at line 52 of file ossl_cipher.c.

References cCipher, GetCipher, ossl_raise(), PRIsVALUE, rb_eArgError, rb_obj_is_kind_of(), RSTRING_PTR, and StringValueCStr.

## Variable Documentation

## ◆ cCipher

VALUE cCipher

Definition at line 33 of file ossl_cipher.c.

Referenced by Init_ossl_cipher(), ossl_cipher_new(), and ossl_evp_get_cipherbyname().

## ◆ eCipherError

VALUE eCipherError

Definition at line 34 of file ossl_cipher.c.

Referenced by Init_ossl_cipher(), and ossl_cipher_new().